pytrilogy 0.0.2.13__py3-none-any.whl → 0.0.2.14__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.13.dist-info → pytrilogy-0.0.2.14.dist-info}/METADATA +1 -1
- {pytrilogy-0.0.2.13.dist-info → pytrilogy-0.0.2.14.dist-info}/RECORD +28 -28
- trilogy/__init__.py +1 -1
- trilogy/constants.py +12 -2
- trilogy/core/models.py +120 -11
- trilogy/core/optimizations/predicate_pushdown.py +1 -1
- trilogy/core/processing/node_generators/common.py +0 -13
- trilogy/core/processing/node_generators/filter_node.py +1 -15
- trilogy/core/processing/node_generators/group_node.py +19 -1
- trilogy/core/processing/node_generators/group_to_node.py +0 -12
- trilogy/core/processing/node_generators/multiselect_node.py +1 -10
- trilogy/core/processing/node_generators/rowset_node.py +3 -14
- trilogy/core/processing/node_generators/select_node.py +26 -0
- trilogy/core/processing/node_generators/window_node.py +1 -1
- trilogy/core/processing/nodes/base_node.py +28 -1
- trilogy/core/processing/nodes/group_node.py +31 -18
- trilogy/core/processing/nodes/merge_node.py +13 -4
- trilogy/core/processing/nodes/select_node_v2.py +4 -0
- trilogy/core/processing/utility.py +91 -3
- trilogy/core/query_processor.py +1 -2
- trilogy/dialect/common.py +10 -8
- trilogy/parsing/common.py +18 -2
- trilogy/parsing/parse_engine.py +13 -9
- trilogy/parsing/trilogy.lark +2 -2
- {pytrilogy-0.0.2.13.dist-info → pytrilogy-0.0.2.14.dist-info}/LICENSE.md +0 -0
- {pytrilogy-0.0.2.13.dist-info → pytrilogy-0.0.2.14.dist-info}/WHEEL +0 -0
- {pytrilogy-0.0.2.13.dist-info → pytrilogy-0.0.2.14.dist-info}/entry_points.txt +0 -0
- {pytrilogy-0.0.2.13.dist-info → pytrilogy-0.0.2.14.dist-info}/top_level.txt +0 -0
trilogy/parsing/parse_engine.py
CHANGED
|
@@ -92,6 +92,7 @@ from trilogy.core.models import (
|
|
|
92
92
|
WindowItemOver,
|
|
93
93
|
RawColumnExpr,
|
|
94
94
|
arg_to_datatype,
|
|
95
|
+
merge_datatypes,
|
|
95
96
|
ListWrapper,
|
|
96
97
|
MapWrapper,
|
|
97
98
|
MapType,
|
|
@@ -1705,8 +1706,7 @@ class ParseToObjects(Transformer):
|
|
|
1705
1706
|
@v_args(meta=True)
|
|
1706
1707
|
def fadd(self, meta, args) -> Function:
|
|
1707
1708
|
args = process_function_args(args, meta=meta, environment=self.environment)
|
|
1708
|
-
output_datatype = arg_to_datatype(args
|
|
1709
|
-
# TODO: check for valid transforms?
|
|
1709
|
+
output_datatype = merge_datatypes([arg_to_datatype(x) for x in args])
|
|
1710
1710
|
return Function(
|
|
1711
1711
|
operator=FunctionType.ADD,
|
|
1712
1712
|
arguments=args,
|
|
@@ -1719,7 +1719,7 @@ class ParseToObjects(Transformer):
|
|
|
1719
1719
|
@v_args(meta=True)
|
|
1720
1720
|
def fsub(self, meta, args) -> Function:
|
|
1721
1721
|
args = process_function_args(args, meta=meta, environment=self.environment)
|
|
1722
|
-
output_datatype = arg_to_datatype(args
|
|
1722
|
+
output_datatype = merge_datatypes([arg_to_datatype(x) for x in args])
|
|
1723
1723
|
return Function(
|
|
1724
1724
|
operator=FunctionType.SUBTRACT,
|
|
1725
1725
|
arguments=args,
|
|
@@ -1732,7 +1732,7 @@ class ParseToObjects(Transformer):
|
|
|
1732
1732
|
@v_args(meta=True)
|
|
1733
1733
|
def fmul(self, meta, args) -> Function:
|
|
1734
1734
|
args = process_function_args(args, meta=meta, environment=self.environment)
|
|
1735
|
-
output_datatype = arg_to_datatype(args
|
|
1735
|
+
output_datatype = merge_datatypes([arg_to_datatype(x) for x in args])
|
|
1736
1736
|
return Function(
|
|
1737
1737
|
operator=FunctionType.MULTIPLY,
|
|
1738
1738
|
arguments=args,
|
|
@@ -1744,8 +1744,8 @@ class ParseToObjects(Transformer):
|
|
|
1744
1744
|
|
|
1745
1745
|
@v_args(meta=True)
|
|
1746
1746
|
def fdiv(self, meta: Meta, args):
|
|
1747
|
-
output_datatype = arg_to_datatype(args[0])
|
|
1748
1747
|
args = process_function_args(args, meta=meta, environment=self.environment)
|
|
1748
|
+
output_datatype = merge_datatypes([arg_to_datatype(x) for x in args])
|
|
1749
1749
|
return Function(
|
|
1750
1750
|
operator=FunctionType.DIVIDE,
|
|
1751
1751
|
arguments=args,
|
|
@@ -1757,12 +1757,11 @@ class ParseToObjects(Transformer):
|
|
|
1757
1757
|
|
|
1758
1758
|
@v_args(meta=True)
|
|
1759
1759
|
def fmod(self, meta: Meta, args):
|
|
1760
|
-
output_datatype = arg_to_datatype(args[0])
|
|
1761
1760
|
args = process_function_args(args, meta=meta, environment=self.environment)
|
|
1762
1761
|
return Function(
|
|
1763
1762
|
operator=FunctionType.MOD,
|
|
1764
1763
|
arguments=args,
|
|
1765
|
-
output_datatype=
|
|
1764
|
+
output_datatype=DataType.INTEGER,
|
|
1766
1765
|
output_purpose=function_args_to_output_purpose(args),
|
|
1767
1766
|
valid_inputs=[
|
|
1768
1767
|
{DataType.INTEGER, DataType.FLOAT, DataType.NUMBER},
|
|
@@ -1789,12 +1788,15 @@ class ParseToObjects(Transformer):
|
|
|
1789
1788
|
|
|
1790
1789
|
def fcase(self, args: List[Union[CaseWhen, CaseElse]]):
|
|
1791
1790
|
datatypes = set()
|
|
1791
|
+
mapz = dict()
|
|
1792
1792
|
for arg in args:
|
|
1793
1793
|
output_datatype = arg_to_datatype(arg.expr)
|
|
1794
|
-
|
|
1794
|
+
if output_datatype != DataType.NULL:
|
|
1795
|
+
datatypes.add(output_datatype)
|
|
1796
|
+
mapz[str(arg.expr)] = output_datatype
|
|
1795
1797
|
if not len(datatypes) == 1:
|
|
1796
1798
|
raise SyntaxError(
|
|
1797
|
-
f"All case expressions must have the same output datatype, got {datatypes}"
|
|
1799
|
+
f"All case expressions must have the same output datatype, got {datatypes} from {mapz}"
|
|
1798
1800
|
)
|
|
1799
1801
|
return Function(
|
|
1800
1802
|
operator=FunctionType.CASE,
|
|
@@ -1838,6 +1840,8 @@ def unpack_visit_error(e: VisitError):
|
|
|
1838
1840
|
unpack_visit_error(e.orig_exc)
|
|
1839
1841
|
elif isinstance(e.orig_exc, (UndefinedConceptException, ImportError)):
|
|
1840
1842
|
raise e.orig_exc
|
|
1843
|
+
elif isinstance(e.orig_exc, SyntaxError):
|
|
1844
|
+
raise InvalidSyntaxException(str(e.orig_exc) + str(e.rule) + str(e.obj))
|
|
1841
1845
|
elif isinstance(e.orig_exc, (ValidationError, TypeError)):
|
|
1842
1846
|
raise InvalidSyntaxException(str(e.orig_exc) + str(e.rule) + str(e.obj))
|
|
1843
1847
|
raise e
|
trilogy/parsing/trilogy.lark
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
|
|
44
44
|
query: "query" MULTILINE_STRING
|
|
45
45
|
|
|
46
|
-
concept_assignment: SHORTHAND_MODIFIER
|
|
46
|
+
concept_assignment: SHORTHAND_MODIFIER* IDENTIFIER
|
|
47
47
|
|
|
48
48
|
//column_assignment
|
|
49
49
|
//figure out if we want static
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
|
|
151
151
|
subselect_comparison: expr array_comparison (literal | _constant_functions | _string_functions | concept_lit | filter_item | window_item | unnest | fgroup | expr_tuple | parenthetical )
|
|
152
152
|
|
|
153
|
-
expr_tuple: "(" expr ("," expr)+ ","? ")"
|
|
153
|
+
expr_tuple: ("(" expr ("," expr)+ ","? ")") | ("(" expr "," ")")
|
|
154
154
|
|
|
155
155
|
parenthetical: "(" expr ")"
|
|
156
156
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|