sqlassert 0.4.1__py3-none-any.whl → 0.4.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sqlassert/declared_types.py +158 -0
- sqlassert/diagnostics.py +1 -4
- sqlassert/dialects.py +118 -396
- sqlassert/discovery/bigquery.py +2 -2
- sqlassert/discovery/databricks.py +4 -6
- sqlassert/discovery/fetcher.py +22 -52
- sqlassert/discovery/information_schema.py +7 -10
- sqlassert/discovery/mysql.py +4 -8
- sqlassert/discovery/postgres.py +17 -26
- sqlassert/discovery/redshift.py +2 -2
- sqlassert/discovery/snowflake.py +2 -2
- sqlassert/functions/__init__.py +10 -0
- sqlassert/functions/load.py +375 -0
- sqlassert/functions/table.py +2721 -0
- sqlassert/hazards.py +1 -1
- sqlassert/ir/__init__.py +13 -5
- sqlassert/ir/convert/aggregation.py +2 -3
- sqlassert/ir/convert/expressions.py +76 -67
- sqlassert/ir/convert/parser.py +0 -4
- sqlassert/ir/convert/schema.py +11 -80
- sqlassert/ir/convert/selects.py +30 -15
- sqlassert/ir/convert/shared.py +2 -3
- sqlassert/ir/convert/sources.py +2 -1
- sqlassert/ir/convert/value_types.py +12 -157
- sqlassert/ir/model.py +331 -138
- sqlassert/main.py +7 -10
- sqlassert/rules/causes/domain.py +1 -1
- sqlassert/rules/causes/unique.py +46 -5
- sqlassert/rules/domain.py +1 -1
- sqlassert/rules/join_cardinality.py +14 -21
- sqlassert/rules/nullability.py +3 -3
- sqlassert/rules/uniqueness.py +42 -41
- sqlassert/rules/value_typing.py +266 -133
- sqlassert/suggest.py +2 -2
- {sqlassert-0.4.1.dist-info → sqlassert-0.4.2.dist-info}/METADATA +18 -14
- sqlassert-0.4.2.dist-info/RECORD +72 -0
- sqlassert/ir/convert/builtins.py +0 -140
- sqlassert-0.4.1.dist-info/RECORD +0 -69
- {sqlassert-0.4.1.dist-info → sqlassert-0.4.2.dist-info}/WHEEL +0 -0
- {sqlassert-0.4.1.dist-info → sqlassert-0.4.2.dist-info}/entry_points.txt +0 -0
- {sqlassert-0.4.1.dist-info → sqlassert-0.4.2.dist-info}/licenses/LICENSE +0 -0
- {sqlassert-0.4.1.dist-info → sqlassert-0.4.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,2721 @@
|
|
|
1
|
+
"""The function table: what sqlassert knows of each SQL function and operator,
|
|
2
|
+
one `Function` per SQLGlot node, decided for every modelled dialect.
|
|
3
|
+
|
|
4
|
+
The file opens with the vocabulary the entries are written in, then the
|
|
5
|
+
shorthand constants built from it, then the entries by domain. An entry gives
|
|
6
|
+
the node's property function (strictness, totality, which arguments it is
|
|
7
|
+
one-to-one in: ADR 0011) and, in one required keyword per dialect, its result
|
|
8
|
+
type. A missing keyword is an error for the type checker and at import, so
|
|
9
|
+
every dialect is decided explicitly: `UNDECIDED` is the answer for one not
|
|
10
|
+
yet looked at, `unmodelled(Reason.X)` for one looked at and not modelled.
|
|
11
|
+
|
|
12
|
+
`functions/load.py` builds one dialect's Builtins from the entries; nothing
|
|
13
|
+
else reads this file's data. A result type is a claim about the dialect's
|
|
14
|
+
latest release under its default settings (ADR 0006); `docs/dialects.md`
|
|
15
|
+
argues them, and a fact tentative from memory is true like any other
|
|
16
|
+
(AGENTS.md).
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from collections.abc import Callable, Mapping, Sequence
|
|
22
|
+
from dataclasses import dataclass, replace
|
|
23
|
+
from decimal import Decimal, InvalidOperation
|
|
24
|
+
from enum import Enum
|
|
25
|
+
from typing import overload
|
|
26
|
+
|
|
27
|
+
from sqlglot import Expr, exp
|
|
28
|
+
|
|
29
|
+
from sqlassert import ir
|
|
30
|
+
from sqlassert.declared_types import cast_table
|
|
31
|
+
from sqlassert.dialects import MODELLED_DIALECTS, DialectSemantics
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# ---------------------------------------------------------------------------
|
|
35
|
+
# The vocabulary: result types
|
|
36
|
+
# ---------------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
INT: ir.TypeFamily = "integer"
|
|
39
|
+
DECIMAL: ir.TypeFamily = "decimal"
|
|
40
|
+
FLOAT: ir.TypeFamily = "float"
|
|
41
|
+
TEXT: ir.TypeFamily = "text"
|
|
42
|
+
BOOLEAN: ir.TypeFamily = "boolean"
|
|
43
|
+
UUID: ir.TypeFamily = "uuid"
|
|
44
|
+
DATE: ir.TypeFamily = "date"
|
|
45
|
+
TIME: ir.TypeFamily = "time"
|
|
46
|
+
TIMESTAMP: ir.TypeFamily = "timestamp"
|
|
47
|
+
TIMESTAMPTZ: ir.TypeFamily = "timestamptz"
|
|
48
|
+
INTERVAL: ir.TypeFamily = "interval"
|
|
49
|
+
BYTES: ir.TypeFamily = "bytes"
|
|
50
|
+
JSON: ir.TypeFamily = "json"
|
|
51
|
+
ARRAY: ir.TypeFamily = "array"
|
|
52
|
+
STRUCT: ir.TypeFamily = "struct"
|
|
53
|
+
GEOGRAPHY: ir.TypeFamily = "geography"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class Reason(Enum):
|
|
57
|
+
"""Why a function has no result type in a dialect, though it was looked
|
|
58
|
+
at. The value is the text the docs and explanations show."""
|
|
59
|
+
|
|
60
|
+
STORAGE_CLASS = "a SQLite value's type is its own storage class, not its expression's"
|
|
61
|
+
NOT_A_NUMBER = "an operand is not a number"
|
|
62
|
+
ARGUMENT_TYPE_UNLISTED = "the dialect's result type for this argument type is not modelled"
|
|
63
|
+
DIVISION = "the result type of a division depends on the dialect and the operands (an integer, or a DECIMAL)"
|
|
64
|
+
COMPOSITE = "the result is a composite (an array, a struct), which a ValueTyping cannot say"
|
|
65
|
+
ELEMENT_TYPE = "the result is an element of a composite (an array, a list, a map), whose type a ValueTyping cannot say"
|
|
66
|
+
WRAPS_ARGUMENT = "the result type follows its argument's wrapper (Nullable, LowCardinality)"
|
|
67
|
+
OVERLOADED = "the result type differs by overload (arrays, bytes, the number of arguments)"
|
|
68
|
+
FINER_THAN_FAMILY = "the result type is finer than the argument's family (ClickHouse's abs of Int32 is UInt32)"
|
|
69
|
+
DEPENDS_ON_LITERAL = "the result type depends on a literal argument (a unit, a format)"
|
|
70
|
+
KEEPS_ARGUMENT_PARAMETERS = "the result carries its argument's length and collation"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@dataclass(frozen=True)
|
|
74
|
+
class Keep:
|
|
75
|
+
"""Exactly argument `index`'s type, parameters included (`abs`, `upper`)."""
|
|
76
|
+
|
|
77
|
+
index: int
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@dataclass(frozen=True)
|
|
81
|
+
class FamilyOf:
|
|
82
|
+
"""Argument `index`'s base type with its parameters dropped: `DECIMAL(10,2)`
|
|
83
|
+
gives a decimal of no claimed precision or scale, `BIGINT` stays `BIGINT`,
|
|
84
|
+
`VARCHAR(10)` gives `VARCHAR`. Never some integer: an integer's width
|
|
85
|
+
matters to a comparison."""
|
|
86
|
+
|
|
87
|
+
index: int
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@dataclass(frozen=True)
|
|
91
|
+
class OnArg:
|
|
92
|
+
"""Branch on argument `index`'s family: each value a typing or a type
|
|
93
|
+
name, so branches nest. An argument of unknown type gives no type, and
|
|
94
|
+
`otherwise` (required) answers every other known family."""
|
|
95
|
+
|
|
96
|
+
index: int
|
|
97
|
+
branches: Mapping[ir.TypeFamily, Typing]
|
|
98
|
+
otherwise: Typing
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@dataclass(frozen=True)
|
|
102
|
+
class OnLiteral:
|
|
103
|
+
"""Branch on the value of a literal the call is written with: SQLGlot's
|
|
104
|
+
argument `key` (`unit` of `date_trunc`, the `this` of `extract(epoch FROM
|
|
105
|
+
ts)`, MySQL's `format`), lower-cased. `otherwise` (required) answers any
|
|
106
|
+
other value and a key that is no literal."""
|
|
107
|
+
|
|
108
|
+
key: str
|
|
109
|
+
branches: Mapping[str, Typing]
|
|
110
|
+
otherwise: Typing
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@dataclass(frozen=True)
|
|
114
|
+
class OnArity:
|
|
115
|
+
"""Branch on the number of arguments the call is written with: Postgres's
|
|
116
|
+
`round(x)` of an integer is a double precision, `round(x, k)` a numeric.
|
|
117
|
+
`otherwise` (required) answers any other number."""
|
|
118
|
+
|
|
119
|
+
branches: Mapping[int, Typing]
|
|
120
|
+
otherwise: Typing
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@dataclass(frozen=True)
|
|
124
|
+
class Common:
|
|
125
|
+
"""The type the arguments at `indices` share: the widest among integers, a
|
|
126
|
+
string literal taking its neighbour's type, NULL taking any."""
|
|
127
|
+
|
|
128
|
+
indices: tuple[int, ...]
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@dataclass(frozen=True)
|
|
132
|
+
class Target:
|
|
133
|
+
"""A CAST's target type, captured where the CAST is written."""
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
@dataclass(frozen=True)
|
|
137
|
+
class Absent:
|
|
138
|
+
"""SQLGlot reads SQL of the dialect as the node, but the engine has no such
|
|
139
|
+
function (DuckDB's `normalize`, BigQuery's `concat_ws`): a probe checks the
|
|
140
|
+
engine rejects the call (`absent(Node)`)."""
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@dataclass(frozen=True)
|
|
144
|
+
class Unreachable:
|
|
145
|
+
"""No SQL of the dialect lowers to the node: SQLGlot has no spelling of it
|
|
146
|
+
there, or reads the dialect's spelling as another node (Spark's `CAST` is a
|
|
147
|
+
`TryCast`). A test checks the example is not the node in the dialect."""
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
@dataclass(frozen=True)
|
|
151
|
+
class Undecided:
|
|
152
|
+
"""Not yet decided for the dialect: the ratchet's count (a test pins it)."""
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
@dataclass(frozen=True)
|
|
156
|
+
class Unmodelled:
|
|
157
|
+
"""The function exists in the dialect, or a branch of it has no type, and
|
|
158
|
+
is not modelled: the `Reason` says why."""
|
|
159
|
+
|
|
160
|
+
reason: Reason
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
# A fixed type is a plain string, in the dialect's spelling (`"DOUBLE PRECISION"`).
|
|
164
|
+
type Typing = str | Keep | FamilyOf | OnArg | OnLiteral | OnArity | Common | Target | Absent | Unreachable | Undecided | Unmodelled
|
|
165
|
+
|
|
166
|
+
target = Target()
|
|
167
|
+
ABSENT = Absent()
|
|
168
|
+
UNREACHABLE = Unreachable()
|
|
169
|
+
UNDECIDED = Undecided()
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def keep(index: int) -> Keep:
|
|
173
|
+
"""The type of argument `index`, exactly (parameters included)."""
|
|
174
|
+
return Keep(index)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def family(index: int) -> FamilyOf:
|
|
178
|
+
"""The base type of argument `index`, its parameters dropped."""
|
|
179
|
+
return FamilyOf(index)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def on_arg(index: int, branches: Mapping[ir.TypeFamily, Typing], *, otherwise: Typing) -> OnArg:
|
|
183
|
+
"""Branch on the family of argument `index`; `otherwise` for any other known family."""
|
|
184
|
+
return OnArg(index, branches, otherwise)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def on_literal(key: str, branches: Mapping[str, Typing], *, otherwise: Typing) -> OnLiteral:
|
|
188
|
+
"""Branch on the lower-cased value of the literal argument `key` of the call."""
|
|
189
|
+
return OnLiteral(key, branches, otherwise)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def on_arity(branches: Mapping[int, Typing], *, otherwise: Typing) -> OnArity:
|
|
193
|
+
"""Branch on the number of arguments the call is written with."""
|
|
194
|
+
return OnArity(branches, otherwise)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def common(*indices: int) -> Common:
|
|
198
|
+
"""The type the arguments at `indices` share."""
|
|
199
|
+
return Common(indices)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def unmodelled(reason: Reason) -> Unmodelled:
|
|
203
|
+
"""Looked at, and not modelled, for this `reason`."""
|
|
204
|
+
return Unmodelled(reason)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
# ---------------------------------------------------------------------------
|
|
208
|
+
# The vocabulary: property functions
|
|
209
|
+
# ---------------------------------------------------------------------------
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
@dataclass(frozen=True)
|
|
213
|
+
class Shape:
|
|
214
|
+
"""The call a property function builds a Builtin for: its `name`, its
|
|
215
|
+
`arity` of fixed parameters, and whether the last parameter repeats."""
|
|
216
|
+
|
|
217
|
+
name: str
|
|
218
|
+
arity: int
|
|
219
|
+
variadic: bool = False
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
# A property function: the Builtin of a call shape, its strictness, totality
|
|
223
|
+
# and which arguments it is one-to-one in (ADR 0011), as a dialect's
|
|
224
|
+
# `DialectSemantics` flags make them. It has no typing yet: the loader adds it.
|
|
225
|
+
type Properties = Callable[[Shape, DialectSemantics], ir.Builtin]
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
@dataclass(frozen=True)
|
|
229
|
+
class Volatile:
|
|
230
|
+
"""A function that is no function of its arguments (`now()`, `random()`,
|
|
231
|
+
`current_date`): it has a type but lowers to an `OpaqueExpression` carrying
|
|
232
|
+
it, never to a `Call`."""
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
VOLATILE = Volatile()
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
@dataclass(frozen=True)
|
|
239
|
+
class PerDialect:
|
|
240
|
+
"""The properties differ by dialect beyond `DialectSemantics`' flags, so
|
|
241
|
+
each keyword pairs its typing with its property function."""
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
PER_DIALECT = PerDialect()
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def _constant(shape: Shape, strict: bool, total: bool | None, repeated: tuple[bool, bool] | None = None, *, skips_null: bool = False) -> ir.Builtin:
|
|
248
|
+
"""A Builtin whose strictness and totality are the same for every call:
|
|
249
|
+
strict in each parameter or none, total in each (None: never total)."""
|
|
250
|
+
flags = (strict,) * shape.arity
|
|
251
|
+
return ir.Builtin.constant(
|
|
252
|
+
shape.name, flags, None if total is None else (total,) * shape.arity,
|
|
253
|
+
repeated=repeated if shape.variadic else None, skips_null=skips_null,
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def STRICT(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
258
|
+
"""NULL exactly when an argument is: strict and total in each. Text
|
|
259
|
+
functions take any value as text, so no cast fails."""
|
|
260
|
+
return _constant(shape, True, True, (True, True))
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def STRICT_CHECKED(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
264
|
+
"""Strict, and total where arithmetic is checked (`checked_arithmetic`):
|
|
265
|
+
a number read from bad text is an error only where a bad CAST is
|
|
266
|
+
(SQLite's `floor('x')` is NULL though its comparisons raise)."""
|
|
267
|
+
return _constant(shape, True, True if meaning.checked_arithmetic else None, (True, True))
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def STRICT_CASTS(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
271
|
+
"""Strict, and total where a failed implicit cast raises (`casts_raise`; in
|
|
272
|
+
Hive `1 < 'x'` is NULL): comparisons, LIKE, NOT and the bitwise operators."""
|
|
273
|
+
return _constant(shape, True, True if meaning.casts_raise else None, (True, True))
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def STRICT_UNLESS_EMPTY_IS_NULL(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
277
|
+
"""Strict, and total unless an empty string is NULL (`trim(' ')` is '', so NULL in Oracle)."""
|
|
278
|
+
return _constant(shape, True, None if meaning.empty_string_is_null else True, (True, True))
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def STRICT_IN_FIRST(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
282
|
+
"""NULL for a NULL first argument and, through the others, only sometimes:
|
|
283
|
+
`nullif(a, b)` is NULL when its arguments are equal, `xs[i]` when `i` is
|
|
284
|
+
out of range or the element NULL."""
|
|
285
|
+
return ir.Builtin.constant(shape.name, (True,) + (False,) * (shape.arity - 1), None)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
def BETWEEN(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
289
|
+
"""`1 BETWEEN NULL AND 0` is FALSE: strict in the value alone, and total
|
|
290
|
+
where a failed implicit cast raises."""
|
|
291
|
+
return ir.Builtin.constant(shape.name, (True, False, False), (True, True, True) if meaning.casts_raise else None)
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def CONSERVATIVE(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
295
|
+
"""Nothing known of its strictness or totality: a pure function that
|
|
296
|
+
respects equality in the arguments compared by identity, reflects it in none."""
|
|
297
|
+
return _constant(shape, False, None, (False, False))
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
def SKIPS_NULL(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
301
|
+
"""NULL only when every argument is: `greatest(NULL, 1)` is 1."""
|
|
302
|
+
return _constant(shape, False, None, (False, False), skips_null=True)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
def NULL_IF_ANY(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
306
|
+
"""NULL when any argument is, and perhaps otherwise: `greatest(NULL, 1)` is NULL."""
|
|
307
|
+
return _constant(shape, True, None, (True, False))
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def NEVER_NULL(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
311
|
+
"""A NULL argument is skipped, so it is never NULL: `concat(NULL)` is ''."""
|
|
312
|
+
return ir.Builtin.constant(shape.name, (False,) * shape.arity, (False,) * shape.arity, repeated=(False, False) if shape.variadic else None)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def LENIENT(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
316
|
+
"""A NULL argument does not make it NULL, though two non-null ones make it
|
|
317
|
+
non-null: Postgres's `ARRAY[1] || NULL` is `{1}`."""
|
|
318
|
+
return _constant(shape, False, True)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def SEPARATOR_STRICT(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
322
|
+
"""`concat_ws(sep, value, ...)` skipping NULL values: strict and total in
|
|
323
|
+
the separator alone, `concat_ws(',', NULL)` is ''."""
|
|
324
|
+
return ir.Builtin.constant(shape.name, (True,), (True,), repeated=(False, False))
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def one_to_one(*families: ir.TypeFamily) -> Properties:
|
|
328
|
+
"""Strict and total, and one-to-one in its one argument where that argument
|
|
329
|
+
is of one of `families` and compares by identity (bytes always do):
|
|
330
|
+
`to_base64` of bytes, `timestamp` of a date. Named per function, since a
|
|
331
|
+
family it keeps apart for one it merges for another (MySQL's `timestamp`
|
|
332
|
+
of an integer is NULL or a date-like reading of its digits). Equal values
|
|
333
|
+
of an identity type give the same result."""
|
|
334
|
+
over = frozenset(families)
|
|
335
|
+
|
|
336
|
+
def build(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
337
|
+
def properties(arguments: tuple[ir.Argument, ...], result: ir.ValueTyping | None) -> ir.CallProperties:
|
|
338
|
+
typing = arguments[0].typing if arguments else None
|
|
339
|
+
apart = typing is not None and typing.family in over and (typing.identity_comparison or typing.family == "bytes")
|
|
340
|
+
return ir.CallProperties(
|
|
341
|
+
strict=(True,) * shape.arity, total=(True,) * shape.arity, respects=ir.identity_arguments(arguments),
|
|
342
|
+
reflects=(apart,) + (False,) * (shape.arity - 1),
|
|
343
|
+
reason=f"{shape.name} is one-to-one in its argument over {', '.join(sorted(over))}",
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
return ir.Builtin(shape.name, shape.arity, properties)
|
|
347
|
+
|
|
348
|
+
return build
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
def _exact(argument: ir.Argument) -> bool:
|
|
352
|
+
return argument.typing is not None and argument.typing.exact_numeric
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
def _numeric(argument: ir.Argument) -> bool:
|
|
356
|
+
"""An exact number or a float: arithmetic over floats respects their
|
|
357
|
+
equality, since the only distinct floats that compare equal, -0.0 and
|
|
358
|
+
0.0, give results that compare equal under `+`, `-` and `*`."""
|
|
359
|
+
return argument.typing is not None and (argument.typing.exact_numeric or argument.typing.floating)
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
def _non_zero(argument: ir.Argument) -> bool:
|
|
363
|
+
"""A numeric literal whose value is not zero."""
|
|
364
|
+
literal = argument.literal
|
|
365
|
+
if literal is None or literal.type != "numeric":
|
|
366
|
+
return False
|
|
367
|
+
try:
|
|
368
|
+
return Decimal(literal.text) != 0
|
|
369
|
+
except InvalidOperation:
|
|
370
|
+
return False
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
def SUM(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
374
|
+
"""`+`, `-` or negation: strict, total where arithmetic is checked, and
|
|
375
|
+
over exact numbers one-to-one in each operand, the others fixed (`a + 1`,
|
|
376
|
+
`10 - a`, `-a`). A float rounds (1e16 + 1 = 1e16). It respects equality
|
|
377
|
+
over any numbers (`_numeric`). Values are assumed to stay in range (ADR 0007)."""
|
|
378
|
+
name, arity, checked = shape.name, shape.arity, meaning.checked_arithmetic
|
|
379
|
+
strict = (True,) * arity
|
|
380
|
+
|
|
381
|
+
def properties(arguments: tuple[ir.Argument, ...], result: ir.ValueTyping | None) -> ir.CallProperties:
|
|
382
|
+
exact = all(_exact(argument) for argument in arguments)
|
|
383
|
+
if exact:
|
|
384
|
+
reason = f"{name} of exact numbers is one-to-one in each operand"
|
|
385
|
+
else:
|
|
386
|
+
reason = f"{name} is one-to-one only over exact numbers: a float rounds (1e16 + 1 = 1e16)"
|
|
387
|
+
numeric = all(_numeric(argument) for argument in arguments)
|
|
388
|
+
return ir.CallProperties(
|
|
389
|
+
strict=strict, total=strict if checked else None, respects=(numeric,) * arity, reflects=(exact,) * arity, reason=reason,
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
return ir.Builtin(name, arity, properties)
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def PRODUCT(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
396
|
+
"""`*`: strict, total where arithmetic is checked, and over exact numbers
|
|
397
|
+
one-to-one in an operand when the other is a non-zero literal (`a * 2`;
|
|
398
|
+
`a * 0` is 0 for every `a`)."""
|
|
399
|
+
checked = meaning.checked_arithmetic
|
|
400
|
+
|
|
401
|
+
def properties(arguments: tuple[ir.Argument, ...], result: ir.ValueTyping | None) -> ir.CallProperties:
|
|
402
|
+
left, right = arguments
|
|
403
|
+
exact = _exact(left) and _exact(right)
|
|
404
|
+
reflects = (exact and _non_zero(right), exact and _non_zero(left))
|
|
405
|
+
if not exact:
|
|
406
|
+
reason = "* is one-to-one only over exact numbers: a float rounds"
|
|
407
|
+
elif any(reflects):
|
|
408
|
+
reason = "* of exact numbers by a non-zero literal is one-to-one in the other operand"
|
|
409
|
+
else:
|
|
410
|
+
reason = "* is one-to-one only by a non-zero literal: x * 0 is 0 for every x"
|
|
411
|
+
numeric = _numeric(left) and _numeric(right)
|
|
412
|
+
return ir.CallProperties(
|
|
413
|
+
strict=(True, True), total=(True, True) if checked else None, respects=(numeric, numeric), reflects=reflects, reason=reason,
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
return ir.Builtin(shape.name, 2, properties)
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
# Two values each division operator makes one, for its reason.
|
|
420
|
+
_MERGED_BY = {"/": "7 / 2 = 6 / 2 where it truncates integers", "//": "7 // 2 = 6 // 2", "%": "7 % 2 = 9 % 2"}
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def DIVISION(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
424
|
+
"""`/`, integer division or `%`: strict, and total where division by zero
|
|
425
|
+
raises (`checked_division`), or where arithmetic is checked
|
|
426
|
+
(`checked_arithmetic`) and the divisor is a non-zero literal, which
|
|
427
|
+
leaves no division by zero to give NULL. One-to-one in no operand; it
|
|
428
|
+
respects equality only in an operand compared by identity (`1 / -0.0` is
|
|
429
|
+
`-inf`, `1 / 0.0` is `inf`)."""
|
|
430
|
+
name = shape.name
|
|
431
|
+
|
|
432
|
+
def properties(arguments: tuple[ir.Argument, ...], result: ir.ValueTyping | None) -> ir.CallProperties:
|
|
433
|
+
total = meaning.checked_division or meaning.checked_arithmetic and _non_zero(arguments[1])
|
|
434
|
+
return ir.CallProperties(
|
|
435
|
+
strict=(True, True), total=(True, True) if total else None, respects=ir.identity_arguments(arguments),
|
|
436
|
+
reflects=(False, False), reason=f"{name} is one-to-one in no operand ({_MERGED_BY[name]})",
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
return ir.Builtin(name, 2, properties)
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
def CAST(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
443
|
+
"""CAST: strict, total where arithmetic is checked (SQLite turns a NaN into
|
|
444
|
+
NULL, MySQL a bad date CAST), and one-to-one in its operand where the
|
|
445
|
+
dialect's cast table (`DialectSemantics.casts`) says the cast from the
|
|
446
|
+
operand's type to the target keeps different values different (widening
|
|
447
|
+
or injective), into a type compared by identity: `CAST(id AS TEXT)` of an
|
|
448
|
+
integer, `CAST(d AS TIMESTAMP)` of a DATE. It respects equality where the
|
|
449
|
+
operand compares by identity (equal values are identical), or the cast
|
|
450
|
+
widens, keeping each value and so how it compares (a REAL into a DOUBLE:
|
|
451
|
+
`-0.0 = 0.0` in both); not from a DOUBLE into text, where `-0.0 = 0.0` but
|
|
452
|
+
'-0.0' <> '0.0'. The target is the call's own type (`target`)."""
|
|
453
|
+
table = cast_table(meaning)
|
|
454
|
+
checked = meaning.checked_arithmetic
|
|
455
|
+
|
|
456
|
+
def properties(arguments: tuple[ir.Argument, ...], result: ir.ValueTyping | None) -> ir.CallProperties:
|
|
457
|
+
source = arguments[0].typing
|
|
458
|
+
kind, why = table.classify(source, result)
|
|
459
|
+
identity = result is not None and result.identity_comparison
|
|
460
|
+
reflects = kind != "lossy" and identity
|
|
461
|
+
if kind != "lossy" and not identity:
|
|
462
|
+
why = f"{why}, but the target type does not compare by identity"
|
|
463
|
+
respects = source is not None and (source.identity_comparison or kind == "widening")
|
|
464
|
+
return ir.CallProperties(
|
|
465
|
+
strict=(True,), total=(True,) if checked else None, respects=(respects,), reflects=(reflects,), reason=why,
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
return ir.Builtin(shape.name, 1, properties)
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
def TRY_CAST(shape: Shape, meaning: DialectSemantics) -> ir.Builtin:
|
|
472
|
+
"""TRY_CAST: a CAST that gives NULL where the CAST would raise, so CAST's
|
|
473
|
+
properties but never total. Still one-to-one where the CAST is: the NULLs
|
|
474
|
+
of failed casts equal nothing, so no two values are made one."""
|
|
475
|
+
cast = CAST(shape, meaning)
|
|
476
|
+
|
|
477
|
+
def properties(arguments: tuple[ir.Argument, ...], result: ir.ValueTyping | None) -> ir.CallProperties:
|
|
478
|
+
return replace(cast.properties(arguments, result), total=None)
|
|
479
|
+
|
|
480
|
+
return replace(cast, properties=properties)
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
# ---------------------------------------------------------------------------
|
|
484
|
+
# The vocabulary: an entry
|
|
485
|
+
# ---------------------------------------------------------------------------
|
|
486
|
+
|
|
487
|
+
# The argument keys of a call, in order, as SQLGlot's node names them: a key
|
|
488
|
+
# with a leading `*` is a list whose last element repeats (`*expressions`).
|
|
489
|
+
type Signature = tuple[str, ...]
|
|
490
|
+
|
|
491
|
+
# What a keyword gives: a typing, or, in an entry of `PER_DIALECT` properties, the typing and its property function.
|
|
492
|
+
type Paired = tuple[Typing, Properties]
|
|
493
|
+
type Keyword = Typing | Paired
|
|
494
|
+
|
|
495
|
+
# The dialects an entry decides, in the order its keywords are written.
|
|
496
|
+
DIALECTS = (
|
|
497
|
+
"duckdb", "postgres", "mysql", "snowflake", "bigquery", "redshift", "databricks", "spark", "hive", "sqlite", "clickhouse", "oracle", "trino",
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
class Function:
|
|
502
|
+
"""What is known of one SQLGlot node (`Anonymous:<name>` for a function
|
|
503
|
+
SQLGlot does not know) in every dialect.
|
|
504
|
+
|
|
505
|
+
`properties` is the property function, or `PER_DIALECT`. `signatures` are
|
|
506
|
+
the argument keys a call of the node reads, one per way to write it; a
|
|
507
|
+
call carrying another argument is no call of the function (`floor(x, 2)`),
|
|
508
|
+
unless the key is in `ignores`. `example` is a call in DuckDB spelling
|
|
509
|
+
(`spelling` names another dialect where DuckDB has none), which
|
|
510
|
+
`tests/test_functions.py` reads as the node in every dialect not `ABSENT`.
|
|
511
|
+
The name labels the Builtin in explanations (`name`, else the node's SQL name). Each dialect is a keyword, all required."""
|
|
512
|
+
|
|
513
|
+
node: type[Expr] | str
|
|
514
|
+
properties: Properties | PerDialect | Volatile
|
|
515
|
+
signatures: Sequence[Signature]
|
|
516
|
+
example: str
|
|
517
|
+
spelling: str
|
|
518
|
+
name: str
|
|
519
|
+
ignores: tuple[str, ...]
|
|
520
|
+
keywords: Mapping[str, Keyword]
|
|
521
|
+
|
|
522
|
+
@overload
|
|
523
|
+
def __init__(
|
|
524
|
+
self, node: type[Expr] | str, properties: Properties | Volatile, *, signatures: Sequence[Signature], example: str, spelling: str = "duckdb",
|
|
525
|
+
name: str = "", ignores: tuple[str, ...] = (),
|
|
526
|
+
duckdb: Typing, postgres: Typing, mysql: Typing, snowflake: Typing, bigquery: Typing, redshift: Typing, databricks: Typing,
|
|
527
|
+
spark: Typing, hive: Typing, sqlite: Typing, clickhouse: Typing, oracle: Typing, trino: Typing,
|
|
528
|
+
) -> None: ...
|
|
529
|
+
|
|
530
|
+
@overload
|
|
531
|
+
def __init__(
|
|
532
|
+
self, node: type[Expr] | str, properties: PerDialect, *, signatures: Sequence[Signature], example: str, spelling: str = "duckdb",
|
|
533
|
+
name: str = "", ignores: tuple[str, ...] = (),
|
|
534
|
+
duckdb: Paired, postgres: Paired, mysql: Paired, snowflake: Paired, bigquery: Paired, redshift: Paired, databricks: Paired,
|
|
535
|
+
spark: Paired, hive: Paired, sqlite: Paired, clickhouse: Paired, oracle: Paired, trino: Paired,
|
|
536
|
+
) -> None: ...
|
|
537
|
+
|
|
538
|
+
def __init__(
|
|
539
|
+
self, node: type[Expr] | str, properties: Properties | PerDialect | Volatile, *, signatures: Sequence[Signature], example: str, spelling: str = "duckdb",
|
|
540
|
+
name: str = "", ignores: tuple[str, ...] = (), **keywords: Keyword,
|
|
541
|
+
) -> None:
|
|
542
|
+
if set(keywords) != set(DIALECTS):
|
|
543
|
+
raise TypeError(f"{node}: the keywords must be exactly {sorted(DIALECTS)}, not {sorted(keywords)}")
|
|
544
|
+
paired = [isinstance(keyword, tuple) for keyword in keywords.values()]
|
|
545
|
+
if isinstance(properties, PerDialect) != all(paired) or any(paired) != all(paired):
|
|
546
|
+
raise TypeError(f"{node}: PER_DIALECT properties pair a property function with the typing in every keyword, and no other entry does")
|
|
547
|
+
self.node = node
|
|
548
|
+
self.properties = properties
|
|
549
|
+
self.signatures = tuple(signatures)
|
|
550
|
+
self.example = example
|
|
551
|
+
self.spelling = spelling
|
|
552
|
+
self.ignores = ignores
|
|
553
|
+
self.keywords = keywords
|
|
554
|
+
if not name:
|
|
555
|
+
if isinstance(node, str):
|
|
556
|
+
name = node.split(":", 1)[1]
|
|
557
|
+
else:
|
|
558
|
+
names = node.sql_names() if issubclass(node, exp.Func) else []
|
|
559
|
+
if not names:
|
|
560
|
+
raise TypeError(f"{node.__name__}: a node with no SQL name needs a `name`")
|
|
561
|
+
name = names[0].lower()
|
|
562
|
+
self.name = name
|
|
563
|
+
|
|
564
|
+
@property
|
|
565
|
+
def key(self) -> str:
|
|
566
|
+
"""The node's name, `Anonymous:<name>` for a function SQLGlot does not know."""
|
|
567
|
+
return self.node if isinstance(self.node, str) else self.node.__name__
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
assert set(DIALECTS) == MODELLED_DIALECTS, "the table decides exactly the dialects dialects.py models"
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
# ---------------------------------------------------------------------------
|
|
574
|
+
# Shorthands
|
|
575
|
+
# ---------------------------------------------------------------------------
|
|
576
|
+
|
|
577
|
+
# The result of `+`, `-` and `*` over two typed operands, in every dialect:
|
|
578
|
+
# values are assumed to stay in range (ADR 0007), so overflow does not change
|
|
579
|
+
# it. A float operand makes the result a float. Integers give the widest
|
|
580
|
+
# integer; any other arithmetic over exact numbers is a decimal, whose
|
|
581
|
+
# precision is not claimed (`family` of a decimal). An operand of unknown type
|
|
582
|
+
# gives none, and so does one that is no number beside no float.
|
|
583
|
+
# Provenance: DuckDB 2.0.0 `typeof` (`x + 1`, `x * 2` of an integer type keep
|
|
584
|
+
# it; `DECIMAL(10,2) + 1` is `DECIMAL(13,2)`); other engines from memory
|
|
585
|
+
# (docs/dialects.md, "Types of computed expressions").
|
|
586
|
+
PROMOTED = on_arg(0, {
|
|
587
|
+
FLOAT: on_arg(1, {}, otherwise=keep(0)),
|
|
588
|
+
DECIMAL: on_arg(1, {FLOAT: keep(1), DECIMAL: family(0), INT: family(0)}, otherwise=unmodelled(Reason.NOT_A_NUMBER)),
|
|
589
|
+
INT: on_arg(1, {FLOAT: keep(1), DECIMAL: family(1), INT: common(0, 1)}, otherwise=unmodelled(Reason.NOT_A_NUMBER)),
|
|
590
|
+
}, otherwise=on_arg(1, {FLOAT: keep(1)}, otherwise=unmodelled(Reason.NOT_A_NUMBER)))
|
|
591
|
+
|
|
592
|
+
# The negation of an exact number or a float has its type (`-x` is `x`'s type in DuckDB 2.0.0).
|
|
593
|
+
NEGATED = on_arg(0, {INT: keep(0), DECIMAL: keep(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.NOT_A_NUMBER))
|
|
594
|
+
|
|
595
|
+
# `ln`, `exp`, `sqrt` and `sign` of an integer or a float are a DOUBLE
|
|
596
|
+
# PRECISION in Postgres, of a NUMERIC a NUMERIC.
|
|
597
|
+
POSTGRES_MATH = on_arg(0, {INT: "DOUBLE PRECISION", FLOAT: "DOUBLE PRECISION", DECIMAL: "NUMERIC"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED))
|
|
598
|
+
|
|
599
|
+
# `ln`, `exp` and `sqrt` of an INT64 or a FLOAT64 are a FLOAT64, of a NUMERIC a NUMERIC.
|
|
600
|
+
BIGQUERY_MATH = on_arg(0, {INT: "FLOAT64", FLOAT: "FLOAT64", DECIMAL: "NUMERIC"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED))
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
# ---------------------------------------------------------------------------
|
|
604
|
+
# The entries
|
|
605
|
+
# ---------------------------------------------------------------------------
|
|
606
|
+
|
|
607
|
+
# Notes on the keywords, by dialect (what the result-type blocks of dialects.py said before this table):
|
|
608
|
+
# duckdb: Certified with `typeof` (scripts/certify_dialects.py).
|
|
609
|
+
# postgres: Hashes certified; beyond them tentative (probed by hand on 18.6, not certified).
|
|
610
|
+
# mysql: No type function to certify result types with. Tentative (probed by hand on 8.4, not certified).
|
|
611
|
+
# snowflake: Tentative, from its docs. VARCHAR or BINARY follows the argument where a keyword keeps it.
|
|
612
|
+
# bigquery: Tentative, from its docs. String functions return STRING or BYTES as their argument is.
|
|
613
|
+
# redshift: Tentative, from its docs and memory. A CHAR argument may give a CHAR.
|
|
614
|
+
# databricks: As Spark (its keywords were never told apart), except where a property differs.
|
|
615
|
+
# spark: Tentative. Spark 4 and Databricks under ANSI mode, their default (ADR 0006).
|
|
616
|
+
# hive: Tentative, from its docs and memory.
|
|
617
|
+
# sqlite: Claims no function result type: a value's type is its own (storage class), not its expression's.
|
|
618
|
+
# clickhouse: Tentative (probed by hand on 26.10, not certified): of a Nullable or LowCardinality argument, the result is wrapped alike.
|
|
619
|
+
# oracle: Tentative, from its docs and memory: text functions return VARCHAR2 or CLOB as their argument is, math functions keep NUMBER or a binary float.
|
|
620
|
+
# trino: md5/sha1/sha256 take and return VARBINARY. Beyond the hashes, tentative (probed by hand on 484, not certified). A text result keeps its argument's length, so only those that lose it are fixed.
|
|
621
|
+
|
|
622
|
+
FUNCTIONS: tuple[Function, ...] = (
|
|
623
|
+
# arithmetic
|
|
624
|
+
Function(exp.Add, SUM, name="+", signatures=[("this", "expression")], example="1 + 2",
|
|
625
|
+
duckdb=PROMOTED,
|
|
626
|
+
postgres=PROMOTED,
|
|
627
|
+
mysql=PROMOTED,
|
|
628
|
+
snowflake=PROMOTED,
|
|
629
|
+
bigquery=PROMOTED,
|
|
630
|
+
redshift=PROMOTED,
|
|
631
|
+
databricks=PROMOTED,
|
|
632
|
+
spark=PROMOTED,
|
|
633
|
+
hive=PROMOTED,
|
|
634
|
+
sqlite=PROMOTED,
|
|
635
|
+
clickhouse=PROMOTED,
|
|
636
|
+
oracle=PROMOTED,
|
|
637
|
+
trino=PROMOTED),
|
|
638
|
+
Function(exp.Sub, SUM, name="-", signatures=[("this", "expression")], example="3 - 1",
|
|
639
|
+
duckdb=PROMOTED,
|
|
640
|
+
postgres=PROMOTED,
|
|
641
|
+
mysql=PROMOTED,
|
|
642
|
+
snowflake=PROMOTED,
|
|
643
|
+
bigquery=PROMOTED,
|
|
644
|
+
redshift=PROMOTED,
|
|
645
|
+
databricks=PROMOTED,
|
|
646
|
+
spark=PROMOTED,
|
|
647
|
+
hive=PROMOTED,
|
|
648
|
+
sqlite=PROMOTED,
|
|
649
|
+
clickhouse=PROMOTED,
|
|
650
|
+
oracle=PROMOTED,
|
|
651
|
+
trino=PROMOTED),
|
|
652
|
+
Function(exp.Mul, PRODUCT, name="*", signatures=[("this", "expression")], example="2 * 3",
|
|
653
|
+
duckdb=PROMOTED,
|
|
654
|
+
postgres=PROMOTED,
|
|
655
|
+
mysql=PROMOTED,
|
|
656
|
+
snowflake=PROMOTED,
|
|
657
|
+
bigquery=PROMOTED,
|
|
658
|
+
redshift=PROMOTED,
|
|
659
|
+
databricks=PROMOTED,
|
|
660
|
+
spark=PROMOTED,
|
|
661
|
+
hive=PROMOTED,
|
|
662
|
+
sqlite=PROMOTED,
|
|
663
|
+
clickhouse=PROMOTED,
|
|
664
|
+
oracle=PROMOTED,
|
|
665
|
+
trino=PROMOTED),
|
|
666
|
+
Function(exp.Neg, SUM, name="unary -", signatures=[("this",)], example="-(1 + 1)",
|
|
667
|
+
duckdb=NEGATED,
|
|
668
|
+
postgres=NEGATED,
|
|
669
|
+
mysql=NEGATED,
|
|
670
|
+
snowflake=NEGATED,
|
|
671
|
+
bigquery=NEGATED,
|
|
672
|
+
redshift=NEGATED,
|
|
673
|
+
databricks=NEGATED,
|
|
674
|
+
spark=NEGATED,
|
|
675
|
+
hive=NEGATED,
|
|
676
|
+
sqlite=NEGATED,
|
|
677
|
+
clickhouse=NEGATED,
|
|
678
|
+
oracle=NEGATED,
|
|
679
|
+
trino=NEGATED),
|
|
680
|
+
Function(exp.Div, DIVISION, name="/", signatures=[("this", "expression")], example="4 / 2",
|
|
681
|
+
duckdb=unmodelled(Reason.DIVISION),
|
|
682
|
+
postgres=unmodelled(Reason.DIVISION),
|
|
683
|
+
mysql=unmodelled(Reason.DIVISION),
|
|
684
|
+
snowflake=unmodelled(Reason.DIVISION),
|
|
685
|
+
bigquery=unmodelled(Reason.DIVISION),
|
|
686
|
+
redshift=unmodelled(Reason.DIVISION),
|
|
687
|
+
databricks=unmodelled(Reason.DIVISION),
|
|
688
|
+
spark=unmodelled(Reason.DIVISION),
|
|
689
|
+
hive=unmodelled(Reason.DIVISION),
|
|
690
|
+
sqlite=unmodelled(Reason.DIVISION),
|
|
691
|
+
clickhouse=unmodelled(Reason.DIVISION),
|
|
692
|
+
oracle=unmodelled(Reason.DIVISION),
|
|
693
|
+
trino=unmodelled(Reason.DIVISION)),
|
|
694
|
+
Function(exp.IntDiv, DIVISION, name="//", signatures=[("this", "expression")], example="4 // 2",
|
|
695
|
+
duckdb=unmodelled(Reason.DIVISION),
|
|
696
|
+
postgres=UNREACHABLE,
|
|
697
|
+
mysql=unmodelled(Reason.DIVISION),
|
|
698
|
+
snowflake=UNREACHABLE,
|
|
699
|
+
bigquery=unmodelled(Reason.DIVISION),
|
|
700
|
+
redshift=UNREACHABLE,
|
|
701
|
+
databricks=unmodelled(Reason.DIVISION),
|
|
702
|
+
spark=unmodelled(Reason.DIVISION),
|
|
703
|
+
hive=unmodelled(Reason.DIVISION),
|
|
704
|
+
sqlite=UNREACHABLE,
|
|
705
|
+
clickhouse=UNREACHABLE,
|
|
706
|
+
oracle=UNREACHABLE,
|
|
707
|
+
trino=UNREACHABLE),
|
|
708
|
+
Function(exp.Mod, DIVISION, name="%", signatures=[("this", "expression")], example="5 % 2",
|
|
709
|
+
duckdb=unmodelled(Reason.DIVISION),
|
|
710
|
+
postgres=unmodelled(Reason.DIVISION),
|
|
711
|
+
mysql=unmodelled(Reason.DIVISION),
|
|
712
|
+
snowflake=unmodelled(Reason.DIVISION),
|
|
713
|
+
bigquery=unmodelled(Reason.DIVISION),
|
|
714
|
+
redshift=unmodelled(Reason.DIVISION),
|
|
715
|
+
databricks=unmodelled(Reason.DIVISION),
|
|
716
|
+
spark=unmodelled(Reason.DIVISION),
|
|
717
|
+
hive=unmodelled(Reason.DIVISION),
|
|
718
|
+
sqlite=unmodelled(Reason.DIVISION),
|
|
719
|
+
clickhouse=unmodelled(Reason.DIVISION),
|
|
720
|
+
oracle=unmodelled(Reason.DIVISION),
|
|
721
|
+
trino=unmodelled(Reason.DIVISION)),
|
|
722
|
+
Function(exp.Abs, STRICT_CHECKED, signatures=[("this",)], example="abs(-1)",
|
|
723
|
+
duckdb=keep(0),
|
|
724
|
+
postgres=keep(0),
|
|
725
|
+
mysql=keep(0),
|
|
726
|
+
snowflake=keep(0),
|
|
727
|
+
bigquery=keep(0),
|
|
728
|
+
redshift=keep(0),
|
|
729
|
+
databricks=on_arg(0, {INT: keep(0), DECIMAL: keep(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), # of text a DOUBLE
|
|
730
|
+
spark=on_arg(0, {INT: keep(0), DECIMAL: keep(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), # of text a DOUBLE
|
|
731
|
+
hive=on_arg(0, {INT: keep(0), DECIMAL: keep(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), # of text a DOUBLE
|
|
732
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
733
|
+
clickhouse=unmodelled(Reason.FINER_THAN_FAMILY), # Int32 gives UInt32
|
|
734
|
+
oracle=keep(0),
|
|
735
|
+
trino=keep(0)),
|
|
736
|
+
Function(exp.Floor, STRICT_CHECKED, signatures=[("this",)], example="floor(1.5)",
|
|
737
|
+
duckdb=on_arg(0, {INT: "DOUBLE", DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
738
|
+
postgres=on_arg(0, {INT: "DOUBLE PRECISION", DECIMAL: family(0), FLOAT: "DOUBLE PRECISION"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
739
|
+
mysql=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
740
|
+
snowflake=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
741
|
+
bigquery=on_arg(0, {INT: "FLOAT64", DECIMAL: keep(0), FLOAT: "FLOAT64"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), # `floor` and the like of an INT64 are a FLOAT64
|
|
742
|
+
redshift=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
743
|
+
databricks=on_arg(0, {INT: "BIGINT", DECIMAL: family(0), FLOAT: "BIGINT"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
744
|
+
spark=on_arg(0, {INT: "BIGINT", DECIMAL: family(0), FLOAT: "BIGINT"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
745
|
+
hive=on_arg(0, {INT: "BIGINT", DECIMAL: family(0), FLOAT: "BIGINT"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
746
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
747
|
+
clickhouse=on_arg(0, {INT: keep(0), DECIMAL: keep(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
748
|
+
oracle=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
749
|
+
trino=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED))),
|
|
750
|
+
Function(exp.Ceil, STRICT_CHECKED, signatures=[("this",)], example="ceil(1.5)",
|
|
751
|
+
duckdb=on_arg(0, {INT: "DOUBLE", DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
752
|
+
postgres=on_arg(0, {INT: "DOUBLE PRECISION", DECIMAL: family(0), FLOAT: "DOUBLE PRECISION"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
753
|
+
mysql=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
754
|
+
snowflake=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
755
|
+
bigquery=on_arg(0, {INT: "FLOAT64", DECIMAL: keep(0), FLOAT: "FLOAT64"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), # `floor` and the like of an INT64 are a FLOAT64
|
|
756
|
+
redshift=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
757
|
+
databricks=on_arg(0, {INT: "BIGINT", DECIMAL: family(0), FLOAT: "BIGINT"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
758
|
+
spark=on_arg(0, {INT: "BIGINT", DECIMAL: family(0), FLOAT: "BIGINT"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
759
|
+
hive=on_arg(0, {INT: "BIGINT", DECIMAL: family(0), FLOAT: "BIGINT"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
760
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
761
|
+
clickhouse=on_arg(0, {INT: keep(0), DECIMAL: keep(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
762
|
+
oracle=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
763
|
+
trino=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED))),
|
|
764
|
+
Function(exp.Round, STRICT_CHECKED, signatures=[("this",), ("this", "decimals")], example="round(1.5)",
|
|
765
|
+
duckdb=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
766
|
+
# `round(x)` of an integer resolves to round(double precision); only `round(numeric, int)` takes a scale.
|
|
767
|
+
postgres=on_arity({
|
|
768
|
+
1: on_arg(0, {INT: "DOUBLE PRECISION", DECIMAL: family(0), FLOAT: "DOUBLE PRECISION"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
769
|
+
2: on_arg(0, {INT: "NUMERIC", DECIMAL: family(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
770
|
+
}, otherwise=unmodelled(Reason.OVERLOADED)),
|
|
771
|
+
mysql=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
772
|
+
snowflake=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
773
|
+
bigquery=on_arg(0, {INT: "FLOAT64", DECIMAL: keep(0), FLOAT: "FLOAT64"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
774
|
+
redshift=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
775
|
+
databricks=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
776
|
+
spark=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
777
|
+
hive=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
778
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
779
|
+
clickhouse=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
780
|
+
oracle=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
781
|
+
trino=on_arg(0, {INT: keep(0), DECIMAL: family(0), FLOAT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED))),
|
|
782
|
+
|
|
783
|
+
# comparison, logic and bit operators
|
|
784
|
+
Function(exp.NEQ, STRICT_CASTS, name="<>", signatures=[("this", "expression")], example="1 <> 2",
|
|
785
|
+
duckdb="BOOLEAN",
|
|
786
|
+
postgres="BOOLEAN",
|
|
787
|
+
mysql="BIGINT",
|
|
788
|
+
snowflake="BOOLEAN",
|
|
789
|
+
bigquery="BOOL",
|
|
790
|
+
redshift="BOOLEAN",
|
|
791
|
+
databricks="BOOLEAN",
|
|
792
|
+
spark="BOOLEAN",
|
|
793
|
+
hive="BOOLEAN",
|
|
794
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
795
|
+
clickhouse="UInt8",
|
|
796
|
+
oracle="BOOLEAN",
|
|
797
|
+
trino="BOOLEAN"),
|
|
798
|
+
Function(exp.GT, STRICT_CASTS, name=">", signatures=[("this", "expression")], example="1 > 2",
|
|
799
|
+
duckdb="BOOLEAN",
|
|
800
|
+
postgres="BOOLEAN",
|
|
801
|
+
mysql="BIGINT",
|
|
802
|
+
snowflake="BOOLEAN",
|
|
803
|
+
bigquery="BOOL",
|
|
804
|
+
redshift="BOOLEAN",
|
|
805
|
+
databricks="BOOLEAN",
|
|
806
|
+
spark="BOOLEAN",
|
|
807
|
+
hive="BOOLEAN",
|
|
808
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
809
|
+
clickhouse="UInt8",
|
|
810
|
+
oracle="BOOLEAN",
|
|
811
|
+
trino="BOOLEAN"),
|
|
812
|
+
Function(exp.GTE, STRICT_CASTS, name=">=", signatures=[("this", "expression")], example="1 >= 2",
|
|
813
|
+
duckdb="BOOLEAN",
|
|
814
|
+
postgres="BOOLEAN",
|
|
815
|
+
mysql="BIGINT",
|
|
816
|
+
snowflake="BOOLEAN",
|
|
817
|
+
bigquery="BOOL",
|
|
818
|
+
redshift="BOOLEAN",
|
|
819
|
+
databricks="BOOLEAN",
|
|
820
|
+
spark="BOOLEAN",
|
|
821
|
+
hive="BOOLEAN",
|
|
822
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
823
|
+
clickhouse="UInt8",
|
|
824
|
+
oracle="BOOLEAN",
|
|
825
|
+
trino="BOOLEAN"),
|
|
826
|
+
Function(exp.LT, STRICT_CASTS, name="<", signatures=[("this", "expression")], example="1 < 2",
|
|
827
|
+
duckdb="BOOLEAN",
|
|
828
|
+
postgres="BOOLEAN",
|
|
829
|
+
mysql="BIGINT",
|
|
830
|
+
snowflake="BOOLEAN",
|
|
831
|
+
bigquery="BOOL",
|
|
832
|
+
redshift="BOOLEAN",
|
|
833
|
+
databricks="BOOLEAN",
|
|
834
|
+
spark="BOOLEAN",
|
|
835
|
+
hive="BOOLEAN",
|
|
836
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
837
|
+
clickhouse="UInt8",
|
|
838
|
+
oracle="BOOLEAN",
|
|
839
|
+
trino="BOOLEAN"),
|
|
840
|
+
Function(exp.LTE, STRICT_CASTS, name="<=", signatures=[("this", "expression")], example="1 <= 2",
|
|
841
|
+
duckdb="BOOLEAN",
|
|
842
|
+
postgres="BOOLEAN",
|
|
843
|
+
mysql="BIGINT",
|
|
844
|
+
snowflake="BOOLEAN",
|
|
845
|
+
bigquery="BOOL",
|
|
846
|
+
redshift="BOOLEAN",
|
|
847
|
+
databricks="BOOLEAN",
|
|
848
|
+
spark="BOOLEAN",
|
|
849
|
+
hive="BOOLEAN",
|
|
850
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
851
|
+
clickhouse="UInt8",
|
|
852
|
+
oracle="BOOLEAN",
|
|
853
|
+
trino="BOOLEAN"),
|
|
854
|
+
Function(exp.Like, STRICT_CASTS, name="LIKE", signatures=[("this", "expression")], example="'a' LIKE 'b'",
|
|
855
|
+
duckdb="BOOLEAN",
|
|
856
|
+
postgres="BOOLEAN",
|
|
857
|
+
mysql="BIGINT",
|
|
858
|
+
snowflake="BOOLEAN",
|
|
859
|
+
bigquery="BOOL",
|
|
860
|
+
redshift="BOOLEAN",
|
|
861
|
+
databricks="BOOLEAN",
|
|
862
|
+
spark="BOOLEAN",
|
|
863
|
+
hive="BOOLEAN",
|
|
864
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
865
|
+
clickhouse="UInt8",
|
|
866
|
+
oracle="BOOLEAN",
|
|
867
|
+
trino="BOOLEAN"),
|
|
868
|
+
Function(exp.ILike, STRICT_CASTS, name="ILIKE", signatures=[("this", "expression")], example="'a' ILIKE 'b'",
|
|
869
|
+
duckdb="BOOLEAN",
|
|
870
|
+
postgres="BOOLEAN",
|
|
871
|
+
mysql="BIGINT",
|
|
872
|
+
snowflake="BOOLEAN",
|
|
873
|
+
bigquery="BOOL",
|
|
874
|
+
redshift="BOOLEAN",
|
|
875
|
+
databricks="BOOLEAN",
|
|
876
|
+
spark="BOOLEAN",
|
|
877
|
+
hive="BOOLEAN",
|
|
878
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
879
|
+
clickhouse="UInt8",
|
|
880
|
+
oracle="BOOLEAN",
|
|
881
|
+
trino="BOOLEAN"),
|
|
882
|
+
Function(exp.Not, STRICT_CASTS, name="NOT", signatures=[("this",)], example="NOT TRUE",
|
|
883
|
+
duckdb="BOOLEAN",
|
|
884
|
+
postgres="BOOLEAN",
|
|
885
|
+
mysql="BIGINT",
|
|
886
|
+
snowflake="BOOLEAN",
|
|
887
|
+
bigquery="BOOL",
|
|
888
|
+
redshift="BOOLEAN",
|
|
889
|
+
databricks="BOOLEAN",
|
|
890
|
+
spark="BOOLEAN",
|
|
891
|
+
hive="BOOLEAN",
|
|
892
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
893
|
+
clickhouse="UInt8",
|
|
894
|
+
oracle="BOOLEAN",
|
|
895
|
+
trino="BOOLEAN"),
|
|
896
|
+
Function(exp.Between, BETWEEN, name="BETWEEN", signatures=[("this", "low", "high")], example="1 BETWEEN 0 AND 2",
|
|
897
|
+
duckdb="BOOLEAN",
|
|
898
|
+
postgres="BOOLEAN",
|
|
899
|
+
mysql="BIGINT",
|
|
900
|
+
snowflake="BOOLEAN",
|
|
901
|
+
bigquery="BOOL",
|
|
902
|
+
redshift="BOOLEAN",
|
|
903
|
+
databricks="BOOLEAN",
|
|
904
|
+
spark="BOOLEAN",
|
|
905
|
+
hive="BOOLEAN",
|
|
906
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
907
|
+
clickhouse="UInt8",
|
|
908
|
+
oracle="BOOLEAN",
|
|
909
|
+
trino="BOOLEAN"),
|
|
910
|
+
Function(exp.Nullif, STRICT_IN_FIRST, signatures=[("this", "expression")], example="nullif(1, 2)",
|
|
911
|
+
duckdb=common(0, 1),
|
|
912
|
+
postgres=common(0, 1),
|
|
913
|
+
mysql=common(0, 1),
|
|
914
|
+
snowflake=common(0, 1),
|
|
915
|
+
bigquery=common(0, 1),
|
|
916
|
+
redshift=common(0, 1),
|
|
917
|
+
databricks=common(0, 1),
|
|
918
|
+
spark=common(0, 1),
|
|
919
|
+
hive=common(0, 1),
|
|
920
|
+
sqlite=common(0, 1),
|
|
921
|
+
clickhouse=common(0, 1),
|
|
922
|
+
oracle=common(0, 1),
|
|
923
|
+
trino=common(0, 1)),
|
|
924
|
+
Function(exp.BitwiseAnd, STRICT_CASTS, name="&", signatures=[("this", "expression")], example="1 & 2",
|
|
925
|
+
duckdb=common(0, 1),
|
|
926
|
+
postgres=common(0, 1),
|
|
927
|
+
mysql="BIGINT UNSIGNED",
|
|
928
|
+
snowflake=common(0, 1),
|
|
929
|
+
bigquery=common(0, 1),
|
|
930
|
+
redshift=common(0, 1),
|
|
931
|
+
databricks=common(0, 1),
|
|
932
|
+
spark=common(0, 1),
|
|
933
|
+
hive=common(0, 1),
|
|
934
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
935
|
+
clickhouse=common(0, 1),
|
|
936
|
+
oracle=common(0, 1),
|
|
937
|
+
trino=common(0, 1)),
|
|
938
|
+
Function(exp.BitwiseOr, STRICT_CASTS, name="|", signatures=[("this", "expression")], example="1 | 2",
|
|
939
|
+
duckdb=common(0, 1),
|
|
940
|
+
postgres=common(0, 1),
|
|
941
|
+
mysql="BIGINT UNSIGNED",
|
|
942
|
+
snowflake=common(0, 1),
|
|
943
|
+
bigquery=common(0, 1),
|
|
944
|
+
redshift=common(0, 1),
|
|
945
|
+
databricks=common(0, 1),
|
|
946
|
+
spark=common(0, 1),
|
|
947
|
+
hive=common(0, 1),
|
|
948
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
949
|
+
clickhouse=common(0, 1),
|
|
950
|
+
oracle=common(0, 1),
|
|
951
|
+
trino=common(0, 1)),
|
|
952
|
+
Function(exp.BitwiseXor, STRICT_CASTS, name="^", signatures=[("this", "expression")], example="xor(1, 2)",
|
|
953
|
+
duckdb=common(0, 1),
|
|
954
|
+
postgres=common(0, 1),
|
|
955
|
+
mysql="BIGINT UNSIGNED",
|
|
956
|
+
snowflake=common(0, 1),
|
|
957
|
+
bigquery=common(0, 1),
|
|
958
|
+
redshift=UNREACHABLE,
|
|
959
|
+
databricks=common(0, 1),
|
|
960
|
+
spark=common(0, 1),
|
|
961
|
+
hive=common(0, 1),
|
|
962
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
963
|
+
clickhouse=common(0, 1),
|
|
964
|
+
oracle=common(0, 1),
|
|
965
|
+
trino=common(0, 1)),
|
|
966
|
+
Function(exp.BitwiseLeftShift, STRICT_CASTS, name="<<", signatures=[("this", "expression")], example="1 << 2",
|
|
967
|
+
duckdb=keep(0),
|
|
968
|
+
postgres=keep(0),
|
|
969
|
+
mysql="BIGINT UNSIGNED",
|
|
970
|
+
snowflake=keep(0),
|
|
971
|
+
bigquery=keep(0),
|
|
972
|
+
redshift=keep(0),
|
|
973
|
+
databricks=on_arg(0, {INT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
974
|
+
spark=on_arg(0, {INT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
975
|
+
hive=on_arg(0, {INT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
976
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
977
|
+
clickhouse=keep(0),
|
|
978
|
+
oracle=keep(0),
|
|
979
|
+
trino=keep(0)),
|
|
980
|
+
Function(exp.BitwiseRightShift, STRICT_CASTS, name=">>", signatures=[("this", "expression")], example="8 >> 2",
|
|
981
|
+
duckdb=keep(0),
|
|
982
|
+
postgres=keep(0),
|
|
983
|
+
mysql="BIGINT UNSIGNED",
|
|
984
|
+
snowflake=keep(0),
|
|
985
|
+
bigquery=keep(0),
|
|
986
|
+
redshift=keep(0),
|
|
987
|
+
databricks=on_arg(0, {INT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
988
|
+
spark=on_arg(0, {INT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
989
|
+
hive=on_arg(0, {INT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
990
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
991
|
+
clickhouse=keep(0),
|
|
992
|
+
oracle=keep(0),
|
|
993
|
+
trino=keep(0)),
|
|
994
|
+
Function(exp.BitwiseNot, STRICT_CASTS, name="~", signatures=[("this",)], example="~1",
|
|
995
|
+
duckdb=keep(0),
|
|
996
|
+
postgres=keep(0),
|
|
997
|
+
mysql="BIGINT UNSIGNED",
|
|
998
|
+
snowflake=keep(0),
|
|
999
|
+
bigquery=keep(0),
|
|
1000
|
+
redshift=keep(0),
|
|
1001
|
+
databricks=keep(0),
|
|
1002
|
+
spark=keep(0),
|
|
1003
|
+
hive=keep(0),
|
|
1004
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1005
|
+
clickhouse=keep(0),
|
|
1006
|
+
oracle=keep(0),
|
|
1007
|
+
trino=keep(0)),
|
|
1008
|
+
|
|
1009
|
+
# cast
|
|
1010
|
+
Function(exp.Cast, CAST, name="CAST", signatures=[("this",)], ignores=("to", "format", "default",), example="CAST('1' AS BIGINT)",
|
|
1011
|
+
duckdb=target,
|
|
1012
|
+
postgres=target,
|
|
1013
|
+
mysql=target,
|
|
1014
|
+
snowflake=target,
|
|
1015
|
+
bigquery=target,
|
|
1016
|
+
redshift=target,
|
|
1017
|
+
databricks=target,
|
|
1018
|
+
spark=UNREACHABLE,
|
|
1019
|
+
hive=UNREACHABLE,
|
|
1020
|
+
sqlite=target,
|
|
1021
|
+
clickhouse=target,
|
|
1022
|
+
oracle=target,
|
|
1023
|
+
trino=target),
|
|
1024
|
+
Function(exp.TryCast, TRY_CAST, name="TRY_CAST", signatures=[("this",)], ignores=("to", "format", "default",), example="TRY_CAST('1' AS BIGINT)",
|
|
1025
|
+
duckdb=target,
|
|
1026
|
+
postgres=ABSENT,
|
|
1027
|
+
mysql=ABSENT,
|
|
1028
|
+
snowflake=target,
|
|
1029
|
+
bigquery=target,
|
|
1030
|
+
redshift=target,
|
|
1031
|
+
databricks=target,
|
|
1032
|
+
spark=target,
|
|
1033
|
+
hive=target,
|
|
1034
|
+
sqlite=ABSENT,
|
|
1035
|
+
clickhouse=target,
|
|
1036
|
+
oracle=target,
|
|
1037
|
+
trino=target),
|
|
1038
|
+
|
|
1039
|
+
# text
|
|
1040
|
+
Function(exp.Lower, STRICT, signatures=[("this",)], example="lower('A')",
|
|
1041
|
+
duckdb="VARCHAR",
|
|
1042
|
+
postgres="TEXT",
|
|
1043
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), # a text result carries its argument's length and collation
|
|
1044
|
+
snowflake="VARCHAR",
|
|
1045
|
+
bigquery=keep(0),
|
|
1046
|
+
redshift="VARCHAR",
|
|
1047
|
+
databricks="STRING",
|
|
1048
|
+
spark="STRING",
|
|
1049
|
+
hive="STRING",
|
|
1050
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1051
|
+
clickhouse="String",
|
|
1052
|
+
oracle=keep(0),
|
|
1053
|
+
trino=keep(0)),
|
|
1054
|
+
Function(exp.Upper, STRICT, signatures=[("this",)], example="upper('a')",
|
|
1055
|
+
duckdb="VARCHAR",
|
|
1056
|
+
postgres="TEXT",
|
|
1057
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), # a text result carries its argument's length and collation
|
|
1058
|
+
snowflake="VARCHAR",
|
|
1059
|
+
bigquery=keep(0),
|
|
1060
|
+
redshift="VARCHAR",
|
|
1061
|
+
databricks="STRING",
|
|
1062
|
+
spark="STRING",
|
|
1063
|
+
hive="STRING",
|
|
1064
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1065
|
+
clickhouse="String",
|
|
1066
|
+
oracle=keep(0),
|
|
1067
|
+
trino=keep(0)),
|
|
1068
|
+
Function(exp.Length, STRICT, signatures=[("this",)], example="length('abc')",
|
|
1069
|
+
duckdb="BIGINT",
|
|
1070
|
+
postgres="INTEGER",
|
|
1071
|
+
mysql="INT",
|
|
1072
|
+
snowflake="NUMBER",
|
|
1073
|
+
bigquery="INT64",
|
|
1074
|
+
redshift="INTEGER",
|
|
1075
|
+
databricks="INT",
|
|
1076
|
+
spark="INT",
|
|
1077
|
+
hive="INT",
|
|
1078
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1079
|
+
clickhouse="UInt64",
|
|
1080
|
+
oracle="NUMBER",
|
|
1081
|
+
trino="BIGINT"),
|
|
1082
|
+
Function(exp.Trim, STRICT_UNLESS_EMPTY_IS_NULL, signatures=[("this",)], example="trim(' a ')",
|
|
1083
|
+
duckdb="VARCHAR",
|
|
1084
|
+
postgres="TEXT",
|
|
1085
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), # a text result carries its argument's length and collation
|
|
1086
|
+
snowflake="VARCHAR",
|
|
1087
|
+
bigquery=keep(0),
|
|
1088
|
+
redshift="VARCHAR",
|
|
1089
|
+
databricks="STRING",
|
|
1090
|
+
spark="STRING",
|
|
1091
|
+
hive="STRING",
|
|
1092
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1093
|
+
clickhouse="String",
|
|
1094
|
+
oracle=keep(0),
|
|
1095
|
+
trino=keep(0)),
|
|
1096
|
+
Function(exp.Concat, PER_DIALECT, signatures=[("*expressions",)], example="concat('a', 'b')",
|
|
1097
|
+
duckdb=(unmodelled(Reason.OVERLOADED), NEVER_NULL), # of a list
|
|
1098
|
+
postgres=("TEXT", NEVER_NULL),
|
|
1099
|
+
mysql=(unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), STRICT),
|
|
1100
|
+
snowflake=(on_arg(0, {TEXT: "VARCHAR"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), STRICT),
|
|
1101
|
+
bigquery=(keep(0), STRICT),
|
|
1102
|
+
redshift=("VARCHAR", CONSERVATIVE),
|
|
1103
|
+
databricks=(unmodelled(Reason.OVERLOADED), STRICT), # of arrays
|
|
1104
|
+
spark=(unmodelled(Reason.OVERLOADED), STRICT), # of arrays
|
|
1105
|
+
hive=(unmodelled(Reason.OVERLOADED), STRICT), # BINARY of BINARY
|
|
1106
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), CONSERVATIVE),
|
|
1107
|
+
clickhouse=("String", CONSERVATIVE),
|
|
1108
|
+
oracle=(keep(0), CONSERVATIVE),
|
|
1109
|
+
trino=("VARCHAR", STRICT)),
|
|
1110
|
+
Function(exp.ConcatWs, PER_DIALECT, signatures=[("*expressions",)], example="concat_ws('-', 'a', 1)",
|
|
1111
|
+
duckdb=("VARCHAR", SEPARATOR_STRICT),
|
|
1112
|
+
postgres=("TEXT", SEPARATOR_STRICT),
|
|
1113
|
+
mysql=(unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), SEPARATOR_STRICT),
|
|
1114
|
+
snowflake=("VARCHAR", STRICT),
|
|
1115
|
+
bigquery=(ABSENT, CONSERVATIVE), # BigQuery has no concat_ws
|
|
1116
|
+
redshift=("VARCHAR", CONSERVATIVE),
|
|
1117
|
+
databricks=("STRING", SEPARATOR_STRICT),
|
|
1118
|
+
spark=("STRING", SEPARATOR_STRICT),
|
|
1119
|
+
hive=("STRING", CONSERVATIVE),
|
|
1120
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), SEPARATOR_STRICT),
|
|
1121
|
+
clickhouse=("String", STRICT),
|
|
1122
|
+
oracle=("VARCHAR2", CONSERVATIVE),
|
|
1123
|
+
trino=("VARCHAR", CONSERVATIVE)), # not modelled: it skips a NULL VARCHAR, but its ARRAY(VARCHAR) overload is NULL for a NULL array, and SQLGlot parses both alike
|
|
1124
|
+
Function(exp.DPipe, PER_DIALECT, name="||", signatures=[("this", "expression")], example="'a' || 'b'",
|
|
1125
|
+
duckdb=(on_arg(0, {TEXT: "VARCHAR"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), STRICT),
|
|
1126
|
+
postgres=(on_arg(0, {TEXT: "TEXT"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), LENIENT), # `ARRAY[1] || NULL` is `{1}`; a TEXT or VARCHAR operand gives a TEXT
|
|
1127
|
+
mysql=(UNREACHABLE, CONSERVATIVE), # `||` is OR in MySQL
|
|
1128
|
+
snowflake=(on_arg(0, {TEXT: "VARCHAR"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), STRICT),
|
|
1129
|
+
bigquery=(keep(0), STRICT),
|
|
1130
|
+
redshift=(on_arg(0, {TEXT: "VARCHAR"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), STRICT),
|
|
1131
|
+
databricks=(on_arg(0, {TEXT: "STRING"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), STRICT), # not `||` of arrays
|
|
1132
|
+
spark=(on_arg(0, {TEXT: "STRING"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), STRICT), # not `||` of arrays
|
|
1133
|
+
hive=(on_arg(0, {TEXT: "STRING"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), STRICT),
|
|
1134
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), STRICT),
|
|
1135
|
+
clickhouse=("String", CONSERVATIVE),
|
|
1136
|
+
oracle=(on_arg(0, {TEXT: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), CONSERVATIVE),
|
|
1137
|
+
trino=(on_arg(0, {TEXT: "VARCHAR"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), STRICT)), # unlike Postgres, a NULL array or element operand makes `||` NULL too
|
|
1138
|
+
Function(exp.Replace, CONSERVATIVE, signatures=[("this", "expression", "replacement")], example="replace('ab', 'a', 'c')",
|
|
1139
|
+
duckdb="VARCHAR",
|
|
1140
|
+
postgres="TEXT",
|
|
1141
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), # a text result carries its argument's length and collation
|
|
1142
|
+
snowflake="VARCHAR",
|
|
1143
|
+
bigquery=keep(0),
|
|
1144
|
+
redshift="VARCHAR",
|
|
1145
|
+
databricks="STRING",
|
|
1146
|
+
spark="STRING",
|
|
1147
|
+
hive="STRING",
|
|
1148
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1149
|
+
clickhouse="String",
|
|
1150
|
+
oracle=keep(0),
|
|
1151
|
+
trino="VARCHAR"),
|
|
1152
|
+
Function(exp.Left, CONSERVATIVE, signatures=[("this", "expression")], example="left('abc', 2)",
|
|
1153
|
+
duckdb="VARCHAR",
|
|
1154
|
+
postgres="TEXT",
|
|
1155
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), # a text result carries its argument's length and collation
|
|
1156
|
+
snowflake=keep(0),
|
|
1157
|
+
bigquery=keep(0),
|
|
1158
|
+
redshift="VARCHAR",
|
|
1159
|
+
databricks=on_arg(0, {BYTES: "BINARY"}, otherwise="STRING"),
|
|
1160
|
+
spark=on_arg(0, {BYTES: "BINARY"}, otherwise="STRING"),
|
|
1161
|
+
hive=ABSENT,
|
|
1162
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1163
|
+
clickhouse="String",
|
|
1164
|
+
oracle=ABSENT,
|
|
1165
|
+
trino=ABSENT),
|
|
1166
|
+
Function(exp.Right, CONSERVATIVE, signatures=[("this", "expression")], example="right('abc', 2)",
|
|
1167
|
+
duckdb="VARCHAR",
|
|
1168
|
+
postgres="TEXT",
|
|
1169
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), # a text result carries its argument's length and collation
|
|
1170
|
+
snowflake=keep(0),
|
|
1171
|
+
bigquery=keep(0),
|
|
1172
|
+
redshift="VARCHAR",
|
|
1173
|
+
databricks="STRING",
|
|
1174
|
+
spark="STRING",
|
|
1175
|
+
hive=ABSENT,
|
|
1176
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1177
|
+
clickhouse="String",
|
|
1178
|
+
oracle=ABSENT,
|
|
1179
|
+
trino=ABSENT),
|
|
1180
|
+
Function(exp.Substring, CONSERVATIVE, signatures=[("this", "start", "length")], example="substring('abcd', 2, 2)",
|
|
1181
|
+
duckdb="VARCHAR",
|
|
1182
|
+
postgres=on_arg(0, {BYTES: "BYTEA"}, otherwise="TEXT"),
|
|
1183
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), # a text result carries its argument's length and collation
|
|
1184
|
+
snowflake=keep(0),
|
|
1185
|
+
bigquery=keep(0),
|
|
1186
|
+
redshift="VARCHAR",
|
|
1187
|
+
databricks=on_arg(0, {BYTES: "BINARY"}, otherwise="STRING"),
|
|
1188
|
+
spark=on_arg(0, {BYTES: "BINARY"}, otherwise="STRING"),
|
|
1189
|
+
hive=on_arg(0, {BYTES: "BINARY"}, otherwise="STRING"),
|
|
1190
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1191
|
+
clickhouse="String",
|
|
1192
|
+
oracle=keep(0),
|
|
1193
|
+
trino=keep(0)),
|
|
1194
|
+
Function(exp.Pad, CONSERVATIVE, signatures=[("this", "expression", "fill_pattern")], example="lpad('a', 3, '0')",
|
|
1195
|
+
duckdb="VARCHAR",
|
|
1196
|
+
postgres="TEXT",
|
|
1197
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), # a text result carries its argument's length and collation
|
|
1198
|
+
snowflake=keep(0),
|
|
1199
|
+
bigquery=keep(0),
|
|
1200
|
+
redshift="VARCHAR",
|
|
1201
|
+
databricks="STRING",
|
|
1202
|
+
spark="STRING",
|
|
1203
|
+
hive="STRING",
|
|
1204
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1205
|
+
clickhouse="String",
|
|
1206
|
+
oracle=keep(0),
|
|
1207
|
+
trino="VARCHAR"),
|
|
1208
|
+
Function(exp.Repeat, CONSERVATIVE, signatures=[("this", "times")], example="repeat('a', 2)",
|
|
1209
|
+
duckdb=on_arg(0, {TEXT: "VARCHAR", BYTES: "BLOB"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
1210
|
+
postgres="TEXT",
|
|
1211
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), # a text result carries its argument's length and collation
|
|
1212
|
+
snowflake="VARCHAR",
|
|
1213
|
+
bigquery=keep(0),
|
|
1214
|
+
redshift="VARCHAR",
|
|
1215
|
+
databricks="STRING",
|
|
1216
|
+
spark="STRING",
|
|
1217
|
+
hive="STRING",
|
|
1218
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1219
|
+
clickhouse="String",
|
|
1220
|
+
oracle=ABSENT,
|
|
1221
|
+
trino=unmodelled(Reason.OVERLOADED)), # repeat is an array function
|
|
1222
|
+
Function(exp.Reverse, CONSERVATIVE, signatures=[("this",)], example="reverse('ab')",
|
|
1223
|
+
duckdb="VARCHAR",
|
|
1224
|
+
postgres=on_arg(0, {BYTES: "BYTEA"}, otherwise="TEXT"),
|
|
1225
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS), # a text result carries its argument's length and collation
|
|
1226
|
+
snowflake=keep(0),
|
|
1227
|
+
bigquery=keep(0),
|
|
1228
|
+
redshift="VARCHAR",
|
|
1229
|
+
databricks=on_arg(0, {TEXT: "STRING"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), # not `reverse` of arrays
|
|
1230
|
+
spark=on_arg(0, {TEXT: "STRING"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), # not `reverse` of arrays
|
|
1231
|
+
hive="STRING",
|
|
1232
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1233
|
+
clickhouse="String",
|
|
1234
|
+
oracle=ABSENT,
|
|
1235
|
+
trino=keep(0)),
|
|
1236
|
+
Function(exp.Initcap, CONSERVATIVE, signatures=[("this", "expression")], example="initcap('ab')",
|
|
1237
|
+
duckdb=ABSENT,
|
|
1238
|
+
postgres="TEXT",
|
|
1239
|
+
mysql=ABSENT,
|
|
1240
|
+
snowflake="VARCHAR",
|
|
1241
|
+
bigquery="STRING",
|
|
1242
|
+
redshift="VARCHAR",
|
|
1243
|
+
databricks="STRING",
|
|
1244
|
+
spark="STRING",
|
|
1245
|
+
hive="STRING",
|
|
1246
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1247
|
+
clickhouse="String",
|
|
1248
|
+
oracle=keep(0),
|
|
1249
|
+
trino=ABSENT),
|
|
1250
|
+
Function(exp.SplitPart, CONSERVATIVE, signatures=[("this", "delimiter", "part_index")], example="split_part('a-b', '-', 1)",
|
|
1251
|
+
duckdb="VARCHAR",
|
|
1252
|
+
postgres="TEXT",
|
|
1253
|
+
mysql=ABSENT,
|
|
1254
|
+
snowflake="VARCHAR",
|
|
1255
|
+
bigquery=ABSENT,
|
|
1256
|
+
redshift="VARCHAR",
|
|
1257
|
+
databricks="STRING",
|
|
1258
|
+
spark="STRING",
|
|
1259
|
+
hive=ABSENT,
|
|
1260
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1261
|
+
clickhouse="String",
|
|
1262
|
+
oracle=ABSENT,
|
|
1263
|
+
trino="VARCHAR"),
|
|
1264
|
+
Function(exp.Translate, CONSERVATIVE, signatures=[("this", "from_", "to")], example="translate('ab', 'a', 'c')",
|
|
1265
|
+
duckdb="VARCHAR",
|
|
1266
|
+
postgres="TEXT",
|
|
1267
|
+
mysql=ABSENT,
|
|
1268
|
+
snowflake="VARCHAR",
|
|
1269
|
+
bigquery=keep(0),
|
|
1270
|
+
redshift="VARCHAR",
|
|
1271
|
+
databricks="STRING",
|
|
1272
|
+
spark="STRING",
|
|
1273
|
+
hive="STRING",
|
|
1274
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1275
|
+
clickhouse="String",
|
|
1276
|
+
oracle=keep(0),
|
|
1277
|
+
trino="VARCHAR"),
|
|
1278
|
+
Function(exp.Overlay, CONSERVATIVE, signatures=[("this", "expression", "from_", "for_")], example="overlay('abc' PLACING 'x' FROM 1)",
|
|
1279
|
+
duckdb="VARCHAR",
|
|
1280
|
+
postgres=on_arg(0, {BYTES: "BYTEA"}, otherwise="TEXT"),
|
|
1281
|
+
mysql=ABSENT,
|
|
1282
|
+
snowflake=ABSENT,
|
|
1283
|
+
bigquery=ABSENT,
|
|
1284
|
+
redshift=ABSENT,
|
|
1285
|
+
databricks="STRING",
|
|
1286
|
+
spark="STRING",
|
|
1287
|
+
hive=ABSENT,
|
|
1288
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1289
|
+
clickhouse="String",
|
|
1290
|
+
oracle=ABSENT,
|
|
1291
|
+
trino="VARCHAR"),
|
|
1292
|
+
Function(exp.Normalize, CONSERVATIVE, signatures=[("this", "form")], example="normalize('a')",
|
|
1293
|
+
duckdb=ABSENT,
|
|
1294
|
+
postgres="TEXT",
|
|
1295
|
+
mysql=ABSENT,
|
|
1296
|
+
snowflake=ABSENT,
|
|
1297
|
+
bigquery="STRING",
|
|
1298
|
+
redshift=ABSENT,
|
|
1299
|
+
databricks=ABSENT,
|
|
1300
|
+
spark=ABSENT,
|
|
1301
|
+
hive=ABSENT,
|
|
1302
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1303
|
+
clickhouse=ABSENT,
|
|
1304
|
+
oracle=ABSENT,
|
|
1305
|
+
trino="VARCHAR"),
|
|
1306
|
+
Function(exp.Chr, CONSERVATIVE, signatures=[("expressions", "charset")], example="chr(65)",
|
|
1307
|
+
duckdb="VARCHAR",
|
|
1308
|
+
postgres="TEXT",
|
|
1309
|
+
mysql="VARBINARY",
|
|
1310
|
+
snowflake="VARCHAR",
|
|
1311
|
+
bigquery="STRING",
|
|
1312
|
+
redshift="VARCHAR",
|
|
1313
|
+
databricks="STRING",
|
|
1314
|
+
spark="STRING",
|
|
1315
|
+
hive="STRING",
|
|
1316
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1317
|
+
clickhouse="String",
|
|
1318
|
+
oracle="VARCHAR2",
|
|
1319
|
+
trino="VARCHAR"),
|
|
1320
|
+
Function(exp.Format, CONSERVATIVE, signatures=[("this", "expressions")], example="format('{}', 1)",
|
|
1321
|
+
duckdb="VARCHAR",
|
|
1322
|
+
postgres="TEXT",
|
|
1323
|
+
mysql=UNREACHABLE,
|
|
1324
|
+
snowflake=ABSENT,
|
|
1325
|
+
bigquery="STRING",
|
|
1326
|
+
redshift=ABSENT,
|
|
1327
|
+
databricks=ABSENT,
|
|
1328
|
+
spark=ABSENT,
|
|
1329
|
+
hive=ABSENT,
|
|
1330
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1331
|
+
clickhouse="String",
|
|
1332
|
+
oracle=ABSENT,
|
|
1333
|
+
trino="VARCHAR"),
|
|
1334
|
+
Function(exp.ArrayToString, CONSERVATIVE, signatures=[("this", "expression", "null")], example="array_to_string([1, 2], ',')",
|
|
1335
|
+
duckdb="VARCHAR",
|
|
1336
|
+
postgres="TEXT",
|
|
1337
|
+
mysql=ABSENT,
|
|
1338
|
+
snowflake="VARCHAR",
|
|
1339
|
+
bigquery="STRING",
|
|
1340
|
+
redshift=ABSENT,
|
|
1341
|
+
databricks="STRING",
|
|
1342
|
+
spark="STRING",
|
|
1343
|
+
hive=ABSENT,
|
|
1344
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1345
|
+
clickhouse="String",
|
|
1346
|
+
oracle=ABSENT,
|
|
1347
|
+
trino="VARCHAR"),
|
|
1348
|
+
Function(exp.RegexpReplace, CONSERVATIVE, signatures=[("this", "expression", "replacement", "position", "occurrence", "modifiers")], example="regexp_replace('a', 'a', 'b')",
|
|
1349
|
+
duckdb="VARCHAR",
|
|
1350
|
+
postgres="TEXT",
|
|
1351
|
+
mysql="LONGTEXT", # always LONGTEXT
|
|
1352
|
+
snowflake="VARCHAR",
|
|
1353
|
+
bigquery=keep(0),
|
|
1354
|
+
redshift="VARCHAR",
|
|
1355
|
+
databricks="STRING",
|
|
1356
|
+
spark="STRING",
|
|
1357
|
+
hive="STRING",
|
|
1358
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1359
|
+
clickhouse="String",
|
|
1360
|
+
oracle=keep(0),
|
|
1361
|
+
trino="VARCHAR"),
|
|
1362
|
+
Function(exp.RegexpExtract, CONSERVATIVE, signatures=[("this", "expression", "position", "occurrence", "parameters", "group")], example="regexp_extract('a', 'a')",
|
|
1363
|
+
duckdb=unmodelled(Reason.OVERLOADED), # a STRUCT for a list of group names
|
|
1364
|
+
postgres=ABSENT,
|
|
1365
|
+
mysql=ABSENT,
|
|
1366
|
+
snowflake="VARCHAR",
|
|
1367
|
+
bigquery=keep(0),
|
|
1368
|
+
redshift="VARCHAR",
|
|
1369
|
+
databricks="STRING",
|
|
1370
|
+
spark="STRING",
|
|
1371
|
+
hive="STRING",
|
|
1372
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1373
|
+
clickhouse="String",
|
|
1374
|
+
oracle=ABSENT,
|
|
1375
|
+
trino="VARCHAR"),
|
|
1376
|
+
Function(exp.RegexpSubstr, CONSERVATIVE, signatures=[("this", "expression", "position", "occurrence", "parameters", "group")], example="regexp_substr('a', 'a')",
|
|
1377
|
+
duckdb=ABSENT,
|
|
1378
|
+
postgres="TEXT",
|
|
1379
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS),
|
|
1380
|
+
snowflake=UNREACHABLE,
|
|
1381
|
+
bigquery=UNREACHABLE,
|
|
1382
|
+
redshift=UNREACHABLE,
|
|
1383
|
+
databricks="STRING",
|
|
1384
|
+
spark="STRING",
|
|
1385
|
+
hive=ABSENT,
|
|
1386
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1387
|
+
clickhouse=UNREACHABLE,
|
|
1388
|
+
oracle=keep(0),
|
|
1389
|
+
trino=ABSENT),
|
|
1390
|
+
Function(exp.RegexpLike, CONSERVATIVE, signatures=[("this", "expression", "flag")], example="regexp_matches('a', 'a')",
|
|
1391
|
+
duckdb="BOOLEAN",
|
|
1392
|
+
postgres="BOOLEAN",
|
|
1393
|
+
mysql="INT",
|
|
1394
|
+
snowflake="BOOLEAN",
|
|
1395
|
+
bigquery="BOOL",
|
|
1396
|
+
redshift=ABSENT,
|
|
1397
|
+
databricks="BOOLEAN",
|
|
1398
|
+
spark="BOOLEAN",
|
|
1399
|
+
hive="BOOLEAN",
|
|
1400
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1401
|
+
clickhouse="UInt8",
|
|
1402
|
+
oracle="BOOLEAN",
|
|
1403
|
+
trino="BOOLEAN"),
|
|
1404
|
+
Function(exp.RegexpFullMatch, CONSERVATIVE, signatures=[("this", "expression", "options")], example="regexp_full_match('a', 'a')",
|
|
1405
|
+
duckdb="BOOLEAN",
|
|
1406
|
+
postgres=ABSENT,
|
|
1407
|
+
mysql=ABSENT,
|
|
1408
|
+
snowflake=ABSENT,
|
|
1409
|
+
bigquery=ABSENT,
|
|
1410
|
+
redshift=ABSENT,
|
|
1411
|
+
databricks=ABSENT,
|
|
1412
|
+
spark=ABSENT,
|
|
1413
|
+
hive=ABSENT,
|
|
1414
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1415
|
+
clickhouse=ABSENT,
|
|
1416
|
+
oracle=ABSENT,
|
|
1417
|
+
trino=ABSENT),
|
|
1418
|
+
Function(exp.StartsWith, CONSERVATIVE, signatures=[("this", "expression")], example="starts_with('ab', 'a')",
|
|
1419
|
+
duckdb="BOOLEAN",
|
|
1420
|
+
postgres="BOOLEAN",
|
|
1421
|
+
mysql=ABSENT,
|
|
1422
|
+
snowflake="BOOLEAN",
|
|
1423
|
+
bigquery="BOOL",
|
|
1424
|
+
redshift=ABSENT,
|
|
1425
|
+
databricks="BOOLEAN",
|
|
1426
|
+
spark="BOOLEAN",
|
|
1427
|
+
hive=ABSENT,
|
|
1428
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1429
|
+
clickhouse="UInt8",
|
|
1430
|
+
oracle=ABSENT,
|
|
1431
|
+
trino="BOOLEAN"),
|
|
1432
|
+
Function(exp.EndsWith, CONSERVATIVE, signatures=[("this", "expression")], example="ends_with('ab', 'b')",
|
|
1433
|
+
duckdb="BOOLEAN",
|
|
1434
|
+
postgres=ABSENT,
|
|
1435
|
+
mysql=ABSENT,
|
|
1436
|
+
snowflake="BOOLEAN",
|
|
1437
|
+
bigquery="BOOL",
|
|
1438
|
+
redshift=ABSENT,
|
|
1439
|
+
databricks="BOOLEAN",
|
|
1440
|
+
spark="BOOLEAN",
|
|
1441
|
+
hive=ABSENT,
|
|
1442
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1443
|
+
clickhouse="UInt8",
|
|
1444
|
+
oracle=ABSENT,
|
|
1445
|
+
trino="BOOLEAN"),
|
|
1446
|
+
Function(exp.Contains, CONSERVATIVE, signatures=[("this", "expression", "json_scope")], example="contains('ab', 'a')",
|
|
1447
|
+
duckdb="BOOLEAN",
|
|
1448
|
+
postgres=ABSENT,
|
|
1449
|
+
mysql=ABSENT,
|
|
1450
|
+
snowflake="BOOLEAN",
|
|
1451
|
+
bigquery=ABSENT,
|
|
1452
|
+
redshift=ABSENT,
|
|
1453
|
+
databricks="BOOLEAN",
|
|
1454
|
+
spark="BOOLEAN",
|
|
1455
|
+
hive=ABSENT,
|
|
1456
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1457
|
+
clickhouse=ABSENT,
|
|
1458
|
+
oracle=ABSENT,
|
|
1459
|
+
trino=UNREACHABLE),
|
|
1460
|
+
Function(exp.StrPosition, CONSERVATIVE, signatures=[("this", "substr", "position", "occurrence")], example="strpos('abc', 'b')",
|
|
1461
|
+
duckdb="BIGINT",
|
|
1462
|
+
postgres="INTEGER",
|
|
1463
|
+
mysql="INT",
|
|
1464
|
+
snowflake="NUMBER",
|
|
1465
|
+
bigquery="INT64",
|
|
1466
|
+
redshift="INTEGER",
|
|
1467
|
+
databricks="INT",
|
|
1468
|
+
spark="INT",
|
|
1469
|
+
hive="INT",
|
|
1470
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1471
|
+
clickhouse="UInt64",
|
|
1472
|
+
oracle="NUMBER",
|
|
1473
|
+
trino="BIGINT"),
|
|
1474
|
+
Function(exp.Ascii, CONSERVATIVE, signatures=[("this",)], example="ascii('a')",
|
|
1475
|
+
duckdb="INTEGER",
|
|
1476
|
+
postgres="INTEGER",
|
|
1477
|
+
mysql="INT",
|
|
1478
|
+
snowflake="NUMBER",
|
|
1479
|
+
bigquery="INT64",
|
|
1480
|
+
redshift="INTEGER",
|
|
1481
|
+
databricks="INT",
|
|
1482
|
+
spark="INT",
|
|
1483
|
+
hive="INT",
|
|
1484
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1485
|
+
clickhouse="Int32",
|
|
1486
|
+
oracle="NUMBER",
|
|
1487
|
+
trino=ABSENT),
|
|
1488
|
+
Function(exp.BitLength, CONSERVATIVE, signatures=[("this",)], example="bit_length('a')",
|
|
1489
|
+
duckdb="BIGINT",
|
|
1490
|
+
postgres="INTEGER",
|
|
1491
|
+
mysql="INT",
|
|
1492
|
+
snowflake="NUMBER",
|
|
1493
|
+
bigquery=ABSENT,
|
|
1494
|
+
redshift=ABSENT,
|
|
1495
|
+
databricks="INT",
|
|
1496
|
+
spark="INT",
|
|
1497
|
+
hive=ABSENT,
|
|
1498
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1499
|
+
clickhouse=ABSENT,
|
|
1500
|
+
oracle=ABSENT,
|
|
1501
|
+
trino=ABSENT),
|
|
1502
|
+
Function(exp.ToChar, CONSERVATIVE, signatures=[("this", "format", "nlsparam")], example="to_char(DATE '2020-01-01', 'YYYY')",
|
|
1503
|
+
duckdb=ABSENT,
|
|
1504
|
+
postgres=UNREACHABLE,
|
|
1505
|
+
mysql=ABSENT,
|
|
1506
|
+
snowflake=UNREACHABLE,
|
|
1507
|
+
bigquery=ABSENT,
|
|
1508
|
+
redshift=UNREACHABLE,
|
|
1509
|
+
databricks="STRING",
|
|
1510
|
+
spark="STRING",
|
|
1511
|
+
hive=ABSENT,
|
|
1512
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1513
|
+
clickhouse=ABSENT,
|
|
1514
|
+
oracle=UNREACHABLE,
|
|
1515
|
+
trino=UNREACHABLE),
|
|
1516
|
+
Function("Anonymous:octet_length", CONSERVATIVE, signatures=[("*expressions",)], example="octet_length(CAST('a' AS BLOB))",
|
|
1517
|
+
duckdb="BIGINT",
|
|
1518
|
+
postgres="INTEGER",
|
|
1519
|
+
mysql="INT",
|
|
1520
|
+
snowflake=UNREACHABLE,
|
|
1521
|
+
bigquery=UNREACHABLE,
|
|
1522
|
+
redshift="INTEGER",
|
|
1523
|
+
databricks="INT",
|
|
1524
|
+
spark="INT",
|
|
1525
|
+
hive="INT",
|
|
1526
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1527
|
+
clickhouse="UInt64",
|
|
1528
|
+
oracle=ABSENT,
|
|
1529
|
+
trino=ABSENT),
|
|
1530
|
+
Function("Anonymous:strlen", CONSERVATIVE, signatures=[("*expressions",)], example="strlen('a')",
|
|
1531
|
+
duckdb="BIGINT",
|
|
1532
|
+
postgres=ABSENT,
|
|
1533
|
+
mysql=ABSENT,
|
|
1534
|
+
snowflake=ABSENT,
|
|
1535
|
+
bigquery=ABSENT,
|
|
1536
|
+
redshift=ABSENT,
|
|
1537
|
+
databricks=ABSENT,
|
|
1538
|
+
spark=ABSENT,
|
|
1539
|
+
hive=ABSENT,
|
|
1540
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1541
|
+
clickhouse=ABSENT,
|
|
1542
|
+
oracle=ABSENT,
|
|
1543
|
+
trino=ABSENT),
|
|
1544
|
+
Function("Anonymous:prefix", CONSERVATIVE, signatures=[("*expressions",)], example="prefix('ab', 'a')",
|
|
1545
|
+
duckdb="BOOLEAN",
|
|
1546
|
+
postgres=ABSENT,
|
|
1547
|
+
mysql=ABSENT,
|
|
1548
|
+
snowflake=ABSENT,
|
|
1549
|
+
bigquery=ABSENT,
|
|
1550
|
+
redshift=ABSENT,
|
|
1551
|
+
databricks=ABSENT,
|
|
1552
|
+
spark=ABSENT,
|
|
1553
|
+
hive=ABSENT,
|
|
1554
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1555
|
+
clickhouse=ABSENT,
|
|
1556
|
+
oracle=ABSENT,
|
|
1557
|
+
trino=ABSENT),
|
|
1558
|
+
Function("Anonymous:suffix", CONSERVATIVE, signatures=[("*expressions",)], example="suffix('ab', 'b')",
|
|
1559
|
+
duckdb="BOOLEAN",
|
|
1560
|
+
postgres=ABSENT,
|
|
1561
|
+
mysql=ABSENT,
|
|
1562
|
+
snowflake=ABSENT,
|
|
1563
|
+
bigquery=ABSENT,
|
|
1564
|
+
redshift=ABSENT,
|
|
1565
|
+
databricks=ABSENT,
|
|
1566
|
+
spark=ABSENT,
|
|
1567
|
+
hive=ABSENT,
|
|
1568
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1569
|
+
clickhouse=ABSENT,
|
|
1570
|
+
oracle=ABSENT,
|
|
1571
|
+
trino=ABSENT),
|
|
1572
|
+
Function("Anonymous:nfc_normalize", CONSERVATIVE, signatures=[("*expressions",)], example="nfc_normalize('a')",
|
|
1573
|
+
duckdb="VARCHAR",
|
|
1574
|
+
postgres=ABSENT,
|
|
1575
|
+
mysql=ABSENT,
|
|
1576
|
+
snowflake=ABSENT,
|
|
1577
|
+
bigquery=ABSENT,
|
|
1578
|
+
redshift=ABSENT,
|
|
1579
|
+
databricks=ABSENT,
|
|
1580
|
+
spark=ABSENT,
|
|
1581
|
+
hive=ABSENT,
|
|
1582
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1583
|
+
clickhouse=ABSENT,
|
|
1584
|
+
oracle=ABSENT,
|
|
1585
|
+
trino=ABSENT),
|
|
1586
|
+
|
|
1587
|
+
# math
|
|
1588
|
+
Function(exp.Greatest, PER_DIALECT, signatures=[("this", "*expressions")], example="greatest(1, 2)",
|
|
1589
|
+
duckdb=(common(0, 1), SKIPS_NULL),
|
|
1590
|
+
postgres=(common(0, 1), SKIPS_NULL),
|
|
1591
|
+
mysql=(common(0, 1), NULL_IF_ANY),
|
|
1592
|
+
snowflake=(common(0, 1), CONSERVATIVE),
|
|
1593
|
+
bigquery=(common(0, 1), CONSERVATIVE),
|
|
1594
|
+
redshift=(common(0, 1), CONSERVATIVE),
|
|
1595
|
+
databricks=(common(0, 1), CONSERVATIVE),
|
|
1596
|
+
spark=(common(0, 1), SKIPS_NULL),
|
|
1597
|
+
hive=(common(0, 1), CONSERVATIVE),
|
|
1598
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), CONSERVATIVE),
|
|
1599
|
+
clickhouse=(common(0, 1), CONSERVATIVE),
|
|
1600
|
+
oracle=(common(0, 1), CONSERVATIVE),
|
|
1601
|
+
trino=(common(0, 1), NULL_IF_ANY)),
|
|
1602
|
+
Function(exp.Least, PER_DIALECT, signatures=[("this", "*expressions")], example="least(1, 2)",
|
|
1603
|
+
duckdb=(common(0, 1), SKIPS_NULL),
|
|
1604
|
+
postgres=(common(0, 1), SKIPS_NULL),
|
|
1605
|
+
mysql=(common(0, 1), NULL_IF_ANY),
|
|
1606
|
+
snowflake=(common(0, 1), CONSERVATIVE),
|
|
1607
|
+
bigquery=(common(0, 1), CONSERVATIVE),
|
|
1608
|
+
redshift=(common(0, 1), CONSERVATIVE),
|
|
1609
|
+
databricks=(common(0, 1), CONSERVATIVE),
|
|
1610
|
+
spark=(common(0, 1), SKIPS_NULL),
|
|
1611
|
+
hive=(common(0, 1), CONSERVATIVE),
|
|
1612
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), CONSERVATIVE),
|
|
1613
|
+
clickhouse=(common(0, 1), CONSERVATIVE),
|
|
1614
|
+
oracle=(common(0, 1), CONSERVATIVE),
|
|
1615
|
+
trino=(common(0, 1), NULL_IF_ANY)),
|
|
1616
|
+
Function(exp.Sign, CONSERVATIVE, signatures=[("this",)], example="sign(1)",
|
|
1617
|
+
duckdb="TINYINT",
|
|
1618
|
+
postgres=on_arg(0, {INT: "DOUBLE PRECISION", DECIMAL: "NUMERIC", FLOAT: "DOUBLE PRECISION"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
1619
|
+
mysql="BIGINT",
|
|
1620
|
+
snowflake="NUMBER",
|
|
1621
|
+
bigquery=keep(0),
|
|
1622
|
+
redshift=keep(0),
|
|
1623
|
+
databricks="DOUBLE",
|
|
1624
|
+
spark="DOUBLE",
|
|
1625
|
+
hive="DOUBLE",
|
|
1626
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1627
|
+
clickhouse="Int8",
|
|
1628
|
+
oracle="NUMBER",
|
|
1629
|
+
trino=on_arg(0, {DECIMAL: family(0)}, otherwise=keep(0))), # `sign` of a decimal(10,2) is a decimal(1,0)
|
|
1630
|
+
Function(exp.Ln, CONSERVATIVE, signatures=[("this",)], example="ln(2)",
|
|
1631
|
+
duckdb="DOUBLE",
|
|
1632
|
+
postgres=on_arg(0, {INT: "DOUBLE PRECISION", DECIMAL: "NUMERIC", FLOAT: "DOUBLE PRECISION"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
1633
|
+
mysql="DOUBLE",
|
|
1634
|
+
snowflake="FLOAT", # `ln` and the like are FLOAT but for a DECFLOAT
|
|
1635
|
+
bigquery=on_arg(0, {INT: "FLOAT64", DECIMAL: "NUMERIC", FLOAT: "FLOAT64"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), # BIGNUMERIC gave BIGNUMERIC: not a family yet
|
|
1636
|
+
redshift="DOUBLE PRECISION",
|
|
1637
|
+
databricks="DOUBLE",
|
|
1638
|
+
spark="DOUBLE",
|
|
1639
|
+
hive="DOUBLE",
|
|
1640
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1641
|
+
clickhouse="Float64",
|
|
1642
|
+
oracle=keep(0),
|
|
1643
|
+
trino="DOUBLE"),
|
|
1644
|
+
Function(exp.Exp, CONSERVATIVE, signatures=[("this",)], example="exp(2)",
|
|
1645
|
+
duckdb="DOUBLE",
|
|
1646
|
+
postgres=on_arg(0, {INT: "DOUBLE PRECISION", DECIMAL: "NUMERIC", FLOAT: "DOUBLE PRECISION"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
1647
|
+
mysql="DOUBLE",
|
|
1648
|
+
snowflake="FLOAT",
|
|
1649
|
+
bigquery=on_arg(0, {INT: "FLOAT64", DECIMAL: "NUMERIC", FLOAT: "FLOAT64"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), # BIGNUMERIC gave BIGNUMERIC: not a family yet
|
|
1650
|
+
redshift="DOUBLE PRECISION",
|
|
1651
|
+
databricks="DOUBLE",
|
|
1652
|
+
spark="DOUBLE",
|
|
1653
|
+
hive="DOUBLE",
|
|
1654
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1655
|
+
clickhouse="Float64",
|
|
1656
|
+
oracle=keep(0),
|
|
1657
|
+
trino="DOUBLE"),
|
|
1658
|
+
Function(exp.Sqrt, CONSERVATIVE, signatures=[("this",)], example="sqrt(2)",
|
|
1659
|
+
duckdb="DOUBLE",
|
|
1660
|
+
postgres=on_arg(0, {INT: "DOUBLE PRECISION", DECIMAL: "NUMERIC", FLOAT: "DOUBLE PRECISION"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
1661
|
+
mysql="DOUBLE",
|
|
1662
|
+
snowflake="FLOAT",
|
|
1663
|
+
bigquery=on_arg(0, {INT: "FLOAT64", DECIMAL: "NUMERIC", FLOAT: "FLOAT64"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)), # BIGNUMERIC gave BIGNUMERIC: not a family yet
|
|
1664
|
+
redshift="DOUBLE PRECISION",
|
|
1665
|
+
databricks="DOUBLE",
|
|
1666
|
+
spark="DOUBLE",
|
|
1667
|
+
hive="DOUBLE",
|
|
1668
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1669
|
+
clickhouse="Float64",
|
|
1670
|
+
oracle=keep(0),
|
|
1671
|
+
trino="DOUBLE"),
|
|
1672
|
+
Function(exp.Pow, CONSERVATIVE, signatures=[("this", "expression")], example="power(2, 2)",
|
|
1673
|
+
duckdb="DOUBLE",
|
|
1674
|
+
postgres=POSTGRES_MATH,
|
|
1675
|
+
mysql="DOUBLE",
|
|
1676
|
+
snowflake="FLOAT",
|
|
1677
|
+
bigquery=BIGQUERY_MATH,
|
|
1678
|
+
redshift="DOUBLE PRECISION",
|
|
1679
|
+
databricks="DOUBLE",
|
|
1680
|
+
spark="DOUBLE",
|
|
1681
|
+
hive="DOUBLE",
|
|
1682
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1683
|
+
clickhouse="Float64",
|
|
1684
|
+
oracle=keep(0),
|
|
1685
|
+
trino="DOUBLE"),
|
|
1686
|
+
Function(exp.Log, CONSERVATIVE, signatures=[("this", "expression")], example="log(2, 8)",
|
|
1687
|
+
duckdb="DOUBLE",
|
|
1688
|
+
# `log(x)` of an integer or a double is a double precision; `log(b, x)` takes and gives a numeric only.
|
|
1689
|
+
postgres=on_arity({
|
|
1690
|
+
1: on_arg(0, {INT: "DOUBLE PRECISION", FLOAT: "DOUBLE PRECISION", DECIMAL: "NUMERIC"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
1691
|
+
2: on_arg(0, {INT: "NUMERIC", DECIMAL: "NUMERIC"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
1692
|
+
}, otherwise=unmodelled(Reason.OVERLOADED)),
|
|
1693
|
+
mysql="DOUBLE",
|
|
1694
|
+
snowflake="FLOAT",
|
|
1695
|
+
bigquery=BIGQUERY_MATH,
|
|
1696
|
+
redshift="DOUBLE PRECISION",
|
|
1697
|
+
databricks="DOUBLE",
|
|
1698
|
+
spark="DOUBLE",
|
|
1699
|
+
hive="DOUBLE",
|
|
1700
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1701
|
+
clickhouse="Float64",
|
|
1702
|
+
oracle=keep(0),
|
|
1703
|
+
trino="DOUBLE"),
|
|
1704
|
+
Function(exp.Sin, CONSERVATIVE, signatures=[("this",)], example="sin(0.5)",
|
|
1705
|
+
duckdb="DOUBLE",
|
|
1706
|
+
postgres="DOUBLE PRECISION",
|
|
1707
|
+
mysql="DOUBLE",
|
|
1708
|
+
snowflake="FLOAT",
|
|
1709
|
+
bigquery="FLOAT64",
|
|
1710
|
+
redshift="DOUBLE PRECISION",
|
|
1711
|
+
databricks="DOUBLE",
|
|
1712
|
+
spark="DOUBLE",
|
|
1713
|
+
hive="DOUBLE",
|
|
1714
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1715
|
+
clickhouse="Float64",
|
|
1716
|
+
oracle=keep(0),
|
|
1717
|
+
trino="DOUBLE"),
|
|
1718
|
+
Function(exp.Cos, CONSERVATIVE, signatures=[("this",)], example="cos(0.5)",
|
|
1719
|
+
duckdb="DOUBLE",
|
|
1720
|
+
postgres="DOUBLE PRECISION",
|
|
1721
|
+
mysql="DOUBLE",
|
|
1722
|
+
snowflake="FLOAT",
|
|
1723
|
+
bigquery="FLOAT64",
|
|
1724
|
+
redshift="DOUBLE PRECISION",
|
|
1725
|
+
databricks="DOUBLE",
|
|
1726
|
+
spark="DOUBLE",
|
|
1727
|
+
hive="DOUBLE",
|
|
1728
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1729
|
+
clickhouse="Float64",
|
|
1730
|
+
oracle=keep(0),
|
|
1731
|
+
trino="DOUBLE"),
|
|
1732
|
+
Function(exp.Tan, CONSERVATIVE, signatures=[("this",)], example="tan(0.5)",
|
|
1733
|
+
duckdb="DOUBLE",
|
|
1734
|
+
postgres="DOUBLE PRECISION",
|
|
1735
|
+
mysql="DOUBLE",
|
|
1736
|
+
snowflake="FLOAT",
|
|
1737
|
+
bigquery="FLOAT64",
|
|
1738
|
+
redshift="DOUBLE PRECISION",
|
|
1739
|
+
databricks="DOUBLE",
|
|
1740
|
+
spark="DOUBLE",
|
|
1741
|
+
hive="DOUBLE",
|
|
1742
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1743
|
+
clickhouse="Float64",
|
|
1744
|
+
oracle=keep(0),
|
|
1745
|
+
trino="DOUBLE"),
|
|
1746
|
+
Function(exp.Asin, CONSERVATIVE, signatures=[("this",)], example="asin(0.5)",
|
|
1747
|
+
duckdb="DOUBLE",
|
|
1748
|
+
postgres="DOUBLE PRECISION",
|
|
1749
|
+
mysql="DOUBLE",
|
|
1750
|
+
snowflake="FLOAT",
|
|
1751
|
+
bigquery="FLOAT64",
|
|
1752
|
+
redshift="DOUBLE PRECISION",
|
|
1753
|
+
databricks="DOUBLE",
|
|
1754
|
+
spark="DOUBLE",
|
|
1755
|
+
hive="DOUBLE",
|
|
1756
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1757
|
+
clickhouse="Float64",
|
|
1758
|
+
oracle=keep(0),
|
|
1759
|
+
trino="DOUBLE"),
|
|
1760
|
+
Function(exp.Acos, CONSERVATIVE, signatures=[("this",)], example="acos(0.5)",
|
|
1761
|
+
duckdb="DOUBLE",
|
|
1762
|
+
postgres="DOUBLE PRECISION",
|
|
1763
|
+
mysql="DOUBLE",
|
|
1764
|
+
snowflake="FLOAT",
|
|
1765
|
+
bigquery="FLOAT64",
|
|
1766
|
+
redshift="DOUBLE PRECISION",
|
|
1767
|
+
databricks="DOUBLE",
|
|
1768
|
+
spark="DOUBLE",
|
|
1769
|
+
hive="DOUBLE",
|
|
1770
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1771
|
+
clickhouse="Float64",
|
|
1772
|
+
oracle=keep(0),
|
|
1773
|
+
trino="DOUBLE"),
|
|
1774
|
+
Function(exp.Atan, CONSERVATIVE, signatures=[("this", "expression")], example="atan(0.5)",
|
|
1775
|
+
duckdb="DOUBLE",
|
|
1776
|
+
postgres="DOUBLE PRECISION",
|
|
1777
|
+
mysql="DOUBLE",
|
|
1778
|
+
snowflake="FLOAT",
|
|
1779
|
+
bigquery="FLOAT64",
|
|
1780
|
+
redshift="DOUBLE PRECISION",
|
|
1781
|
+
databricks="DOUBLE",
|
|
1782
|
+
spark="DOUBLE",
|
|
1783
|
+
hive="DOUBLE",
|
|
1784
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1785
|
+
clickhouse="Float64",
|
|
1786
|
+
oracle=keep(0),
|
|
1787
|
+
trino="DOUBLE"),
|
|
1788
|
+
Function(exp.Atan2, CONSERVATIVE, signatures=[("this", "expression")], example="atan2(1, 2)",
|
|
1789
|
+
duckdb="DOUBLE",
|
|
1790
|
+
postgres="DOUBLE PRECISION",
|
|
1791
|
+
mysql="DOUBLE",
|
|
1792
|
+
snowflake="FLOAT",
|
|
1793
|
+
bigquery="FLOAT64",
|
|
1794
|
+
redshift="DOUBLE PRECISION",
|
|
1795
|
+
databricks="DOUBLE",
|
|
1796
|
+
spark="DOUBLE",
|
|
1797
|
+
hive="DOUBLE",
|
|
1798
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1799
|
+
clickhouse="Float64",
|
|
1800
|
+
oracle=keep(0),
|
|
1801
|
+
trino="DOUBLE"),
|
|
1802
|
+
|
|
1803
|
+
# datetime
|
|
1804
|
+
Function(exp.Year, CONSERVATIVE, signatures=[("this",)], example="year(DATE '2020-01-01')",
|
|
1805
|
+
duckdb="BIGINT",
|
|
1806
|
+
postgres=ABSENT, # Postgres has no `year`
|
|
1807
|
+
mysql="YEAR", # `year()` is a YEAR
|
|
1808
|
+
snowflake="NUMBER",
|
|
1809
|
+
bigquery=ABSENT,
|
|
1810
|
+
redshift=ABSENT,
|
|
1811
|
+
databricks="INT",
|
|
1812
|
+
spark="INT",
|
|
1813
|
+
hive="INT",
|
|
1814
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1815
|
+
clickhouse="UInt16",
|
|
1816
|
+
oracle=ABSENT,
|
|
1817
|
+
trino="BIGINT"),
|
|
1818
|
+
Function(exp.Month, CONSERVATIVE, signatures=[("this",)], example="month(DATE '2020-01-01')",
|
|
1819
|
+
duckdb="BIGINT",
|
|
1820
|
+
postgres=ABSENT,
|
|
1821
|
+
mysql="INT",
|
|
1822
|
+
snowflake="NUMBER",
|
|
1823
|
+
bigquery=ABSENT,
|
|
1824
|
+
redshift=ABSENT,
|
|
1825
|
+
databricks="INT",
|
|
1826
|
+
spark="INT",
|
|
1827
|
+
hive="INT",
|
|
1828
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1829
|
+
clickhouse="UInt8",
|
|
1830
|
+
oracle=ABSENT,
|
|
1831
|
+
trino="BIGINT"),
|
|
1832
|
+
Function(exp.Day, CONSERVATIVE, signatures=[("this",)], example="day(DATE '2020-01-01')",
|
|
1833
|
+
duckdb="BIGINT",
|
|
1834
|
+
postgres=ABSENT,
|
|
1835
|
+
mysql="INT",
|
|
1836
|
+
snowflake="NUMBER",
|
|
1837
|
+
bigquery=ABSENT,
|
|
1838
|
+
redshift=ABSENT,
|
|
1839
|
+
databricks="INT",
|
|
1840
|
+
spark="INT",
|
|
1841
|
+
hive="INT",
|
|
1842
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1843
|
+
clickhouse="UInt8",
|
|
1844
|
+
oracle=ABSENT,
|
|
1845
|
+
trino="BIGINT"),
|
|
1846
|
+
Function(exp.Hour, CONSERVATIVE, signatures=[("this",)], example="hour(TIMESTAMP '2020-01-01 10:00')",
|
|
1847
|
+
duckdb="BIGINT",
|
|
1848
|
+
postgres=ABSENT,
|
|
1849
|
+
mysql="INT",
|
|
1850
|
+
snowflake="NUMBER",
|
|
1851
|
+
bigquery=ABSENT,
|
|
1852
|
+
redshift=ABSENT,
|
|
1853
|
+
databricks="INT",
|
|
1854
|
+
spark="INT",
|
|
1855
|
+
hive="INT",
|
|
1856
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1857
|
+
clickhouse="UInt8",
|
|
1858
|
+
oracle=ABSENT,
|
|
1859
|
+
trino="BIGINT"),
|
|
1860
|
+
Function(exp.Minute, CONSERVATIVE, signatures=[("this",)], example="minute(TIMESTAMP '2020-01-01 10:00')",
|
|
1861
|
+
duckdb="BIGINT",
|
|
1862
|
+
postgres=ABSENT,
|
|
1863
|
+
mysql="INT",
|
|
1864
|
+
snowflake="NUMBER",
|
|
1865
|
+
bigquery=ABSENT,
|
|
1866
|
+
redshift=ABSENT,
|
|
1867
|
+
databricks="INT",
|
|
1868
|
+
spark="INT",
|
|
1869
|
+
hive="INT",
|
|
1870
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1871
|
+
clickhouse="UInt8",
|
|
1872
|
+
oracle=ABSENT,
|
|
1873
|
+
trino="BIGINT"),
|
|
1874
|
+
Function(exp.Second, CONSERVATIVE, signatures=[("this",)], example="second(TIMESTAMP '2020-01-01 10:00')",
|
|
1875
|
+
duckdb="BIGINT",
|
|
1876
|
+
postgres=ABSENT,
|
|
1877
|
+
mysql="INT",
|
|
1878
|
+
snowflake="NUMBER",
|
|
1879
|
+
bigquery=ABSENT,
|
|
1880
|
+
redshift=ABSENT,
|
|
1881
|
+
databricks="INT",
|
|
1882
|
+
spark="INT",
|
|
1883
|
+
hive="INT",
|
|
1884
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1885
|
+
clickhouse="UInt8",
|
|
1886
|
+
oracle=ABSENT,
|
|
1887
|
+
trino="BIGINT"),
|
|
1888
|
+
Function(exp.Quarter, CONSERVATIVE, signatures=[("this",)], example="quarter(DATE '2020-01-01')",
|
|
1889
|
+
duckdb="BIGINT",
|
|
1890
|
+
postgres=ABSENT,
|
|
1891
|
+
mysql="INT",
|
|
1892
|
+
snowflake="NUMBER",
|
|
1893
|
+
bigquery=ABSENT,
|
|
1894
|
+
redshift=ABSENT,
|
|
1895
|
+
databricks="INT",
|
|
1896
|
+
spark="INT",
|
|
1897
|
+
hive="INT",
|
|
1898
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1899
|
+
clickhouse="UInt8",
|
|
1900
|
+
oracle=ABSENT,
|
|
1901
|
+
trino="BIGINT"),
|
|
1902
|
+
Function(exp.Week, CONSERVATIVE, signatures=[("this", "mode")], example="week(DATE '2020-01-01')",
|
|
1903
|
+
duckdb="BIGINT",
|
|
1904
|
+
postgres=ABSENT,
|
|
1905
|
+
mysql="INT",
|
|
1906
|
+
snowflake="NUMBER",
|
|
1907
|
+
bigquery=UNREACHABLE,
|
|
1908
|
+
redshift=ABSENT,
|
|
1909
|
+
databricks=ABSENT, # `weekofyear`, another node; no `week` (probed on Spark 4.3)
|
|
1910
|
+
spark=ABSENT,
|
|
1911
|
+
hive=ABSENT,
|
|
1912
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1913
|
+
clickhouse="UInt8",
|
|
1914
|
+
oracle=ABSENT,
|
|
1915
|
+
trino=UNREACHABLE),
|
|
1916
|
+
Function(exp.DayOfWeek, CONSERVATIVE, signatures=[("this",)], example="dayofweek(DATE '2020-01-01')",
|
|
1917
|
+
duckdb="BIGINT",
|
|
1918
|
+
postgres=ABSENT,
|
|
1919
|
+
mysql="INT",
|
|
1920
|
+
snowflake="NUMBER",
|
|
1921
|
+
bigquery=ABSENT,
|
|
1922
|
+
redshift=ABSENT,
|
|
1923
|
+
databricks="INT",
|
|
1924
|
+
spark="INT",
|
|
1925
|
+
hive="INT",
|
|
1926
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1927
|
+
clickhouse="UInt8",
|
|
1928
|
+
oracle=ABSENT,
|
|
1929
|
+
trino="BIGINT"),
|
|
1930
|
+
Function(exp.DayOfYear, CONSERVATIVE, signatures=[("this",)], example="dayofyear(DATE '2020-01-01')",
|
|
1931
|
+
duckdb="BIGINT",
|
|
1932
|
+
postgres=ABSENT,
|
|
1933
|
+
mysql="INT",
|
|
1934
|
+
snowflake="NUMBER",
|
|
1935
|
+
bigquery=ABSENT,
|
|
1936
|
+
redshift=ABSENT,
|
|
1937
|
+
databricks="INT",
|
|
1938
|
+
spark="INT",
|
|
1939
|
+
hive=ABSENT,
|
|
1940
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1941
|
+
clickhouse="UInt16",
|
|
1942
|
+
oracle=ABSENT,
|
|
1943
|
+
trino="BIGINT"),
|
|
1944
|
+
Function(exp.DayOfWeekIso, CONSERVATIVE, signatures=[("this",)], example="isodow(DATE '2020-01-01')",
|
|
1945
|
+
duckdb="BIGINT",
|
|
1946
|
+
postgres=ABSENT,
|
|
1947
|
+
mysql=ABSENT,
|
|
1948
|
+
snowflake="NUMBER",
|
|
1949
|
+
bigquery=ABSENT,
|
|
1950
|
+
redshift=ABSENT,
|
|
1951
|
+
databricks=ABSENT,
|
|
1952
|
+
spark=ABSENT,
|
|
1953
|
+
hive=ABSENT,
|
|
1954
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1955
|
+
clickhouse="UInt8",
|
|
1956
|
+
oracle=ABSENT,
|
|
1957
|
+
trino="BIGINT"),
|
|
1958
|
+
Function(exp.Dayname, CONSERVATIVE, signatures=[("this",)], example="dayname(DATE '2020-01-01')",
|
|
1959
|
+
duckdb="VARCHAR",
|
|
1960
|
+
postgres=ABSENT, # Postgres has no `dayname`
|
|
1961
|
+
mysql="VARCHAR",
|
|
1962
|
+
snowflake="VARCHAR",
|
|
1963
|
+
bigquery=ABSENT,
|
|
1964
|
+
redshift=ABSENT,
|
|
1965
|
+
databricks="STRING",
|
|
1966
|
+
spark="STRING",
|
|
1967
|
+
hive=ABSENT,
|
|
1968
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1969
|
+
clickhouse="String",
|
|
1970
|
+
oracle=ABSENT,
|
|
1971
|
+
trino=ABSENT),
|
|
1972
|
+
Function(exp.Monthname, CONSERVATIVE, signatures=[("this",)], example="monthname(DATE '2020-01-01')",
|
|
1973
|
+
duckdb="VARCHAR",
|
|
1974
|
+
postgres=ABSENT,
|
|
1975
|
+
mysql=UNREACHABLE,
|
|
1976
|
+
snowflake="VARCHAR",
|
|
1977
|
+
bigquery=ABSENT,
|
|
1978
|
+
redshift=ABSENT,
|
|
1979
|
+
databricks="STRING",
|
|
1980
|
+
spark="STRING",
|
|
1981
|
+
hive=ABSENT,
|
|
1982
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1983
|
+
clickhouse="String",
|
|
1984
|
+
oracle=ABSENT,
|
|
1985
|
+
trino=ABSENT),
|
|
1986
|
+
Function(exp.DateDiff, CONSERVATIVE, signatures=[("this", "expression", "unit", "zone")], example="date_diff('day', DATE '2020-01-01', DATE '2020-02-01')",
|
|
1987
|
+
duckdb="BIGINT",
|
|
1988
|
+
postgres=ABSENT, # Postgres has no `datediff`
|
|
1989
|
+
mysql="INT",
|
|
1990
|
+
snowflake="NUMBER",
|
|
1991
|
+
bigquery="INT64",
|
|
1992
|
+
redshift=UNREACHABLE,
|
|
1993
|
+
databricks=unmodelled(Reason.OVERLOADED), # INT for two arguments, BIGINT for three
|
|
1994
|
+
spark=unmodelled(Reason.OVERLOADED), # INT for two arguments, BIGINT for three
|
|
1995
|
+
hive="INT",
|
|
1996
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
1997
|
+
clickhouse="Int64",
|
|
1998
|
+
oracle=ABSENT,
|
|
1999
|
+
trino="BIGINT"),
|
|
2000
|
+
Function(exp.TsOrDsDiff, CONSERVATIVE, signatures=[("this", "expression", "unit")], example="datediff(day, DATE '2020-01-01', DATE '2020-02-01')", spelling="redshift",
|
|
2001
|
+
duckdb=UNREACHABLE,
|
|
2002
|
+
postgres=UNREACHABLE,
|
|
2003
|
+
mysql=UNREACHABLE,
|
|
2004
|
+
snowflake=UNREACHABLE,
|
|
2005
|
+
bigquery=UNREACHABLE,
|
|
2006
|
+
redshift="BIGINT", # `datediff` parses as TsOrDsDiff
|
|
2007
|
+
databricks=UNREACHABLE,
|
|
2008
|
+
spark=UNREACHABLE,
|
|
2009
|
+
hive=UNREACHABLE,
|
|
2010
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2011
|
+
clickhouse=ABSENT,
|
|
2012
|
+
oracle=ABSENT,
|
|
2013
|
+
trino=UNREACHABLE),
|
|
2014
|
+
Function(exp.LastDay, CONSERVATIVE, signatures=[("this", "unit")], example="last_day(DATE '2020-01-01')",
|
|
2015
|
+
duckdb="DATE",
|
|
2016
|
+
postgres=ABSENT, # Postgres has no `last_day`
|
|
2017
|
+
mysql="DATE",
|
|
2018
|
+
snowflake="DATE",
|
|
2019
|
+
bigquery="DATE",
|
|
2020
|
+
redshift="DATE",
|
|
2021
|
+
databricks="DATE",
|
|
2022
|
+
spark="DATE",
|
|
2023
|
+
hive="STRING", # `last_day` is a STRING
|
|
2024
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2025
|
+
clickhouse="Date",
|
|
2026
|
+
oracle="DATE",
|
|
2027
|
+
trino="DATE"),
|
|
2028
|
+
Function(exp.DateFromParts, CONSERVATIVE, signatures=[("year", "month", "day")], example="make_date(2020, 1, 1)",
|
|
2029
|
+
duckdb="DATE",
|
|
2030
|
+
postgres=ABSENT,
|
|
2031
|
+
mysql=ABSENT,
|
|
2032
|
+
snowflake="DATE",
|
|
2033
|
+
bigquery="DATE",
|
|
2034
|
+
redshift=ABSENT,
|
|
2035
|
+
databricks=UNREACHABLE,
|
|
2036
|
+
spark=UNREACHABLE,
|
|
2037
|
+
hive=ABSENT,
|
|
2038
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2039
|
+
clickhouse="Date",
|
|
2040
|
+
oracle=ABSENT,
|
|
2041
|
+
trino=ABSENT),
|
|
2042
|
+
Function("Anonymous:make_date", CONSERVATIVE, signatures=[("*expressions",)], example="make_date(2020, 1, 1)", spelling="postgres",
|
|
2043
|
+
duckdb=UNREACHABLE,
|
|
2044
|
+
postgres="DATE",
|
|
2045
|
+
mysql=ABSENT,
|
|
2046
|
+
snowflake=ABSENT,
|
|
2047
|
+
bigquery=ABSENT,
|
|
2048
|
+
redshift=ABSENT,
|
|
2049
|
+
databricks="DATE",
|
|
2050
|
+
spark="DATE",
|
|
2051
|
+
hive=ABSENT,
|
|
2052
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2053
|
+
clickhouse=ABSENT,
|
|
2054
|
+
oracle=ABSENT,
|
|
2055
|
+
trino=ABSENT),
|
|
2056
|
+
Function(exp.DateTrunc, CONSERVATIVE, signatures=[("this", "unit", "zone")], example="date_trunc(DATE '2020-01-01', MONTH)", spelling="bigquery",
|
|
2057
|
+
duckdb="TIMESTAMP", # `date_trunc` of a DATE, probed on 2.0.1
|
|
2058
|
+
postgres=UNREACHABLE,
|
|
2059
|
+
mysql=ABSENT,
|
|
2060
|
+
snowflake=ABSENT,
|
|
2061
|
+
bigquery=keep(0),
|
|
2062
|
+
redshift=UNREACHABLE,
|
|
2063
|
+
databricks="DATE",
|
|
2064
|
+
spark="DATE",
|
|
2065
|
+
hive=ABSENT,
|
|
2066
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2067
|
+
clickhouse=unmodelled(Reason.DEPENDS_ON_LITERAL), # by the unit
|
|
2068
|
+
oracle="DATE",
|
|
2069
|
+
trino="DATE"),
|
|
2070
|
+
Function(exp.TimestampTrunc, CONSERVATIVE, signatures=[("this", "unit", "zone")], example="date_trunc('month', TIMESTAMP '2020-01-01')",
|
|
2071
|
+
duckdb=on_arg(0, {DATE: "TIMESTAMP", TIMESTAMP: "TIMESTAMP", TIMESTAMPTZ: "TIMESTAMP WITH TIME ZONE", INTERVAL: "INTERVAL"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
2072
|
+
postgres=on_arg(0, {DATE: "TIMESTAMP WITH TIME ZONE", TIMESTAMP: "TIMESTAMP", TIMESTAMPTZ: "TIMESTAMP WITH TIME ZONE", INTERVAL: "INTERVAL"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
2073
|
+
mysql=UNREACHABLE,
|
|
2074
|
+
snowflake=keep(0),
|
|
2075
|
+
bigquery=keep(0),
|
|
2076
|
+
redshift=on_arg(0, {DATE: "TIMESTAMP", TIMESTAMP: "TIMESTAMP", TIMESTAMPTZ: "TIMESTAMP WITH TIME ZONE"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
2077
|
+
databricks="TIMESTAMP",
|
|
2078
|
+
spark="TIMESTAMP",
|
|
2079
|
+
hive=ABSENT,
|
|
2080
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2081
|
+
clickhouse=UNREACHABLE,
|
|
2082
|
+
oracle=ABSENT,
|
|
2083
|
+
trino=keep(0)),
|
|
2084
|
+
Function(exp.TimeToStr, CONSERVATIVE, signatures=[("this", "format", "culture", "zone")], example="strftime(DATE '2020-01-01', '%Y')",
|
|
2085
|
+
duckdb="VARCHAR",
|
|
2086
|
+
postgres="TEXT",
|
|
2087
|
+
mysql="VARCHAR",
|
|
2088
|
+
snowflake="VARCHAR",
|
|
2089
|
+
bigquery="STRING",
|
|
2090
|
+
redshift="VARCHAR",
|
|
2091
|
+
databricks="STRING",
|
|
2092
|
+
spark="STRING",
|
|
2093
|
+
hive="STRING",
|
|
2094
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2095
|
+
clickhouse="String",
|
|
2096
|
+
oracle="VARCHAR2",
|
|
2097
|
+
trino="VARCHAR"),
|
|
2098
|
+
|
|
2099
|
+
# hash
|
|
2100
|
+
Function(exp.MD5, PER_DIALECT, signatures=[("this",)], example="md5('a')",
|
|
2101
|
+
duckdb=("VARCHAR", STRICT),
|
|
2102
|
+
postgres=("TEXT", STRICT),
|
|
2103
|
+
mysql=("VARCHAR", STRICT),
|
|
2104
|
+
snowflake=("VARCHAR", STRICT),
|
|
2105
|
+
bigquery=("STRING", STRICT), # `md5` and `sha256` return BYTES; `to_hex(md5(x))` parses as MD5
|
|
2106
|
+
redshift=("VARCHAR", STRICT),
|
|
2107
|
+
databricks=("STRING", STRICT),
|
|
2108
|
+
spark=("STRING", STRICT),
|
|
2109
|
+
hive=("STRING", STRICT),
|
|
2110
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), CONSERVATIVE),
|
|
2111
|
+
clickhouse=(UNREACHABLE, CONSERVATIVE),
|
|
2112
|
+
oracle=(ABSENT, CONSERVATIVE),
|
|
2113
|
+
trino=(UNREACHABLE, CONSERVATIVE)),
|
|
2114
|
+
Function(exp.SHA, PER_DIALECT, name="sha1", signatures=[("this",)], example="sha1('a')",
|
|
2115
|
+
duckdb=("VARCHAR", STRICT),
|
|
2116
|
+
postgres=(ABSENT, CONSERVATIVE),
|
|
2117
|
+
mysql=("VARCHAR", STRICT),
|
|
2118
|
+
snowflake=("VARCHAR", STRICT),
|
|
2119
|
+
bigquery=(UNREACHABLE, CONSERVATIVE),
|
|
2120
|
+
redshift=("VARCHAR", STRICT),
|
|
2121
|
+
databricks=("STRING", STRICT),
|
|
2122
|
+
spark=("STRING", STRICT),
|
|
2123
|
+
hive=("STRING", STRICT),
|
|
2124
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), CONSERVATIVE),
|
|
2125
|
+
clickhouse=(UNREACHABLE, STRICT),
|
|
2126
|
+
oracle=(ABSENT, CONSERVATIVE),
|
|
2127
|
+
trino=(UNREACHABLE, STRICT)),
|
|
2128
|
+
Function(exp.SHA2, PER_DIALECT, name="sha256", signatures=[("this",)], ignores=("length",), example="sha256('a')",
|
|
2129
|
+
duckdb=("VARCHAR", STRICT),
|
|
2130
|
+
postgres=(UNREACHABLE, CONSERVATIVE),
|
|
2131
|
+
mysql=("VARCHAR", CONSERVATIVE), # not SHA2: its length is free
|
|
2132
|
+
snowflake=("VARCHAR", CONSERVATIVE),
|
|
2133
|
+
bigquery=(UNREACHABLE, CONSERVATIVE),
|
|
2134
|
+
redshift=("VARCHAR", CONSERVATIVE),
|
|
2135
|
+
databricks=("STRING", CONSERVATIVE), # not SHA2: `sha2(x, n)` is NULL for an unsupported `n`
|
|
2136
|
+
spark=("STRING", CONSERVATIVE), # not SHA2: `sha2(x, n)` is NULL for an unsupported `n`
|
|
2137
|
+
hive=("STRING", CONSERVATIVE), # not SHA2: `sha2(x, n)` is NULL for an unsupported `n`
|
|
2138
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), CONSERVATIVE),
|
|
2139
|
+
clickhouse=(UNREACHABLE, STRICT),
|
|
2140
|
+
oracle=(ABSENT, CONSERVATIVE),
|
|
2141
|
+
trino=(UNREACHABLE, CONSERVATIVE)),
|
|
2142
|
+
Function(exp.MD5Digest, PER_DIALECT, name="md5 digest", signatures=[("this",)], example="md5_binary('a')", spelling="snowflake",
|
|
2143
|
+
duckdb=(UNREACHABLE, CONSERVATIVE),
|
|
2144
|
+
postgres=(ABSENT, CONSERVATIVE),
|
|
2145
|
+
mysql=(ABSENT, CONSERVATIVE),
|
|
2146
|
+
snowflake=("BINARY", STRICT), # `md5_binary` is MD5Digest
|
|
2147
|
+
bigquery=("BYTES", STRICT),
|
|
2148
|
+
redshift=(ABSENT, CONSERVATIVE),
|
|
2149
|
+
databricks=(UNREACHABLE, CONSERVATIVE),
|
|
2150
|
+
spark=(UNREACHABLE, CONSERVATIVE),
|
|
2151
|
+
hive=(UNREACHABLE, CONSERVATIVE),
|
|
2152
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), CONSERVATIVE),
|
|
2153
|
+
clickhouse=(unmodelled(Reason.WRAPS_ARGUMENT), STRICT), # MD5/SHA1/SHA256 return FixedString bytes, wrapped in Nullable for a Nullable argument
|
|
2154
|
+
oracle=(ABSENT, CONSERVATIVE),
|
|
2155
|
+
trino=("VARBINARY", STRICT)),
|
|
2156
|
+
Function(exp.SHA1Digest, PER_DIALECT, name="sha1 digest", signatures=[("this",)], example="sha1_binary('a')", spelling="snowflake",
|
|
2157
|
+
duckdb=(UNREACHABLE, CONSERVATIVE),
|
|
2158
|
+
postgres=(ABSENT, CONSERVATIVE),
|
|
2159
|
+
mysql=(ABSENT, CONSERVATIVE),
|
|
2160
|
+
snowflake=("BINARY", CONSERVATIVE),
|
|
2161
|
+
bigquery=("BYTES", STRICT),
|
|
2162
|
+
redshift=(ABSENT, CONSERVATIVE),
|
|
2163
|
+
databricks=(UNREACHABLE, CONSERVATIVE),
|
|
2164
|
+
spark=(UNREACHABLE, CONSERVATIVE),
|
|
2165
|
+
hive=(ABSENT, CONSERVATIVE),
|
|
2166
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), CONSERVATIVE),
|
|
2167
|
+
clickhouse=(unmodelled(Reason.WRAPS_ARGUMENT), CONSERVATIVE),
|
|
2168
|
+
oracle=(ABSENT, CONSERVATIVE),
|
|
2169
|
+
trino=("VARBINARY", CONSERVATIVE)),
|
|
2170
|
+
Function(exp.SHA2Digest, PER_DIALECT, name="sha256 digest", signatures=[("this",)], ignores=("length",), example="sha256('a'::BYTEA)", spelling="postgres",
|
|
2171
|
+
duckdb=(UNREACHABLE, CONSERVATIVE),
|
|
2172
|
+
postgres=("BYTEA", STRICT), # `sha256(x)` returns bytea: SHA2Digest. No Postgres SQL parses to SHA or SHA2
|
|
2173
|
+
mysql=(ABSENT, CONSERVATIVE),
|
|
2174
|
+
snowflake=("BINARY", CONSERVATIVE),
|
|
2175
|
+
bigquery=("BYTES", STRICT),
|
|
2176
|
+
redshift=(ABSENT, CONSERVATIVE),
|
|
2177
|
+
databricks=(UNREACHABLE, CONSERVATIVE),
|
|
2178
|
+
spark=(UNREACHABLE, CONSERVATIVE),
|
|
2179
|
+
hive=(ABSENT, CONSERVATIVE),
|
|
2180
|
+
sqlite=(unmodelled(Reason.STORAGE_CLASS), CONSERVATIVE),
|
|
2181
|
+
clickhouse=(unmodelled(Reason.WRAPS_ARGUMENT), CONSERVATIVE),
|
|
2182
|
+
oracle=(ABSENT, CONSERVATIVE),
|
|
2183
|
+
trino=("VARBINARY", STRICT)),
|
|
2184
|
+
|
|
2185
|
+
# collections
|
|
2186
|
+
Function(exp.Bracket, PER_DIALECT, name="[]", signatures=[("this", "expressions")], example="[1, 2][1]",
|
|
2187
|
+
duckdb=(unmodelled(Reason.ELEMENT_TYPE), STRICT_IN_FIRST),
|
|
2188
|
+
postgres=(unmodelled(Reason.ELEMENT_TYPE), STRICT_IN_FIRST),
|
|
2189
|
+
mysql=(ABSENT, CONSERVATIVE),
|
|
2190
|
+
snowflake=(unmodelled(Reason.ELEMENT_TYPE), CONSERVATIVE),
|
|
2191
|
+
bigquery=(unmodelled(Reason.ELEMENT_TYPE), CONSERVATIVE),
|
|
2192
|
+
redshift=(unmodelled(Reason.ELEMENT_TYPE), CONSERVATIVE),
|
|
2193
|
+
databricks=(unmodelled(Reason.ELEMENT_TYPE), CONSERVATIVE),
|
|
2194
|
+
spark=(unmodelled(Reason.ELEMENT_TYPE), STRICT_IN_FIRST),
|
|
2195
|
+
hive=(unmodelled(Reason.ELEMENT_TYPE), CONSERVATIVE),
|
|
2196
|
+
sqlite=(UNREACHABLE, CONSERVATIVE),
|
|
2197
|
+
clickhouse=(unmodelled(Reason.ELEMENT_TYPE), CONSERVATIVE),
|
|
2198
|
+
oracle=(ABSENT, CONSERVATIVE),
|
|
2199
|
+
trino=(unmodelled(Reason.ELEMENT_TYPE), STRICT_IN_FIRST)),
|
|
2200
|
+
|
|
2201
|
+
# date and time: the audit's backlog
|
|
2202
|
+
Function("Anonymous:to_seconds", CONSERVATIVE, signatures=[("*expressions",)], example="to_seconds(1.5)",
|
|
2203
|
+
duckdb="INTERVAL",
|
|
2204
|
+
postgres=ABSENT,
|
|
2205
|
+
mysql="BIGINT",
|
|
2206
|
+
snowflake=ABSENT,
|
|
2207
|
+
bigquery=ABSENT,
|
|
2208
|
+
redshift=ABSENT,
|
|
2209
|
+
databricks=ABSENT,
|
|
2210
|
+
spark=ABSENT,
|
|
2211
|
+
hive=ABSENT,
|
|
2212
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2213
|
+
clickhouse=ABSENT,
|
|
2214
|
+
oracle=ABSENT,
|
|
2215
|
+
trino=ABSENT),
|
|
2216
|
+
Function("Anonymous:timezone", CONSERVATIVE, signatures=[("*expressions",)], example="timezone('UTC', TIMESTAMP '2020-01-01 10:00:00')",
|
|
2217
|
+
duckdb=unmodelled(Reason.OVERLOADED),
|
|
2218
|
+
postgres=unmodelled(Reason.OVERLOADED),
|
|
2219
|
+
mysql=ABSENT,
|
|
2220
|
+
snowflake=ABSENT,
|
|
2221
|
+
bigquery=ABSENT,
|
|
2222
|
+
redshift=unmodelled(Reason.OVERLOADED),
|
|
2223
|
+
databricks=ABSENT,
|
|
2224
|
+
spark=ABSENT,
|
|
2225
|
+
hive=ABSENT,
|
|
2226
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2227
|
+
clickhouse=ABSENT,
|
|
2228
|
+
oracle=ABSENT,
|
|
2229
|
+
trino=ABSENT),
|
|
2230
|
+
Function(exp.Timestamp, one_to_one(DATE), signatures=[("this",), ("this", "zone")], example="timestamp(DATE '2020-01-01')",
|
|
2231
|
+
duckdb=ABSENT,
|
|
2232
|
+
postgres=ABSENT,
|
|
2233
|
+
mysql="DATETIME",
|
|
2234
|
+
snowflake=ABSENT,
|
|
2235
|
+
bigquery="TIMESTAMP",
|
|
2236
|
+
redshift=ABSENT,
|
|
2237
|
+
databricks=UNREACHABLE,
|
|
2238
|
+
spark=UNREACHABLE,
|
|
2239
|
+
hive=ABSENT,
|
|
2240
|
+
sqlite=ABSENT,
|
|
2241
|
+
clickhouse=unmodelled(Reason.OVERLOADED),
|
|
2242
|
+
oracle=ABSENT,
|
|
2243
|
+
trino=ABSENT),
|
|
2244
|
+
Function(exp.Date, CONSERVATIVE, signatures=[("this", "zone"), ("this", "expressions")], example="date(TIMESTAMP '2020-01-01 10:00:00')",
|
|
2245
|
+
duckdb="DATE",
|
|
2246
|
+
postgres="DATE",
|
|
2247
|
+
mysql=UNREACHABLE,
|
|
2248
|
+
snowflake=UNREACHABLE,
|
|
2249
|
+
bigquery="DATE",
|
|
2250
|
+
redshift="DATE",
|
|
2251
|
+
databricks=UNREACHABLE,
|
|
2252
|
+
spark=UNREACHABLE,
|
|
2253
|
+
hive="DATE",
|
|
2254
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2255
|
+
clickhouse="Date",
|
|
2256
|
+
oracle=ABSENT,
|
|
2257
|
+
trino="DATE"),
|
|
2258
|
+
Function(exp.TsOrDsToDate, CONSERVATIVE, name="date", signatures=[("this", "format")], spelling="mysql", example="date(x)",
|
|
2259
|
+
duckdb=UNREACHABLE,
|
|
2260
|
+
postgres=UNREACHABLE,
|
|
2261
|
+
mysql="DATE",
|
|
2262
|
+
snowflake=ABSENT,
|
|
2263
|
+
bigquery=UNREACHABLE,
|
|
2264
|
+
redshift=UNREACHABLE,
|
|
2265
|
+
databricks="DATE",
|
|
2266
|
+
spark="DATE",
|
|
2267
|
+
hive="DATE",
|
|
2268
|
+
sqlite=UNREACHABLE,
|
|
2269
|
+
clickhouse=UNREACHABLE,
|
|
2270
|
+
oracle=UNREACHABLE,
|
|
2271
|
+
trino=UNREACHABLE),
|
|
2272
|
+
Function(exp.DateAdd, CONSERVATIVE, signatures=[("this", "expression", "unit")], example="date_add(DATE '2020-01-01', INTERVAL 1 DAY)",
|
|
2273
|
+
duckdb=on_arg(0, {DATE: "TIMESTAMP", TIME: keep(0), TIMESTAMP: keep(0), TIMESTAMPTZ: keep(0)}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
2274
|
+
postgres=on_arg(0, {DATE: "TIMESTAMP", TIMESTAMP: "TIMESTAMP", TIMESTAMPTZ: "TIMESTAMP WITH TIME ZONE"}, otherwise=unmodelled(Reason.ARGUMENT_TYPE_UNLISTED)),
|
|
2275
|
+
mysql=unmodelled(Reason.DEPENDS_ON_LITERAL),
|
|
2276
|
+
snowflake=keep(0),
|
|
2277
|
+
bigquery=keep(0),
|
|
2278
|
+
redshift=UNREACHABLE,
|
|
2279
|
+
databricks=UNREACHABLE,
|
|
2280
|
+
spark=UNREACHABLE,
|
|
2281
|
+
hive=UNREACHABLE,
|
|
2282
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2283
|
+
clickhouse=keep(0),
|
|
2284
|
+
oracle=ABSENT,
|
|
2285
|
+
trino=keep(0)),
|
|
2286
|
+
Function(exp.DateSub, CONSERVATIVE, signatures=[("this", "expression", "unit")], spelling="bigquery", example="date_sub(DATE '2020-01-01', INTERVAL 1 DAY)",
|
|
2287
|
+
duckdb=UNREACHABLE,
|
|
2288
|
+
postgres=ABSENT,
|
|
2289
|
+
mysql=unmodelled(Reason.DEPENDS_ON_LITERAL),
|
|
2290
|
+
snowflake=ABSENT,
|
|
2291
|
+
bigquery=keep(0),
|
|
2292
|
+
redshift=ABSENT,
|
|
2293
|
+
databricks=UNREACHABLE,
|
|
2294
|
+
spark=UNREACHABLE,
|
|
2295
|
+
hive=UNREACHABLE,
|
|
2296
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2297
|
+
clickhouse=keep(0),
|
|
2298
|
+
oracle=ABSENT,
|
|
2299
|
+
trino=ABSENT),
|
|
2300
|
+
Function(exp.TsOrDsAdd, CONSERVATIVE, name="date_add", signatures=[("this", "expression", "unit")], spelling="spark", example="date_add(DATE '2020-01-01', 1)",
|
|
2301
|
+
duckdb=UNREACHABLE,
|
|
2302
|
+
postgres=UNREACHABLE,
|
|
2303
|
+
mysql=UNREACHABLE,
|
|
2304
|
+
snowflake=UNREACHABLE,
|
|
2305
|
+
bigquery=UNREACHABLE,
|
|
2306
|
+
redshift=ABSENT,
|
|
2307
|
+
databricks="DATE",
|
|
2308
|
+
spark="DATE",
|
|
2309
|
+
hive="DATE",
|
|
2310
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2311
|
+
clickhouse=ABSENT,
|
|
2312
|
+
oracle=ABSENT,
|
|
2313
|
+
trino=UNREACHABLE),
|
|
2314
|
+
Function(exp.StrToDate, CONSERVATIVE, name="str_to_date", signatures=[("this", "format")], spelling="postgres", example="to_date('2020-01-01', 'YYYY-MM-DD')",
|
|
2315
|
+
duckdb=UNREACHABLE,
|
|
2316
|
+
postgres="DATE",
|
|
2317
|
+
mysql=on_literal("format", {"%Y-%m-%d": "DATE", "%Y-%m-%d %H:%i:%s": "DATETIME", "%H:%i:%s": "TIME"}, otherwise=unmodelled(Reason.DEPENDS_ON_LITERAL)),
|
|
2318
|
+
snowflake=UNREACHABLE,
|
|
2319
|
+
bigquery="DATE",
|
|
2320
|
+
redshift="DATE",
|
|
2321
|
+
databricks=UNREACHABLE,
|
|
2322
|
+
spark=UNREACHABLE,
|
|
2323
|
+
hive=UNREACHABLE,
|
|
2324
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2325
|
+
clickhouse=UNREACHABLE,
|
|
2326
|
+
oracle="DATE",
|
|
2327
|
+
trino=UNREACHABLE),
|
|
2328
|
+
Function(exp.StrToTime, CONSERVATIVE, name="str_to_time", signatures=[("this", "format"), ("this", "format", "zone")], example="strptime('2020-01-01', '%Y-%m-%d')",
|
|
2329
|
+
duckdb="TIMESTAMP",
|
|
2330
|
+
postgres="TIMESTAMP WITH TIME ZONE",
|
|
2331
|
+
mysql=UNREACHABLE,
|
|
2332
|
+
snowflake="TIMESTAMP_NTZ",
|
|
2333
|
+
bigquery="TIMESTAMP",
|
|
2334
|
+
redshift="TIMESTAMP WITH TIME ZONE",
|
|
2335
|
+
databricks="TIMESTAMP",
|
|
2336
|
+
spark="TIMESTAMP",
|
|
2337
|
+
hive=UNREACHABLE,
|
|
2338
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2339
|
+
clickhouse=ABSENT,
|
|
2340
|
+
oracle="TIMESTAMP",
|
|
2341
|
+
trino="TIMESTAMP"),
|
|
2342
|
+
Function("Anonymous:try_strptime", CONSERVATIVE, signatures=[("*expressions",)], example="try_strptime('2020-01-01', '%Y-%m-%d')",
|
|
2343
|
+
duckdb="TIMESTAMP",
|
|
2344
|
+
postgres=ABSENT,
|
|
2345
|
+
mysql=ABSENT,
|
|
2346
|
+
snowflake=ABSENT,
|
|
2347
|
+
bigquery=ABSENT,
|
|
2348
|
+
redshift=ABSENT,
|
|
2349
|
+
databricks=ABSENT,
|
|
2350
|
+
spark=ABSENT,
|
|
2351
|
+
hive=ABSENT,
|
|
2352
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2353
|
+
clickhouse=ABSENT,
|
|
2354
|
+
oracle=ABSENT,
|
|
2355
|
+
trino=ABSENT),
|
|
2356
|
+
Function(exp.Extract, CONSERVATIVE, signatures=[("this", "expression")], example="extract(year FROM TIMESTAMP '2020-01-01 10:00:00')",
|
|
2357
|
+
duckdb=on_literal("this", {"epoch": "DOUBLE", "julian": "DOUBLE"}, otherwise="BIGINT"),
|
|
2358
|
+
postgres="NUMERIC",
|
|
2359
|
+
mysql="BIGINT",
|
|
2360
|
+
snowflake="NUMBER",
|
|
2361
|
+
bigquery="INT64",
|
|
2362
|
+
redshift="NUMERIC",
|
|
2363
|
+
databricks=on_literal("this", {"second": unmodelled(Reason.DEPENDS_ON_LITERAL), "epoch": unmodelled(Reason.DEPENDS_ON_LITERAL)}, otherwise="INT"),
|
|
2364
|
+
spark=on_literal("this", {"second": unmodelled(Reason.DEPENDS_ON_LITERAL), "epoch": unmodelled(Reason.DEPENDS_ON_LITERAL)}, otherwise="INT"),
|
|
2365
|
+
hive="INT",
|
|
2366
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2367
|
+
clickhouse="Int64",
|
|
2368
|
+
oracle="NUMBER",
|
|
2369
|
+
trino="BIGINT"),
|
|
2370
|
+
Function("Anonymous:date_part", CONSERVATIVE, signatures=[("*expressions",)], example="date_part('year', DATE '2020-01-01')",
|
|
2371
|
+
duckdb=unmodelled(Reason.DEPENDS_ON_LITERAL),
|
|
2372
|
+
postgres=UNREACHABLE,
|
|
2373
|
+
mysql=ABSENT,
|
|
2374
|
+
snowflake=UNREACHABLE,
|
|
2375
|
+
bigquery=ABSENT,
|
|
2376
|
+
redshift=UNREACHABLE,
|
|
2377
|
+
databricks=unmodelled(Reason.DEPENDS_ON_LITERAL),
|
|
2378
|
+
spark=unmodelled(Reason.DEPENDS_ON_LITERAL),
|
|
2379
|
+
hive=ABSENT,
|
|
2380
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2381
|
+
clickhouse="UInt16",
|
|
2382
|
+
oracle=ABSENT,
|
|
2383
|
+
trino=ABSENT),
|
|
2384
|
+
Function("Anonymous:yearweek", CONSERVATIVE, signatures=[("*expressions",)], spelling="mysql", example="yearweek(DATE '2020-01-01')",
|
|
2385
|
+
duckdb="BIGINT",
|
|
2386
|
+
postgres=ABSENT,
|
|
2387
|
+
mysql="INT",
|
|
2388
|
+
snowflake=ABSENT,
|
|
2389
|
+
bigquery=ABSENT,
|
|
2390
|
+
redshift=ABSENT,
|
|
2391
|
+
databricks=ABSENT,
|
|
2392
|
+
spark=ABSENT,
|
|
2393
|
+
hive=ABSENT,
|
|
2394
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2395
|
+
clickhouse="UInt32",
|
|
2396
|
+
oracle=ABSENT,
|
|
2397
|
+
trino=ABSENT),
|
|
2398
|
+
Function(exp.UnixSeconds, CONSERVATIVE, name="unix_seconds", signatures=[("this",)], spelling="bigquery", example="unix_seconds(TIMESTAMP '2020-01-01 10:00:00')",
|
|
2399
|
+
duckdb=ABSENT,
|
|
2400
|
+
postgres=ABSENT,
|
|
2401
|
+
mysql=ABSENT,
|
|
2402
|
+
snowflake=ABSENT,
|
|
2403
|
+
bigquery="INT64",
|
|
2404
|
+
redshift=ABSENT,
|
|
2405
|
+
databricks="BIGINT",
|
|
2406
|
+
spark="BIGINT",
|
|
2407
|
+
hive=ABSENT,
|
|
2408
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2409
|
+
clickhouse=ABSENT,
|
|
2410
|
+
oracle=ABSENT,
|
|
2411
|
+
trino=ABSENT),
|
|
2412
|
+
|
|
2413
|
+
# volatile functions: typed, no function of their arguments: the audit's backlog
|
|
2414
|
+
Function(exp.CurrentTimestamp, VOLATILE, signatures=[()], example="current_timestamp",
|
|
2415
|
+
duckdb="TIMESTAMP WITH TIME ZONE",
|
|
2416
|
+
postgres="TIMESTAMP WITH TIME ZONE",
|
|
2417
|
+
mysql="DATETIME",
|
|
2418
|
+
snowflake="TIMESTAMP_LTZ",
|
|
2419
|
+
bigquery="TIMESTAMP",
|
|
2420
|
+
redshift="TIMESTAMP WITH TIME ZONE",
|
|
2421
|
+
databricks="TIMESTAMP",
|
|
2422
|
+
spark="TIMESTAMP",
|
|
2423
|
+
hive="TIMESTAMP",
|
|
2424
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2425
|
+
clickhouse="DateTime",
|
|
2426
|
+
oracle="TIMESTAMP WITH TIME ZONE",
|
|
2427
|
+
trino="TIMESTAMP WITH TIME ZONE"),
|
|
2428
|
+
Function(exp.CurrentDate, VOLATILE, signatures=[()], example="current_date",
|
|
2429
|
+
duckdb="DATE",
|
|
2430
|
+
postgres="DATE",
|
|
2431
|
+
mysql="DATE",
|
|
2432
|
+
snowflake="DATE",
|
|
2433
|
+
bigquery="DATE",
|
|
2434
|
+
redshift="DATE",
|
|
2435
|
+
databricks="DATE",
|
|
2436
|
+
spark="DATE",
|
|
2437
|
+
hive="DATE",
|
|
2438
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2439
|
+
clickhouse="Date",
|
|
2440
|
+
oracle="DATE",
|
|
2441
|
+
trino="DATE"),
|
|
2442
|
+
Function(exp.CurrentTime, VOLATILE, signatures=[()], example="current_time",
|
|
2443
|
+
duckdb="TIME WITH TIME ZONE",
|
|
2444
|
+
postgres="TIME WITH TIME ZONE",
|
|
2445
|
+
mysql="TIME",
|
|
2446
|
+
snowflake=UNREACHABLE,
|
|
2447
|
+
bigquery="TIME",
|
|
2448
|
+
redshift="TIME WITH TIME ZONE",
|
|
2449
|
+
databricks="TIME",
|
|
2450
|
+
spark="TIME",
|
|
2451
|
+
hive=ABSENT,
|
|
2452
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2453
|
+
clickhouse=ABSENT,
|
|
2454
|
+
oracle=ABSENT,
|
|
2455
|
+
trino="TIME WITH TIME ZONE"),
|
|
2456
|
+
Function(exp.Localtimestamp, VOLATILE, signatures=[()], example="localtimestamp",
|
|
2457
|
+
duckdb="TIMESTAMP",
|
|
2458
|
+
postgres="TIMESTAMP",
|
|
2459
|
+
mysql="DATETIME",
|
|
2460
|
+
snowflake=UNREACHABLE,
|
|
2461
|
+
bigquery=UNREACHABLE,
|
|
2462
|
+
redshift="TIMESTAMP",
|
|
2463
|
+
databricks=UNREACHABLE,
|
|
2464
|
+
spark=UNREACHABLE,
|
|
2465
|
+
hive=UNREACHABLE,
|
|
2466
|
+
sqlite=UNREACHABLE,
|
|
2467
|
+
clickhouse=UNREACHABLE,
|
|
2468
|
+
oracle="TIMESTAMP",
|
|
2469
|
+
trino="TIMESTAMP"),
|
|
2470
|
+
Function(exp.Rand, VOLATILE, signatures=[()], example="random()",
|
|
2471
|
+
duckdb="DOUBLE",
|
|
2472
|
+
postgres="DOUBLE PRECISION",
|
|
2473
|
+
mysql="DOUBLE",
|
|
2474
|
+
snowflake="NUMBER",
|
|
2475
|
+
bigquery="FLOAT64",
|
|
2476
|
+
redshift="DOUBLE PRECISION",
|
|
2477
|
+
databricks="DOUBLE",
|
|
2478
|
+
spark="DOUBLE",
|
|
2479
|
+
hive="DOUBLE",
|
|
2480
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2481
|
+
clickhouse="UInt32",
|
|
2482
|
+
oracle=ABSENT,
|
|
2483
|
+
trino="DOUBLE"),
|
|
2484
|
+
Function(exp.Uuid, VOLATILE, signatures=[()], example="uuid()",
|
|
2485
|
+
duckdb="UUID",
|
|
2486
|
+
postgres="UUID",
|
|
2487
|
+
mysql="VARCHAR",
|
|
2488
|
+
snowflake="VARCHAR",
|
|
2489
|
+
bigquery="STRING",
|
|
2490
|
+
redshift=ABSENT,
|
|
2491
|
+
databricks="STRING",
|
|
2492
|
+
spark="STRING",
|
|
2493
|
+
hive="STRING",
|
|
2494
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2495
|
+
clickhouse="UUID",
|
|
2496
|
+
oracle=ABSENT,
|
|
2497
|
+
trino="UUID"),
|
|
2498
|
+
Function(exp.Seq4, VOLATILE, signatures=[()], spelling="snowflake", example="seq4()",
|
|
2499
|
+
duckdb=ABSENT,
|
|
2500
|
+
postgres=ABSENT,
|
|
2501
|
+
mysql=ABSENT,
|
|
2502
|
+
snowflake="NUMBER",
|
|
2503
|
+
bigquery=ABSENT,
|
|
2504
|
+
redshift=ABSENT,
|
|
2505
|
+
databricks=ABSENT,
|
|
2506
|
+
spark=ABSENT,
|
|
2507
|
+
hive=ABSENT,
|
|
2508
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2509
|
+
clickhouse=ABSENT,
|
|
2510
|
+
oracle=ABSENT,
|
|
2511
|
+
trino=ABSENT),
|
|
2512
|
+
Function("Anonymous:now", CONSERVATIVE, signatures=[("*expressions",)], example="now()",
|
|
2513
|
+
duckdb="TIMESTAMP WITH TIME ZONE",
|
|
2514
|
+
postgres=UNREACHABLE,
|
|
2515
|
+
mysql="DATETIME",
|
|
2516
|
+
snowflake="TIMESTAMP_LTZ",
|
|
2517
|
+
bigquery="TIMESTAMP",
|
|
2518
|
+
redshift=UNREACHABLE,
|
|
2519
|
+
databricks=UNREACHABLE,
|
|
2520
|
+
spark="TIMESTAMP",
|
|
2521
|
+
hive="TIMESTAMP",
|
|
2522
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2523
|
+
clickhouse="DateTime",
|
|
2524
|
+
oracle="TIMESTAMP WITH TIME ZONE",
|
|
2525
|
+
trino=UNREACHABLE),
|
|
2526
|
+
|
|
2527
|
+
# encoding: the audit's backlog
|
|
2528
|
+
Function(exp.ToBase64, one_to_one(BYTES), name="to_base64", signatures=[("this",)], example="to_base64(CAST('a' AS BLOB))",
|
|
2529
|
+
duckdb="VARCHAR",
|
|
2530
|
+
postgres=ABSENT,
|
|
2531
|
+
mysql=unmodelled(Reason.KEEPS_ARGUMENT_PARAMETERS),
|
|
2532
|
+
snowflake=ABSENT,
|
|
2533
|
+
bigquery="STRING",
|
|
2534
|
+
redshift=ABSENT,
|
|
2535
|
+
databricks="STRING",
|
|
2536
|
+
spark="STRING",
|
|
2537
|
+
hive="STRING",
|
|
2538
|
+
sqlite=ABSENT,
|
|
2539
|
+
clickhouse="String",
|
|
2540
|
+
oracle=ABSENT,
|
|
2541
|
+
trino="VARCHAR"),
|
|
2542
|
+
|
|
2543
|
+
# arithmetic (backlog): the audit's backlog
|
|
2544
|
+
Function(exp.SafeDivide, CONSERVATIVE, name="safe_divide", signatures=[("this", "expression")], spelling="bigquery", example="safe_divide(4, 2)",
|
|
2545
|
+
duckdb=ABSENT,
|
|
2546
|
+
postgres=ABSENT,
|
|
2547
|
+
mysql=ABSENT,
|
|
2548
|
+
snowflake=ABSENT,
|
|
2549
|
+
bigquery=BIGQUERY_MATH,
|
|
2550
|
+
redshift=ABSENT,
|
|
2551
|
+
databricks=unmodelled(Reason.DIVISION),
|
|
2552
|
+
spark=unmodelled(Reason.DIVISION),
|
|
2553
|
+
hive=ABSENT,
|
|
2554
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2555
|
+
clickhouse=ABSENT,
|
|
2556
|
+
oracle=ABSENT,
|
|
2557
|
+
trino=ABSENT),
|
|
2558
|
+
|
|
2559
|
+
# json: the audit's backlog
|
|
2560
|
+
Function("Anonymous:json_array_length", CONSERVATIVE, signatures=[("*expressions",)], example="json_array_length('[1, 2]')",
|
|
2561
|
+
duckdb="UBIGINT",
|
|
2562
|
+
postgres="INTEGER",
|
|
2563
|
+
mysql=ABSENT,
|
|
2564
|
+
snowflake=ABSENT,
|
|
2565
|
+
bigquery=ABSENT,
|
|
2566
|
+
redshift="BIGINT",
|
|
2567
|
+
databricks="INT",
|
|
2568
|
+
spark="INT",
|
|
2569
|
+
hive=ABSENT,
|
|
2570
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2571
|
+
clickhouse="UInt64",
|
|
2572
|
+
oracle=ABSENT,
|
|
2573
|
+
trino="BIGINT"),
|
|
2574
|
+
Function(exp.JSONExtractArray, CONSERVATIVE, name="json_extract_array", signatures=[("this", "expression")], spelling="bigquery", example="json_extract_array('[1]', '$')",
|
|
2575
|
+
duckdb=ABSENT,
|
|
2576
|
+
postgres=ABSENT,
|
|
2577
|
+
mysql=ABSENT,
|
|
2578
|
+
snowflake=ABSENT,
|
|
2579
|
+
bigquery=unmodelled(Reason.COMPOSITE),
|
|
2580
|
+
redshift=ABSENT,
|
|
2581
|
+
databricks=ABSENT,
|
|
2582
|
+
spark=ABSENT,
|
|
2583
|
+
hive=ABSENT,
|
|
2584
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2585
|
+
clickhouse=ABSENT,
|
|
2586
|
+
oracle=ABSENT,
|
|
2587
|
+
trino=ABSENT),
|
|
2588
|
+
Function(exp.JSONFormat, CONSERVATIVE, name="json_format", signatures=[("this", "options")], spelling="trino", example="json_format(CAST('[1]' AS JSON))",
|
|
2589
|
+
duckdb=ABSENT,
|
|
2590
|
+
postgres=ABSENT,
|
|
2591
|
+
mysql=ABSENT,
|
|
2592
|
+
snowflake="VARCHAR",
|
|
2593
|
+
bigquery="STRING",
|
|
2594
|
+
redshift=ABSENT,
|
|
2595
|
+
databricks="STRING",
|
|
2596
|
+
spark="STRING",
|
|
2597
|
+
hive=ABSENT,
|
|
2598
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2599
|
+
clickhouse=ABSENT,
|
|
2600
|
+
oracle=ABSENT,
|
|
2601
|
+
trino="VARCHAR"),
|
|
2602
|
+
|
|
2603
|
+
# composites: the audit's backlog
|
|
2604
|
+
Function(exp.Split, CONSERVATIVE, signatures=[("this", "expression", "limit")], example="split('a,b', ',')",
|
|
2605
|
+
duckdb=unmodelled(Reason.COMPOSITE),
|
|
2606
|
+
postgres=ABSENT,
|
|
2607
|
+
mysql=ABSENT,
|
|
2608
|
+
snowflake=unmodelled(Reason.COMPOSITE),
|
|
2609
|
+
bigquery=unmodelled(Reason.COMPOSITE),
|
|
2610
|
+
redshift=ABSENT,
|
|
2611
|
+
databricks=UNREACHABLE,
|
|
2612
|
+
spark=UNREACHABLE,
|
|
2613
|
+
hive=UNREACHABLE,
|
|
2614
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2615
|
+
clickhouse=unmodelled(Reason.COMPOSITE),
|
|
2616
|
+
oracle=ABSENT,
|
|
2617
|
+
trino=unmodelled(Reason.COMPOSITE)),
|
|
2618
|
+
Function(exp.RegexpSplit, CONSERVATIVE, name="split", signatures=[("this", "expression", "limit")], spelling="spark", example="split('a,b', ',')",
|
|
2619
|
+
duckdb=unmodelled(Reason.COMPOSITE), # `str_split_regex`: a VARCHAR[]
|
|
2620
|
+
postgres=ABSENT,
|
|
2621
|
+
mysql=ABSENT,
|
|
2622
|
+
snowflake=ABSENT,
|
|
2623
|
+
bigquery=ABSENT,
|
|
2624
|
+
redshift=ABSENT,
|
|
2625
|
+
databricks=unmodelled(Reason.COMPOSITE),
|
|
2626
|
+
spark=unmodelled(Reason.COMPOSITE),
|
|
2627
|
+
hive=unmodelled(Reason.COMPOSITE),
|
|
2628
|
+
sqlite=ABSENT,
|
|
2629
|
+
clickhouse=unmodelled(Reason.COMPOSITE),
|
|
2630
|
+
oracle=ABSENT,
|
|
2631
|
+
trino=unmodelled(Reason.COMPOSITE)),
|
|
2632
|
+
Function(exp.ArraySize, CONSERVATIVE, name="array_length", signatures=[("this", "expression")], example="array_length([1, 2])",
|
|
2633
|
+
duckdb="BIGINT",
|
|
2634
|
+
postgres="INTEGER",
|
|
2635
|
+
mysql=ABSENT,
|
|
2636
|
+
snowflake="NUMBER",
|
|
2637
|
+
bigquery="INT64",
|
|
2638
|
+
redshift=ABSENT,
|
|
2639
|
+
databricks="INT",
|
|
2640
|
+
spark="INT",
|
|
2641
|
+
hive="INT",
|
|
2642
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2643
|
+
clickhouse="UInt64",
|
|
2644
|
+
oracle=ABSENT,
|
|
2645
|
+
trino="BIGINT"),
|
|
2646
|
+
Function(exp.Struct, CONSERVATIVE, name="struct", signatures=[("*expressions",)], example="{'a': 1}",
|
|
2647
|
+
duckdb=unmodelled(Reason.COMPOSITE),
|
|
2648
|
+
postgres=unmodelled(Reason.COMPOSITE),
|
|
2649
|
+
mysql=ABSENT,
|
|
2650
|
+
snowflake=unmodelled(Reason.COMPOSITE),
|
|
2651
|
+
bigquery=unmodelled(Reason.COMPOSITE),
|
|
2652
|
+
redshift=unmodelled(Reason.COMPOSITE),
|
|
2653
|
+
databricks=unmodelled(Reason.COMPOSITE),
|
|
2654
|
+
spark=unmodelled(Reason.COMPOSITE),
|
|
2655
|
+
hive=unmodelled(Reason.COMPOSITE),
|
|
2656
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2657
|
+
clickhouse=unmodelled(Reason.COMPOSITE),
|
|
2658
|
+
oracle=unmodelled(Reason.COMPOSITE),
|
|
2659
|
+
trino=unmodelled(Reason.COMPOSITE)),
|
|
2660
|
+
Function(exp.Array, CONSERVATIVE, name="array", signatures=[("*expressions",)], example="[1, 2]",
|
|
2661
|
+
duckdb=unmodelled(Reason.COMPOSITE),
|
|
2662
|
+
postgres=unmodelled(Reason.COMPOSITE),
|
|
2663
|
+
mysql=ABSENT,
|
|
2664
|
+
snowflake=unmodelled(Reason.COMPOSITE),
|
|
2665
|
+
bigquery=unmodelled(Reason.COMPOSITE),
|
|
2666
|
+
redshift=unmodelled(Reason.COMPOSITE),
|
|
2667
|
+
databricks=unmodelled(Reason.COMPOSITE),
|
|
2668
|
+
spark=unmodelled(Reason.COMPOSITE),
|
|
2669
|
+
hive=unmodelled(Reason.COMPOSITE),
|
|
2670
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2671
|
+
clickhouse=unmodelled(Reason.COMPOSITE),
|
|
2672
|
+
oracle=unmodelled(Reason.COMPOSITE),
|
|
2673
|
+
trino=unmodelled(Reason.COMPOSITE)),
|
|
2674
|
+
|
|
2675
|
+
# math (backlog): the audit's backlog
|
|
2676
|
+
Function(exp.IsNan, CONSERVATIVE, name="isnan", signatures=[("this",)], example="isnan(1.5)",
|
|
2677
|
+
duckdb="BOOLEAN",
|
|
2678
|
+
postgres=ABSENT,
|
|
2679
|
+
mysql=ABSENT,
|
|
2680
|
+
snowflake=ABSENT,
|
|
2681
|
+
bigquery="BOOL",
|
|
2682
|
+
redshift=ABSENT,
|
|
2683
|
+
databricks="BOOLEAN",
|
|
2684
|
+
spark="BOOLEAN",
|
|
2685
|
+
hive=ABSENT,
|
|
2686
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2687
|
+
clickhouse="UInt8",
|
|
2688
|
+
oracle=ABSENT,
|
|
2689
|
+
trino="BOOLEAN"),
|
|
2690
|
+
|
|
2691
|
+
# geography: the audit's backlog
|
|
2692
|
+
Function("Anonymous:st_area", CONSERVATIVE, signatures=[("*expressions",)], example="st_area(g)",
|
|
2693
|
+
duckdb=ABSENT,
|
|
2694
|
+
postgres="DOUBLE PRECISION",
|
|
2695
|
+
mysql="DOUBLE",
|
|
2696
|
+
snowflake="FLOAT",
|
|
2697
|
+
bigquery="FLOAT64",
|
|
2698
|
+
redshift="DOUBLE PRECISION",
|
|
2699
|
+
databricks="DOUBLE",
|
|
2700
|
+
spark=ABSENT,
|
|
2701
|
+
hive=ABSENT,
|
|
2702
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2703
|
+
clickhouse=ABSENT,
|
|
2704
|
+
oracle=ABSENT,
|
|
2705
|
+
trino="DOUBLE"),
|
|
2706
|
+
Function("Anonymous:st_intersects", CONSERVATIVE, signatures=[("*expressions",)], example="st_intersects(g, h)",
|
|
2707
|
+
duckdb=ABSENT,
|
|
2708
|
+
postgres="BOOLEAN",
|
|
2709
|
+
mysql="BIGINT",
|
|
2710
|
+
snowflake="BOOLEAN",
|
|
2711
|
+
bigquery="BOOL",
|
|
2712
|
+
redshift="BOOLEAN",
|
|
2713
|
+
databricks="BOOLEAN",
|
|
2714
|
+
spark=ABSENT,
|
|
2715
|
+
hive=ABSENT,
|
|
2716
|
+
sqlite=unmodelled(Reason.STORAGE_CLASS),
|
|
2717
|
+
clickhouse=ABSENT,
|
|
2718
|
+
oracle=ABSENT,
|
|
2719
|
+
trino="BOOLEAN"),
|
|
2720
|
+
|
|
2721
|
+
)
|