-
Notifications
You must be signed in to change notification settings - Fork 5.4k
/
Copy pathrest_function_server.yaml
334 lines (334 loc) · 11.4 KB
/
rest_function_server.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
openapi: 3.0.0
info:
title: Presto Remote Function Rest APIs
description: These APIs shall be implemented by REST server for retrieval and execution of remote functions.
version: "1"
servers:
- url: http://localhost:8080
description: Presto endpoint when running locally
paths:
/v1/functions:
head:
summary: Retrieve the headers of the GET which list of functions supported by REST server.
description: |
This is useful for checking the version of the API, which will be returned as a header.
The `HEAD` request retrieves the headers that would be returned by the `GET` request.
responses:
'200':
description: Successfully retrieved headers. The body is empty.
headers:
Last-Modified:
description: The date and time when the resource was last modified.
schema:
type: string
format: date-time
ETag:
description: An identifier for a specific version of the resource.
schema:
type: string
'404':
description: The function list could not be found.
get:
summary: Retrieve list of all functions supported by REST server.
description: |
This endpoint retrieves all the function signatures that are available on the REST server.
The response includes details about each function, such as its kind, input and output types,
schema, and characteristics like determinism and null handling.
responses:
'200':
description: A map of function names to lists of function metadata.
content:
application/json:
schema:
$ref: '#/components/schemas/UdfSignatureMap'
/v1/functions/{schema}:
parameters:
- name: schema
in: path
required: true
schema:
type: string
description: The schema in which the function is defined.
get:
summary: Retrieve list of functions in the specified schema.
description: |
This endpoint returns the complete listing of all functions in the specified schema.
The response includes details about each function, such as its kind, input and output types,
schema, and characteristics like determinism and null handling.
responses:
'200':
description: A map of function names to lists of function metadata.
content:
application/json:
schema:
$ref: '#/components/schemas/UdfSignatureMap'
/v1/functions/{schema}/{functionName}:
parameters:
- name: schema
in: path
required: true
schema:
type: string
description: The schema in which the function is defined.
- name: functionName
in: path
required: true
schema:
type: string
description: The name of the function.
get:
summary: Retrieve list of functions with at schema with name.
description: |
This endpoint returns the complete listing of functions in the specified schema with the specified function name.
The response includes details about each function, such as its kind, input and output types,
schema, and characteristics like determinism and null handling.
responses:
'200':
description: A map of function names to lists of function metadata.
content:
application/json:
schema:
$ref: '#/components/schemas/UdfSignatureMap'
post:
summary: Add a new function in the specified schema with the specified name.
description: |
This endpoint creates a new function in the specified schema. The function object will contain the metadata of the function,
including its arguments, return type, and other metadata.
requestBody:
description: JSON object representing the function to be added.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/JsonBasedUdfFunctionMetadata'
responses:
'201':
description: The function was successfully created, and the function ID is returned.
content:
application/json:
schema:
type: string
description: The function ID of the newly created function.
'400':
description: Invalid request due to malformed input.
'409':
description: A function with the same name and signature already exists.
/v1/functions/{schema}/{functionName}/{functionId}:
parameters:
- name: schema
in: path
required: true
schema:
type: string
description: The schema in which the function is defined.
- name: functionName
in: path
required: true
schema:
type: string
description: The name of the function.
- name: functionId
in: path
required: true
schema:
type: string
description: The ID of the function.
put:
summary: Update the function in the specified schema with the specified name and function ID.
description: |
This endpoint updates the function in the specified schema. The function object will contain the updated metadata of the function.
requestBody:
description: JSON object representing the function to be updated.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/JsonBasedUdfFunctionMetadata'
responses:
'200':
description: The function was successfully updated, and the function ID is returned.
content:
application/json:
schema:
type: string
description: The function ID of the updated function.
'400':
description: Invalid request due to malformed input.
'404':
description: The function was not found.
'409':
description: Error occurred while updating the function.
delete:
summary: Delete the function in the specified schema with the specified name and function ID.
description: |
This endpoint deletes the function in the specified schema. The function is identified by its name and ID..
responses:
'204':
description: The function was successfully deleted. The response body is empty.
'404':
description: The function was not found.
/v1/functions/{schema}/{functionName}/{functionId}/{version}:
post:
summary: Retrieve value from function
parameters:
- name: schema
in: path
required: true
schema:
type: string
description: The schema in which the function is defined.
- name: functionName
in: path
required: true
schema:
type: string
description: The name of the function.
- name: functionId
in: path
required: true
schema:
type: string
description: The ID of the function.
- name: version
in: path
schema:
type: string
required: true
description: The version of the function to execute
requestBody:
required: true
content:
text/plain; charset=utf-8:
schema:
$ref: '#/components/schemas/SerializedPageBinary'
responses:
'200':
description: function value output
content:
text/plain; charset=utf-8:
schema:
$ref: '#/components/schemas/SerializedPageBinary'
components:
schemas:
UdfSignatureMap:
type: object
description: A map of function names to lists of function metadata.
additionalProperties:
type: array
items:
$ref: '#/components/schemas/JsonBasedUdfFunctionMetadata'
JsonBasedUdfFunctionMetadata:
type: object
properties:
docString:
type: string
description: A description of what the function does.
example: "Returns the square of a number."
functionKind:
$ref: '#/components/schemas/FunctionKind'
outputType:
type: string
description: The output type of the function.
example: "integer"
paramTypes:
type: array
items:
type: string
description: The input parameter types of the function.
example: ["integer"]
schema:
type: string
description: The schema to which the function belongs.
example: "test_schema"
routineCharacteristics:
$ref: '#/components/schemas/RoutineCharacteristics'
aggregateMetadata:
$ref: '#/components/schemas/AggregateMetadata'
functionId:
$ref: '#/components/schemas/SqlFunctionId'
version:
type: string
description: The version of the function. This version shall be maintained by REST server for any change in the function.
example: "1"
FunctionKind:
type: string
description: The kind of function.
enum:
- SCALAR
- AGGREGATE
- WINDOW
example: "SCALAR"
RoutineCharacteristics:
type: object
properties:
language:
$ref: '#/components/schemas/Language'
determinism:
$ref: '#/components/schemas/Determinism'
nullCallClause:
$ref: '#/components/schemas/NullCallClause'
Language:
type: string
description: The implementation language of the function.
enum:
- SQL
- CPP
- REST
example: "REST"
Determinism:
type: string
description: Whether the function is deterministic.
enum:
- DETERMINISTIC
- NOT_DETERMINISTIC
example: "DETERMINISTIC"
NullCallClause:
type: string
description: How the function handles null inputs.
enum:
- RETURNS_NULL_ON_NULL_INPUT
- CALLED_ON_NULL_INPUT
example: "CALLED_ON_NULL_INPUT"
AggregateMetadata:
type: object
nullable: true
properties:
intermediateType:
type: string
description: The intermediate type used in aggregation.
example: "ROW(bigint, int)"
isOrderSensitive:
type: boolean
description: Whether the aggregation is sensitive to the order of inputs.
example: false
QualifiedObjectName:
type: object
properties:
catalogName:
type: string
description: The name of the catalog.
schemaName:
type: string
description: The name of the schema.
objectName:
type: string
description: The name of the function.
TypeSignature:
type: string
description: Serialized signature of the type.
SqlFunctionId:
type: object
properties:
functionName:
$ref: '#/components/schemas/QualifiedObjectName'
argumentTypes:
type: array
items:
$ref: '#/components/schemas/TypeSignature'
SerializedPageBinary:
type: string
format: binary
description: Match this format https://prestodb.io/docs/current/develop/serialized-page.html
Page:
type: string
format: binary