pylegend 0.4.0__py3-none-any.whl → 0.6.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.
Files changed (24) hide show
  1. pylegend/__init__.py +9 -1
  2. pylegend/core/database/sql_to_string/db_extension.py +3 -0
  3. pylegend/core/language/__init__.py +2 -0
  4. pylegend/core/language/shared/functions.py +9 -0
  5. pylegend/core/language/shared/helpers.py +1 -9
  6. pylegend/core/language/shared/operations/binary_expression.py +22 -22
  7. pylegend/core/language/shared/operations/boolean_operation_expressions.py +13 -16
  8. pylegend/core/language/shared/operations/date_operation_expressions.py +208 -42
  9. pylegend/core/language/shared/operations/float_operation_expressions.py +20 -25
  10. pylegend/core/language/shared/operations/integer_operation_expressions.py +25 -30
  11. pylegend/core/language/shared/operations/nullary_expression.py +6 -1
  12. pylegend/core/language/shared/operations/number_operation_expressions.py +109 -90
  13. pylegend/core/language/shared/operations/primitive_operation_expressions.py +59 -7
  14. pylegend/core/language/shared/operations/string_operation_expressions.py +67 -25
  15. pylegend/core/language/shared/operations/unary_expression.py +16 -1
  16. pylegend/core/language/shared/primitives/date.py +37 -0
  17. pylegend/core/language/shared/primitives/primitive.py +16 -0
  18. pylegend/core/sql/metamodel_extension.py +12 -0
  19. {pylegend-0.4.0.dist-info → pylegend-0.6.0.dist-info}/METADATA +1 -1
  20. {pylegend-0.4.0.dist-info → pylegend-0.6.0.dist-info}/RECORD +24 -24
  21. {pylegend-0.4.0.dist-info → pylegend-0.6.0.dist-info}/LICENSE +0 -0
  22. {pylegend-0.4.0.dist-info → pylegend-0.6.0.dist-info}/LICENSE.spdx +0 -0
  23. {pylegend-0.4.0.dist-info → pylegend-0.6.0.dist-info}/NOTICE +0 -0
  24. {pylegend-0.4.0.dist-info → pylegend-0.6.0.dist-info}/WHEEL +0 -0
@@ -21,7 +21,9 @@ from pylegend.core.language.shared.expression import (
21
21
  PyLegendExpressionDateTimeReturn,
22
22
  PyLegendExpressionStrictDateReturn,
23
23
  PyLegendExpressionIntegerReturn,
24
+ PyLegendExpressionBooleanReturn,
24
25
  )
26
+ from pylegend.core.language.shared.operations.binary_expression import PyLegendBinaryExpression
25
27
  from pylegend.core.language.shared.operations.nullary_expression import PyLegendNullaryExpression
26
28
  from pylegend.core.language.shared.operations.unary_expression import PyLegendUnaryExpression
27
29
  from pylegend.core.language.shared.helpers import generate_pure_functional_call
@@ -36,6 +38,8 @@ from pylegend.core.sql.metamodel import (
36
38
  CurrentTimeType,
37
39
  Cast,
38
40
  ColumnType,
41
+ ComparisonExpression,
42
+ ComparisonOperator,
39
43
  )
40
44
  from pylegend.core.sql.metamodel_extension import (
41
45
  FirstDayOfYearExpression,
@@ -83,6 +87,10 @@ __all__: PyLegendSequence[str] = [
83
87
  "PyLegendTodayExpression",
84
88
  "PyLegendNowExpression",
85
89
  "PyLegendDatePartExpression",
90
+ "PyLegendDateLessThanExpression",
91
+ "PyLegendDateLessThanEqualExpression",
92
+ "PyLegendDateGreaterThanExpression",
93
+ "PyLegendDateGreaterThanEqualExpression",
86
94
  ]
87
95
 
88
96
 
@@ -98,7 +106,7 @@ class PyLegendFirstDayOfYearExpression(PyLegendUnaryExpression, PyLegendExpressi
98
106
 
99
107
  @staticmethod
100
108
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
101
- return generate_pure_functional_call("firstDayOfYear", [op_expr], auto_map=True)
109
+ return generate_pure_functional_call("firstDayOfYear", [op_expr])
102
110
 
103
111
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
104
112
  PyLegendExpressionDateReturn.__init__(self)
@@ -106,7 +114,9 @@ class PyLegendFirstDayOfYearExpression(PyLegendUnaryExpression, PyLegendExpressi
106
114
  self,
107
115
  operand,
108
116
  PyLegendFirstDayOfYearExpression.__to_sql_func,
109
- PyLegendFirstDayOfYearExpression.__to_pure_func
117
+ PyLegendFirstDayOfYearExpression.__to_pure_func,
118
+ non_nullable=True,
119
+ operand_needs_to_be_non_nullable=True
110
120
  )
111
121
 
112
122
 
@@ -122,7 +132,7 @@ class PyLegendFirstDayOfQuarterExpression(PyLegendUnaryExpression, PyLegendExpre
122
132
 
123
133
  @staticmethod
124
134
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
125
- return generate_pure_functional_call("firstDayOfQuarter", [op_expr], auto_map=True)
135
+ return generate_pure_functional_call("firstDayOfQuarter", [op_expr])
126
136
 
127
137
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
128
138
  PyLegendExpressionDateReturn.__init__(self)
@@ -130,7 +140,9 @@ class PyLegendFirstDayOfQuarterExpression(PyLegendUnaryExpression, PyLegendExpre
130
140
  self,
131
141
  operand,
132
142
  PyLegendFirstDayOfQuarterExpression.__to_sql_func,
133
- PyLegendFirstDayOfQuarterExpression.__to_pure_func
143
+ PyLegendFirstDayOfQuarterExpression.__to_pure_func,
144
+ non_nullable=True,
145
+ operand_needs_to_be_non_nullable=True
134
146
  )
135
147
 
136
148
 
@@ -146,7 +158,7 @@ class PyLegendFirstDayOfMonthExpression(PyLegendUnaryExpression, PyLegendExpress
146
158
 
147
159
  @staticmethod
148
160
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
149
- return generate_pure_functional_call("firstDayOfMonth", [op_expr], auto_map=True)
161
+ return generate_pure_functional_call("firstDayOfMonth", [op_expr])
150
162
 
151
163
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
152
164
  PyLegendExpressionDateReturn.__init__(self)
@@ -154,7 +166,9 @@ class PyLegendFirstDayOfMonthExpression(PyLegendUnaryExpression, PyLegendExpress
154
166
  self,
155
167
  operand,
156
168
  PyLegendFirstDayOfMonthExpression.__to_sql_func,
157
- PyLegendFirstDayOfMonthExpression.__to_pure_func
169
+ PyLegendFirstDayOfMonthExpression.__to_pure_func,
170
+ non_nullable=True,
171
+ operand_needs_to_be_non_nullable=True
158
172
  )
159
173
 
160
174
 
@@ -170,7 +184,7 @@ class PyLegendFirstDayOfWeekExpression(PyLegendUnaryExpression, PyLegendExpressi
170
184
 
171
185
  @staticmethod
172
186
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
173
- return generate_pure_functional_call("firstDayOfWeek", [op_expr], auto_map=True)
187
+ return generate_pure_functional_call("firstDayOfWeek", [op_expr])
174
188
 
175
189
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
176
190
  PyLegendExpressionDateReturn.__init__(self)
@@ -178,7 +192,9 @@ class PyLegendFirstDayOfWeekExpression(PyLegendUnaryExpression, PyLegendExpressi
178
192
  self,
179
193
  operand,
180
194
  PyLegendFirstDayOfWeekExpression.__to_sql_func,
181
- PyLegendFirstDayOfWeekExpression.__to_pure_func
195
+ PyLegendFirstDayOfWeekExpression.__to_pure_func,
196
+ non_nullable=True,
197
+ operand_needs_to_be_non_nullable=True
182
198
  )
183
199
 
184
200
 
@@ -194,7 +210,7 @@ class PyLegendFirstHourOfDayExpression(PyLegendUnaryExpression, PyLegendExpressi
194
210
 
195
211
  @staticmethod
196
212
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
197
- return generate_pure_functional_call("firstHourOfDay", [op_expr], auto_map=True)
213
+ return generate_pure_functional_call("firstHourOfDay", [op_expr])
198
214
 
199
215
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
200
216
  PyLegendExpressionDateTimeReturn.__init__(self)
@@ -202,7 +218,9 @@ class PyLegendFirstHourOfDayExpression(PyLegendUnaryExpression, PyLegendExpressi
202
218
  self,
203
219
  operand,
204
220
  PyLegendFirstHourOfDayExpression.__to_sql_func,
205
- PyLegendFirstHourOfDayExpression.__to_pure_func
221
+ PyLegendFirstHourOfDayExpression.__to_pure_func,
222
+ non_nullable=True,
223
+ operand_needs_to_be_non_nullable=True
206
224
  )
207
225
 
208
226
 
@@ -218,7 +236,7 @@ class PyLegendFirstMinuteOfHourExpression(PyLegendUnaryExpression, PyLegendExpre
218
236
 
219
237
  @staticmethod
220
238
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
221
- return generate_pure_functional_call("firstMinuteOfHour", [op_expr], auto_map=True)
239
+ return generate_pure_functional_call("firstMinuteOfHour", [op_expr])
222
240
 
223
241
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
224
242
  PyLegendExpressionDateTimeReturn.__init__(self)
@@ -226,7 +244,9 @@ class PyLegendFirstMinuteOfHourExpression(PyLegendUnaryExpression, PyLegendExpre
226
244
  self,
227
245
  operand,
228
246
  PyLegendFirstMinuteOfHourExpression.__to_sql_func,
229
- PyLegendFirstMinuteOfHourExpression.__to_pure_func
247
+ PyLegendFirstMinuteOfHourExpression.__to_pure_func,
248
+ non_nullable=True,
249
+ operand_needs_to_be_non_nullable=True
230
250
  )
231
251
 
232
252
 
@@ -242,7 +262,7 @@ class PyLegendFirstSecondOfMinuteExpression(PyLegendUnaryExpression, PyLegendExp
242
262
 
243
263
  @staticmethod
244
264
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
245
- return generate_pure_functional_call("firstSecondOfMinute", [op_expr], auto_map=True)
265
+ return generate_pure_functional_call("firstSecondOfMinute", [op_expr])
246
266
 
247
267
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
248
268
  PyLegendExpressionDateTimeReturn.__init__(self)
@@ -250,7 +270,9 @@ class PyLegendFirstSecondOfMinuteExpression(PyLegendUnaryExpression, PyLegendExp
250
270
  self,
251
271
  operand,
252
272
  PyLegendFirstSecondOfMinuteExpression.__to_sql_func,
253
- PyLegendFirstSecondOfMinuteExpression.__to_pure_func
273
+ PyLegendFirstSecondOfMinuteExpression.__to_pure_func,
274
+ non_nullable=True,
275
+ operand_needs_to_be_non_nullable=True
254
276
  )
255
277
 
256
278
 
@@ -266,7 +288,7 @@ class PyLegendFirstMillisecondOfSecondExpression(PyLegendUnaryExpression, PyLege
266
288
 
267
289
  @staticmethod
268
290
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
269
- return generate_pure_functional_call("firstMillisecondOfSecond", [op_expr], auto_map=True)
291
+ return generate_pure_functional_call("firstMillisecondOfSecond", [op_expr])
270
292
 
271
293
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
272
294
  PyLegendExpressionDateTimeReturn.__init__(self)
@@ -274,7 +296,9 @@ class PyLegendFirstMillisecondOfSecondExpression(PyLegendUnaryExpression, PyLege
274
296
  self,
275
297
  operand,
276
298
  PyLegendFirstMillisecondOfSecondExpression.__to_sql_func,
277
- PyLegendFirstMillisecondOfSecondExpression.__to_pure_func
299
+ PyLegendFirstMillisecondOfSecondExpression.__to_pure_func,
300
+ non_nullable=True,
301
+ operand_needs_to_be_non_nullable=True
278
302
  )
279
303
 
280
304
 
@@ -290,7 +314,7 @@ class PyLegendYearExpression(PyLegendUnaryExpression, PyLegendExpressionIntegerR
290
314
 
291
315
  @staticmethod
292
316
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
293
- return generate_pure_functional_call("year", [op_expr], auto_map=True)
317
+ return generate_pure_functional_call("year", [op_expr])
294
318
 
295
319
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
296
320
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -298,7 +322,9 @@ class PyLegendYearExpression(PyLegendUnaryExpression, PyLegendExpressionIntegerR
298
322
  self,
299
323
  operand,
300
324
  PyLegendYearExpression.__to_sql_func,
301
- PyLegendYearExpression.__to_pure_func
325
+ PyLegendYearExpression.__to_pure_func,
326
+ non_nullable=True,
327
+ operand_needs_to_be_non_nullable=True
302
328
  )
303
329
 
304
330
 
@@ -314,7 +340,7 @@ class PyLegendQuarterExpression(PyLegendUnaryExpression, PyLegendExpressionInteg
314
340
 
315
341
  @staticmethod
316
342
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
317
- return generate_pure_functional_call("quarter", [op_expr], auto_map=True)
343
+ return generate_pure_functional_call("quarter", [op_expr])
318
344
 
319
345
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
320
346
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -322,7 +348,9 @@ class PyLegendQuarterExpression(PyLegendUnaryExpression, PyLegendExpressionInteg
322
348
  self,
323
349
  operand,
324
350
  PyLegendQuarterExpression.__to_sql_func,
325
- PyLegendQuarterExpression.__to_pure_func
351
+ PyLegendQuarterExpression.__to_pure_func,
352
+ non_nullable=True,
353
+ operand_needs_to_be_non_nullable=True
326
354
  )
327
355
 
328
356
 
@@ -338,7 +366,7 @@ class PyLegendMonthExpression(PyLegendUnaryExpression, PyLegendExpressionInteger
338
366
 
339
367
  @staticmethod
340
368
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
341
- return generate_pure_functional_call("month", [op_expr], auto_map=True)
369
+ return generate_pure_functional_call("month", [op_expr])
342
370
 
343
371
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
344
372
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -346,7 +374,9 @@ class PyLegendMonthExpression(PyLegendUnaryExpression, PyLegendExpressionInteger
346
374
  self,
347
375
  operand,
348
376
  PyLegendMonthExpression.__to_sql_func,
349
- PyLegendMonthExpression.__to_pure_func
377
+ PyLegendMonthExpression.__to_pure_func,
378
+ non_nullable=True,
379
+ operand_needs_to_be_non_nullable=True
350
380
  )
351
381
 
352
382
 
@@ -362,7 +392,7 @@ class PyLegendWeekOfYearExpression(PyLegendUnaryExpression, PyLegendExpressionIn
362
392
 
363
393
  @staticmethod
364
394
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
365
- return generate_pure_functional_call("weekOfYear", [op_expr], auto_map=True)
395
+ return generate_pure_functional_call("weekOfYear", [op_expr])
366
396
 
367
397
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
368
398
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -370,7 +400,9 @@ class PyLegendWeekOfYearExpression(PyLegendUnaryExpression, PyLegendExpressionIn
370
400
  self,
371
401
  operand,
372
402
  PyLegendWeekOfYearExpression.__to_sql_func,
373
- PyLegendWeekOfYearExpression.__to_pure_func
403
+ PyLegendWeekOfYearExpression.__to_pure_func,
404
+ non_nullable=True,
405
+ operand_needs_to_be_non_nullable=True
374
406
  )
375
407
 
376
408
 
@@ -386,7 +418,7 @@ class PyLegendDayOfYearExpression(PyLegendUnaryExpression, PyLegendExpressionInt
386
418
 
387
419
  @staticmethod
388
420
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
389
- return generate_pure_functional_call("dayOfYear", [op_expr], auto_map=True)
421
+ return generate_pure_functional_call("dayOfYear", [op_expr])
390
422
 
391
423
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
392
424
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -394,7 +426,9 @@ class PyLegendDayOfYearExpression(PyLegendUnaryExpression, PyLegendExpressionInt
394
426
  self,
395
427
  operand,
396
428
  PyLegendDayOfYearExpression.__to_sql_func,
397
- PyLegendDayOfYearExpression.__to_pure_func
429
+ PyLegendDayOfYearExpression.__to_pure_func,
430
+ non_nullable=True,
431
+ operand_needs_to_be_non_nullable=True
398
432
  )
399
433
 
400
434
 
@@ -410,7 +444,7 @@ class PyLegendDayOfMonthExpression(PyLegendUnaryExpression, PyLegendExpressionIn
410
444
 
411
445
  @staticmethod
412
446
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
413
- return generate_pure_functional_call("dayOfMonth", [op_expr], auto_map=True)
447
+ return generate_pure_functional_call("dayOfMonth", [op_expr])
414
448
 
415
449
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
416
450
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -418,7 +452,9 @@ class PyLegendDayOfMonthExpression(PyLegendUnaryExpression, PyLegendExpressionIn
418
452
  self,
419
453
  operand,
420
454
  PyLegendDayOfMonthExpression.__to_sql_func,
421
- PyLegendDayOfMonthExpression.__to_pure_func
455
+ PyLegendDayOfMonthExpression.__to_pure_func,
456
+ non_nullable=True,
457
+ operand_needs_to_be_non_nullable=True
422
458
  )
423
459
 
424
460
 
@@ -434,7 +470,7 @@ class PyLegendDayOfWeekExpression(PyLegendUnaryExpression, PyLegendExpressionInt
434
470
 
435
471
  @staticmethod
436
472
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
437
- return generate_pure_functional_call("dayOfWeekNumber", [op_expr], auto_map=True)
473
+ return generate_pure_functional_call("dayOfWeekNumber", [op_expr])
438
474
 
439
475
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
440
476
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -442,7 +478,9 @@ class PyLegendDayOfWeekExpression(PyLegendUnaryExpression, PyLegendExpressionInt
442
478
  self,
443
479
  operand,
444
480
  PyLegendDayOfWeekExpression.__to_sql_func,
445
- PyLegendDayOfWeekExpression.__to_pure_func
481
+ PyLegendDayOfWeekExpression.__to_pure_func,
482
+ non_nullable=True,
483
+ operand_needs_to_be_non_nullable=True
446
484
  )
447
485
 
448
486
 
@@ -458,7 +496,7 @@ class PyLegendHourExpression(PyLegendUnaryExpression, PyLegendExpressionIntegerR
458
496
 
459
497
  @staticmethod
460
498
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
461
- return generate_pure_functional_call("hour", [op_expr], auto_map=True)
499
+ return generate_pure_functional_call("hour", [op_expr])
462
500
 
463
501
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
464
502
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -466,7 +504,9 @@ class PyLegendHourExpression(PyLegendUnaryExpression, PyLegendExpressionIntegerR
466
504
  self,
467
505
  operand,
468
506
  PyLegendHourExpression.__to_sql_func,
469
- PyLegendHourExpression.__to_pure_func
507
+ PyLegendHourExpression.__to_pure_func,
508
+ non_nullable=True,
509
+ operand_needs_to_be_non_nullable=True
470
510
  )
471
511
 
472
512
 
@@ -482,7 +522,7 @@ class PyLegendMinuteExpression(PyLegendUnaryExpression, PyLegendExpressionIntege
482
522
 
483
523
  @staticmethod
484
524
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
485
- return generate_pure_functional_call("minute", [op_expr], auto_map=True)
525
+ return generate_pure_functional_call("minute", [op_expr])
486
526
 
487
527
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
488
528
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -490,7 +530,9 @@ class PyLegendMinuteExpression(PyLegendUnaryExpression, PyLegendExpressionIntege
490
530
  self,
491
531
  operand,
492
532
  PyLegendMinuteExpression.__to_sql_func,
493
- PyLegendMinuteExpression.__to_pure_func
533
+ PyLegendMinuteExpression.__to_pure_func,
534
+ non_nullable=True,
535
+ operand_needs_to_be_non_nullable=True
494
536
  )
495
537
 
496
538
 
@@ -506,7 +548,7 @@ class PyLegendSecondExpression(PyLegendUnaryExpression, PyLegendExpressionIntege
506
548
 
507
549
  @staticmethod
508
550
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
509
- return generate_pure_functional_call("second", [op_expr], auto_map=True)
551
+ return generate_pure_functional_call("second", [op_expr])
510
552
 
511
553
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
512
554
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -514,7 +556,9 @@ class PyLegendSecondExpression(PyLegendUnaryExpression, PyLegendExpressionIntege
514
556
  self,
515
557
  operand,
516
558
  PyLegendSecondExpression.__to_sql_func,
517
- PyLegendSecondExpression.__to_pure_func
559
+ PyLegendSecondExpression.__to_pure_func,
560
+ non_nullable=True,
561
+ operand_needs_to_be_non_nullable=True
518
562
  )
519
563
 
520
564
 
@@ -530,7 +574,7 @@ class PyLegendEpochExpression(PyLegendUnaryExpression, PyLegendExpressionInteger
530
574
 
531
575
  @staticmethod
532
576
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
533
- return generate_pure_functional_call("toEpochValue", [op_expr], auto_map=True)
577
+ return generate_pure_functional_call("toEpochValue", [op_expr])
534
578
 
535
579
  def __init__(self, operand: PyLegendExpressionDateReturn) -> None:
536
580
  PyLegendExpressionIntegerReturn.__init__(self)
@@ -538,7 +582,9 @@ class PyLegendEpochExpression(PyLegendUnaryExpression, PyLegendExpressionInteger
538
582
  self,
539
583
  operand,
540
584
  PyLegendEpochExpression.__to_sql_func,
541
- PyLegendEpochExpression.__to_pure_func
585
+ PyLegendEpochExpression.__to_pure_func,
586
+ non_nullable=True,
587
+ operand_needs_to_be_non_nullable=True
542
588
  )
543
589
 
544
590
 
@@ -560,7 +606,8 @@ class PyLegendTodayExpression(PyLegendNullaryExpression, PyLegendExpressionStric
560
606
  PyLegendNullaryExpression.__init__(
561
607
  self,
562
608
  PyLegendTodayExpression.__to_sql_func,
563
- PyLegendTodayExpression.__to_pure_func
609
+ PyLegendTodayExpression.__to_pure_func,
610
+ non_nullable=True
564
611
  )
565
612
 
566
613
 
@@ -582,7 +629,8 @@ class PyLegendNowExpression(PyLegendNullaryExpression, PyLegendExpressionDateTim
582
629
  PyLegendNullaryExpression.__init__(
583
630
  self,
584
631
  PyLegendNowExpression.__to_sql_func,
585
- PyLegendNowExpression.__to_pure_func
632
+ PyLegendNowExpression.__to_pure_func,
633
+ non_nullable=True
586
634
  )
587
635
 
588
636
 
@@ -601,7 +649,7 @@ class PyLegendDatePartExpression(PyLegendUnaryExpression, PyLegendExpressionStri
601
649
  return generate_pure_functional_call(
602
650
  "cast",
603
651
  [
604
- generate_pure_functional_call("datePart", [op_expr], auto_map=True),
652
+ generate_pure_functional_call("datePart", [op_expr]),
605
653
  "@StrictDate",
606
654
  ]
607
655
  )
@@ -612,5 +660,123 @@ class PyLegendDatePartExpression(PyLegendUnaryExpression, PyLegendExpressionStri
612
660
  self,
613
661
  operand,
614
662
  PyLegendDatePartExpression.__to_sql_func,
615
- PyLegendDatePartExpression.__to_pure_func
663
+ PyLegendDatePartExpression.__to_pure_func,
664
+ non_nullable=True,
665
+ operand_needs_to_be_non_nullable=True
616
666
  )
667
+
668
+
669
+ class PyLegendDateLessThanExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
670
+
671
+ @staticmethod
672
+ def __to_sql_func(
673
+ expression1: Expression,
674
+ expression2: Expression,
675
+ frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
676
+ config: FrameToSqlConfig
677
+ ) -> Expression:
678
+ return ComparisonExpression(expression1, expression2, ComparisonOperator.LESS_THAN)
679
+
680
+ @staticmethod
681
+ def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
682
+ return f"({op1_expr} < {op2_expr})"
683
+
684
+ def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
685
+ PyLegendExpressionBooleanReturn.__init__(self)
686
+ PyLegendBinaryExpression.__init__(
687
+ self,
688
+ operand1,
689
+ operand2,
690
+ PyLegendDateLessThanExpression.__to_sql_func,
691
+ PyLegendDateLessThanExpression.__to_pure_func
692
+ )
693
+
694
+ def is_non_nullable(self) -> bool:
695
+ return True
696
+
697
+
698
+ class PyLegendDateLessThanEqualExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
699
+
700
+ @staticmethod
701
+ def __to_sql_func(
702
+ expression1: Expression,
703
+ expression2: Expression,
704
+ frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
705
+ config: FrameToSqlConfig
706
+ ) -> Expression:
707
+ return ComparisonExpression(expression1, expression2, ComparisonOperator.LESS_THAN_OR_EQUAL)
708
+
709
+ @staticmethod
710
+ def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
711
+ return f"({op1_expr} <= {op2_expr})"
712
+
713
+ def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
714
+ PyLegendExpressionBooleanReturn.__init__(self)
715
+ PyLegendBinaryExpression.__init__(
716
+ self,
717
+ operand1,
718
+ operand2,
719
+ PyLegendDateLessThanEqualExpression.__to_sql_func,
720
+ PyLegendDateLessThanEqualExpression.__to_pure_func
721
+ )
722
+
723
+ def is_non_nullable(self) -> bool:
724
+ return True
725
+
726
+
727
+ class PyLegendDateGreaterThanExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
728
+
729
+ @staticmethod
730
+ def __to_sql_func(
731
+ expression1: Expression,
732
+ expression2: Expression,
733
+ frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
734
+ config: FrameToSqlConfig
735
+ ) -> Expression:
736
+ return ComparisonExpression(expression1, expression2, ComparisonOperator.GREATER_THAN)
737
+
738
+ @staticmethod
739
+ def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
740
+ return f"({op1_expr} > {op2_expr})"
741
+
742
+ def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
743
+ PyLegendExpressionBooleanReturn.__init__(self)
744
+ PyLegendBinaryExpression.__init__(
745
+ self,
746
+ operand1,
747
+ operand2,
748
+ PyLegendDateGreaterThanExpression.__to_sql_func,
749
+ PyLegendDateGreaterThanExpression.__to_pure_func
750
+ )
751
+
752
+ def is_non_nullable(self) -> bool:
753
+ return True
754
+
755
+
756
+ class PyLegendDateGreaterThanEqualExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
757
+
758
+ @staticmethod
759
+ def __to_sql_func(
760
+ expression1: Expression,
761
+ expression2: Expression,
762
+ frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
763
+ config: FrameToSqlConfig
764
+ ) -> Expression:
765
+ return ComparisonExpression(expression1, expression2, ComparisonOperator.GREATER_THAN_OR_EQUAL)
766
+
767
+ @staticmethod
768
+ def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
769
+ return f"({op1_expr} >= {op2_expr})"
770
+
771
+ def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
772
+ PyLegendExpressionBooleanReturn.__init__(self)
773
+ PyLegendBinaryExpression.__init__(
774
+ self,
775
+ operand1,
776
+ operand2,
777
+ PyLegendDateGreaterThanEqualExpression.__to_sql_func,
778
+ PyLegendDateGreaterThanEqualExpression.__to_pure_func
779
+ )
780
+
781
+ def is_non_nullable(self) -> bool:
782
+ return True
@@ -67,15 +67,12 @@ class PyLegendFloatAddExpression(PyLegendBinaryExpression, PyLegendExpressionFlo
67
67
  operand1,
68
68
  operand2,
69
69
  PyLegendFloatAddExpression.__to_sql_func,
70
- PyLegendFloatAddExpression.__to_pure_func
70
+ PyLegendFloatAddExpression.__to_pure_func,
71
+ non_nullable=True,
72
+ first_operand_needs_to_be_non_nullable=True,
73
+ second_operand_needs_to_be_non_nullable=True
71
74
  )
72
75
 
73
- def is_non_nullable(self) -> bool:
74
- return True
75
-
76
- def to_pure_expression(self, config: FrameToPureConfig) -> str:
77
- return PyLegendBinaryExpression.to_pure_expression_with_to_one_on_both_operands(self, config)
78
-
79
76
 
80
77
  class PyLegendFloatSubtractExpression(PyLegendBinaryExpression, PyLegendExpressionFloatReturn):
81
78
 
@@ -99,15 +96,12 @@ class PyLegendFloatSubtractExpression(PyLegendBinaryExpression, PyLegendExpressi
99
96
  operand1,
100
97
  operand2,
101
98
  PyLegendFloatSubtractExpression.__to_sql_func,
102
- PyLegendFloatSubtractExpression.__to_pure_func
99
+ PyLegendFloatSubtractExpression.__to_pure_func,
100
+ non_nullable=True,
101
+ first_operand_needs_to_be_non_nullable=True,
102
+ second_operand_needs_to_be_non_nullable=True
103
103
  )
104
104
 
105
- def is_non_nullable(self) -> bool:
106
- return True
107
-
108
- def to_pure_expression(self, config: FrameToPureConfig) -> str:
109
- return PyLegendBinaryExpression.to_pure_expression_with_to_one_on_both_operands(self, config)
110
-
111
105
 
112
106
  class PyLegendFloatMultiplyExpression(PyLegendBinaryExpression, PyLegendExpressionFloatReturn):
113
107
 
@@ -131,15 +125,12 @@ class PyLegendFloatMultiplyExpression(PyLegendBinaryExpression, PyLegendExpressi
131
125
  operand1,
132
126
  operand2,
133
127
  PyLegendFloatMultiplyExpression.__to_sql_func,
134
- PyLegendFloatMultiplyExpression.__to_pure_func
128
+ PyLegendFloatMultiplyExpression.__to_pure_func,
129
+ non_nullable=True,
130
+ first_operand_needs_to_be_non_nullable=True,
131
+ second_operand_needs_to_be_non_nullable=True
135
132
  )
136
133
 
137
- def is_non_nullable(self) -> bool:
138
- return True
139
-
140
- def to_pure_expression(self, config: FrameToPureConfig) -> str:
141
- return PyLegendBinaryExpression.to_pure_expression_with_to_one_on_both_operands(self, config)
142
-
143
134
 
144
135
  class PyLegendFloatAbsoluteExpression(PyLegendUnaryExpression, PyLegendExpressionFloatReturn):
145
136
 
@@ -153,7 +144,7 @@ class PyLegendFloatAbsoluteExpression(PyLegendUnaryExpression, PyLegendExpressio
153
144
 
154
145
  @staticmethod
155
146
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
156
- return generate_pure_functional_call("abs", [op_expr], auto_map=True)
147
+ return generate_pure_functional_call("abs", [op_expr])
157
148
 
158
149
  def __init__(self, operand: PyLegendExpressionFloatReturn) -> None:
159
150
  PyLegendExpressionFloatReturn.__init__(self)
@@ -161,7 +152,9 @@ class PyLegendFloatAbsoluteExpression(PyLegendUnaryExpression, PyLegendExpressio
161
152
  self,
162
153
  operand,
163
154
  PyLegendFloatAbsoluteExpression.__to_sql_func,
164
- PyLegendFloatAbsoluteExpression.__to_pure_func
155
+ PyLegendFloatAbsoluteExpression.__to_pure_func,
156
+ non_nullable=True,
157
+ operand_needs_to_be_non_nullable=True
165
158
  )
166
159
 
167
160
 
@@ -177,7 +170,7 @@ class PyLegendFloatNegativeExpression(PyLegendUnaryExpression, PyLegendExpressio
177
170
 
178
171
  @staticmethod
179
172
  def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
180
- return generate_pure_functional_call("minus", [op_expr], auto_map=True)
173
+ return generate_pure_functional_call("minus", [op_expr])
181
174
 
182
175
  def __init__(self, operand: PyLegendExpressionFloatReturn) -> None:
183
176
  PyLegendExpressionFloatReturn.__init__(self)
@@ -185,5 +178,7 @@ class PyLegendFloatNegativeExpression(PyLegendUnaryExpression, PyLegendExpressio
185
178
  self,
186
179
  operand,
187
180
  PyLegendFloatNegativeExpression.__to_sql_func,
188
- PyLegendFloatNegativeExpression.__to_pure_func
181
+ PyLegendFloatNegativeExpression.__to_pure_func,
182
+ non_nullable=True,
183
+ operand_needs_to_be_non_nullable=True,
189
184
  )