pytrilogy 0.0.2.1__py3-none-any.whl → 0.0.2.3__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.
Potentially problematic release.
This version of pytrilogy might be problematic. Click here for more details.
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.3.dist-info}/METADATA +3 -3
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.3.dist-info}/RECORD +25 -25
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.3.dist-info}/WHEEL +1 -1
- trilogy/__init__.py +1 -1
- trilogy/core/enums.py +1 -0
- trilogy/core/env_processor.py +5 -0
- trilogy/core/functions.py +30 -5
- trilogy/core/models.py +71 -8
- trilogy/core/optimization.py +46 -31
- trilogy/core/optimizations/predicate_pushdown.py +74 -8
- trilogy/core/processing/concept_strategies_v3.py +9 -0
- trilogy/core/processing/node_generators/basic_node.py +1 -1
- trilogy/core/processing/node_generators/node_merge_node.py +46 -108
- trilogy/core/processing/node_generators/select_node.py +2 -3
- trilogy/core/processing/utility.py +10 -32
- trilogy/core/query_processor.py +3 -1
- trilogy/dialect/base.py +32 -83
- trilogy/dialect/presto.py +1 -0
- trilogy/parsing/common.py +4 -1
- trilogy/parsing/parse_engine.py +25 -5
- trilogy/parsing/render.py +7 -3
- trilogy/parsing/trilogy.lark +6 -3
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.3.dist-info}/LICENSE.md +0 -0
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.3.dist-info}/entry_points.txt +0 -0
- {pytrilogy-0.0.2.1.dist-info → pytrilogy-0.0.2.3.dist-info}/top_level.txt +0 -0
trilogy/parsing/render.py
CHANGED
|
@@ -131,11 +131,15 @@ class Renderer:
|
|
|
131
131
|
@to_string.register
|
|
132
132
|
def _(self, arg: Datasource):
|
|
133
133
|
assignments = ",\n\t".join([self.to_string(x) for x in arg.columns])
|
|
134
|
-
|
|
134
|
+
base = f"""datasource {arg.name} (
|
|
135
135
|
{assignments}
|
|
136
136
|
)
|
|
137
137
|
{self.to_string(arg.grain)}
|
|
138
|
-
{self.to_string(arg.address)}
|
|
138
|
+
{self.to_string(arg.address)}"""
|
|
139
|
+
if arg.where:
|
|
140
|
+
base += f"\n{self.to_string(arg.where)}"
|
|
141
|
+
base += ";"
|
|
142
|
+
return base
|
|
139
143
|
|
|
140
144
|
@to_string.register
|
|
141
145
|
def _(self, arg: "Grain"):
|
|
@@ -196,7 +200,7 @@ class Renderer:
|
|
|
196
200
|
|
|
197
201
|
@to_string.register
|
|
198
202
|
def _(self, arg: "ColumnAssignment"):
|
|
199
|
-
return f"{arg.alias}:{self.to_string(arg.concept)}"
|
|
203
|
+
return f"{arg.alias}: {self.to_string(arg.concept)}"
|
|
200
204
|
|
|
201
205
|
@to_string.register
|
|
202
206
|
def _(self, arg: "ConceptDeclarationStatement"):
|
trilogy/parsing/trilogy.lark
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
prop_ident: "<" IDENTIFIER ("," IDENTIFIER )* ","? ">" "." IDENTIFIER
|
|
36
36
|
|
|
37
37
|
// datasource concepts
|
|
38
|
-
datasource: "datasource" IDENTIFIER "(" column_assignment_list ")" grain_clause? (address | query)
|
|
38
|
+
datasource: "datasource" IDENTIFIER "(" column_assignment_list ")" grain_clause? (address | query) where?
|
|
39
39
|
|
|
40
40
|
grain_clause: "grain" "(" column_list ")"
|
|
41
41
|
|
|
@@ -274,12 +274,14 @@
|
|
|
274
274
|
float_lit: /[0-9]*\.[0-9]+/
|
|
275
275
|
|
|
276
276
|
array_lit: "[" (literal ",")* literal ","? "]"()
|
|
277
|
+
|
|
278
|
+
map_lit: "{" (literal ":" literal ",")* literal ":" literal ","? "}"
|
|
277
279
|
|
|
278
280
|
!bool_lit: "True"i | "False"i
|
|
279
281
|
|
|
280
282
|
!null_lit.1: "null"i
|
|
281
283
|
|
|
282
|
-
literal: null_lit | _string_lit | int_lit | float_lit | bool_lit | array_lit
|
|
284
|
+
literal: null_lit | _string_lit | int_lit | float_lit | bool_lit | array_lit | map_lit
|
|
283
285
|
|
|
284
286
|
MODIFIER: "Optional"i | "Partial"i | "Nullable"i
|
|
285
287
|
|
|
@@ -291,8 +293,9 @@
|
|
|
291
293
|
|
|
292
294
|
numeric_type: "numeric"i "(" int_lit "," int_lit ")"
|
|
293
295
|
|
|
296
|
+
map_type: "map"i "<" data_type "," data_type ">"
|
|
294
297
|
|
|
295
|
-
!data_type: "string"i | "number"i | "numeric"i | "map"i | "list"i | "array"i | "any"i | "int"i | "bigint"i | "date"i | "datetime"i | "timestamp"i | "float"i | "bool"i | numeric_type | struct_type | list_type
|
|
298
|
+
!data_type: "string"i | "number"i | "numeric"i | "map"i | "list"i | "array"i | "any"i | "int"i | "bigint"i | "date"i | "datetime"i | "timestamp"i | "float"i | "bool"i | numeric_type | map_type | struct_type | list_type
|
|
296
299
|
|
|
297
300
|
PURPOSE: "key"i | "metric"i | CONST
|
|
298
301
|
PROPERTY: "property"i
|
|
File without changes
|
|
File without changes
|
|
File without changes
|