clickhouse-orm 3.0.1__py2.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.
- clickhouse_orm/__init__.py +14 -0
- clickhouse_orm/database.py +457 -0
- clickhouse_orm/engines.py +346 -0
- clickhouse_orm/fields.py +665 -0
- clickhouse_orm/funcs.py +1841 -0
- clickhouse_orm/migrations.py +287 -0
- clickhouse_orm/models.py +617 -0
- clickhouse_orm/query.py +701 -0
- clickhouse_orm/system_models.py +170 -0
- clickhouse_orm/utils.py +176 -0
- clickhouse_orm-3.0.1.dist-info/METADATA +90 -0
- clickhouse_orm-3.0.1.dist-info/RECORD +14 -0
- clickhouse_orm-3.0.1.dist-info/WHEEL +5 -0
- clickhouse_orm-3.0.1.dist-info/licenses/LICENSE +27 -0
clickhouse_orm/funcs.py
ADDED
|
@@ -0,0 +1,1841 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from functools import wraps
|
|
4
|
+
from inspect import Parameter, signature
|
|
5
|
+
from types import FunctionType
|
|
6
|
+
|
|
7
|
+
from .query import Cond, QuerySet
|
|
8
|
+
from .utils import NO_VALUE, arg_to_sql, comma_join, is_iterable
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def binary_operator(func):
|
|
12
|
+
"""
|
|
13
|
+
Decorates a function to mark it as a binary operator.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
@wraps(func)
|
|
17
|
+
def wrapper(*args, **kwargs):
|
|
18
|
+
ret = func(*args, **kwargs)
|
|
19
|
+
ret.is_binary_operator = True
|
|
20
|
+
return ret
|
|
21
|
+
|
|
22
|
+
return wrapper
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def type_conversion(func):
|
|
26
|
+
"""
|
|
27
|
+
Decorates a function to mark it as a type conversion function.
|
|
28
|
+
The metaclass automatically generates "OrZero" and "OrNull" combinators
|
|
29
|
+
for the decorated function.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
@wraps(func)
|
|
33
|
+
def wrapper(*args, **kwargs):
|
|
34
|
+
return func(*args, **kwargs)
|
|
35
|
+
|
|
36
|
+
wrapper.f_type = "type_conversion"
|
|
37
|
+
return wrapper
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def aggregate(func):
|
|
41
|
+
"""
|
|
42
|
+
Decorates a function to mark it as an aggregate function.
|
|
43
|
+
The metaclass automatically generates combinators such as "OrDefault",
|
|
44
|
+
"OrNull", "If" etc. for the decorated function.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
@wraps(func)
|
|
48
|
+
def wrapper(*args, **kwargs):
|
|
49
|
+
return func(*args, **kwargs)
|
|
50
|
+
|
|
51
|
+
wrapper.f_type = "aggregate"
|
|
52
|
+
return wrapper
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def with_utf8_support(func):
|
|
56
|
+
"""
|
|
57
|
+
Decorates a function to mark it as a string function that has a UTF8 variant.
|
|
58
|
+
The metaclass automatically generates a "UTF8" combinator for the decorated function.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
@wraps(func)
|
|
62
|
+
def wrapper(*args, **kwargs):
|
|
63
|
+
return func(*args, **kwargs)
|
|
64
|
+
|
|
65
|
+
wrapper.f_type = "with_utf8_support"
|
|
66
|
+
return wrapper
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def parametric(func):
|
|
70
|
+
"""
|
|
71
|
+
Decorates a function to convert it to a parametric function, such
|
|
72
|
+
as `quantile(level)(expr)`.
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
@wraps(func)
|
|
76
|
+
def wrapper(*parameters):
|
|
77
|
+
@wraps(func)
|
|
78
|
+
def inner(*args, **kwargs):
|
|
79
|
+
f = func(*args, **kwargs)
|
|
80
|
+
# Append the parameter to the function name
|
|
81
|
+
parameters_str = comma_join(map(str, parameters))
|
|
82
|
+
f.name = "%s(%s)" % (f.name, parameters_str)
|
|
83
|
+
return f
|
|
84
|
+
|
|
85
|
+
return inner
|
|
86
|
+
|
|
87
|
+
wrapper.f_parametric = True
|
|
88
|
+
return wrapper
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class FunctionOperatorsMixin:
|
|
92
|
+
"""
|
|
93
|
+
A mixin for implementing Python operators using F objects.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
# Comparison operators
|
|
97
|
+
|
|
98
|
+
def __lt__(self, other):
|
|
99
|
+
return F.less(self, other)
|
|
100
|
+
|
|
101
|
+
def __le__(self, other):
|
|
102
|
+
return F.lessOrEquals(self, other)
|
|
103
|
+
|
|
104
|
+
def __eq__(self, other):
|
|
105
|
+
return F.equals(self, other)
|
|
106
|
+
|
|
107
|
+
def __ne__(self, other):
|
|
108
|
+
return F.notEquals(self, other)
|
|
109
|
+
|
|
110
|
+
def __gt__(self, other):
|
|
111
|
+
return F.greater(self, other)
|
|
112
|
+
|
|
113
|
+
def __ge__(self, other):
|
|
114
|
+
return F.greaterOrEquals(self, other)
|
|
115
|
+
|
|
116
|
+
# Arithmetic operators
|
|
117
|
+
|
|
118
|
+
def __add__(self, other):
|
|
119
|
+
return F.plus(self, other)
|
|
120
|
+
|
|
121
|
+
def __radd__(self, other):
|
|
122
|
+
return F.plus(other, self)
|
|
123
|
+
|
|
124
|
+
def __sub__(self, other):
|
|
125
|
+
return F.minus(self, other)
|
|
126
|
+
|
|
127
|
+
def __rsub__(self, other):
|
|
128
|
+
return F.minus(other, self)
|
|
129
|
+
|
|
130
|
+
def __mul__(self, other):
|
|
131
|
+
return F.multiply(self, other)
|
|
132
|
+
|
|
133
|
+
def __rmul__(self, other):
|
|
134
|
+
return F.multiply(other, self)
|
|
135
|
+
|
|
136
|
+
def __truediv__(self, other):
|
|
137
|
+
return F.divide(self, other)
|
|
138
|
+
|
|
139
|
+
def __rtruediv__(self, other):
|
|
140
|
+
return F.divide(other, self)
|
|
141
|
+
|
|
142
|
+
def __floordiv__(self, other):
|
|
143
|
+
return F.intDiv(self, other)
|
|
144
|
+
|
|
145
|
+
def __rfloordiv__(self, other):
|
|
146
|
+
return F.intDiv(other, self)
|
|
147
|
+
|
|
148
|
+
def __mod__(self, other):
|
|
149
|
+
return F.modulo(self, other)
|
|
150
|
+
|
|
151
|
+
def __rmod__(self, other):
|
|
152
|
+
return F.modulo(other, self)
|
|
153
|
+
|
|
154
|
+
def __neg__(self):
|
|
155
|
+
return F.negate(self)
|
|
156
|
+
|
|
157
|
+
def __pos__(self):
|
|
158
|
+
return self
|
|
159
|
+
|
|
160
|
+
# Logical operators
|
|
161
|
+
|
|
162
|
+
def __and__(self, other):
|
|
163
|
+
return F._and(self, other)
|
|
164
|
+
|
|
165
|
+
def __rand__(self, other):
|
|
166
|
+
return F._and(other, self)
|
|
167
|
+
|
|
168
|
+
def __or__(self, other):
|
|
169
|
+
return F._or(self, other)
|
|
170
|
+
|
|
171
|
+
def __ror__(self, other):
|
|
172
|
+
return F._or(other, self)
|
|
173
|
+
|
|
174
|
+
def __xor__(self, other):
|
|
175
|
+
return F._xor(self, other)
|
|
176
|
+
|
|
177
|
+
def __rxor__(self, other):
|
|
178
|
+
return F._xor(other, self)
|
|
179
|
+
|
|
180
|
+
def __invert__(self):
|
|
181
|
+
return F._not(self)
|
|
182
|
+
|
|
183
|
+
def isIn(self, others):
|
|
184
|
+
return F._in(self, others)
|
|
185
|
+
|
|
186
|
+
def isNotIn(self, others):
|
|
187
|
+
return F._notIn(self, others)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class FMeta(type):
|
|
191
|
+
FUNCTION_COMBINATORS = {
|
|
192
|
+
"type_conversion": [
|
|
193
|
+
{"suffix": "OrZero"},
|
|
194
|
+
{"suffix": "OrNull"},
|
|
195
|
+
],
|
|
196
|
+
"aggregate": [
|
|
197
|
+
{"suffix": "OrDefault"},
|
|
198
|
+
{"suffix": "OrNull"},
|
|
199
|
+
{"suffix": "If", "args": ["cond"]},
|
|
200
|
+
{"suffix": "OrDefaultIf", "args": ["cond"]},
|
|
201
|
+
{"suffix": "OrNullIf", "args": ["cond"]},
|
|
202
|
+
],
|
|
203
|
+
"with_utf8_support": [
|
|
204
|
+
{"suffix": "UTF8"},
|
|
205
|
+
],
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
def __init__(cls, name, bases, dct):
|
|
209
|
+
for name, obj in dct.items():
|
|
210
|
+
if hasattr(obj, "__func__"):
|
|
211
|
+
f_type = getattr(obj.__func__, "f_type", "")
|
|
212
|
+
for combinator in FMeta.FUNCTION_COMBINATORS.get(f_type, []):
|
|
213
|
+
new_name = name + combinator["suffix"]
|
|
214
|
+
FMeta._add_func(cls, obj.__func__, new_name, combinator.get("args"))
|
|
215
|
+
|
|
216
|
+
@staticmethod
|
|
217
|
+
def _add_func(cls, base_func, new_name, extra_args):
|
|
218
|
+
"""
|
|
219
|
+
Adds a new func to the cls, based on the signature of the given base_func but with a new name.
|
|
220
|
+
"""
|
|
221
|
+
# Get the function's signature
|
|
222
|
+
sig = signature(base_func)
|
|
223
|
+
new_sig = str(sig)[1:-1] # omit the parentheses
|
|
224
|
+
args = comma_join(sig.parameters)
|
|
225
|
+
# Add extra args
|
|
226
|
+
if extra_args:
|
|
227
|
+
if args:
|
|
228
|
+
args = comma_join([args] + extra_args)
|
|
229
|
+
new_sig = comma_join([new_sig] + extra_args)
|
|
230
|
+
else:
|
|
231
|
+
args = comma_join(extra_args)
|
|
232
|
+
new_sig = comma_join(extra_args)
|
|
233
|
+
# Get default values for args
|
|
234
|
+
argdefs = tuple(p.default for p in sig.parameters.values() if p.default != Parameter.empty)
|
|
235
|
+
# Build the new function
|
|
236
|
+
new_code = compile(
|
|
237
|
+
'def {new_name}({new_sig}): return F("{new_name}", {args})'.format(**locals()), __file__, "exec"
|
|
238
|
+
)
|
|
239
|
+
new_func = FunctionType(code=new_code.co_consts[0], globals=globals(), name=new_name, argdefs=argdefs)
|
|
240
|
+
# If base_func was parametric, new_func should be too
|
|
241
|
+
if getattr(base_func, "f_parametric", False):
|
|
242
|
+
new_func = parametric(new_func)
|
|
243
|
+
# Attach to class
|
|
244
|
+
setattr(cls, new_name, new_func)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
class F(Cond, FunctionOperatorsMixin, metaclass=FMeta):
|
|
248
|
+
"""
|
|
249
|
+
Represents a database function call and its arguments.
|
|
250
|
+
It doubles as a query condition when the function returns a boolean result.
|
|
251
|
+
"""
|
|
252
|
+
|
|
253
|
+
def __init__(self, name, *args):
|
|
254
|
+
"""
|
|
255
|
+
Initializer.
|
|
256
|
+
|
|
257
|
+
"""
|
|
258
|
+
self.name = name
|
|
259
|
+
self.args = args
|
|
260
|
+
self.is_binary_operator = False
|
|
261
|
+
|
|
262
|
+
def __repr__(self):
|
|
263
|
+
return self.to_sql()
|
|
264
|
+
|
|
265
|
+
def to_sql(self, *args):
|
|
266
|
+
"""
|
|
267
|
+
Generates an SQL string for this function and its arguments.
|
|
268
|
+
For example if the function name is a symbol of a binary operator:
|
|
269
|
+
(2.54 * `height`)
|
|
270
|
+
For other functions:
|
|
271
|
+
gcd(12, 300)
|
|
272
|
+
"""
|
|
273
|
+
if self.is_binary_operator:
|
|
274
|
+
prefix = ""
|
|
275
|
+
sep = " " + self.name + " "
|
|
276
|
+
else:
|
|
277
|
+
prefix = self.name
|
|
278
|
+
sep = ", "
|
|
279
|
+
arg_strs = (arg_to_sql(arg) for arg in self.args if arg != NO_VALUE)
|
|
280
|
+
return prefix + "(" + sep.join(arg_strs) + ")"
|
|
281
|
+
|
|
282
|
+
# Arithmetic functions
|
|
283
|
+
|
|
284
|
+
@staticmethod
|
|
285
|
+
@binary_operator
|
|
286
|
+
def plus(a, b):
|
|
287
|
+
return F("+", a, b)
|
|
288
|
+
|
|
289
|
+
@staticmethod
|
|
290
|
+
@binary_operator
|
|
291
|
+
def minus(a, b):
|
|
292
|
+
return F("-", a, b)
|
|
293
|
+
|
|
294
|
+
@staticmethod
|
|
295
|
+
@binary_operator
|
|
296
|
+
def multiply(a, b):
|
|
297
|
+
return F("*", a, b)
|
|
298
|
+
|
|
299
|
+
@staticmethod
|
|
300
|
+
@binary_operator
|
|
301
|
+
def divide(a, b):
|
|
302
|
+
return F("/", a, b)
|
|
303
|
+
|
|
304
|
+
@staticmethod
|
|
305
|
+
def intDiv(a, b):
|
|
306
|
+
return F("intDiv", a, b)
|
|
307
|
+
|
|
308
|
+
@staticmethod
|
|
309
|
+
def intDivOrZero(a, b):
|
|
310
|
+
return F("intDivOrZero", a, b)
|
|
311
|
+
|
|
312
|
+
@staticmethod
|
|
313
|
+
@binary_operator
|
|
314
|
+
def modulo(a, b):
|
|
315
|
+
return F("%", a, b)
|
|
316
|
+
|
|
317
|
+
@staticmethod
|
|
318
|
+
def negate(a):
|
|
319
|
+
return F("negate", a)
|
|
320
|
+
|
|
321
|
+
@staticmethod
|
|
322
|
+
def abs(a):
|
|
323
|
+
return F("abs", a)
|
|
324
|
+
|
|
325
|
+
@staticmethod
|
|
326
|
+
def gcd(a, b):
|
|
327
|
+
return F("gcd", a, b)
|
|
328
|
+
|
|
329
|
+
@staticmethod
|
|
330
|
+
def lcm(a, b):
|
|
331
|
+
return F("lcm", a, b)
|
|
332
|
+
|
|
333
|
+
# Comparison functions
|
|
334
|
+
|
|
335
|
+
@staticmethod
|
|
336
|
+
@binary_operator
|
|
337
|
+
def equals(a, b):
|
|
338
|
+
return F("=", a, b)
|
|
339
|
+
|
|
340
|
+
@staticmethod
|
|
341
|
+
@binary_operator
|
|
342
|
+
def notEquals(a, b):
|
|
343
|
+
return F("!=", a, b)
|
|
344
|
+
|
|
345
|
+
@staticmethod
|
|
346
|
+
@binary_operator
|
|
347
|
+
def less(a, b):
|
|
348
|
+
return F("<", a, b)
|
|
349
|
+
|
|
350
|
+
@staticmethod
|
|
351
|
+
@binary_operator
|
|
352
|
+
def greater(a, b):
|
|
353
|
+
return F(">", a, b)
|
|
354
|
+
|
|
355
|
+
@staticmethod
|
|
356
|
+
@binary_operator
|
|
357
|
+
def lessOrEquals(a, b):
|
|
358
|
+
return F("<=", a, b)
|
|
359
|
+
|
|
360
|
+
@staticmethod
|
|
361
|
+
@binary_operator
|
|
362
|
+
def greaterOrEquals(a, b):
|
|
363
|
+
return F(">=", a, b)
|
|
364
|
+
|
|
365
|
+
# Logical functions (should be used as python operators: & | ^ ~)
|
|
366
|
+
|
|
367
|
+
@staticmethod
|
|
368
|
+
@binary_operator
|
|
369
|
+
def _and(a, b):
|
|
370
|
+
return F("AND", a, b)
|
|
371
|
+
|
|
372
|
+
@staticmethod
|
|
373
|
+
@binary_operator
|
|
374
|
+
def _or(a, b):
|
|
375
|
+
return F("OR", a, b)
|
|
376
|
+
|
|
377
|
+
@staticmethod
|
|
378
|
+
def _xor(a, b):
|
|
379
|
+
return F("xor", a, b)
|
|
380
|
+
|
|
381
|
+
@staticmethod
|
|
382
|
+
def _not(a):
|
|
383
|
+
return F("not", a)
|
|
384
|
+
|
|
385
|
+
# in / not in
|
|
386
|
+
|
|
387
|
+
@staticmethod
|
|
388
|
+
@binary_operator
|
|
389
|
+
def _in(a, b):
|
|
390
|
+
if is_iterable(b) and not isinstance(b, (tuple, QuerySet)):
|
|
391
|
+
b = tuple(b)
|
|
392
|
+
return F("IN", a, b)
|
|
393
|
+
|
|
394
|
+
@staticmethod
|
|
395
|
+
@binary_operator
|
|
396
|
+
def _notIn(a, b):
|
|
397
|
+
if is_iterable(b) and not isinstance(b, (tuple, QuerySet)):
|
|
398
|
+
b = tuple(b)
|
|
399
|
+
return F("NOT IN", a, b)
|
|
400
|
+
|
|
401
|
+
# Functions for working with dates and times
|
|
402
|
+
|
|
403
|
+
@staticmethod
|
|
404
|
+
def toYear(d, timezone=NO_VALUE):
|
|
405
|
+
return F("toYear", d, timezone)
|
|
406
|
+
|
|
407
|
+
@staticmethod
|
|
408
|
+
def toISOYear(d, timezone=NO_VALUE):
|
|
409
|
+
return F("toISOYear", d, timezone)
|
|
410
|
+
|
|
411
|
+
@staticmethod
|
|
412
|
+
def toQuarter(d, timezone=NO_VALUE):
|
|
413
|
+
return F("toQuarter", d, timezone) if timezone else F("toQuarter", d)
|
|
414
|
+
|
|
415
|
+
@staticmethod
|
|
416
|
+
def toMonth(d, timezone=NO_VALUE):
|
|
417
|
+
return F("toMonth", d, timezone)
|
|
418
|
+
|
|
419
|
+
@staticmethod
|
|
420
|
+
def toWeek(d, mode=0, timezone=NO_VALUE):
|
|
421
|
+
return F("toWeek", d, mode, timezone)
|
|
422
|
+
|
|
423
|
+
@staticmethod
|
|
424
|
+
def toISOWeek(d, timezone=NO_VALUE):
|
|
425
|
+
return F("toISOWeek", d, timezone) if timezone else F("toISOWeek", d)
|
|
426
|
+
|
|
427
|
+
@staticmethod
|
|
428
|
+
def toDayOfYear(d, timezone=NO_VALUE):
|
|
429
|
+
return F("toDayOfYear", d, timezone)
|
|
430
|
+
|
|
431
|
+
@staticmethod
|
|
432
|
+
def toDayOfMonth(d, timezone=NO_VALUE):
|
|
433
|
+
return F("toDayOfMonth", d, timezone)
|
|
434
|
+
|
|
435
|
+
@staticmethod
|
|
436
|
+
def toDayOfWeek(d, timezone=NO_VALUE):
|
|
437
|
+
return F("toDayOfWeek", d, timezone)
|
|
438
|
+
|
|
439
|
+
@staticmethod
|
|
440
|
+
def toHour(d, timezone=NO_VALUE):
|
|
441
|
+
return F("toHour", d, timezone)
|
|
442
|
+
|
|
443
|
+
@staticmethod
|
|
444
|
+
def toMinute(d, timezone=NO_VALUE):
|
|
445
|
+
return F("toMinute", d, timezone)
|
|
446
|
+
|
|
447
|
+
@staticmethod
|
|
448
|
+
def toSecond(d, timezone=NO_VALUE):
|
|
449
|
+
return F("toSecond", d, timezone)
|
|
450
|
+
|
|
451
|
+
@staticmethod
|
|
452
|
+
def toMonday(d, timezone=NO_VALUE):
|
|
453
|
+
return F("toMonday", d, timezone)
|
|
454
|
+
|
|
455
|
+
@staticmethod
|
|
456
|
+
def toStartOfMonth(d, timezone=NO_VALUE):
|
|
457
|
+
return F("toStartOfMonth", d, timezone)
|
|
458
|
+
|
|
459
|
+
@staticmethod
|
|
460
|
+
def toStartOfQuarter(d, timezone=NO_VALUE):
|
|
461
|
+
return F("toStartOfQuarter", d, timezone)
|
|
462
|
+
|
|
463
|
+
@staticmethod
|
|
464
|
+
def toStartOfYear(d, timezone=NO_VALUE):
|
|
465
|
+
return F("toStartOfYear", d, timezone)
|
|
466
|
+
|
|
467
|
+
@staticmethod
|
|
468
|
+
def toStartOfISOYear(d, timezone=NO_VALUE):
|
|
469
|
+
return F("toStartOfISOYear", d, timezone)
|
|
470
|
+
|
|
471
|
+
@staticmethod
|
|
472
|
+
def toStartOfTenMinutes(d, timezone=NO_VALUE):
|
|
473
|
+
return F("toStartOfTenMinutes", d, timezone)
|
|
474
|
+
|
|
475
|
+
@staticmethod
|
|
476
|
+
def toStartOfWeek(d, timezone=NO_VALUE):
|
|
477
|
+
return F("toStartOfWeek", d, timezone)
|
|
478
|
+
|
|
479
|
+
@staticmethod
|
|
480
|
+
def toStartOfMinute(d, timezone=NO_VALUE):
|
|
481
|
+
return F("toStartOfMinute", d, timezone)
|
|
482
|
+
|
|
483
|
+
@staticmethod
|
|
484
|
+
def toStartOfFiveMinute(d, timezone=NO_VALUE):
|
|
485
|
+
return F("toStartOfFiveMinute", d, timezone)
|
|
486
|
+
|
|
487
|
+
@staticmethod
|
|
488
|
+
def toStartOfFifteenMinutes(d, timezone=NO_VALUE):
|
|
489
|
+
return F("toStartOfFifteenMinutes", d, timezone)
|
|
490
|
+
|
|
491
|
+
@staticmethod
|
|
492
|
+
def toStartOfHour(d, timezone=NO_VALUE):
|
|
493
|
+
return F("toStartOfHour", d, timezone)
|
|
494
|
+
|
|
495
|
+
@staticmethod
|
|
496
|
+
def toStartOfDay(d, timezone=NO_VALUE):
|
|
497
|
+
return F("toStartOfDay", d, timezone)
|
|
498
|
+
|
|
499
|
+
@staticmethod
|
|
500
|
+
def toTime(d, timezone=NO_VALUE):
|
|
501
|
+
return F("toTime", d, timezone)
|
|
502
|
+
|
|
503
|
+
@staticmethod
|
|
504
|
+
def toTimeZone(dt, timezone):
|
|
505
|
+
return F("toTimeZone", dt, timezone)
|
|
506
|
+
|
|
507
|
+
@staticmethod
|
|
508
|
+
def toUnixTimestamp(dt, timezone=NO_VALUE):
|
|
509
|
+
return F("toUnixTimestamp", dt, timezone)
|
|
510
|
+
|
|
511
|
+
@staticmethod
|
|
512
|
+
def toYYYYMM(dt, timezone=NO_VALUE):
|
|
513
|
+
return F("toYYYYMM", dt, timezone) if timezone else F("toYYYYMM", dt)
|
|
514
|
+
|
|
515
|
+
@staticmethod
|
|
516
|
+
def toYYYYMMDD(dt, timezone=NO_VALUE):
|
|
517
|
+
return F("toYYYYMMDD", dt, timezone) if timezone else F("toYYYYMMDD", dt)
|
|
518
|
+
|
|
519
|
+
@staticmethod
|
|
520
|
+
def toYYYYMMDDhhmmss(dt, timezone=NO_VALUE):
|
|
521
|
+
return F("toYYYYMMDDhhmmss", dt, timezone) if timezone else F("toYYYYMMDDhhmmss", dt)
|
|
522
|
+
|
|
523
|
+
@staticmethod
|
|
524
|
+
def toRelativeYearNum(d, timezone=NO_VALUE):
|
|
525
|
+
return F("toRelativeYearNum", d, timezone)
|
|
526
|
+
|
|
527
|
+
@staticmethod
|
|
528
|
+
def toRelativeMonthNum(d, timezone=NO_VALUE):
|
|
529
|
+
return F("toRelativeMonthNum", d, timezone)
|
|
530
|
+
|
|
531
|
+
@staticmethod
|
|
532
|
+
def toRelativeWeekNum(d, timezone=NO_VALUE):
|
|
533
|
+
return F("toRelativeWeekNum", d, timezone)
|
|
534
|
+
|
|
535
|
+
@staticmethod
|
|
536
|
+
def toRelativeDayNum(d, timezone=NO_VALUE):
|
|
537
|
+
return F("toRelativeDayNum", d, timezone)
|
|
538
|
+
|
|
539
|
+
@staticmethod
|
|
540
|
+
def toRelativeHourNum(d, timezone=NO_VALUE):
|
|
541
|
+
return F("toRelativeHourNum", d, timezone)
|
|
542
|
+
|
|
543
|
+
@staticmethod
|
|
544
|
+
def toRelativeMinuteNum(d, timezone=NO_VALUE):
|
|
545
|
+
return F("toRelativeMinuteNum", d, timezone)
|
|
546
|
+
|
|
547
|
+
@staticmethod
|
|
548
|
+
def toRelativeSecondNum(d, timezone=NO_VALUE):
|
|
549
|
+
return F("toRelativeSecondNum", d, timezone)
|
|
550
|
+
|
|
551
|
+
@staticmethod
|
|
552
|
+
def now():
|
|
553
|
+
return F("now")
|
|
554
|
+
|
|
555
|
+
@staticmethod
|
|
556
|
+
def today():
|
|
557
|
+
return F("today")
|
|
558
|
+
|
|
559
|
+
@staticmethod
|
|
560
|
+
def yesterday():
|
|
561
|
+
return F("yesterday")
|
|
562
|
+
|
|
563
|
+
@staticmethod
|
|
564
|
+
def timeSlot(d):
|
|
565
|
+
return F("timeSlot", d)
|
|
566
|
+
|
|
567
|
+
@staticmethod
|
|
568
|
+
def timeSlots(start_time, duration):
|
|
569
|
+
return F("timeSlots", start_time, F.toUInt32(duration))
|
|
570
|
+
|
|
571
|
+
@staticmethod
|
|
572
|
+
def formatDateTime(d, format, timezone=NO_VALUE):
|
|
573
|
+
return F("formatDateTime", d, format, timezone)
|
|
574
|
+
|
|
575
|
+
@staticmethod
|
|
576
|
+
def addDays(d, n, timezone=NO_VALUE):
|
|
577
|
+
return F("addDays", d, n, timezone)
|
|
578
|
+
|
|
579
|
+
@staticmethod
|
|
580
|
+
def addHours(d, n, timezone=NO_VALUE):
|
|
581
|
+
return F("addHours", d, n, timezone)
|
|
582
|
+
|
|
583
|
+
@staticmethod
|
|
584
|
+
def addMinutes(d, n, timezone=NO_VALUE):
|
|
585
|
+
return F("addMinutes", d, n, timezone)
|
|
586
|
+
|
|
587
|
+
@staticmethod
|
|
588
|
+
def addMonths(d, n, timezone=NO_VALUE):
|
|
589
|
+
return F("addMonths", d, n, timezone)
|
|
590
|
+
|
|
591
|
+
@staticmethod
|
|
592
|
+
def addQuarters(d, n, timezone=NO_VALUE):
|
|
593
|
+
return F("addQuarters", d, n, timezone)
|
|
594
|
+
|
|
595
|
+
@staticmethod
|
|
596
|
+
def addSeconds(d, n, timezone=NO_VALUE):
|
|
597
|
+
return F("addSeconds", d, n, timezone)
|
|
598
|
+
|
|
599
|
+
@staticmethod
|
|
600
|
+
def addWeeks(d, n, timezone=NO_VALUE):
|
|
601
|
+
return F("addWeeks", d, n, timezone)
|
|
602
|
+
|
|
603
|
+
@staticmethod
|
|
604
|
+
def addYears(d, n, timezone=NO_VALUE):
|
|
605
|
+
return F("addYears", d, n, timezone)
|
|
606
|
+
|
|
607
|
+
@staticmethod
|
|
608
|
+
def subtractDays(d, n, timezone=NO_VALUE):
|
|
609
|
+
return F("subtractDays", d, n, timezone)
|
|
610
|
+
|
|
611
|
+
@staticmethod
|
|
612
|
+
def subtractHours(d, n, timezone=NO_VALUE):
|
|
613
|
+
return F("subtractHours", d, n, timezone)
|
|
614
|
+
|
|
615
|
+
@staticmethod
|
|
616
|
+
def subtractMinutes(d, n, timezone=NO_VALUE):
|
|
617
|
+
return F("subtractMinutes", d, n, timezone)
|
|
618
|
+
|
|
619
|
+
@staticmethod
|
|
620
|
+
def subtractMonths(d, n, timezone=NO_VALUE):
|
|
621
|
+
return F("subtractMonths", d, n, timezone)
|
|
622
|
+
|
|
623
|
+
@staticmethod
|
|
624
|
+
def subtractQuarters(d, n, timezone=NO_VALUE):
|
|
625
|
+
return F("subtractQuarters", d, n, timezone)
|
|
626
|
+
|
|
627
|
+
@staticmethod
|
|
628
|
+
def subtractSeconds(d, n, timezone=NO_VALUE):
|
|
629
|
+
return F("subtractSeconds", d, n, timezone)
|
|
630
|
+
|
|
631
|
+
@staticmethod
|
|
632
|
+
def subtractWeeks(d, n, timezone=NO_VALUE):
|
|
633
|
+
return F("subtractWeeks", d, n, timezone)
|
|
634
|
+
|
|
635
|
+
@staticmethod
|
|
636
|
+
def subtractYears(d, n, timezone=NO_VALUE):
|
|
637
|
+
return F("subtractYears", d, n, timezone)
|
|
638
|
+
|
|
639
|
+
@staticmethod
|
|
640
|
+
def toIntervalSecond(number):
|
|
641
|
+
return F("toIntervalSecond", number)
|
|
642
|
+
|
|
643
|
+
@staticmethod
|
|
644
|
+
def toIntervalMinute(number):
|
|
645
|
+
return F("toIntervalMinute", number)
|
|
646
|
+
|
|
647
|
+
@staticmethod
|
|
648
|
+
def toIntervalHour(number):
|
|
649
|
+
return F("toIntervalHour", number)
|
|
650
|
+
|
|
651
|
+
@staticmethod
|
|
652
|
+
def toIntervalDay(number):
|
|
653
|
+
return F("toIntervalDay", number)
|
|
654
|
+
|
|
655
|
+
@staticmethod
|
|
656
|
+
def toIntervalWeek(number):
|
|
657
|
+
return F("toIntervalWeek", number)
|
|
658
|
+
|
|
659
|
+
@staticmethod
|
|
660
|
+
def toIntervalMonth(number):
|
|
661
|
+
return F("toIntervalMonth", number)
|
|
662
|
+
|
|
663
|
+
@staticmethod
|
|
664
|
+
def toIntervalQuarter(number):
|
|
665
|
+
return F("toIntervalQuarter", number)
|
|
666
|
+
|
|
667
|
+
@staticmethod
|
|
668
|
+
def toIntervalYear(number):
|
|
669
|
+
return F("toIntervalYear", number)
|
|
670
|
+
|
|
671
|
+
# Type conversion functions
|
|
672
|
+
|
|
673
|
+
@staticmethod
|
|
674
|
+
@type_conversion
|
|
675
|
+
def toUInt8(x):
|
|
676
|
+
return F("toUInt8", x)
|
|
677
|
+
|
|
678
|
+
@staticmethod
|
|
679
|
+
@type_conversion
|
|
680
|
+
def toUInt16(x):
|
|
681
|
+
return F("toUInt16", x)
|
|
682
|
+
|
|
683
|
+
@staticmethod
|
|
684
|
+
@type_conversion
|
|
685
|
+
def toUInt32(x):
|
|
686
|
+
return F("toUInt32", x)
|
|
687
|
+
|
|
688
|
+
@staticmethod
|
|
689
|
+
@type_conversion
|
|
690
|
+
def toUInt64(x):
|
|
691
|
+
return F("toUInt64", x)
|
|
692
|
+
|
|
693
|
+
@staticmethod
|
|
694
|
+
@type_conversion
|
|
695
|
+
def toInt8(x):
|
|
696
|
+
return F("toInt8", x)
|
|
697
|
+
|
|
698
|
+
@staticmethod
|
|
699
|
+
@type_conversion
|
|
700
|
+
def toInt16(x):
|
|
701
|
+
return F("toInt16", x)
|
|
702
|
+
|
|
703
|
+
@staticmethod
|
|
704
|
+
@type_conversion
|
|
705
|
+
def toInt32(x):
|
|
706
|
+
return F("toInt32", x)
|
|
707
|
+
|
|
708
|
+
@staticmethod
|
|
709
|
+
@type_conversion
|
|
710
|
+
def toInt64(x):
|
|
711
|
+
return F("toInt64", x)
|
|
712
|
+
|
|
713
|
+
@staticmethod
|
|
714
|
+
@type_conversion
|
|
715
|
+
def toFloat32(x):
|
|
716
|
+
return F("toFloat32", x)
|
|
717
|
+
|
|
718
|
+
@staticmethod
|
|
719
|
+
@type_conversion
|
|
720
|
+
def toFloat64(x):
|
|
721
|
+
return F("toFloat64", x)
|
|
722
|
+
|
|
723
|
+
@staticmethod
|
|
724
|
+
@type_conversion
|
|
725
|
+
def toDecimal32(x, scale):
|
|
726
|
+
return F("toDecimal32", x, scale)
|
|
727
|
+
|
|
728
|
+
@staticmethod
|
|
729
|
+
@type_conversion
|
|
730
|
+
def toDecimal64(x, scale):
|
|
731
|
+
return F("toDecimal64", x, scale)
|
|
732
|
+
|
|
733
|
+
@staticmethod
|
|
734
|
+
@type_conversion
|
|
735
|
+
def toDecimal128(x, scale):
|
|
736
|
+
return F("toDecimal128", x, scale)
|
|
737
|
+
|
|
738
|
+
@staticmethod
|
|
739
|
+
@type_conversion
|
|
740
|
+
def toDate(x):
|
|
741
|
+
return F("toDate", x)
|
|
742
|
+
|
|
743
|
+
@staticmethod
|
|
744
|
+
@type_conversion
|
|
745
|
+
def toDateTime(x):
|
|
746
|
+
return F("toDateTime", x)
|
|
747
|
+
|
|
748
|
+
@staticmethod
|
|
749
|
+
@type_conversion
|
|
750
|
+
def toDateTime64(x, precision, timezone=NO_VALUE):
|
|
751
|
+
return F("toDateTime64", x, precision, timezone)
|
|
752
|
+
|
|
753
|
+
@staticmethod
|
|
754
|
+
def toString(x):
|
|
755
|
+
return F("toString", x)
|
|
756
|
+
|
|
757
|
+
@staticmethod
|
|
758
|
+
def toFixedString(s, length):
|
|
759
|
+
return F("toFixedString", s, length)
|
|
760
|
+
|
|
761
|
+
@staticmethod
|
|
762
|
+
def toStringCutToZero(s):
|
|
763
|
+
return F("toStringCutToZero", s)
|
|
764
|
+
|
|
765
|
+
@staticmethod
|
|
766
|
+
def CAST(x, type):
|
|
767
|
+
return F("CAST", x, type)
|
|
768
|
+
|
|
769
|
+
@staticmethod
|
|
770
|
+
@type_conversion
|
|
771
|
+
def parseDateTimeBestEffort(d, timezone=NO_VALUE):
|
|
772
|
+
return F("parseDateTimeBestEffort", d, timezone)
|
|
773
|
+
|
|
774
|
+
# Functions for working with strings
|
|
775
|
+
|
|
776
|
+
@staticmethod
|
|
777
|
+
def empty(s):
|
|
778
|
+
return F("empty", s)
|
|
779
|
+
|
|
780
|
+
@staticmethod
|
|
781
|
+
def notEmpty(s):
|
|
782
|
+
return F("notEmpty", s)
|
|
783
|
+
|
|
784
|
+
@staticmethod
|
|
785
|
+
@with_utf8_support
|
|
786
|
+
def length(s):
|
|
787
|
+
return F("length", s)
|
|
788
|
+
|
|
789
|
+
@staticmethod
|
|
790
|
+
@with_utf8_support
|
|
791
|
+
def lower(s):
|
|
792
|
+
return F("lower", s)
|
|
793
|
+
|
|
794
|
+
@staticmethod
|
|
795
|
+
@with_utf8_support
|
|
796
|
+
def upper(s):
|
|
797
|
+
return F("upper", s)
|
|
798
|
+
|
|
799
|
+
@staticmethod
|
|
800
|
+
@with_utf8_support
|
|
801
|
+
def reverse(s):
|
|
802
|
+
return F("reverse", s)
|
|
803
|
+
|
|
804
|
+
@staticmethod
|
|
805
|
+
def concat(*args):
|
|
806
|
+
return F("concat", *args)
|
|
807
|
+
|
|
808
|
+
@staticmethod
|
|
809
|
+
@with_utf8_support
|
|
810
|
+
def substring(s, offset, length):
|
|
811
|
+
return F("substring", s, offset, length)
|
|
812
|
+
|
|
813
|
+
@staticmethod
|
|
814
|
+
def appendTrailingCharIfAbsent(s, c):
|
|
815
|
+
return F("appendTrailingCharIfAbsent", s, c)
|
|
816
|
+
|
|
817
|
+
@staticmethod
|
|
818
|
+
def convertCharset(s, from_charset, to_charset):
|
|
819
|
+
return F("convertCharset", s, from_charset, to_charset)
|
|
820
|
+
|
|
821
|
+
@staticmethod
|
|
822
|
+
def base64Encode(s):
|
|
823
|
+
return F("base64Encode", s)
|
|
824
|
+
|
|
825
|
+
@staticmethod
|
|
826
|
+
def base64Decode(s):
|
|
827
|
+
return F("base64Decode", s)
|
|
828
|
+
|
|
829
|
+
@staticmethod
|
|
830
|
+
def tryBase64Decode(s):
|
|
831
|
+
return F("tryBase64Decode", s)
|
|
832
|
+
|
|
833
|
+
@staticmethod
|
|
834
|
+
def endsWith(s, suffix):
|
|
835
|
+
return F("endsWith", s, suffix)
|
|
836
|
+
|
|
837
|
+
@staticmethod
|
|
838
|
+
def startsWith(s, prefix):
|
|
839
|
+
return F("startsWith", s, prefix)
|
|
840
|
+
|
|
841
|
+
@staticmethod
|
|
842
|
+
def trimLeft(s):
|
|
843
|
+
return F("trimLeft", s)
|
|
844
|
+
|
|
845
|
+
@staticmethod
|
|
846
|
+
def trimRight(s):
|
|
847
|
+
return F("trimRight", s)
|
|
848
|
+
|
|
849
|
+
@staticmethod
|
|
850
|
+
def trimBoth(s):
|
|
851
|
+
return F("trimBoth", s)
|
|
852
|
+
|
|
853
|
+
@staticmethod
|
|
854
|
+
def CRC32(s):
|
|
855
|
+
return F("CRC32", s)
|
|
856
|
+
|
|
857
|
+
# Functions for searching in strings
|
|
858
|
+
|
|
859
|
+
@staticmethod
|
|
860
|
+
@with_utf8_support
|
|
861
|
+
def position(haystack, needle):
|
|
862
|
+
return F("position", haystack, needle)
|
|
863
|
+
|
|
864
|
+
@staticmethod
|
|
865
|
+
@with_utf8_support
|
|
866
|
+
def positionCaseInsensitive(haystack, needle):
|
|
867
|
+
return F("positionCaseInsensitive", haystack, needle)
|
|
868
|
+
|
|
869
|
+
@staticmethod
|
|
870
|
+
def like(haystack, pattern):
|
|
871
|
+
return F("like", haystack, pattern)
|
|
872
|
+
|
|
873
|
+
@staticmethod
|
|
874
|
+
def notLike(haystack, pattern):
|
|
875
|
+
return F("notLike", haystack, pattern)
|
|
876
|
+
|
|
877
|
+
@staticmethod
|
|
878
|
+
def match(haystack, pattern):
|
|
879
|
+
return F("match", haystack, pattern)
|
|
880
|
+
|
|
881
|
+
@staticmethod
|
|
882
|
+
def extract(haystack, pattern):
|
|
883
|
+
return F("extract", haystack, pattern)
|
|
884
|
+
|
|
885
|
+
@staticmethod
|
|
886
|
+
def extractAll(haystack, pattern):
|
|
887
|
+
return F("extractAll", haystack, pattern)
|
|
888
|
+
|
|
889
|
+
@staticmethod
|
|
890
|
+
@with_utf8_support
|
|
891
|
+
def ngramDistance(haystack, needle):
|
|
892
|
+
return F("ngramDistance", haystack, needle)
|
|
893
|
+
|
|
894
|
+
@staticmethod
|
|
895
|
+
@with_utf8_support
|
|
896
|
+
def ngramDistanceCaseInsensitive(haystack, needle):
|
|
897
|
+
return F("ngramDistanceCaseInsensitive", haystack, needle)
|
|
898
|
+
|
|
899
|
+
@staticmethod
|
|
900
|
+
@with_utf8_support
|
|
901
|
+
def ngramSearch(haystack, needle):
|
|
902
|
+
return F("ngramSearch", haystack, needle)
|
|
903
|
+
|
|
904
|
+
@staticmethod
|
|
905
|
+
@with_utf8_support
|
|
906
|
+
def ngramSearchCaseInsensitive(haystack, needle):
|
|
907
|
+
return F("ngramSearchCaseInsensitive", haystack, needle)
|
|
908
|
+
|
|
909
|
+
# Functions for replacing in strings
|
|
910
|
+
|
|
911
|
+
@staticmethod
|
|
912
|
+
def replace(haystack, pattern, replacement):
|
|
913
|
+
return F("replace", haystack, pattern, replacement)
|
|
914
|
+
|
|
915
|
+
@staticmethod
|
|
916
|
+
def replaceAll(haystack, pattern, replacement):
|
|
917
|
+
return F("replaceAll", haystack, pattern, replacement)
|
|
918
|
+
|
|
919
|
+
@staticmethod
|
|
920
|
+
def replaceOne(haystack, pattern, replacement):
|
|
921
|
+
return F("replaceOne", haystack, pattern, replacement)
|
|
922
|
+
|
|
923
|
+
@staticmethod
|
|
924
|
+
def replaceRegexpAll(haystack, pattern, replacement):
|
|
925
|
+
return F("replaceRegexpAll", haystack, pattern, replacement)
|
|
926
|
+
|
|
927
|
+
@staticmethod
|
|
928
|
+
def replaceRegexpOne(haystack, pattern, replacement):
|
|
929
|
+
return F("replaceRegexpOne", haystack, pattern, replacement)
|
|
930
|
+
|
|
931
|
+
@staticmethod
|
|
932
|
+
def regexpQuoteMeta(x):
|
|
933
|
+
return F("regexpQuoteMeta", x)
|
|
934
|
+
|
|
935
|
+
# Mathematical functions
|
|
936
|
+
|
|
937
|
+
@staticmethod
|
|
938
|
+
def e():
|
|
939
|
+
return F("e")
|
|
940
|
+
|
|
941
|
+
@staticmethod
|
|
942
|
+
def pi():
|
|
943
|
+
return F("pi")
|
|
944
|
+
|
|
945
|
+
@staticmethod
|
|
946
|
+
def exp(x):
|
|
947
|
+
return F("exp", x)
|
|
948
|
+
|
|
949
|
+
@staticmethod
|
|
950
|
+
def log(x):
|
|
951
|
+
return F("log", x)
|
|
952
|
+
|
|
953
|
+
ln = log
|
|
954
|
+
|
|
955
|
+
@staticmethod
|
|
956
|
+
def exp2(x):
|
|
957
|
+
return F("exp2", x)
|
|
958
|
+
|
|
959
|
+
@staticmethod
|
|
960
|
+
def log2(x):
|
|
961
|
+
return F("log2", x)
|
|
962
|
+
|
|
963
|
+
@staticmethod
|
|
964
|
+
def exp10(x):
|
|
965
|
+
return F("exp10", x)
|
|
966
|
+
|
|
967
|
+
@staticmethod
|
|
968
|
+
def log10(x):
|
|
969
|
+
return F("log10", x)
|
|
970
|
+
|
|
971
|
+
@staticmethod
|
|
972
|
+
def sqrt(x):
|
|
973
|
+
return F("sqrt", x)
|
|
974
|
+
|
|
975
|
+
@staticmethod
|
|
976
|
+
def cbrt(x):
|
|
977
|
+
return F("cbrt", x)
|
|
978
|
+
|
|
979
|
+
@staticmethod
|
|
980
|
+
def erf(x):
|
|
981
|
+
return F("erf", x)
|
|
982
|
+
|
|
983
|
+
@staticmethod
|
|
984
|
+
def erfc(x):
|
|
985
|
+
return F("erfc", x)
|
|
986
|
+
|
|
987
|
+
@staticmethod
|
|
988
|
+
def lgamma(x):
|
|
989
|
+
return F("lgamma", x)
|
|
990
|
+
|
|
991
|
+
@staticmethod
|
|
992
|
+
def tgamma(x):
|
|
993
|
+
return F("tgamma", x)
|
|
994
|
+
|
|
995
|
+
@staticmethod
|
|
996
|
+
def sin(x):
|
|
997
|
+
return F("sin", x)
|
|
998
|
+
|
|
999
|
+
@staticmethod
|
|
1000
|
+
def cos(x):
|
|
1001
|
+
return F("cos", x)
|
|
1002
|
+
|
|
1003
|
+
@staticmethod
|
|
1004
|
+
def tan(x):
|
|
1005
|
+
return F("tan", x)
|
|
1006
|
+
|
|
1007
|
+
@staticmethod
|
|
1008
|
+
def asin(x):
|
|
1009
|
+
return F("asin", x)
|
|
1010
|
+
|
|
1011
|
+
@staticmethod
|
|
1012
|
+
def acos(x):
|
|
1013
|
+
return F("acos", x)
|
|
1014
|
+
|
|
1015
|
+
@staticmethod
|
|
1016
|
+
def atan(x):
|
|
1017
|
+
return F("atan", x)
|
|
1018
|
+
|
|
1019
|
+
@staticmethod
|
|
1020
|
+
def power(x, y):
|
|
1021
|
+
return F("power", x, y)
|
|
1022
|
+
|
|
1023
|
+
pow = power
|
|
1024
|
+
|
|
1025
|
+
@staticmethod
|
|
1026
|
+
def intExp10(x):
|
|
1027
|
+
return F("intExp10", x)
|
|
1028
|
+
|
|
1029
|
+
@staticmethod
|
|
1030
|
+
def intExp2(x):
|
|
1031
|
+
return F("intExp2", x)
|
|
1032
|
+
|
|
1033
|
+
# Rounding functions
|
|
1034
|
+
|
|
1035
|
+
@staticmethod
|
|
1036
|
+
def floor(x, n=None):
|
|
1037
|
+
return F("floor", x, n) if n else F("floor", x)
|
|
1038
|
+
|
|
1039
|
+
@staticmethod
|
|
1040
|
+
def ceiling(x, n=None):
|
|
1041
|
+
return F("ceiling", x, n) if n else F("ceiling", x)
|
|
1042
|
+
|
|
1043
|
+
ceil = ceiling
|
|
1044
|
+
|
|
1045
|
+
@staticmethod
|
|
1046
|
+
def round(x, n=None):
|
|
1047
|
+
return F("round", x, n) if n else F("round", x)
|
|
1048
|
+
|
|
1049
|
+
@staticmethod
|
|
1050
|
+
def roundAge(x):
|
|
1051
|
+
return F("roundAge", x)
|
|
1052
|
+
|
|
1053
|
+
@staticmethod
|
|
1054
|
+
def roundDown(x, y):
|
|
1055
|
+
return F("roundDown", x, y)
|
|
1056
|
+
|
|
1057
|
+
@staticmethod
|
|
1058
|
+
def roundDuration(x):
|
|
1059
|
+
return F("roundDuration", x)
|
|
1060
|
+
|
|
1061
|
+
@staticmethod
|
|
1062
|
+
def roundToExp2(x):
|
|
1063
|
+
return F("roundToExp2", x)
|
|
1064
|
+
|
|
1065
|
+
# Functions for working with arrays
|
|
1066
|
+
|
|
1067
|
+
@staticmethod
|
|
1068
|
+
def emptyArrayDate():
|
|
1069
|
+
return F("emptyArrayDate")
|
|
1070
|
+
|
|
1071
|
+
@staticmethod
|
|
1072
|
+
def emptyArrayDateTime():
|
|
1073
|
+
return F("emptyArrayDateTime")
|
|
1074
|
+
|
|
1075
|
+
@staticmethod
|
|
1076
|
+
def emptyArrayFloat32():
|
|
1077
|
+
return F("emptyArrayFloat32")
|
|
1078
|
+
|
|
1079
|
+
@staticmethod
|
|
1080
|
+
def emptyArrayFloat64():
|
|
1081
|
+
return F("emptyArrayFloat64")
|
|
1082
|
+
|
|
1083
|
+
@staticmethod
|
|
1084
|
+
def emptyArrayInt16():
|
|
1085
|
+
return F("emptyArrayInt16")
|
|
1086
|
+
|
|
1087
|
+
@staticmethod
|
|
1088
|
+
def emptyArrayInt32():
|
|
1089
|
+
return F("emptyArrayInt32")
|
|
1090
|
+
|
|
1091
|
+
@staticmethod
|
|
1092
|
+
def emptyArrayInt64():
|
|
1093
|
+
return F("emptyArrayInt64")
|
|
1094
|
+
|
|
1095
|
+
@staticmethod
|
|
1096
|
+
def emptyArrayInt8():
|
|
1097
|
+
return F("emptyArrayInt8")
|
|
1098
|
+
|
|
1099
|
+
@staticmethod
|
|
1100
|
+
def emptyArrayString():
|
|
1101
|
+
return F("emptyArrayString")
|
|
1102
|
+
|
|
1103
|
+
@staticmethod
|
|
1104
|
+
def emptyArrayUInt16():
|
|
1105
|
+
return F("emptyArrayUInt16")
|
|
1106
|
+
|
|
1107
|
+
@staticmethod
|
|
1108
|
+
def emptyArrayUInt32():
|
|
1109
|
+
return F("emptyArrayUInt32")
|
|
1110
|
+
|
|
1111
|
+
@staticmethod
|
|
1112
|
+
def emptyArrayUInt64():
|
|
1113
|
+
return F("emptyArrayUInt64")
|
|
1114
|
+
|
|
1115
|
+
@staticmethod
|
|
1116
|
+
def emptyArrayUInt8():
|
|
1117
|
+
return F("emptyArrayUInt8")
|
|
1118
|
+
|
|
1119
|
+
@staticmethod
|
|
1120
|
+
def emptyArrayToSingle(x):
|
|
1121
|
+
return F("emptyArrayToSingle", x)
|
|
1122
|
+
|
|
1123
|
+
@staticmethod
|
|
1124
|
+
def range(n):
|
|
1125
|
+
return F("range", n)
|
|
1126
|
+
|
|
1127
|
+
@staticmethod
|
|
1128
|
+
def array(*args):
|
|
1129
|
+
return F("array", *args)
|
|
1130
|
+
|
|
1131
|
+
@staticmethod
|
|
1132
|
+
def arrayConcat(*args):
|
|
1133
|
+
return F("arrayConcat", *args)
|
|
1134
|
+
|
|
1135
|
+
@staticmethod
|
|
1136
|
+
def arrayElement(arr, n):
|
|
1137
|
+
return F("arrayElement", arr, n)
|
|
1138
|
+
|
|
1139
|
+
@staticmethod
|
|
1140
|
+
def has(arr, x):
|
|
1141
|
+
return F("has", arr, x)
|
|
1142
|
+
|
|
1143
|
+
@staticmethod
|
|
1144
|
+
def hasAll(arr, x):
|
|
1145
|
+
return F("hasAll", arr, x)
|
|
1146
|
+
|
|
1147
|
+
@staticmethod
|
|
1148
|
+
def hasAny(arr, x):
|
|
1149
|
+
return F("hasAny", arr, x)
|
|
1150
|
+
|
|
1151
|
+
@staticmethod
|
|
1152
|
+
def indexOf(arr, x):
|
|
1153
|
+
return F("indexOf", arr, x)
|
|
1154
|
+
|
|
1155
|
+
@staticmethod
|
|
1156
|
+
def countEqual(arr, x):
|
|
1157
|
+
return F("countEqual", arr, x)
|
|
1158
|
+
|
|
1159
|
+
@staticmethod
|
|
1160
|
+
def arrayEnumerate(arr):
|
|
1161
|
+
return F("arrayEnumerate", arr)
|
|
1162
|
+
|
|
1163
|
+
@staticmethod
|
|
1164
|
+
def arrayEnumerateDense(*args):
|
|
1165
|
+
return F("arrayEnumerateDense", *args)
|
|
1166
|
+
|
|
1167
|
+
@staticmethod
|
|
1168
|
+
def arrayEnumerateDenseRanked(*args):
|
|
1169
|
+
return F("arrayEnumerateDenseRanked", *args)
|
|
1170
|
+
|
|
1171
|
+
@staticmethod
|
|
1172
|
+
def arrayEnumerateUniq(*args):
|
|
1173
|
+
return F("arrayEnumerateUniq", *args)
|
|
1174
|
+
|
|
1175
|
+
@staticmethod
|
|
1176
|
+
def arrayEnumerateUniqRanked(*args):
|
|
1177
|
+
return F("arrayEnumerateUniqRanked", *args)
|
|
1178
|
+
|
|
1179
|
+
@staticmethod
|
|
1180
|
+
def arrayPopBack(arr):
|
|
1181
|
+
return F("arrayPopBack", arr)
|
|
1182
|
+
|
|
1183
|
+
@staticmethod
|
|
1184
|
+
def arrayPopFront(arr):
|
|
1185
|
+
return F("arrayPopFront", arr)
|
|
1186
|
+
|
|
1187
|
+
@staticmethod
|
|
1188
|
+
def arrayPushBack(arr, x):
|
|
1189
|
+
return F("arrayPushBack", arr, x)
|
|
1190
|
+
|
|
1191
|
+
@staticmethod
|
|
1192
|
+
def arrayPushFront(arr, x):
|
|
1193
|
+
return F("arrayPushFront", arr, x)
|
|
1194
|
+
|
|
1195
|
+
@staticmethod
|
|
1196
|
+
def arrayResize(array, size, extender=None):
|
|
1197
|
+
return F("arrayResize", array, size, extender) if extender is not None else F("arrayResize", array, size)
|
|
1198
|
+
|
|
1199
|
+
@staticmethod
|
|
1200
|
+
def arraySlice(array, offset, length=None):
|
|
1201
|
+
return F("arraySlice", array, offset, length) if length is not None else F("arraySlice", array, offset)
|
|
1202
|
+
|
|
1203
|
+
@staticmethod
|
|
1204
|
+
def arrayUniq(*args):
|
|
1205
|
+
return F("arrayUniq", *args)
|
|
1206
|
+
|
|
1207
|
+
@staticmethod
|
|
1208
|
+
def arrayJoin(arr):
|
|
1209
|
+
return F("arrayJoin", arr)
|
|
1210
|
+
|
|
1211
|
+
@staticmethod
|
|
1212
|
+
def arrayDifference(arr):
|
|
1213
|
+
return F("arrayDifference", arr)
|
|
1214
|
+
|
|
1215
|
+
@staticmethod
|
|
1216
|
+
def arrayDistinct(x):
|
|
1217
|
+
return F("arrayDistinct", x)
|
|
1218
|
+
|
|
1219
|
+
@staticmethod
|
|
1220
|
+
def arrayIntersect(*args):
|
|
1221
|
+
return F("arrayIntersect", *args)
|
|
1222
|
+
|
|
1223
|
+
@staticmethod
|
|
1224
|
+
def arrayReduce(agg_func_name, *args):
|
|
1225
|
+
return F("arrayReduce", agg_func_name, *args)
|
|
1226
|
+
|
|
1227
|
+
@staticmethod
|
|
1228
|
+
def arrayReverse(arr):
|
|
1229
|
+
return F("arrayReverse", arr)
|
|
1230
|
+
|
|
1231
|
+
# Functions for splitting and merging strings and arrays
|
|
1232
|
+
|
|
1233
|
+
@staticmethod
|
|
1234
|
+
def splitByChar(sep, s):
|
|
1235
|
+
return F("splitByChar", sep, s)
|
|
1236
|
+
|
|
1237
|
+
@staticmethod
|
|
1238
|
+
def splitByString(sep, s):
|
|
1239
|
+
return F("splitByString", sep, s)
|
|
1240
|
+
|
|
1241
|
+
@staticmethod
|
|
1242
|
+
def arrayStringConcat(arr, sep=None):
|
|
1243
|
+
return F("arrayStringConcat", arr, sep) if sep else F("arrayStringConcat", arr)
|
|
1244
|
+
|
|
1245
|
+
@staticmethod
|
|
1246
|
+
def alphaTokens(s):
|
|
1247
|
+
return F("alphaTokens", s)
|
|
1248
|
+
|
|
1249
|
+
# Bit functions
|
|
1250
|
+
|
|
1251
|
+
@staticmethod
|
|
1252
|
+
def bitAnd(x, y):
|
|
1253
|
+
return F("bitAnd", x, y)
|
|
1254
|
+
|
|
1255
|
+
@staticmethod
|
|
1256
|
+
def bitNot(x):
|
|
1257
|
+
return F("bitNot", x)
|
|
1258
|
+
|
|
1259
|
+
@staticmethod
|
|
1260
|
+
def bitOr(x, y):
|
|
1261
|
+
return F("bitOr", x, y)
|
|
1262
|
+
|
|
1263
|
+
@staticmethod
|
|
1264
|
+
def bitRotateLeft(x, y):
|
|
1265
|
+
return F("bitRotateLeft", x, y)
|
|
1266
|
+
|
|
1267
|
+
@staticmethod
|
|
1268
|
+
def bitRotateRight(x, y):
|
|
1269
|
+
return F("bitRotateRight", x, y)
|
|
1270
|
+
|
|
1271
|
+
@staticmethod
|
|
1272
|
+
def bitShiftLeft(x, y):
|
|
1273
|
+
return F("bitShiftLeft", x, y)
|
|
1274
|
+
|
|
1275
|
+
@staticmethod
|
|
1276
|
+
def bitShiftRight(x, y):
|
|
1277
|
+
return F("bitShiftRight", x, y)
|
|
1278
|
+
|
|
1279
|
+
@staticmethod
|
|
1280
|
+
def bitTest(x, y):
|
|
1281
|
+
return F("bitTest", x, y)
|
|
1282
|
+
|
|
1283
|
+
@staticmethod
|
|
1284
|
+
def bitTestAll(x, *args):
|
|
1285
|
+
return F("bitTestAll", x, *args)
|
|
1286
|
+
|
|
1287
|
+
@staticmethod
|
|
1288
|
+
def bitTestAny(x, *args):
|
|
1289
|
+
return F("bitTestAny", x, *args)
|
|
1290
|
+
|
|
1291
|
+
@staticmethod
|
|
1292
|
+
def bitXor(x, y):
|
|
1293
|
+
return F("bitXor", x, y)
|
|
1294
|
+
|
|
1295
|
+
# Bitmap functions
|
|
1296
|
+
|
|
1297
|
+
@staticmethod
|
|
1298
|
+
def bitmapAnd(x, y):
|
|
1299
|
+
return F("bitmapAnd", x, y)
|
|
1300
|
+
|
|
1301
|
+
@staticmethod
|
|
1302
|
+
def bitmapAndCardinality(x, y):
|
|
1303
|
+
return F("bitmapAndCardinality", x, y)
|
|
1304
|
+
|
|
1305
|
+
@staticmethod
|
|
1306
|
+
def bitmapAndnot(x, y):
|
|
1307
|
+
return F("bitmapAndnot", x, y)
|
|
1308
|
+
|
|
1309
|
+
@staticmethod
|
|
1310
|
+
def bitmapAndnotCardinality(x, y):
|
|
1311
|
+
return F("bitmapAndnotCardinality", x, y)
|
|
1312
|
+
|
|
1313
|
+
@staticmethod
|
|
1314
|
+
def bitmapBuild(x):
|
|
1315
|
+
return F("bitmapBuild", x)
|
|
1316
|
+
|
|
1317
|
+
@staticmethod
|
|
1318
|
+
def bitmapCardinality(x):
|
|
1319
|
+
return F("bitmapCardinality", x)
|
|
1320
|
+
|
|
1321
|
+
@staticmethod
|
|
1322
|
+
def bitmapContains(haystack, needle):
|
|
1323
|
+
return F("bitmapContains", haystack, needle)
|
|
1324
|
+
|
|
1325
|
+
@staticmethod
|
|
1326
|
+
def bitmapHasAll(x, y):
|
|
1327
|
+
return F("bitmapHasAll", x, y)
|
|
1328
|
+
|
|
1329
|
+
@staticmethod
|
|
1330
|
+
def bitmapHasAny(x, y):
|
|
1331
|
+
return F("bitmapHasAny", x, y)
|
|
1332
|
+
|
|
1333
|
+
@staticmethod
|
|
1334
|
+
def bitmapOr(x, y):
|
|
1335
|
+
return F("bitmapOr", x, y)
|
|
1336
|
+
|
|
1337
|
+
@staticmethod
|
|
1338
|
+
def bitmapOrCardinality(x, y):
|
|
1339
|
+
return F("bitmapOrCardinality", x, y)
|
|
1340
|
+
|
|
1341
|
+
@staticmethod
|
|
1342
|
+
def bitmapToArray(x):
|
|
1343
|
+
return F("bitmapToArray", x)
|
|
1344
|
+
|
|
1345
|
+
@staticmethod
|
|
1346
|
+
def bitmapXor(x, y):
|
|
1347
|
+
return F("bitmapXor", x, y)
|
|
1348
|
+
|
|
1349
|
+
@staticmethod
|
|
1350
|
+
def bitmapXorCardinality(x, y):
|
|
1351
|
+
return F("bitmapXorCardinality", x, y)
|
|
1352
|
+
|
|
1353
|
+
# Hash functions
|
|
1354
|
+
|
|
1355
|
+
@staticmethod
|
|
1356
|
+
def halfMD5(*args):
|
|
1357
|
+
return F("halfMD5", *args)
|
|
1358
|
+
|
|
1359
|
+
@staticmethod
|
|
1360
|
+
def MD5(s):
|
|
1361
|
+
return F("MD5", s)
|
|
1362
|
+
|
|
1363
|
+
@staticmethod
|
|
1364
|
+
def sipHash128(*args):
|
|
1365
|
+
return F("sipHash128", *args)
|
|
1366
|
+
|
|
1367
|
+
@staticmethod
|
|
1368
|
+
def sipHash64(*args):
|
|
1369
|
+
return F("sipHash64", *args)
|
|
1370
|
+
|
|
1371
|
+
@staticmethod
|
|
1372
|
+
def cityHash64(*args):
|
|
1373
|
+
return F("cityHash64", *args)
|
|
1374
|
+
|
|
1375
|
+
@staticmethod
|
|
1376
|
+
def intHash32(x):
|
|
1377
|
+
return F("intHash32", x)
|
|
1378
|
+
|
|
1379
|
+
@staticmethod
|
|
1380
|
+
def intHash64(x):
|
|
1381
|
+
return F("intHash64", x)
|
|
1382
|
+
|
|
1383
|
+
@staticmethod
|
|
1384
|
+
def SHA1(s):
|
|
1385
|
+
return F("SHA1", s)
|
|
1386
|
+
|
|
1387
|
+
@staticmethod
|
|
1388
|
+
def SHA224(s):
|
|
1389
|
+
return F("SHA224", s)
|
|
1390
|
+
|
|
1391
|
+
@staticmethod
|
|
1392
|
+
def SHA256(s):
|
|
1393
|
+
return F("SHA256", s)
|
|
1394
|
+
|
|
1395
|
+
@staticmethod
|
|
1396
|
+
def URLHash(url, n=None):
|
|
1397
|
+
return F("URLHash", url, n) if n is not None else F("URLHash", url)
|
|
1398
|
+
|
|
1399
|
+
@staticmethod
|
|
1400
|
+
def farmHash64(*args):
|
|
1401
|
+
return F("farmHash64", *args)
|
|
1402
|
+
|
|
1403
|
+
@staticmethod
|
|
1404
|
+
def javaHash(s):
|
|
1405
|
+
return F("javaHash", s)
|
|
1406
|
+
|
|
1407
|
+
@staticmethod
|
|
1408
|
+
def hiveHash(s):
|
|
1409
|
+
return F("hiveHash", s)
|
|
1410
|
+
|
|
1411
|
+
@staticmethod
|
|
1412
|
+
def metroHash64(*args):
|
|
1413
|
+
return F("metroHash64", *args)
|
|
1414
|
+
|
|
1415
|
+
@staticmethod
|
|
1416
|
+
def jumpConsistentHash(x, buckets):
|
|
1417
|
+
return F("jumpConsistentHash", x, buckets)
|
|
1418
|
+
|
|
1419
|
+
@staticmethod
|
|
1420
|
+
def murmurHash2_32(*args):
|
|
1421
|
+
return F("murmurHash2_32", *args)
|
|
1422
|
+
|
|
1423
|
+
@staticmethod
|
|
1424
|
+
def murmurHash2_64(*args):
|
|
1425
|
+
return F("murmurHash2_64", *args)
|
|
1426
|
+
|
|
1427
|
+
@staticmethod
|
|
1428
|
+
def murmurHash3_32(*args):
|
|
1429
|
+
return F("murmurHash3_32", *args)
|
|
1430
|
+
|
|
1431
|
+
@staticmethod
|
|
1432
|
+
def murmurHash3_64(*args):
|
|
1433
|
+
return F("murmurHash3_64", *args)
|
|
1434
|
+
|
|
1435
|
+
@staticmethod
|
|
1436
|
+
def murmurHash3_128(s):
|
|
1437
|
+
return F("murmurHash3_128", s)
|
|
1438
|
+
|
|
1439
|
+
@staticmethod
|
|
1440
|
+
def xxHash32(*args):
|
|
1441
|
+
return F("xxHash32", *args)
|
|
1442
|
+
|
|
1443
|
+
@staticmethod
|
|
1444
|
+
def xxHash64(*args):
|
|
1445
|
+
return F("xxHash64", *args)
|
|
1446
|
+
|
|
1447
|
+
# Functions for generating pseudo-random numbers
|
|
1448
|
+
|
|
1449
|
+
@staticmethod
|
|
1450
|
+
def rand(dummy=None):
|
|
1451
|
+
return F("rand") if dummy is None else F("rand", dummy)
|
|
1452
|
+
|
|
1453
|
+
@staticmethod
|
|
1454
|
+
def rand64(dummy=None):
|
|
1455
|
+
return F("rand64") if dummy is None else F("rand64", dummy)
|
|
1456
|
+
|
|
1457
|
+
@staticmethod
|
|
1458
|
+
def randConstant(dummy=None):
|
|
1459
|
+
return F("randConstant") if dummy is None else F("randConstant", dummy)
|
|
1460
|
+
|
|
1461
|
+
# Encoding functions
|
|
1462
|
+
|
|
1463
|
+
@staticmethod
|
|
1464
|
+
def hex(x):
|
|
1465
|
+
return F("hex", x)
|
|
1466
|
+
|
|
1467
|
+
@staticmethod
|
|
1468
|
+
def unhex(x):
|
|
1469
|
+
return F("unhex", x)
|
|
1470
|
+
|
|
1471
|
+
@staticmethod
|
|
1472
|
+
def bitmaskToArray(x):
|
|
1473
|
+
return F("bitmaskToArray", x)
|
|
1474
|
+
|
|
1475
|
+
@staticmethod
|
|
1476
|
+
def bitmaskToList(x):
|
|
1477
|
+
return F("bitmaskToList", x)
|
|
1478
|
+
|
|
1479
|
+
# Functions for working with UUID
|
|
1480
|
+
|
|
1481
|
+
@staticmethod
|
|
1482
|
+
def generateUUIDv4():
|
|
1483
|
+
return F("generateUUIDv4")
|
|
1484
|
+
|
|
1485
|
+
@staticmethod
|
|
1486
|
+
def toUUID(s):
|
|
1487
|
+
return F("toUUID", s)
|
|
1488
|
+
|
|
1489
|
+
@staticmethod
|
|
1490
|
+
def UUIDNumToString(s):
|
|
1491
|
+
return F("UUIDNumToString", s)
|
|
1492
|
+
|
|
1493
|
+
@staticmethod
|
|
1494
|
+
def UUIDStringToNum(s):
|
|
1495
|
+
return F("UUIDStringToNum", s)
|
|
1496
|
+
|
|
1497
|
+
# Functions for working with IP addresses
|
|
1498
|
+
|
|
1499
|
+
@staticmethod
|
|
1500
|
+
def IPv4CIDRToRange(ipv4, cidr):
|
|
1501
|
+
return F("IPv4CIDRToRange", ipv4, cidr)
|
|
1502
|
+
|
|
1503
|
+
@staticmethod
|
|
1504
|
+
def IPv4NumToString(num):
|
|
1505
|
+
return F("IPv4NumToString", num)
|
|
1506
|
+
|
|
1507
|
+
@staticmethod
|
|
1508
|
+
def IPv4NumToStringClassC(num):
|
|
1509
|
+
return F("IPv4NumToStringClassC", num)
|
|
1510
|
+
|
|
1511
|
+
@staticmethod
|
|
1512
|
+
def IPv4StringToNum(s):
|
|
1513
|
+
return F("IPv4StringToNum", s)
|
|
1514
|
+
|
|
1515
|
+
@staticmethod
|
|
1516
|
+
def IPv4ToIPv6(ipv4):
|
|
1517
|
+
return F("IPv4ToIPv6", ipv4)
|
|
1518
|
+
|
|
1519
|
+
@staticmethod
|
|
1520
|
+
def IPv6CIDRToRange(ipv6, cidr):
|
|
1521
|
+
return F("IPv6CIDRToRange", ipv6, cidr)
|
|
1522
|
+
|
|
1523
|
+
@staticmethod
|
|
1524
|
+
def IPv6NumToString(num):
|
|
1525
|
+
return F("IPv6NumToString", num)
|
|
1526
|
+
|
|
1527
|
+
@staticmethod
|
|
1528
|
+
def IPv6StringToNum(s):
|
|
1529
|
+
return F("IPv6StringToNum", s)
|
|
1530
|
+
|
|
1531
|
+
@staticmethod
|
|
1532
|
+
def toIPv4(ipv4):
|
|
1533
|
+
return F("toIPv4", ipv4)
|
|
1534
|
+
|
|
1535
|
+
@staticmethod
|
|
1536
|
+
def toIPv6(ipv6):
|
|
1537
|
+
return F("toIPv6", ipv6)
|
|
1538
|
+
|
|
1539
|
+
# Aggregate functions
|
|
1540
|
+
|
|
1541
|
+
@staticmethod
|
|
1542
|
+
@aggregate
|
|
1543
|
+
def any(x):
|
|
1544
|
+
return F("any", x)
|
|
1545
|
+
|
|
1546
|
+
@staticmethod
|
|
1547
|
+
@aggregate
|
|
1548
|
+
def anyHeavy(x):
|
|
1549
|
+
return F("anyHeavy", x)
|
|
1550
|
+
|
|
1551
|
+
@staticmethod
|
|
1552
|
+
@aggregate
|
|
1553
|
+
def anyLast(x):
|
|
1554
|
+
return F("anyLast", x)
|
|
1555
|
+
|
|
1556
|
+
@staticmethod
|
|
1557
|
+
@aggregate
|
|
1558
|
+
def argMax(x, y):
|
|
1559
|
+
return F("argMax", x, y)
|
|
1560
|
+
|
|
1561
|
+
@staticmethod
|
|
1562
|
+
@aggregate
|
|
1563
|
+
def argMin(x, y):
|
|
1564
|
+
return F("argMin", x, y)
|
|
1565
|
+
|
|
1566
|
+
@staticmethod
|
|
1567
|
+
@aggregate
|
|
1568
|
+
def avg(x):
|
|
1569
|
+
return F("avg", x)
|
|
1570
|
+
|
|
1571
|
+
@staticmethod
|
|
1572
|
+
@aggregate
|
|
1573
|
+
def corr(x, y):
|
|
1574
|
+
return F("corr", x, y)
|
|
1575
|
+
|
|
1576
|
+
@staticmethod
|
|
1577
|
+
@aggregate
|
|
1578
|
+
def count():
|
|
1579
|
+
return F("count")
|
|
1580
|
+
|
|
1581
|
+
@staticmethod
|
|
1582
|
+
@aggregate
|
|
1583
|
+
def covarPop(x, y):
|
|
1584
|
+
return F("covarPop", x, y)
|
|
1585
|
+
|
|
1586
|
+
@staticmethod
|
|
1587
|
+
@aggregate
|
|
1588
|
+
def covarSamp(x, y):
|
|
1589
|
+
return F("covarSamp", x, y)
|
|
1590
|
+
|
|
1591
|
+
@staticmethod
|
|
1592
|
+
@aggregate
|
|
1593
|
+
def kurtPop(x):
|
|
1594
|
+
return F("kurtPop", x)
|
|
1595
|
+
|
|
1596
|
+
@staticmethod
|
|
1597
|
+
@aggregate
|
|
1598
|
+
def kurtSamp(x):
|
|
1599
|
+
return F("kurtSamp", x)
|
|
1600
|
+
|
|
1601
|
+
@staticmethod
|
|
1602
|
+
@aggregate
|
|
1603
|
+
def min(x):
|
|
1604
|
+
return F("min", x)
|
|
1605
|
+
|
|
1606
|
+
@staticmethod
|
|
1607
|
+
@aggregate
|
|
1608
|
+
def max(x):
|
|
1609
|
+
return F("max", x)
|
|
1610
|
+
|
|
1611
|
+
@staticmethod
|
|
1612
|
+
@aggregate
|
|
1613
|
+
def skewPop(x):
|
|
1614
|
+
return F("skewPop", x)
|
|
1615
|
+
|
|
1616
|
+
@staticmethod
|
|
1617
|
+
@aggregate
|
|
1618
|
+
def skewSamp(x):
|
|
1619
|
+
return F("skewSamp", x)
|
|
1620
|
+
|
|
1621
|
+
@staticmethod
|
|
1622
|
+
@aggregate
|
|
1623
|
+
def sum(x):
|
|
1624
|
+
return F("sum", x)
|
|
1625
|
+
|
|
1626
|
+
@staticmethod
|
|
1627
|
+
@aggregate
|
|
1628
|
+
def uniq(*args):
|
|
1629
|
+
return F("uniq", *args)
|
|
1630
|
+
|
|
1631
|
+
@staticmethod
|
|
1632
|
+
@aggregate
|
|
1633
|
+
def uniqExact(*args):
|
|
1634
|
+
return F("uniqExact", *args)
|
|
1635
|
+
|
|
1636
|
+
@staticmethod
|
|
1637
|
+
@aggregate
|
|
1638
|
+
def uniqHLL12(*args):
|
|
1639
|
+
return F("uniqHLL12", *args)
|
|
1640
|
+
|
|
1641
|
+
@staticmethod
|
|
1642
|
+
@aggregate
|
|
1643
|
+
def varPop(x):
|
|
1644
|
+
return F("varPop", x)
|
|
1645
|
+
|
|
1646
|
+
@staticmethod
|
|
1647
|
+
@aggregate
|
|
1648
|
+
def varSamp(x):
|
|
1649
|
+
return F("varSamp", x)
|
|
1650
|
+
|
|
1651
|
+
@staticmethod
|
|
1652
|
+
@aggregate
|
|
1653
|
+
def stddevPop(expr):
|
|
1654
|
+
return F("stddevPop", expr)
|
|
1655
|
+
|
|
1656
|
+
@staticmethod
|
|
1657
|
+
@aggregate
|
|
1658
|
+
def stddevSamp(expr):
|
|
1659
|
+
return F("stddevSamp", expr)
|
|
1660
|
+
|
|
1661
|
+
@staticmethod
|
|
1662
|
+
@aggregate
|
|
1663
|
+
@parametric
|
|
1664
|
+
def quantile(expr):
|
|
1665
|
+
return F("quantile", expr)
|
|
1666
|
+
|
|
1667
|
+
@staticmethod
|
|
1668
|
+
@aggregate
|
|
1669
|
+
@parametric
|
|
1670
|
+
def quantileDeterministic(expr, determinator):
|
|
1671
|
+
return F("quantileDeterministic", expr, determinator)
|
|
1672
|
+
|
|
1673
|
+
@staticmethod
|
|
1674
|
+
@aggregate
|
|
1675
|
+
@parametric
|
|
1676
|
+
def quantileExact(expr):
|
|
1677
|
+
return F("quantileExact", expr)
|
|
1678
|
+
|
|
1679
|
+
@staticmethod
|
|
1680
|
+
@aggregate
|
|
1681
|
+
@parametric
|
|
1682
|
+
def quantileExactWeighted(expr, weight):
|
|
1683
|
+
return F("quantileExactWeighted", expr, weight)
|
|
1684
|
+
|
|
1685
|
+
@staticmethod
|
|
1686
|
+
@aggregate
|
|
1687
|
+
@parametric
|
|
1688
|
+
def quantileTiming(expr):
|
|
1689
|
+
return F("quantileTiming", expr)
|
|
1690
|
+
|
|
1691
|
+
@staticmethod
|
|
1692
|
+
@aggregate
|
|
1693
|
+
@parametric
|
|
1694
|
+
def quantileTimingWeighted(expr, weight):
|
|
1695
|
+
return F("quantileTimingWeighted", expr, weight)
|
|
1696
|
+
|
|
1697
|
+
@staticmethod
|
|
1698
|
+
@aggregate
|
|
1699
|
+
@parametric
|
|
1700
|
+
def quantileTDigest(expr):
|
|
1701
|
+
return F("quantileTDigest", expr)
|
|
1702
|
+
|
|
1703
|
+
@staticmethod
|
|
1704
|
+
@aggregate
|
|
1705
|
+
@parametric
|
|
1706
|
+
def quantileTDigestWeighted(expr, weight):
|
|
1707
|
+
return F("quantileTDigestWeighted", expr, weight)
|
|
1708
|
+
|
|
1709
|
+
@staticmethod
|
|
1710
|
+
@aggregate
|
|
1711
|
+
@parametric
|
|
1712
|
+
def quantiles(expr):
|
|
1713
|
+
return F("quantiles", expr)
|
|
1714
|
+
|
|
1715
|
+
@staticmethod
|
|
1716
|
+
@aggregate
|
|
1717
|
+
@parametric
|
|
1718
|
+
def quantilesDeterministic(expr, determinator):
|
|
1719
|
+
return F("quantilesDeterministic", expr, determinator)
|
|
1720
|
+
|
|
1721
|
+
@staticmethod
|
|
1722
|
+
@aggregate
|
|
1723
|
+
@parametric
|
|
1724
|
+
def quantilesExact(expr):
|
|
1725
|
+
return F("quantilesExact", expr)
|
|
1726
|
+
|
|
1727
|
+
@staticmethod
|
|
1728
|
+
@aggregate
|
|
1729
|
+
@parametric
|
|
1730
|
+
def quantilesExactWeighted(expr, weight):
|
|
1731
|
+
return F("quantilesExactWeighted", expr, weight)
|
|
1732
|
+
|
|
1733
|
+
@staticmethod
|
|
1734
|
+
@aggregate
|
|
1735
|
+
@parametric
|
|
1736
|
+
def quantilesTiming(expr):
|
|
1737
|
+
return F("quantilesTiming", expr)
|
|
1738
|
+
|
|
1739
|
+
@staticmethod
|
|
1740
|
+
@aggregate
|
|
1741
|
+
@parametric
|
|
1742
|
+
def quantilesTimingWeighted(expr, weight):
|
|
1743
|
+
return F("quantilesTimingWeighted", expr, weight)
|
|
1744
|
+
|
|
1745
|
+
@staticmethod
|
|
1746
|
+
@aggregate
|
|
1747
|
+
@parametric
|
|
1748
|
+
def quantilesTDigest(expr):
|
|
1749
|
+
return F("quantilesTDigest", expr)
|
|
1750
|
+
|
|
1751
|
+
@staticmethod
|
|
1752
|
+
@aggregate
|
|
1753
|
+
@parametric
|
|
1754
|
+
def quantilesTDigestWeighted(expr, weight):
|
|
1755
|
+
return F("quantilesTDigestWeighted", expr, weight)
|
|
1756
|
+
|
|
1757
|
+
@staticmethod
|
|
1758
|
+
@aggregate
|
|
1759
|
+
@parametric
|
|
1760
|
+
def topK(expr):
|
|
1761
|
+
return F("topK", expr)
|
|
1762
|
+
|
|
1763
|
+
@staticmethod
|
|
1764
|
+
@aggregate
|
|
1765
|
+
@parametric
|
|
1766
|
+
def topKWeighted(expr, weight):
|
|
1767
|
+
return F("topKWeighted", expr, weight)
|
|
1768
|
+
|
|
1769
|
+
# Null handling functions
|
|
1770
|
+
|
|
1771
|
+
@staticmethod
|
|
1772
|
+
def ifNull(x, y):
|
|
1773
|
+
return F("ifNull", x, y)
|
|
1774
|
+
|
|
1775
|
+
@staticmethod
|
|
1776
|
+
def nullIf(x, y):
|
|
1777
|
+
return F("nullIf", x, y)
|
|
1778
|
+
|
|
1779
|
+
@staticmethod
|
|
1780
|
+
def isNotNull(x):
|
|
1781
|
+
return F("isNotNull", x)
|
|
1782
|
+
|
|
1783
|
+
@staticmethod
|
|
1784
|
+
def isNull(x):
|
|
1785
|
+
return F("isNull", x)
|
|
1786
|
+
|
|
1787
|
+
@staticmethod
|
|
1788
|
+
def coalesce(*args):
|
|
1789
|
+
return F("coalesce", *args)
|
|
1790
|
+
|
|
1791
|
+
# Misc functions
|
|
1792
|
+
|
|
1793
|
+
@staticmethod
|
|
1794
|
+
def ifNotFinite(x, y):
|
|
1795
|
+
return F("ifNotFinite", x, y)
|
|
1796
|
+
|
|
1797
|
+
@staticmethod
|
|
1798
|
+
def isFinite(x):
|
|
1799
|
+
return F("isFinite", x)
|
|
1800
|
+
|
|
1801
|
+
@staticmethod
|
|
1802
|
+
def isInfinite(x):
|
|
1803
|
+
return F("isInfinite", x)
|
|
1804
|
+
|
|
1805
|
+
@staticmethod
|
|
1806
|
+
def isNaN(x):
|
|
1807
|
+
return F("isNaN", x)
|
|
1808
|
+
|
|
1809
|
+
@staticmethod
|
|
1810
|
+
def least(x, y):
|
|
1811
|
+
return F("least", x, y)
|
|
1812
|
+
|
|
1813
|
+
@staticmethod
|
|
1814
|
+
def greatest(x, y):
|
|
1815
|
+
return F("greatest", x, y)
|
|
1816
|
+
|
|
1817
|
+
# Dictionary functions
|
|
1818
|
+
|
|
1819
|
+
@staticmethod
|
|
1820
|
+
def dictGet(dict_name, attr_name, id_expr):
|
|
1821
|
+
return F("dictGet", dict_name, attr_name, id_expr)
|
|
1822
|
+
|
|
1823
|
+
@staticmethod
|
|
1824
|
+
def dictGetOrDefault(dict_name, attr_name, id_expr, default):
|
|
1825
|
+
return F("dictGetOrDefault", dict_name, attr_name, id_expr, default)
|
|
1826
|
+
|
|
1827
|
+
@staticmethod
|
|
1828
|
+
def dictHas(dict_name, id_expr):
|
|
1829
|
+
return F("dictHas", dict_name, id_expr)
|
|
1830
|
+
|
|
1831
|
+
@staticmethod
|
|
1832
|
+
def dictGetHierarchy(dict_name, id_expr):
|
|
1833
|
+
return F("dictGetHierarchy", dict_name, id_expr)
|
|
1834
|
+
|
|
1835
|
+
@staticmethod
|
|
1836
|
+
def dictIsIn(dict_name, child_id_expr, ancestor_id_expr):
|
|
1837
|
+
return F("dictIsIn", dict_name, child_id_expr, ancestor_id_expr)
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
# Expose only relevant classes in import *
|
|
1841
|
+
__all__ = ["F"]
|