pytrilogy 0.0.3.65__tar.gz → 0.0.3.66__tar.gz
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.3.65/pytrilogy.egg-info → pytrilogy-0.0.3.66}/PKG-INFO +1 -1
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66/pytrilogy.egg-info}/PKG-INFO +1 -1
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_parsing.py +44 -1
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/__init__.py +1 -1
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/models/author.py +17 -4
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/models/build.py +4 -1
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/query_processor.py +3 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/parsing/common.py +28 -3
- pytrilogy-0.0.3.66/trilogy/std/display.preql +6 -0
- pytrilogy-0.0.3.65/trilogy/std/display.preql +0 -3
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/LICENSE.md +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/README.md +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/pyproject.toml +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/pytrilogy.egg-info/SOURCES.txt +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/pytrilogy.egg-info/dependency_links.txt +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/pytrilogy.egg-info/entry_points.txt +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/pytrilogy.egg-info/requires.txt +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/pytrilogy.egg-info/top_level.txt +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/setup.cfg +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/setup.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_datatypes.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_declarations.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_derived_concepts.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_discovery_nodes.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_enums.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_environment.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_executor.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_failure.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_functions.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_imports.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_metadata.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_models.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_multi_join_assignments.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_parse_engine.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_parsing_failures.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_partial_handling.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_query_processing.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_query_render.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_select.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_show.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_statements.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_typing.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_undefined_concept.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_user_functions.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/tests/test_where_clause.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/authoring/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/compiler.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/constants.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/constants.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/enums.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/env_processor.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/environment_helpers.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/ergonomics.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/exceptions.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/functions.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/graph_models.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/internal.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/models/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/models/build_environment.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/models/core.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/models/datasource.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/models/environment.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/models/execute.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/optimization.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/optimizations/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/optimizations/base_optimization.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/optimizations/inline_datasource.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/optimizations/predicate_pushdown.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/concept_strategies_v3.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/discovery_loop.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/discovery_node_factory.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/discovery_utility.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/discovery_validation.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/graph_utils.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/basic_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/common.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/filter_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/group_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/group_to_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/multiselect_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/node_merge_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/recursive_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/rowset_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/select_helpers/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/select_helpers/datasource_injection.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/select_merge_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/select_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/synonym_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/union_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/unnest_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/window_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/nodes/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/nodes/base_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/nodes/filter_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/nodes/group_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/nodes/merge_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/nodes/recursive_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/nodes/select_node_v2.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/nodes/union_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/nodes/unnest_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/nodes/window_node.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/utility.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/statements/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/statements/author.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/statements/build.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/statements/common.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/statements/execute.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/utility.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/base.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/bigquery.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/common.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/config.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/dataframe.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/duckdb.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/enums.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/postgres.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/presto.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/snowflake.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/dialect/sql_server.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/engine.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/executor.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/hooks/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/hooks/base_hook.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/hooks/graph_hook.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/hooks/query_debugger.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/metadata/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/parser.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/parsing/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/parsing/config.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/parsing/exceptions.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/parsing/helpers.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/parsing/parse_engine.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/parsing/render.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/parsing/trilogy.lark +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/py.typed +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/render.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/scripts/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/scripts/trilogy.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/std/__init__.py +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/std/date.preql +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/std/geography.preql +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/std/money.preql +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/std/net.preql +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/std/ranking.preql +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/std/report.preql +0 -0
- {pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/utility.py +0 -0
|
@@ -2,7 +2,7 @@ from trilogy import Dialects
|
|
|
2
2
|
from trilogy.constants import MagicConstants
|
|
3
3
|
from trilogy.core.enums import BooleanOperator, ComparisonOperator, Purpose
|
|
4
4
|
from trilogy.core.functions import argument_to_purpose, function_args_to_output_purpose
|
|
5
|
-
from trilogy.core.models.author import Comparison
|
|
5
|
+
from trilogy.core.models.author import Comparison, Conditional, SubselectComparison
|
|
6
6
|
from trilogy.core.models.core import (
|
|
7
7
|
DataType,
|
|
8
8
|
TupleWrapper,
|
|
@@ -16,6 +16,7 @@ from trilogy.core.models.environment import (
|
|
|
16
16
|
from trilogy.core.statements.author import SelectStatement, ShowStatement
|
|
17
17
|
from trilogy.core.statements.execute import ProcessedQuery
|
|
18
18
|
from trilogy.dialect.base import BaseDialect
|
|
19
|
+
from trilogy.parsing.common import atom_is_relevant
|
|
19
20
|
from trilogy.parsing.parse_engine import (
|
|
20
21
|
arg_to_datatype,
|
|
21
22
|
parse_text,
|
|
@@ -685,3 +686,45 @@ select x % 10 -> x_mod_10;
|
|
|
685
686
|
|
|
686
687
|
"""
|
|
687
688
|
)
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
def test_is_atom():
|
|
692
|
+
env = Environment()
|
|
693
|
+
|
|
694
|
+
env.parse(
|
|
695
|
+
"""
|
|
696
|
+
key x int;
|
|
697
|
+
auto x_sum <- sum(x);
|
|
698
|
+
"""
|
|
699
|
+
)
|
|
700
|
+
|
|
701
|
+
assert not atom_is_relevant(
|
|
702
|
+
Comparison(left=env.concepts["x_sum"], right=0, operator=ComparisonOperator.GT),
|
|
703
|
+
[env.concepts["x"]],
|
|
704
|
+
env,
|
|
705
|
+
)
|
|
706
|
+
assert atom_is_relevant(
|
|
707
|
+
Comparison(left=env.concepts["x"], right=0, operator=ComparisonOperator.GT),
|
|
708
|
+
[env.concepts["x_sum"]],
|
|
709
|
+
env,
|
|
710
|
+
)
|
|
711
|
+
|
|
712
|
+
assert not atom_is_relevant(
|
|
713
|
+
Conditional(left=env.concepts["x_sum"], right=0, operator=BooleanOperator.AND),
|
|
714
|
+
[env.concepts["x"]],
|
|
715
|
+
env,
|
|
716
|
+
)
|
|
717
|
+
assert atom_is_relevant(
|
|
718
|
+
Conditional(left=env.concepts["x"], right=0, operator=BooleanOperator.AND),
|
|
719
|
+
[env.concepts["x_sum"]],
|
|
720
|
+
env,
|
|
721
|
+
)
|
|
722
|
+
assert not atom_is_relevant(
|
|
723
|
+
SubselectComparison(
|
|
724
|
+
left=env.concepts["x_sum"],
|
|
725
|
+
right=env.concepts["x"],
|
|
726
|
+
operator=ComparisonOperator.IN,
|
|
727
|
+
),
|
|
728
|
+
[env.concepts["x_sum"]],
|
|
729
|
+
env,
|
|
730
|
+
)
|
|
@@ -271,6 +271,20 @@ class Conditional(Mergeable, ConceptArgs, Namespaced, DataTyped, BaseModel):
|
|
|
271
271
|
right: Expr
|
|
272
272
|
operator: BooleanOperator
|
|
273
273
|
|
|
274
|
+
@field_validator("left", mode="before")
|
|
275
|
+
@classmethod
|
|
276
|
+
def left_validator(cls, v, info: ValidationInfo):
|
|
277
|
+
if isinstance(v, Concept):
|
|
278
|
+
return v.reference
|
|
279
|
+
return v
|
|
280
|
+
|
|
281
|
+
@field_validator("right", mode="before")
|
|
282
|
+
@classmethod
|
|
283
|
+
def right_validator(cls, v, info: ValidationInfo):
|
|
284
|
+
if isinstance(v, Concept):
|
|
285
|
+
return v.reference
|
|
286
|
+
return v
|
|
287
|
+
|
|
274
288
|
def __add__(self, other) -> "Conditional":
|
|
275
289
|
if other is None:
|
|
276
290
|
return self
|
|
@@ -346,7 +360,6 @@ class Conditional(Mergeable, ConceptArgs, Namespaced, DataTyped, BaseModel):
|
|
|
346
360
|
|
|
347
361
|
@property
|
|
348
362
|
def concept_arguments(self) -> Sequence[ConceptRef]:
|
|
349
|
-
"""Return concepts directly referenced in where clause"""
|
|
350
363
|
output = []
|
|
351
364
|
output += get_concept_arguments(self.left)
|
|
352
365
|
output += get_concept_arguments(self.right)
|
|
@@ -575,11 +588,11 @@ class Comparison(ConceptArgs, Mergeable, DataTyped, Namespaced, BaseModel):
|
|
|
575
588
|
date,
|
|
576
589
|
Function,
|
|
577
590
|
ConceptRef,
|
|
578
|
-
|
|
591
|
+
Conditional,
|
|
579
592
|
DataType,
|
|
580
|
-
|
|
593
|
+
Comparison,
|
|
581
594
|
FunctionCallWrapper,
|
|
582
|
-
|
|
595
|
+
Parenthetical,
|
|
583
596
|
MagicConstants,
|
|
584
597
|
WindowItem,
|
|
585
598
|
AggregateWrapper,
|
|
@@ -1631,7 +1631,10 @@ class Factory:
|
|
|
1631
1631
|
|
|
1632
1632
|
@build.register
|
|
1633
1633
|
def _(self, base: CaseElse) -> BuildCaseElse:
|
|
1634
|
-
|
|
1634
|
+
expr: Concept | FuncArgs = base.expr
|
|
1635
|
+
if isinstance(expr, (AggregateWrapper, FilterItem, WindowItem)):
|
|
1636
|
+
expr, _ = self.instantiate_concept(expr)
|
|
1637
|
+
return BuildCaseElse.model_construct(expr=self.build(expr))
|
|
1635
1638
|
|
|
1636
1639
|
@build.register
|
|
1637
1640
|
def _(self, base: Concept) -> BuildConcept:
|
|
@@ -395,6 +395,9 @@ def get_query_node(
|
|
|
395
395
|
if not statement.output_components:
|
|
396
396
|
raise ValueError(f"Statement has no output components {statement}")
|
|
397
397
|
history = history or History(base_environment=environment)
|
|
398
|
+
print(
|
|
399
|
+
f"{LOGGER_PREFIX} building query node for {statement.output_components} grain {statement.grain}"
|
|
400
|
+
)
|
|
398
401
|
build_statement: BuildSelectLineage | BuildMultiSelectLineage = Factory(
|
|
399
402
|
environment=environment,
|
|
400
403
|
).build(statement)
|
|
@@ -23,9 +23,13 @@ from trilogy.core.models.author import (
|
|
|
23
23
|
AggregateWrapper,
|
|
24
24
|
AlignClause,
|
|
25
25
|
AlignItem,
|
|
26
|
+
CaseElse,
|
|
27
|
+
CaseWhen,
|
|
28
|
+
Comparison,
|
|
26
29
|
Concept,
|
|
27
30
|
ConceptArgs,
|
|
28
31
|
ConceptRef,
|
|
32
|
+
Conditional,
|
|
29
33
|
FilterItem,
|
|
30
34
|
Function,
|
|
31
35
|
FunctionCallWrapper,
|
|
@@ -38,6 +42,7 @@ from trilogy.core.models.author import (
|
|
|
38
42
|
Parenthetical,
|
|
39
43
|
RowsetItem,
|
|
40
44
|
RowsetLineage,
|
|
45
|
+
SubselectComparison,
|
|
41
46
|
TraitDataType,
|
|
42
47
|
UndefinedConcept,
|
|
43
48
|
WhereClause,
|
|
@@ -198,6 +203,7 @@ def atom_is_relevant(
|
|
|
198
203
|
others: list[Concept | ConceptRef],
|
|
199
204
|
environment: Environment | None = None,
|
|
200
205
|
):
|
|
206
|
+
|
|
201
207
|
if isinstance(atom, (ConceptRef, Concept)):
|
|
202
208
|
# when we are looking at atoms, if there is a concept that is in others
|
|
203
209
|
# return directly
|
|
@@ -210,9 +216,10 @@ def atom_is_relevant(
|
|
|
210
216
|
elif isinstance(atom, AggregateWrapper):
|
|
211
217
|
return any(atom_is_relevant(x, others, environment) for x in atom.by)
|
|
212
218
|
|
|
213
|
-
|
|
219
|
+
elif isinstance(atom, Function):
|
|
214
220
|
relevant = False
|
|
215
221
|
for arg in atom.arguments:
|
|
222
|
+
|
|
216
223
|
relevant = relevant or atom_is_relevant(arg, others, environment)
|
|
217
224
|
return relevant
|
|
218
225
|
elif isinstance(atom, FunctionCallWrapper):
|
|
@@ -220,8 +227,27 @@ def atom_is_relevant(
|
|
|
220
227
|
[atom_is_relevant(atom.content, others, environment)]
|
|
221
228
|
+ [atom_is_relevant(x, others, environment) for x in atom.args]
|
|
222
229
|
)
|
|
230
|
+
elif isinstance(atom, CaseWhen):
|
|
231
|
+
rval = atom_is_relevant(atom.expr, others, environment) or atom_is_relevant(
|
|
232
|
+
atom.comparison, others, environment
|
|
233
|
+
)
|
|
234
|
+
return rval
|
|
235
|
+
elif isinstance(atom, CaseElse):
|
|
236
|
+
|
|
237
|
+
rval = atom_is_relevant(atom.expr, others, environment)
|
|
238
|
+
return rval
|
|
239
|
+
elif isinstance(atom, SubselectComparison):
|
|
240
|
+
return atom_is_relevant(atom.left, others, environment)
|
|
241
|
+
elif isinstance(atom, Comparison):
|
|
242
|
+
return atom_is_relevant(atom.left, others, environment) or atom_is_relevant(
|
|
243
|
+
atom.right, others, environment
|
|
244
|
+
)
|
|
245
|
+
elif isinstance(atom, Conditional):
|
|
246
|
+
return atom_is_relevant(atom.left, others, environment) or atom_is_relevant(
|
|
247
|
+
atom.right, others, environment
|
|
248
|
+
)
|
|
223
249
|
elif isinstance(atom, ConceptArgs):
|
|
224
|
-
# use atom is relevant here to trigger the early exit behavior for
|
|
250
|
+
# use atom is relevant here to trigger the early exit behavior for concepts in set
|
|
225
251
|
return any(
|
|
226
252
|
[atom_is_relevant(x, others, environment) for x in atom.concept_arguments]
|
|
227
253
|
)
|
|
@@ -233,7 +259,6 @@ def concept_is_relevant(
|
|
|
233
259
|
others: list[Concept | ConceptRef],
|
|
234
260
|
environment: Environment | None = None,
|
|
235
261
|
) -> bool:
|
|
236
|
-
|
|
237
262
|
if isinstance(concept, UndefinedConcept):
|
|
238
263
|
return False
|
|
239
264
|
if concept.datatype == DataType.UNKNOWN:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/__init__.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/basic_node.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/filter_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/group_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/group_to_node.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/node_merge_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/recursive_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/rowset_node.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/select_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/synonym_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/union_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/unnest_node.py
RENAMED
|
File without changes
|
{pytrilogy-0.0.3.65 → pytrilogy-0.0.3.66}/trilogy/core/processing/node_generators/window_node.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|