|
| 1 | +openapi: 3.0.0 |
| 2 | +info: |
| 3 | + title: Presto Expression API |
| 4 | + description: API for evaluating and simplifying row expressions in Presto |
| 5 | + version: "1" |
| 6 | +servers: |
| 7 | + - url: http://localhost:8080 |
| 8 | + description: Presto endpoint when running locally |
| 9 | +paths: |
| 10 | + /v1/expressions: |
| 11 | + post: |
| 12 | + summary: Simplify the list of row expressions |
| 13 | + description: This endpoint takes in a list of row expressions and attempts to simplify them to their simplest logical equivalent expression. |
| 14 | + requestBody: |
| 15 | + content: |
| 16 | + application/json: |
| 17 | + schema: |
| 18 | + $ref: '#/components/schemas/RowExpressions' |
| 19 | + required: true |
| 20 | + responses: |
| 21 | + '200': |
| 22 | + description: Results |
| 23 | + content: |
| 24 | + application/json: |
| 25 | + schema: |
| 26 | + $ref: '#/components/schemas/RowExpressions' |
| 27 | +components: |
| 28 | + schemas: |
| 29 | + RowExpressions: |
| 30 | + type: array |
| 31 | + maxItems: 100 |
| 32 | + items: |
| 33 | + $ref: "#/components/schemas/RowExpression" |
| 34 | + RowExpression: |
| 35 | + oneOf: |
| 36 | + - $ref: "#/components/schemas/ConstantExpression" |
| 37 | + - $ref: "#/components/schemas/VariableReferenceExpression" |
| 38 | + - $ref: "#/components/schemas/InputReferenceExpression" |
| 39 | + - $ref: "#/components/schemas/LambdaDefinitionExpression" |
| 40 | + - $ref: "#/components/schemas/SpecialFormExpression" |
| 41 | + - $ref: "#/components/schemas/CallExpression" |
| 42 | + RowExpressionParent: |
| 43 | + type: object |
| 44 | + properties: |
| 45 | + sourceLocation: |
| 46 | + $ref: "#/components/schemas/SourceLocation" |
| 47 | + SourceLocation: |
| 48 | + description: The source location of the row expression in the original query, referencing the line and the column of the query. |
| 49 | + type: object |
| 50 | + properties: |
| 51 | + line: |
| 52 | + type: integer |
| 53 | + column: |
| 54 | + type: integer |
| 55 | + ConstantExpression: |
| 56 | + description: A constant expression is a row expression that represents a constant value. The value attribute is the constant value. |
| 57 | + allOf: |
| 58 | + - $ref: "#/components/schemas/RowExpressionParent" |
| 59 | + - type: object |
| 60 | + properties: |
| 61 | + "@type": |
| 62 | + type: string |
| 63 | + enum : ["constant"] |
| 64 | + typeSignature: |
| 65 | + type: string |
| 66 | + valueBlock: |
| 67 | + type: string |
| 68 | + VariableReferenceExpression: |
| 69 | + description: A variable reference expression is a row expression that represents a reference to a variable. The name attribute indicates the name of the variable. |
| 70 | + allOf: |
| 71 | + - $ref: "#/components/schemas/RowExpressionParent" |
| 72 | + - type: object |
| 73 | + properties: |
| 74 | + "@type": |
| 75 | + type: string |
| 76 | + enum : ["variable"] |
| 77 | + typeSignature: |
| 78 | + type: string |
| 79 | + name: |
| 80 | + type: string |
| 81 | + InputReferenceExpression: |
| 82 | + description: > |
| 83 | + An input reference expression is a row expression that represents a reference to a column in the input schema. The field attribute indicates the index of the column in the |
| 84 | + input schema. |
| 85 | + allOf: |
| 86 | + - $ref: "#/components/schemas/RowExpressionParent" |
| 87 | + - type: object |
| 88 | + properties: |
| 89 | + "@type": |
| 90 | + type: string |
| 91 | + enum : ["input"] |
| 92 | + typeSignature: |
| 93 | + type: string |
| 94 | + field: |
| 95 | + type: integer |
| 96 | + LambdaDefinitionExpression: |
| 97 | + description: > |
| 98 | + A lambda definition expression is a row expression that represents a lambda function. The lambda function is defined by a list of argument types, a list of argument names, |
| 99 | + and a body expression. |
| 100 | + allOf: |
| 101 | + - $ref: "#/components/schemas/RowExpressionParent" |
| 102 | + - type: object |
| 103 | + properties: |
| 104 | + "@type": |
| 105 | + type: string |
| 106 | + enum : ["lambda"] |
| 107 | + argumentTypeSignatures: |
| 108 | + type: array |
| 109 | + items: |
| 110 | + type: string |
| 111 | + arguments: |
| 112 | + type: array |
| 113 | + items: |
| 114 | + type: string |
| 115 | + body: |
| 116 | + $ref: "#/components/schemas/RowExpression" |
| 117 | + SpecialFormExpression: |
| 118 | + description: > |
| 119 | + A special form expression is a row expression that represents a special language construct. The form attribute indicates the specific form of the special form, |
| 120 | + which is a well known list, and with each having special semantics. The arguments attribute is a list of row expressions that are the arguments to the special form, with |
| 121 | + each form taking in a specific number of arguments. |
| 122 | + allOf: |
| 123 | + - $ref: "#/components/schemas/RowExpressionParent" |
| 124 | + - type: object |
| 125 | + properties: |
| 126 | + "@type": |
| 127 | + type: string |
| 128 | + enum : ["special"] |
| 129 | + form: |
| 130 | + type: string |
| 131 | + enum: ["IF","NULL_IF","SWITCH","WHEN","IS_NULL","COALESCE","IN","AND","OR","DEREFERENCE","ROW_CONSTRUCTOR","BIND"] |
| 132 | + returnTypeSignature: |
| 133 | + type: string |
| 134 | + arguments: |
| 135 | + type: array |
| 136 | + items: |
| 137 | + $ref: "#/components/schemas/RowExpression" |
| 138 | + CallExpression: |
| 139 | + description: > |
| 140 | + A call expression is a row expression that represents a call to a function. The functionHandle attribute is an opaque handle to the function that is being called. |
| 141 | + The arguments attribute is a list of row expressions that are the arguments to the function. |
| 142 | + allOf: |
| 143 | + - $ref: "#/components/schemas/RowExpressionParent" |
| 144 | + - type: object |
| 145 | + properties: |
| 146 | + "@type": |
| 147 | + type: string |
| 148 | + enum : ["call"] |
| 149 | + displayName: |
| 150 | + type: string |
| 151 | + functionHandle: |
| 152 | + $ref: "#/components/schemas/FunctionHandle" |
| 153 | + returnTypeSignature: |
| 154 | + type: string |
| 155 | + arguments: |
| 156 | + type: array |
| 157 | + items: |
| 158 | + $ref: "#/components/schemas/RowExpression" |
| 159 | + FunctionHandle: |
| 160 | + description: An opaque handle to a function that may be invoked. This is interpreted by the registered function namespace manager. |
| 161 | + anyOf: |
| 162 | + - $ref: "#/components/schemas/OpaqueFunctionHandle" |
| 163 | + - $ref: "#/components/schemas/SqlFunctionHandle" |
| 164 | + OpaqueFunctionHandle: |
| 165 | + type: object |
| 166 | + properties: {} # any opaque object may be passed and interpreted by a function namespace manager |
| 167 | + SqlFunctionHandle: |
| 168 | + type: object |
| 169 | + properties: |
| 170 | + functionId: |
| 171 | + type: string |
| 172 | + version: |
| 173 | + type: string |
0 commit comments