pylegend 0.3.0__py3-none-any.whl → 0.5.0__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.
- pylegend/__init__.py +16 -6
- pylegend/core/{databse → database}/sql_to_string/__init__.py +3 -3
- pylegend/core/{databse → database}/sql_to_string/db_extension.py +14 -5
- pylegend/core/{databse → database}/sql_to_string/generator.py +2 -2
- pylegend/core/language/__init__.py +12 -10
- pylegend/core/language/legacy_api/__init__.py +13 -0
- pylegend/core/language/{aggregate_specification.py → legacy_api/aggregate_specification.py} +10 -10
- pylegend/core/language/legacy_api/legacy_api_tds_row.py +32 -0
- pylegend/core/language/legendql_api/__init__.py +13 -0
- pylegend/core/language/legendql_api/legendql_api_custom_expressions.py +541 -0
- pylegend/core/language/legendql_api/legendql_api_tds_row.py +292 -0
- pylegend/core/language/shared/__init__.py +13 -0
- pylegend/core/language/{column_expressions.py → shared/column_expressions.py} +32 -31
- pylegend/core/language/{expression.py → shared/expression.py} +8 -0
- pylegend/core/language/{functions.py → shared/functions.py} +12 -3
- pylegend/core/language/shared/helpers.py +75 -0
- pylegend/core/language/{literal_expressions.py → shared/literal_expressions.py} +39 -1
- pylegend/core/language/{operations → shared/operations}/binary_expression.py +34 -2
- pylegend/core/language/{operations → shared/operations}/boolean_operation_expressions.py +34 -6
- pylegend/core/language/{operations → shared/operations}/collection_operation_expressions.py +146 -26
- pylegend/core/language/{operations → shared/operations}/date_operation_expressions.py +288 -24
- pylegend/core/language/{operations → shared/operations}/float_operation_expressions.py +53 -8
- pylegend/core/language/{operations → shared/operations}/integer_operation_expressions.py +62 -9
- pylegend/core/language/{operations → shared/operations}/nullary_expression.py +9 -2
- pylegend/core/language/{operations → shared/operations}/number_operation_expressions.py +211 -30
- pylegend/core/language/shared/operations/primitive_operation_expressions.py +155 -0
- pylegend/core/language/{operations → shared/operations}/string_operation_expressions.py +194 -21
- pylegend/core/language/{operations → shared/operations}/unary_expression.py +10 -2
- pylegend/core/language/{primitive_collection.py → shared/primitive_collection.py} +2 -2
- pylegend/core/language/{primitives → shared/primitives}/__init__.py +9 -9
- pylegend/core/language/{primitives → shared/primitives}/boolean.py +9 -5
- pylegend/core/language/{primitives → shared/primitives}/date.py +60 -15
- pylegend/core/language/{primitives → shared/primitives}/datetime.py +4 -5
- pylegend/core/language/{primitives → shared/primitives}/float.py +6 -6
- pylegend/core/language/{primitives → shared/primitives}/integer.py +6 -6
- pylegend/core/language/{primitives → shared/primitives}/number.py +16 -13
- pylegend/core/language/{primitives → shared/primitives}/primitive.py +41 -5
- pylegend/core/language/{primitives → shared/primitives}/strictdate.py +4 -5
- pylegend/core/language/{primitives → shared/primitives}/string.py +18 -19
- pylegend/core/language/{tds_row.py → shared/tds_row.py} +46 -16
- pylegend/core/request/__init__.py +7 -1
- pylegend/core/request/auth.py +55 -1
- pylegend/core/request/legend_client.py +32 -0
- pylegend/core/sql/metamodel_extension.py +28 -0
- pylegend/core/tds/abstract/__init__.py +13 -0
- pylegend/core/tds/abstract/frames/__init__.py +13 -0
- pylegend/core/tds/{legend_api/frames/legend_api_applied_function_tds_frame.py → abstract/frames/applied_function_tds_frame.py} +19 -13
- pylegend/core/tds/abstract/frames/base_tds_frame.py +125 -0
- pylegend/core/tds/{legend_api/frames/legend_api_input_tds_frame.py → abstract/frames/input_tds_frame.py} +9 -12
- pylegend/core/tds/{legend_api/frames/functions → abstract}/function_helpers.py +1 -1
- pylegend/core/tds/{legend_api/frames/functions/concatenate_function.py → legacy_api/frames/functions/legacy_api_concatenate_function.py} +25 -13
- pylegend/core/tds/{legend_api/frames/functions/distinct_function.py → legacy_api/frames/functions/legacy_api_distinct_function.py} +13 -8
- pylegend/core/tds/{legend_api/frames/functions/drop_function.py → legacy_api/frames/functions/legacy_api_drop_function.py} +13 -8
- pylegend/core/tds/{legend_api/frames/functions/extend_function.py → legacy_api/frames/functions/legacy_api_extend_function.py} +36 -16
- pylegend/core/tds/{legend_api/frames/functions/filter_function.py → legacy_api/frames/functions/legacy_api_filter_function.py} +25 -13
- pylegend/core/tds/{legend_api/frames/functions/group_by_function.py → legacy_api/frames/functions/legacy_api_group_by_function.py} +44 -17
- pylegend/core/tds/{legend_api/frames/functions/head_function.py → legacy_api/frames/functions/legacy_api_head_function.py} +13 -8
- pylegend/core/tds/{legend_api/frames/functions/join_by_columns_function.py → legacy_api/frames/functions/legacy_api_join_by_columns_function.py} +40 -13
- pylegend/core/tds/{legend_api/frames/functions/join_function.py → legacy_api/frames/functions/legacy_api_join_function.py} +44 -20
- pylegend/core/tds/{legend_api/frames/functions/rename_columns_function.py → legacy_api/frames/functions/legacy_api_rename_columns_function.py} +20 -8
- pylegend/core/tds/{legend_api/frames/functions/restrict_function.py → legacy_api/frames/functions/legacy_api_restrict_function.py} +17 -8
- pylegend/core/tds/{legend_api/frames/functions/slice_function.py → legacy_api/frames/functions/legacy_api_slice_function.py} +13 -8
- pylegend/core/tds/{legend_api/frames/functions/sort_function.py → legacy_api/frames/functions/legacy_api_sort_function.py} +19 -8
- pylegend/core/tds/legacy_api/frames/legacy_api_applied_function_tds_frame.py +37 -0
- pylegend/core/tds/legacy_api/frames/legacy_api_base_tds_frame.py +204 -0
- pylegend/core/tds/legacy_api/frames/legacy_api_input_tds_frame.py +51 -0
- pylegend/core/tds/{legend_api/frames/legend_api_tds_frame.py → legacy_api/frames/legacy_api_tds_frame.py} +28 -28
- pylegend/core/tds/legendql_api/__init__.py +13 -0
- pylegend/core/tds/legendql_api/frames/__init__.py +13 -0
- pylegend/core/tds/legendql_api/frames/functions/__init__.py +13 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_asofjoin_function.py +156 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_concatenate_function.py +139 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_distinct_function.py +69 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_drop_function.py +74 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_extend_function.py +256 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_filter_function.py +121 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_function_helpers.py +137 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_groupby_function.py +256 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_head_function.py +74 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_join_function.py +214 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_project_function.py +169 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_rename_function.py +189 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_select_function.py +131 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_slice_function.py +82 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_sort_function.py +93 -0
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_window_extend_function.py +283 -0
- pylegend/core/tds/legendql_api/frames/legendql_api_applied_function_tds_frame.py +37 -0
- pylegend/core/tds/legendql_api/frames/legendql_api_base_tds_frame.py +419 -0
- pylegend/core/tds/legendql_api/frames/legendql_api_input_tds_frame.py +50 -0
- pylegend/core/tds/legendql_api/frames/legendql_api_tds_frame.py +327 -0
- pylegend/core/tds/pandas_api/frames/functions/assign_function.py +6 -6
- pylegend/core/tds/pandas_api/frames/pandas_api_applied_function_tds_frame.py +4 -0
- pylegend/core/tds/pandas_api/frames/pandas_api_base_tds_frame.py +11 -3
- pylegend/core/tds/pandas_api/frames/pandas_api_tds_frame.py +2 -2
- pylegend/core/tds/tds_frame.py +32 -2
- pylegend/extensions/database/vendors/postgres/postgres_sql_to_string.py +1 -1
- pylegend/extensions/tds/abstract/legend_function_input_frame.py +4 -0
- pylegend/extensions/tds/abstract/legend_service_input_frame.py +4 -0
- pylegend/extensions/tds/abstract/table_spec_input_frame.py +4 -0
- pylegend/extensions/tds/{legend_api/frames/legend_api_legend_function_input_frame.py → legacy_api/frames/legacy_api_legend_function_input_frame.py} +5 -5
- pylegend/extensions/tds/{legend_api/frames/legend_api_legend_service_input_frame.py → legacy_api/frames/legacy_api_legend_service_input_frame.py} +6 -6
- pylegend/extensions/tds/{legend_api/frames/legend_api_table_spec_input_frame.py → legacy_api/frames/legacy_api_table_spec_input_frame.py} +5 -5
- pylegend/extensions/tds/legendql_api/__init__.py +13 -0
- pylegend/extensions/tds/legendql_api/frames/__init__.py +13 -0
- pylegend/extensions/tds/legendql_api/frames/legendql_api_legend_service_input_frame.py +46 -0
- pylegend/extensions/tds/legendql_api/frames/legendql_api_table_spec_input_frame.py +36 -0
- pylegend/{legend_api_tds_client.py → legacy_api_tds_client.py} +15 -15
- {pylegend-0.3.0.dist-info → pylegend-0.5.0.dist-info}/METADATA +7 -8
- pylegend-0.5.0.dist-info/NOTICE +5 -0
- pylegend-0.5.0.dist-info/RECORD +155 -0
- {pylegend-0.3.0.dist-info → pylegend-0.5.0.dist-info}/WHEEL +1 -1
- pylegend/core/language/operations/primitive_operation_expressions.py +0 -56
- pylegend/core/tds/legend_api/frames/legend_api_base_tds_frame.py +0 -294
- pylegend-0.3.0.dist-info/RECORD +0 -115
- /pylegend/core/{databse → database}/__init__.py +0 -0
- /pylegend/core/{databse → database}/sql_to_string/config.py +0 -0
- /pylegend/core/language/{operations → shared/operations}/__init__.py +0 -0
- /pylegend/core/tds/{legend_api → legacy_api}/__init__.py +0 -0
- /pylegend/core/tds/{legend_api → legacy_api}/frames/__init__.py +0 -0
- /pylegend/core/tds/{legend_api → legacy_api}/frames/functions/__init__.py +0 -0
- /pylegend/extensions/tds/{legend_api → legacy_api}/__init__.py +0 -0
- /pylegend/extensions/tds/{legend_api → legacy_api}/frames/__init__.py +0 -0
- {pylegend-0.3.0.dist-info → pylegend-0.5.0.dist-info}/LICENSE +0 -0
- {pylegend-0.3.0.dist-info → pylegend-0.5.0.dist-info}/LICENSE.spdx +0 -0
|
@@ -16,15 +16,19 @@ from pylegend._typing import (
|
|
|
16
16
|
PyLegendSequence,
|
|
17
17
|
PyLegendDict,
|
|
18
18
|
)
|
|
19
|
-
from pylegend.core.language.expression import (
|
|
19
|
+
from pylegend.core.language.shared.expression import (
|
|
20
20
|
PyLegendExpressionDateReturn,
|
|
21
21
|
PyLegendExpressionDateTimeReturn,
|
|
22
22
|
PyLegendExpressionStrictDateReturn,
|
|
23
23
|
PyLegendExpressionIntegerReturn,
|
|
24
|
+
PyLegendExpressionBooleanReturn,
|
|
24
25
|
)
|
|
25
|
-
from pylegend.core.language.operations.
|
|
26
|
-
from pylegend.core.language.operations.
|
|
26
|
+
from pylegend.core.language.shared.operations.binary_expression import PyLegendBinaryExpression
|
|
27
|
+
from pylegend.core.language.shared.operations.nullary_expression import PyLegendNullaryExpression
|
|
28
|
+
from pylegend.core.language.shared.operations.unary_expression import PyLegendUnaryExpression
|
|
29
|
+
from pylegend.core.language.shared.helpers import generate_pure_functional_call
|
|
27
30
|
from pylegend.core.tds.tds_frame import FrameToSqlConfig
|
|
31
|
+
from pylegend.core.tds.tds_frame import FrameToPureConfig
|
|
28
32
|
from pylegend.core.sql.metamodel import (
|
|
29
33
|
Expression,
|
|
30
34
|
QuerySpecification,
|
|
@@ -32,6 +36,10 @@ from pylegend.core.sql.metamodel import (
|
|
|
32
36
|
from pylegend.core.sql.metamodel import (
|
|
33
37
|
CurrentTime,
|
|
34
38
|
CurrentTimeType,
|
|
39
|
+
Cast,
|
|
40
|
+
ColumnType,
|
|
41
|
+
ComparisonExpression,
|
|
42
|
+
ComparisonOperator,
|
|
35
43
|
)
|
|
36
44
|
from pylegend.core.sql.metamodel_extension import (
|
|
37
45
|
FirstDayOfYearExpression,
|
|
@@ -78,6 +86,11 @@ __all__: PyLegendSequence[str] = [
|
|
|
78
86
|
"PyLegendEpochExpression",
|
|
79
87
|
"PyLegendTodayExpression",
|
|
80
88
|
"PyLegendNowExpression",
|
|
89
|
+
"PyLegendDatePartExpression",
|
|
90
|
+
"PyLegendDateLessThanExpression",
|
|
91
|
+
"PyLegendDateLessThanEqualExpression",
|
|
92
|
+
"PyLegendDateGreaterThanExpression",
|
|
93
|
+
"PyLegendDateGreaterThanEqualExpression",
|
|
81
94
|
]
|
|
82
95
|
|
|
83
96
|
|
|
@@ -91,12 +104,17 @@ class PyLegendFirstDayOfYearExpression(PyLegendUnaryExpression, PyLegendExpressi
|
|
|
91
104
|
) -> Expression:
|
|
92
105
|
return FirstDayOfYearExpression(expression)
|
|
93
106
|
|
|
107
|
+
@staticmethod
|
|
108
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
109
|
+
return generate_pure_functional_call("firstDayOfYear", [op_expr], auto_map=True)
|
|
110
|
+
|
|
94
111
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
95
112
|
PyLegendExpressionDateReturn.__init__(self)
|
|
96
113
|
PyLegendUnaryExpression.__init__(
|
|
97
114
|
self,
|
|
98
115
|
operand,
|
|
99
|
-
PyLegendFirstDayOfYearExpression.__to_sql_func
|
|
116
|
+
PyLegendFirstDayOfYearExpression.__to_sql_func,
|
|
117
|
+
PyLegendFirstDayOfYearExpression.__to_pure_func
|
|
100
118
|
)
|
|
101
119
|
|
|
102
120
|
|
|
@@ -110,12 +128,17 @@ class PyLegendFirstDayOfQuarterExpression(PyLegendUnaryExpression, PyLegendExpre
|
|
|
110
128
|
) -> Expression:
|
|
111
129
|
return FirstDayOfQuarterExpression(expression)
|
|
112
130
|
|
|
131
|
+
@staticmethod
|
|
132
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
133
|
+
return generate_pure_functional_call("firstDayOfQuarter", [op_expr], auto_map=True)
|
|
134
|
+
|
|
113
135
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
114
136
|
PyLegendExpressionDateReturn.__init__(self)
|
|
115
137
|
PyLegendUnaryExpression.__init__(
|
|
116
138
|
self,
|
|
117
139
|
operand,
|
|
118
|
-
PyLegendFirstDayOfQuarterExpression.__to_sql_func
|
|
140
|
+
PyLegendFirstDayOfQuarterExpression.__to_sql_func,
|
|
141
|
+
PyLegendFirstDayOfQuarterExpression.__to_pure_func
|
|
119
142
|
)
|
|
120
143
|
|
|
121
144
|
|
|
@@ -129,12 +152,17 @@ class PyLegendFirstDayOfMonthExpression(PyLegendUnaryExpression, PyLegendExpress
|
|
|
129
152
|
) -> Expression:
|
|
130
153
|
return FirstDayOfMonthExpression(expression)
|
|
131
154
|
|
|
155
|
+
@staticmethod
|
|
156
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
157
|
+
return generate_pure_functional_call("firstDayOfMonth", [op_expr], auto_map=True)
|
|
158
|
+
|
|
132
159
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
133
160
|
PyLegendExpressionDateReturn.__init__(self)
|
|
134
161
|
PyLegendUnaryExpression.__init__(
|
|
135
162
|
self,
|
|
136
163
|
operand,
|
|
137
|
-
PyLegendFirstDayOfMonthExpression.__to_sql_func
|
|
164
|
+
PyLegendFirstDayOfMonthExpression.__to_sql_func,
|
|
165
|
+
PyLegendFirstDayOfMonthExpression.__to_pure_func
|
|
138
166
|
)
|
|
139
167
|
|
|
140
168
|
|
|
@@ -148,12 +176,17 @@ class PyLegendFirstDayOfWeekExpression(PyLegendUnaryExpression, PyLegendExpressi
|
|
|
148
176
|
) -> Expression:
|
|
149
177
|
return FirstDayOfWeekExpression(expression)
|
|
150
178
|
|
|
179
|
+
@staticmethod
|
|
180
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
181
|
+
return generate_pure_functional_call("firstDayOfWeek", [op_expr], auto_map=True)
|
|
182
|
+
|
|
151
183
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
152
184
|
PyLegendExpressionDateReturn.__init__(self)
|
|
153
185
|
PyLegendUnaryExpression.__init__(
|
|
154
186
|
self,
|
|
155
187
|
operand,
|
|
156
|
-
PyLegendFirstDayOfWeekExpression.__to_sql_func
|
|
188
|
+
PyLegendFirstDayOfWeekExpression.__to_sql_func,
|
|
189
|
+
PyLegendFirstDayOfWeekExpression.__to_pure_func
|
|
157
190
|
)
|
|
158
191
|
|
|
159
192
|
|
|
@@ -167,12 +200,17 @@ class PyLegendFirstHourOfDayExpression(PyLegendUnaryExpression, PyLegendExpressi
|
|
|
167
200
|
) -> Expression:
|
|
168
201
|
return FirstHourOfDayExpression(expression)
|
|
169
202
|
|
|
203
|
+
@staticmethod
|
|
204
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
205
|
+
return generate_pure_functional_call("firstHourOfDay", [op_expr], auto_map=True)
|
|
206
|
+
|
|
170
207
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
171
208
|
PyLegendExpressionDateTimeReturn.__init__(self)
|
|
172
209
|
PyLegendUnaryExpression.__init__(
|
|
173
210
|
self,
|
|
174
211
|
operand,
|
|
175
|
-
PyLegendFirstHourOfDayExpression.__to_sql_func
|
|
212
|
+
PyLegendFirstHourOfDayExpression.__to_sql_func,
|
|
213
|
+
PyLegendFirstHourOfDayExpression.__to_pure_func
|
|
176
214
|
)
|
|
177
215
|
|
|
178
216
|
|
|
@@ -186,12 +224,17 @@ class PyLegendFirstMinuteOfHourExpression(PyLegendUnaryExpression, PyLegendExpre
|
|
|
186
224
|
) -> Expression:
|
|
187
225
|
return FirstMinuteOfHourExpression(expression)
|
|
188
226
|
|
|
227
|
+
@staticmethod
|
|
228
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
229
|
+
return generate_pure_functional_call("firstMinuteOfHour", [op_expr], auto_map=True)
|
|
230
|
+
|
|
189
231
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
190
232
|
PyLegendExpressionDateTimeReturn.__init__(self)
|
|
191
233
|
PyLegendUnaryExpression.__init__(
|
|
192
234
|
self,
|
|
193
235
|
operand,
|
|
194
|
-
PyLegendFirstMinuteOfHourExpression.__to_sql_func
|
|
236
|
+
PyLegendFirstMinuteOfHourExpression.__to_sql_func,
|
|
237
|
+
PyLegendFirstMinuteOfHourExpression.__to_pure_func
|
|
195
238
|
)
|
|
196
239
|
|
|
197
240
|
|
|
@@ -205,12 +248,17 @@ class PyLegendFirstSecondOfMinuteExpression(PyLegendUnaryExpression, PyLegendExp
|
|
|
205
248
|
) -> Expression:
|
|
206
249
|
return FirstSecondOfMinuteExpression(expression)
|
|
207
250
|
|
|
251
|
+
@staticmethod
|
|
252
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
253
|
+
return generate_pure_functional_call("firstSecondOfMinute", [op_expr], auto_map=True)
|
|
254
|
+
|
|
208
255
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
209
256
|
PyLegendExpressionDateTimeReturn.__init__(self)
|
|
210
257
|
PyLegendUnaryExpression.__init__(
|
|
211
258
|
self,
|
|
212
259
|
operand,
|
|
213
|
-
PyLegendFirstSecondOfMinuteExpression.__to_sql_func
|
|
260
|
+
PyLegendFirstSecondOfMinuteExpression.__to_sql_func,
|
|
261
|
+
PyLegendFirstSecondOfMinuteExpression.__to_pure_func
|
|
214
262
|
)
|
|
215
263
|
|
|
216
264
|
|
|
@@ -224,12 +272,17 @@ class PyLegendFirstMillisecondOfSecondExpression(PyLegendUnaryExpression, PyLege
|
|
|
224
272
|
) -> Expression:
|
|
225
273
|
return FirstMillisecondOfSecondExpression(expression)
|
|
226
274
|
|
|
275
|
+
@staticmethod
|
|
276
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
277
|
+
return generate_pure_functional_call("firstMillisecondOfSecond", [op_expr], auto_map=True)
|
|
278
|
+
|
|
227
279
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
228
280
|
PyLegendExpressionDateTimeReturn.__init__(self)
|
|
229
281
|
PyLegendUnaryExpression.__init__(
|
|
230
282
|
self,
|
|
231
283
|
operand,
|
|
232
|
-
PyLegendFirstMillisecondOfSecondExpression.__to_sql_func
|
|
284
|
+
PyLegendFirstMillisecondOfSecondExpression.__to_sql_func,
|
|
285
|
+
PyLegendFirstMillisecondOfSecondExpression.__to_pure_func
|
|
233
286
|
)
|
|
234
287
|
|
|
235
288
|
|
|
@@ -243,12 +296,17 @@ class PyLegendYearExpression(PyLegendUnaryExpression, PyLegendExpressionIntegerR
|
|
|
243
296
|
) -> Expression:
|
|
244
297
|
return YearExpression(expression)
|
|
245
298
|
|
|
299
|
+
@staticmethod
|
|
300
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
301
|
+
return generate_pure_functional_call("year", [op_expr], auto_map=True)
|
|
302
|
+
|
|
246
303
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
247
304
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
248
305
|
PyLegendUnaryExpression.__init__(
|
|
249
306
|
self,
|
|
250
307
|
operand,
|
|
251
|
-
PyLegendYearExpression.__to_sql_func
|
|
308
|
+
PyLegendYearExpression.__to_sql_func,
|
|
309
|
+
PyLegendYearExpression.__to_pure_func
|
|
252
310
|
)
|
|
253
311
|
|
|
254
312
|
|
|
@@ -262,12 +320,17 @@ class PyLegendQuarterExpression(PyLegendUnaryExpression, PyLegendExpressionInteg
|
|
|
262
320
|
) -> Expression:
|
|
263
321
|
return QuarterExpression(expression)
|
|
264
322
|
|
|
323
|
+
@staticmethod
|
|
324
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
325
|
+
return generate_pure_functional_call("quarter", [op_expr], auto_map=True)
|
|
326
|
+
|
|
265
327
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
266
328
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
267
329
|
PyLegendUnaryExpression.__init__(
|
|
268
330
|
self,
|
|
269
331
|
operand,
|
|
270
|
-
PyLegendQuarterExpression.__to_sql_func
|
|
332
|
+
PyLegendQuarterExpression.__to_sql_func,
|
|
333
|
+
PyLegendQuarterExpression.__to_pure_func
|
|
271
334
|
)
|
|
272
335
|
|
|
273
336
|
|
|
@@ -281,12 +344,17 @@ class PyLegendMonthExpression(PyLegendUnaryExpression, PyLegendExpressionInteger
|
|
|
281
344
|
) -> Expression:
|
|
282
345
|
return MonthExpression(expression)
|
|
283
346
|
|
|
347
|
+
@staticmethod
|
|
348
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
349
|
+
return generate_pure_functional_call("month", [op_expr], auto_map=True)
|
|
350
|
+
|
|
284
351
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
285
352
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
286
353
|
PyLegendUnaryExpression.__init__(
|
|
287
354
|
self,
|
|
288
355
|
operand,
|
|
289
|
-
PyLegendMonthExpression.__to_sql_func
|
|
356
|
+
PyLegendMonthExpression.__to_sql_func,
|
|
357
|
+
PyLegendMonthExpression.__to_pure_func
|
|
290
358
|
)
|
|
291
359
|
|
|
292
360
|
|
|
@@ -300,12 +368,17 @@ class PyLegendWeekOfYearExpression(PyLegendUnaryExpression, PyLegendExpressionIn
|
|
|
300
368
|
) -> Expression:
|
|
301
369
|
return WeekOfYearExpression(expression)
|
|
302
370
|
|
|
371
|
+
@staticmethod
|
|
372
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
373
|
+
return generate_pure_functional_call("weekOfYear", [op_expr], auto_map=True)
|
|
374
|
+
|
|
303
375
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
304
376
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
305
377
|
PyLegendUnaryExpression.__init__(
|
|
306
378
|
self,
|
|
307
379
|
operand,
|
|
308
|
-
PyLegendWeekOfYearExpression.__to_sql_func
|
|
380
|
+
PyLegendWeekOfYearExpression.__to_sql_func,
|
|
381
|
+
PyLegendWeekOfYearExpression.__to_pure_func
|
|
309
382
|
)
|
|
310
383
|
|
|
311
384
|
|
|
@@ -319,12 +392,17 @@ class PyLegendDayOfYearExpression(PyLegendUnaryExpression, PyLegendExpressionInt
|
|
|
319
392
|
) -> Expression:
|
|
320
393
|
return DayOfYearExpression(expression)
|
|
321
394
|
|
|
395
|
+
@staticmethod
|
|
396
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
397
|
+
return generate_pure_functional_call("dayOfYear", [op_expr], auto_map=True)
|
|
398
|
+
|
|
322
399
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
323
400
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
324
401
|
PyLegendUnaryExpression.__init__(
|
|
325
402
|
self,
|
|
326
403
|
operand,
|
|
327
|
-
PyLegendDayOfYearExpression.__to_sql_func
|
|
404
|
+
PyLegendDayOfYearExpression.__to_sql_func,
|
|
405
|
+
PyLegendDayOfYearExpression.__to_pure_func
|
|
328
406
|
)
|
|
329
407
|
|
|
330
408
|
|
|
@@ -338,12 +416,17 @@ class PyLegendDayOfMonthExpression(PyLegendUnaryExpression, PyLegendExpressionIn
|
|
|
338
416
|
) -> Expression:
|
|
339
417
|
return DayOfMonthExpression(expression)
|
|
340
418
|
|
|
419
|
+
@staticmethod
|
|
420
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
421
|
+
return generate_pure_functional_call("dayOfMonth", [op_expr], auto_map=True)
|
|
422
|
+
|
|
341
423
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
342
424
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
343
425
|
PyLegendUnaryExpression.__init__(
|
|
344
426
|
self,
|
|
345
427
|
operand,
|
|
346
|
-
PyLegendDayOfMonthExpression.__to_sql_func
|
|
428
|
+
PyLegendDayOfMonthExpression.__to_sql_func,
|
|
429
|
+
PyLegendDayOfMonthExpression.__to_pure_func
|
|
347
430
|
)
|
|
348
431
|
|
|
349
432
|
|
|
@@ -357,12 +440,17 @@ class PyLegendDayOfWeekExpression(PyLegendUnaryExpression, PyLegendExpressionInt
|
|
|
357
440
|
) -> Expression:
|
|
358
441
|
return DayOfWeekExpression(expression)
|
|
359
442
|
|
|
443
|
+
@staticmethod
|
|
444
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
445
|
+
return generate_pure_functional_call("dayOfWeekNumber", [op_expr], auto_map=True)
|
|
446
|
+
|
|
360
447
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
361
448
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
362
449
|
PyLegendUnaryExpression.__init__(
|
|
363
450
|
self,
|
|
364
451
|
operand,
|
|
365
|
-
PyLegendDayOfWeekExpression.__to_sql_func
|
|
452
|
+
PyLegendDayOfWeekExpression.__to_sql_func,
|
|
453
|
+
PyLegendDayOfWeekExpression.__to_pure_func
|
|
366
454
|
)
|
|
367
455
|
|
|
368
456
|
|
|
@@ -376,12 +464,17 @@ class PyLegendHourExpression(PyLegendUnaryExpression, PyLegendExpressionIntegerR
|
|
|
376
464
|
) -> Expression:
|
|
377
465
|
return HourExpression(expression)
|
|
378
466
|
|
|
467
|
+
@staticmethod
|
|
468
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
469
|
+
return generate_pure_functional_call("hour", [op_expr], auto_map=True)
|
|
470
|
+
|
|
379
471
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
380
472
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
381
473
|
PyLegendUnaryExpression.__init__(
|
|
382
474
|
self,
|
|
383
475
|
operand,
|
|
384
|
-
PyLegendHourExpression.__to_sql_func
|
|
476
|
+
PyLegendHourExpression.__to_sql_func,
|
|
477
|
+
PyLegendHourExpression.__to_pure_func
|
|
385
478
|
)
|
|
386
479
|
|
|
387
480
|
|
|
@@ -395,12 +488,17 @@ class PyLegendMinuteExpression(PyLegendUnaryExpression, PyLegendExpressionIntege
|
|
|
395
488
|
) -> Expression:
|
|
396
489
|
return MinuteExpression(expression)
|
|
397
490
|
|
|
491
|
+
@staticmethod
|
|
492
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
493
|
+
return generate_pure_functional_call("minute", [op_expr], auto_map=True)
|
|
494
|
+
|
|
398
495
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
399
496
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
400
497
|
PyLegendUnaryExpression.__init__(
|
|
401
498
|
self,
|
|
402
499
|
operand,
|
|
403
|
-
PyLegendMinuteExpression.__to_sql_func
|
|
500
|
+
PyLegendMinuteExpression.__to_sql_func,
|
|
501
|
+
PyLegendMinuteExpression.__to_pure_func
|
|
404
502
|
)
|
|
405
503
|
|
|
406
504
|
|
|
@@ -414,12 +512,17 @@ class PyLegendSecondExpression(PyLegendUnaryExpression, PyLegendExpressionIntege
|
|
|
414
512
|
) -> Expression:
|
|
415
513
|
return SecondExpression(expression)
|
|
416
514
|
|
|
515
|
+
@staticmethod
|
|
516
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
517
|
+
return generate_pure_functional_call("second", [op_expr], auto_map=True)
|
|
518
|
+
|
|
417
519
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
418
520
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
419
521
|
PyLegendUnaryExpression.__init__(
|
|
420
522
|
self,
|
|
421
523
|
operand,
|
|
422
|
-
PyLegendSecondExpression.__to_sql_func
|
|
524
|
+
PyLegendSecondExpression.__to_sql_func,
|
|
525
|
+
PyLegendSecondExpression.__to_pure_func
|
|
423
526
|
)
|
|
424
527
|
|
|
425
528
|
|
|
@@ -433,12 +536,17 @@ class PyLegendEpochExpression(PyLegendUnaryExpression, PyLegendExpressionInteger
|
|
|
433
536
|
) -> Expression:
|
|
434
537
|
return EpochExpression(expression)
|
|
435
538
|
|
|
539
|
+
@staticmethod
|
|
540
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
541
|
+
return generate_pure_functional_call("toEpochValue", [op_expr], auto_map=True)
|
|
542
|
+
|
|
436
543
|
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
437
544
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
438
545
|
PyLegendUnaryExpression.__init__(
|
|
439
546
|
self,
|
|
440
547
|
operand,
|
|
441
|
-
PyLegendEpochExpression.__to_sql_func
|
|
548
|
+
PyLegendEpochExpression.__to_sql_func,
|
|
549
|
+
PyLegendEpochExpression.__to_pure_func
|
|
442
550
|
)
|
|
443
551
|
|
|
444
552
|
|
|
@@ -451,11 +559,16 @@ class PyLegendTodayExpression(PyLegendNullaryExpression, PyLegendExpressionStric
|
|
|
451
559
|
) -> Expression:
|
|
452
560
|
return CurrentTime(type_=CurrentTimeType.DATE, precision=None)
|
|
453
561
|
|
|
562
|
+
@staticmethod
|
|
563
|
+
def __to_pure_func(config: FrameToPureConfig) -> str:
|
|
564
|
+
return "today()"
|
|
565
|
+
|
|
454
566
|
def __init__(self) -> None:
|
|
455
567
|
PyLegendExpressionStrictDateReturn.__init__(self)
|
|
456
568
|
PyLegendNullaryExpression.__init__(
|
|
457
569
|
self,
|
|
458
|
-
PyLegendTodayExpression.__to_sql_func
|
|
570
|
+
PyLegendTodayExpression.__to_sql_func,
|
|
571
|
+
PyLegendTodayExpression.__to_pure_func
|
|
459
572
|
)
|
|
460
573
|
|
|
461
574
|
|
|
@@ -468,9 +581,160 @@ class PyLegendNowExpression(PyLegendNullaryExpression, PyLegendExpressionDateTim
|
|
|
468
581
|
) -> Expression:
|
|
469
582
|
return CurrentTime(type_=CurrentTimeType.TIMESTAMP, precision=None)
|
|
470
583
|
|
|
584
|
+
@staticmethod
|
|
585
|
+
def __to_pure_func(config: FrameToPureConfig) -> str:
|
|
586
|
+
return "now()"
|
|
587
|
+
|
|
471
588
|
def __init__(self) -> None:
|
|
472
589
|
PyLegendExpressionDateTimeReturn.__init__(self)
|
|
473
590
|
PyLegendNullaryExpression.__init__(
|
|
474
591
|
self,
|
|
475
|
-
PyLegendNowExpression.__to_sql_func
|
|
592
|
+
PyLegendNowExpression.__to_sql_func,
|
|
593
|
+
PyLegendNowExpression.__to_pure_func
|
|
476
594
|
)
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
class PyLegendDatePartExpression(PyLegendUnaryExpression, PyLegendExpressionStrictDateReturn):
|
|
598
|
+
|
|
599
|
+
@staticmethod
|
|
600
|
+
def __to_sql_func(
|
|
601
|
+
expression: Expression,
|
|
602
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
603
|
+
config: FrameToSqlConfig
|
|
604
|
+
) -> Expression:
|
|
605
|
+
return Cast(expression, ColumnType(name="DATE", parameters=[]))
|
|
606
|
+
|
|
607
|
+
@staticmethod
|
|
608
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
609
|
+
return generate_pure_functional_call(
|
|
610
|
+
"cast",
|
|
611
|
+
[
|
|
612
|
+
generate_pure_functional_call("datePart", [op_expr], auto_map=True),
|
|
613
|
+
"@StrictDate",
|
|
614
|
+
]
|
|
615
|
+
)
|
|
616
|
+
|
|
617
|
+
def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
|
|
618
|
+
PyLegendExpressionStrictDateReturn.__init__(self)
|
|
619
|
+
PyLegendUnaryExpression.__init__(
|
|
620
|
+
self,
|
|
621
|
+
operand,
|
|
622
|
+
PyLegendDatePartExpression.__to_sql_func,
|
|
623
|
+
PyLegendDatePartExpression.__to_pure_func
|
|
624
|
+
)
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
class PyLegendDateLessThanExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
|
|
628
|
+
|
|
629
|
+
@staticmethod
|
|
630
|
+
def __to_sql_func(
|
|
631
|
+
expression1: Expression,
|
|
632
|
+
expression2: Expression,
|
|
633
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
634
|
+
config: FrameToSqlConfig
|
|
635
|
+
) -> Expression:
|
|
636
|
+
return ComparisonExpression(expression1, expression2, ComparisonOperator.LESS_THAN)
|
|
637
|
+
|
|
638
|
+
@staticmethod
|
|
639
|
+
def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
|
|
640
|
+
return f"({op1_expr} < {op2_expr})"
|
|
641
|
+
|
|
642
|
+
def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
|
|
643
|
+
PyLegendExpressionBooleanReturn.__init__(self)
|
|
644
|
+
PyLegendBinaryExpression.__init__(
|
|
645
|
+
self,
|
|
646
|
+
operand1,
|
|
647
|
+
operand2,
|
|
648
|
+
PyLegendDateLessThanExpression.__to_sql_func,
|
|
649
|
+
PyLegendDateLessThanExpression.__to_pure_func
|
|
650
|
+
)
|
|
651
|
+
|
|
652
|
+
def is_non_nullable(self) -> bool:
|
|
653
|
+
return True
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
class PyLegendDateLessThanEqualExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
|
|
657
|
+
|
|
658
|
+
@staticmethod
|
|
659
|
+
def __to_sql_func(
|
|
660
|
+
expression1: Expression,
|
|
661
|
+
expression2: Expression,
|
|
662
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
663
|
+
config: FrameToSqlConfig
|
|
664
|
+
) -> Expression:
|
|
665
|
+
return ComparisonExpression(expression1, expression2, ComparisonOperator.LESS_THAN_OR_EQUAL)
|
|
666
|
+
|
|
667
|
+
@staticmethod
|
|
668
|
+
def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
|
|
669
|
+
return f"({op1_expr} <= {op2_expr})"
|
|
670
|
+
|
|
671
|
+
def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
|
|
672
|
+
PyLegendExpressionBooleanReturn.__init__(self)
|
|
673
|
+
PyLegendBinaryExpression.__init__(
|
|
674
|
+
self,
|
|
675
|
+
operand1,
|
|
676
|
+
operand2,
|
|
677
|
+
PyLegendDateLessThanEqualExpression.__to_sql_func,
|
|
678
|
+
PyLegendDateLessThanEqualExpression.__to_pure_func
|
|
679
|
+
)
|
|
680
|
+
|
|
681
|
+
def is_non_nullable(self) -> bool:
|
|
682
|
+
return True
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
class PyLegendDateGreaterThanExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
|
|
686
|
+
|
|
687
|
+
@staticmethod
|
|
688
|
+
def __to_sql_func(
|
|
689
|
+
expression1: Expression,
|
|
690
|
+
expression2: Expression,
|
|
691
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
692
|
+
config: FrameToSqlConfig
|
|
693
|
+
) -> Expression:
|
|
694
|
+
return ComparisonExpression(expression1, expression2, ComparisonOperator.GREATER_THAN)
|
|
695
|
+
|
|
696
|
+
@staticmethod
|
|
697
|
+
def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
|
|
698
|
+
return f"({op1_expr} > {op2_expr})"
|
|
699
|
+
|
|
700
|
+
def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
|
|
701
|
+
PyLegendExpressionBooleanReturn.__init__(self)
|
|
702
|
+
PyLegendBinaryExpression.__init__(
|
|
703
|
+
self,
|
|
704
|
+
operand1,
|
|
705
|
+
operand2,
|
|
706
|
+
PyLegendDateGreaterThanExpression.__to_sql_func,
|
|
707
|
+
PyLegendDateGreaterThanExpression.__to_pure_func
|
|
708
|
+
)
|
|
709
|
+
|
|
710
|
+
def is_non_nullable(self) -> bool:
|
|
711
|
+
return True
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
class PyLegendDateGreaterThanEqualExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
|
|
715
|
+
|
|
716
|
+
@staticmethod
|
|
717
|
+
def __to_sql_func(
|
|
718
|
+
expression1: Expression,
|
|
719
|
+
expression2: Expression,
|
|
720
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
721
|
+
config: FrameToSqlConfig
|
|
722
|
+
) -> Expression:
|
|
723
|
+
return ComparisonExpression(expression1, expression2, ComparisonOperator.GREATER_THAN_OR_EQUAL)
|
|
724
|
+
|
|
725
|
+
@staticmethod
|
|
726
|
+
def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
|
|
727
|
+
return f"({op1_expr} >= {op2_expr})"
|
|
728
|
+
|
|
729
|
+
def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
|
|
730
|
+
PyLegendExpressionBooleanReturn.__init__(self)
|
|
731
|
+
PyLegendBinaryExpression.__init__(
|
|
732
|
+
self,
|
|
733
|
+
operand1,
|
|
734
|
+
operand2,
|
|
735
|
+
PyLegendDateGreaterThanEqualExpression.__to_sql_func,
|
|
736
|
+
PyLegendDateGreaterThanEqualExpression.__to_pure_func
|
|
737
|
+
)
|
|
738
|
+
|
|
739
|
+
def is_non_nullable(self) -> bool:
|
|
740
|
+
return True
|