data-flow-control 0.1.5__tar.gz → 0.1.7__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.
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/Cargo.lock +3 -3
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/Cargo.toml +1 -1
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/PKG-INFO +1 -1
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/aggregate_registry.rs +2 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/full_push.rs +7 -1
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewrite_strategy.rs +64 -33
- data_flow_control-0.1.7/passant-core/src/rewriter/insert_output_policy.rs +719 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/mod.rs +1 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/plan/actions.rs +25 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/plan/mod.rs +81 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/plan/scope_plan.rs +16 -1
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/policy_expr.rs +34 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/resolution.rs +79 -2
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/select.rs +29 -2
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/types.rs +22 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/write_path.rs +21 -1
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite/main.rs +2 -0
- data_flow_control-0.1.7/passant-core/tests/rewrite/meal_deduction.rs +133 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/pyproject.toml +2 -1
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/LICENSE +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/Cargo.toml +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/benches/rewrite_perf.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/catalog.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/diagnostics.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/explain.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/identifiers.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/intern.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/ir.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/lib.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/optimizer.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/parser.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/partial_push.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/planner.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy_compile.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy_index.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy_parser.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy_pgn.pest +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy_store/branch.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy_store/compiled.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy_store/delete.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy_store/indexes.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy_store/memory.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/policy_store/mod.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/query_analysis.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewrite_stats.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/aggregates.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/columns.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/constraint_preprocess.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/derived_policy.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/dimensions.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/exists.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/expr.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/helpers.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/limit.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/plan/applicability.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/plan/dominance.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/plan/write_plan.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/projection.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/rewriter/scope.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/semiring.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/source_set_index.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/source_sets/analysis.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/source_sets/annotations.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/source_sets/branch.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/source_sets/mod.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/source_sets/rewrites.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/source_sets/split.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/sql/ast_stats.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/sql/builders.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/sql/columns.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/sql/dialect.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/sql/expr.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/sql/expr_key.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/sql/mod.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/sql/parse.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/sql/render.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/statement_tables.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/src/threshold.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/common/duckdb.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/common/mod.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/conformance.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/main.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/partial_push.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/pgn.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/pgn_unique.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/policy_storage.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/rewrite_api_parity.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/semiring.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/source_sets.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/symmetric_self_join.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/threshold.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/completion/unique_not_unique.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/dialect.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/execution/insert.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/execution/kill.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/execution/main.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/execution/oracle.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/execution/remove.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/execution/update.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/expected/duckdb/remove_scan.sql +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/expected/postgres/remove_scan.sql +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/expected/sqlite/remove_scan.sql +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/explain_strategy.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/column_propagation.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/dimensions.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/exists_join.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/having_where.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/identifiers.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/insert_shapes.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/main.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/multi_source.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/operators.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/query_shapes.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/gaps/scalar_subquery.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/indexed_candidate_differential.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/insert_values_body.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/paper_examples.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/parser.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/planner.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/policy.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/policy_dialect.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/policy_store_memory.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite/derived_policy.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite/in_semijoin.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite/insert.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite/joins.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite/output.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite/recursive.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite/scan.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite/update.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite_candidate_regression.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite_fast_paths.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite_large_registry.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/rewrite_stats_timings.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/scan_ready_expr.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/source_set_split_no_parse.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/sql_builders.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/sql_columns.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-core/tests/ui_resolution.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-py/Cargo.toml +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-py/src/bindings/catalog.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-py/src/bindings/errors.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-py/src/bindings/mod.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-py/src/bindings/planner.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-py/src/bindings/policy.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-py/src/bindings/stats.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/passant-py/src/lib.rs +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/__init__.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/_rust.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/__init__.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/base.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/clickhouse.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/datafusion.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/duckdb.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/kill.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/pg_catalog.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/postgres.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/registry.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/sqlite.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/adapters/umbra.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/aggregate_introspection.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/catalog.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/connection.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/dialect.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/langchain/__init__.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/langchain/agent.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/langchain/call_tool_with_dataflow.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/langchain/database.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/langchain/middleware.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/langchain/schema.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/langchain/sql_validation.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/langchain/tool_spec.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/langchain/wrapper.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/options.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/planner.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/policy.py +0 -0
- {data_flow_control-0.1.5 → data_flow_control-0.1.7}/python/data_flow_control/ui.py +0 -0
|
@@ -1593,7 +1593,7 @@ dependencies = [
|
|
|
1593
1593
|
|
|
1594
1594
|
[[package]]
|
|
1595
1595
|
name = "passant-cli"
|
|
1596
|
-
version = "0.1.
|
|
1596
|
+
version = "0.1.7"
|
|
1597
1597
|
dependencies = [
|
|
1598
1598
|
"anyhow",
|
|
1599
1599
|
"assert_cmd",
|
|
@@ -1605,7 +1605,7 @@ dependencies = [
|
|
|
1605
1605
|
|
|
1606
1606
|
[[package]]
|
|
1607
1607
|
name = "passant-core"
|
|
1608
|
-
version = "0.1.
|
|
1608
|
+
version = "0.1.7"
|
|
1609
1609
|
dependencies = [
|
|
1610
1610
|
"anyhow",
|
|
1611
1611
|
"criterion",
|
|
@@ -1623,7 +1623,7 @@ dependencies = [
|
|
|
1623
1623
|
|
|
1624
1624
|
[[package]]
|
|
1625
1625
|
name = "passant-py"
|
|
1626
|
-
version = "0.1.
|
|
1626
|
+
version = "0.1.7"
|
|
1627
1627
|
dependencies = [
|
|
1628
1628
|
"passant-core",
|
|
1629
1629
|
"pyo3",
|
|
@@ -18,6 +18,10 @@ fn semiring_allows_full_push(rewriter: &PassantRewriter, semiring: &SemiringAnal
|
|
|
18
18
|
.all(|aggregate| count_if_style_scan_aggregate(rewriter, aggregate))
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
fn aggregate_function_name(aggregate: &str) -> &str {
|
|
22
|
+
aggregate.split('(').next().unwrap_or(aggregate).trim()
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
fn count_if_style_scan_aggregate(rewriter: &PassantRewriter, aggregate: &str) -> bool {
|
|
22
26
|
let lower = aggregate.to_ascii_lowercase();
|
|
23
27
|
if lower.contains("array_agg")
|
|
@@ -27,7 +31,9 @@ fn count_if_style_scan_aggregate(rewriter: &PassantRewriter, aggregate: &str) ->
|
|
|
27
31
|
{
|
|
28
32
|
return false;
|
|
29
33
|
}
|
|
30
|
-
rewriter
|
|
34
|
+
rewriter
|
|
35
|
+
.aggregate_registry
|
|
36
|
+
.is_scan_transformable(aggregate_function_name(&lower))
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
/// Full-push engine — mutates the query in place, preserving its overall shape.
|
|
@@ -330,22 +330,6 @@ mod tests {
|
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
fn non_distributive_policy() -> PolicyIr {
|
|
334
|
-
PolicyIr::Pgn {
|
|
335
|
-
sources: vec!["foo".to_string()],
|
|
336
|
-
required_sources: Vec::new(),
|
|
337
|
-
dimension_tables: Vec::new(),
|
|
338
|
-
dimension_aliases: std::collections::HashMap::new(),
|
|
339
|
-
dimension_queries: std::collections::HashMap::new(),
|
|
340
|
-
sink: None,
|
|
341
|
-
sink_alias: None,
|
|
342
|
-
source_aliases: std::collections::HashMap::new(),
|
|
343
|
-
constraint: "string_agg(foo.name, ',') = 'x'".to_string(),
|
|
344
|
-
on_fail: Resolution::Remove,
|
|
345
|
-
description: None,
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
333
|
#[test]
|
|
350
334
|
fn full_push_runs_before_partial_push() {
|
|
351
335
|
let full = FullPushEngine;
|
|
@@ -377,24 +361,71 @@ mod tests {
|
|
|
377
361
|
}
|
|
378
362
|
|
|
379
363
|
#[test]
|
|
380
|
-
fn
|
|
364
|
+
fn introspected_arbitrary_in_catalog_still_rewrites_kill_insert() {
|
|
365
|
+
use crate::aggregate_registry::AggregateFunctionSnapshot;
|
|
366
|
+
use crate::catalog::{CatalogSnapshot, CatalogTableInfo};
|
|
367
|
+
use std::collections::HashMap;
|
|
368
|
+
|
|
369
|
+
let policy_text = "SOURCE Receipts SINK Expenses CONSTRAINT ARBITRARY(Receipts.cat) != 'Meal' OR Expenses.biz_use <= 50.0 ON FAIL KILL";
|
|
370
|
+
let sql = "INSERT INTO Expenses SELECT 1, 100.0 FROM Receipts";
|
|
371
|
+
|
|
381
372
|
let mut rewriter = PassantRewriter::new();
|
|
382
|
-
rewriter
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
373
|
+
rewriter
|
|
374
|
+
.register_validated_policy(crate::parse_policy_text(policy_text).expect("parse"))
|
|
375
|
+
.expect("register without catalog");
|
|
376
|
+
let without_catalog = rewriter.rewrite(sql).expect("rewrite without catalog");
|
|
377
|
+
assert!(
|
|
378
|
+
without_catalog.contains("passant_kill"),
|
|
379
|
+
"baseline rewrite without catalog introspection: {without_catalog}"
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
let mut tables = HashMap::new();
|
|
383
|
+
tables.insert(
|
|
384
|
+
"Receipts".to_string(),
|
|
385
|
+
CatalogTableInfo {
|
|
386
|
+
columns: vec!["cat".into(), "biz_use".into()],
|
|
387
|
+
..CatalogTableInfo::default()
|
|
388
|
+
},
|
|
389
|
+
);
|
|
390
|
+
tables.insert(
|
|
391
|
+
"Expenses".to_string(),
|
|
392
|
+
CatalogTableInfo {
|
|
393
|
+
columns: vec!["biz_use".into()],
|
|
394
|
+
..CatalogTableInfo::default()
|
|
395
|
+
},
|
|
396
|
+
);
|
|
397
|
+
let mut rewriter = PassantRewriter::new();
|
|
398
|
+
rewriter.apply_catalog_snapshot(CatalogSnapshot {
|
|
399
|
+
dialect: Some("duckdb".to_string()),
|
|
400
|
+
tables,
|
|
401
|
+
aggregate_functions: vec![AggregateFunctionSnapshot {
|
|
402
|
+
name: "arbitrary".to_string(),
|
|
403
|
+
schema: None,
|
|
404
|
+
aliases: vec![],
|
|
405
|
+
classification: None,
|
|
406
|
+
source: Some("introspected".to_string()),
|
|
407
|
+
}],
|
|
408
|
+
..CatalogSnapshot::default()
|
|
409
|
+
});
|
|
410
|
+
rewriter
|
|
411
|
+
.register_validated_policy(crate::parse_policy_text(policy_text).expect("parse"))
|
|
412
|
+
.expect("register validated policy");
|
|
413
|
+
assert!(
|
|
414
|
+
rewriter
|
|
415
|
+
.policy_store()
|
|
416
|
+
.has_enforcement_resolution_policies(),
|
|
417
|
+
"KILL policy should register as enforcement resolution"
|
|
418
|
+
);
|
|
419
|
+
assert_eq!(rewriter.policy_store().active_count(), 1);
|
|
420
|
+
let with_catalog = rewriter.rewrite(sql);
|
|
421
|
+
if let Err(err) = &with_catalog {
|
|
422
|
+
panic!("rewrite with catalog failed: {err}");
|
|
423
|
+
}
|
|
424
|
+
let with_catalog = with_catalog.expect("rewrite ok");
|
|
425
|
+
let summary = rewriter.last_statement_rewrite_summary();
|
|
426
|
+
assert!(
|
|
427
|
+
with_catalog.contains("passant_kill"),
|
|
428
|
+
"expected kill rewrite with introspected arbitrary aggregate, got: {with_catalog}; summary={summary:?}"
|
|
395
429
|
);
|
|
396
|
-
assert!(!request.semiring.all_distributive);
|
|
397
|
-
assert!(!FullPushEngine.matches(&rewriter, &request));
|
|
398
|
-
assert!(PartialPushEngine.matches(&rewriter, &request));
|
|
399
430
|
}
|
|
400
431
|
}
|