data-flow-control 0.2.4__tar.gz → 0.3.1__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.2.4 → data_flow_control-0.3.1}/Cargo.lock +3 -3
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/Cargo.toml +1 -1
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/PKG-INFO +1 -1
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/catalog/dimension.rs +173 -52
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy.rs +19 -6
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy_store/compiled.rs +1 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/resolution_registry.rs +5 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/limit.rs +4 -2
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/plan/actions.rs +9 -5
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/policy_expr.rs +5 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/resolution.rs +48 -30
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/select.rs +1 -1
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/write_path.rs +23 -8
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/pyproject.toml +1 -1
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/__init__.py +3 -1
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/_rust.py +1 -1
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/duckdb.py +39 -4
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/connection.py +59 -18
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/errors.py +19 -1
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/langchain/call_tool_with_dataflow.py +84 -49
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/langchain/database.py +0 -1
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/langchain/sql_validation.py +6 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/planner.py +3 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/policy.py +17 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/tools/retry.py +32 -20
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/LICENSE +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/Cargo.toml +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/benches/rewrite_perf.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/aggregate_registry.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/catalog/constraint_subquery.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/catalog.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/diagnostics.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/explain.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/full_push.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/identifiers.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/intern.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/ir.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/lib.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/optimizer.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/parser.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/partial_push.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/planner.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy_compile.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy_index.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy_parser.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy_pgn.pest +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy_store/branch.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy_store/delete.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy_store/indexes.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy_store/memory.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/policy_store/mod.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/query_analysis.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/resolution_placement.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewrite_stats.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewrite_strategy.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/aggregates.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/columns.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/constraint_preprocess.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/derived_policy.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/dimensions.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/exists.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/expr.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/helpers.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/insert_output_policy.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/joint_lineage/grouped_projection.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/joint_lineage/terminal_distinct.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/joint_lineage/terminal_except.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/joint_lineage/terminal_intersect.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/joint_lineage.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/mod.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/output_scope.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/plan/applicability.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/plan/dominance.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/plan/mod.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/plan/scope_plan.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/plan/write_plan.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/projection.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/scope.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/sink_columns.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/types.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/semiring.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/source_set_index.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/source_sets/analysis.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/source_sets/annotations.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/source_sets/branch.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/source_sets/mod.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/source_sets/rewrites.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/source_sets/split.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/sql/ast_stats.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/sql/builders.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/sql/columns.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/sql/dialect.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/sql/expr.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/sql/expr_key.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/sql/mod.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/sql/parse.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/sql/render.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/statement_tables.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/threshold.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/common/duckdb.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/common/mod.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/conformance.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/main.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/partial_push.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/pgn.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/pgn_unique.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/policy_storage.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/rewrite_api_parity.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/semiring.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/source_sets.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/symmetric_self_join.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/threshold.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/completion/unique_not_unique.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/dialect.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/execution/insert.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/execution/kill.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/execution/main.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/execution/oracle.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/execution/remove.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/execution/update.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/expected/duckdb/remove_scan.sql +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/expected/postgres/remove_scan.sql +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/expected/sqlite/remove_scan.sql +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/explain_strategy.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/column_propagation.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/dimensions.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/exists_join.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/having_where.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/identifiers.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/insert_shapes.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/main.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/multi_source.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/operators.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/query_shapes.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/gaps/scalar_subquery.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/indexed_candidate_differential.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/insert_values_body.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/kill_null_guard_regression.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/paper_examples.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/parser.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/planner.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/policy.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/policy_dialect.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/policy_store_memory.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite/derived_policy.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite/in_semijoin.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite/insert.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite/joins.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite/main.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite/meal_deduction.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite/output.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite/recursive.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite/scan.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite/update.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite_candidate_regression.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite_fast_paths.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite_large_registry.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/rewrite_stats_timings.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/scan_ready_expr.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/source_set_split_no_parse.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/sql_builders.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/sql_columns.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/tests/ui_resolution.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-py/Cargo.toml +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-py/src/bindings/catalog.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-py/src/bindings/errors.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-py/src/bindings/mod.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-py/src/bindings/planner.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-py/src/bindings/policy.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-py/src/bindings/stats.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-py/src/lib.rs +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/__init__.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/_retry.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/base.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/clickhouse.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/datafusion.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/duckdb_policy_binding.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/kill.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/pg_catalog.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/postgres.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/registry.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/sqlite.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/adapters/umbra.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/aggregate_introspection.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/catalog.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/dialect.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/langchain/__init__.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/langchain/agent.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/langchain/middleware.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/langchain/schema.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/langchain/tool_spec.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/langchain/wrapper.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/options.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/python/data_flow_control/tools/__init__.py +0 -0
- {data_flow_control-0.2.4 → data_flow_control-0.3.1}/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.
|
|
1596
|
+
version = "0.3.1"
|
|
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.
|
|
1608
|
+
version = "0.3.1"
|
|
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.
|
|
1626
|
+
version = "0.3.1"
|
|
1627
1627
|
dependencies = [
|
|
1628
1628
|
"passant-core",
|
|
1629
1629
|
"pyo3",
|
|
@@ -6,7 +6,7 @@ use crate::{
|
|
|
6
6
|
};
|
|
7
7
|
use sqlparser::ast::{
|
|
8
8
|
Expr, FunctionArg, FunctionArgExpr, FunctionArguments, JoinConstraint, JoinOperator, Query,
|
|
9
|
-
SelectItem, SetExpr, Statement, TableFactor, Visit, Visitor,
|
|
9
|
+
SelectItem, SetExpr, SetQuantifier, Statement, TableFactor, Visit, Visitor,
|
|
10
10
|
};
|
|
11
11
|
use std::{collections::HashSet, ops::ControlFlow};
|
|
12
12
|
|
|
@@ -23,7 +23,7 @@ pub(super) fn bound_projection(
|
|
|
23
23
|
let Statement::Query(query) = crate::parser::parse_query(sql)? else {
|
|
24
24
|
return Err(unsupported("requires a SELECT query"));
|
|
25
25
|
};
|
|
26
|
-
bind_query(catalog, &query)
|
|
26
|
+
bind_query(catalog, &query, &[], true)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
fn unsupported(detail: &str) -> RewriteError {
|
|
@@ -40,7 +40,16 @@ fn unknown(kind: ErrorKind, detail: String) -> RewriteError {
|
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
// The last scope is the nearest enclosing SELECT. A derived table is bound
|
|
44
|
+
// independently unless LATERAL is explicitly supported.
|
|
45
|
+
type OuterScopes<'a> = [&'a [Relation]];
|
|
46
|
+
|
|
47
|
+
fn bind_query(
|
|
48
|
+
catalog: &TableCatalog,
|
|
49
|
+
query: &Query,
|
|
50
|
+
outer: &OuterScopes<'_>,
|
|
51
|
+
named_outputs: bool,
|
|
52
|
+
) -> Result<Vec<String>, RewriteError> {
|
|
44
53
|
if query.with.is_some()
|
|
45
54
|
|| !query.locks.is_empty()
|
|
46
55
|
|| query.for_clause.is_some()
|
|
@@ -50,16 +59,51 @@ fn bind_query(catalog: &TableCatalog, query: &Query) -> Result<Vec<String>, Rewr
|
|
|
50
59
|
"does not yet support CTEs, locking, or dialect-specific query clauses",
|
|
51
60
|
));
|
|
52
61
|
}
|
|
53
|
-
let (relations, outputs) =
|
|
62
|
+
let (relations, outputs) = bind_body(catalog, query.body.as_ref(), outer, named_outputs)?;
|
|
63
|
+
let output_names = outputs.iter().cloned().collect();
|
|
64
|
+
check(catalog, &query.order_by, &relations, outer, &output_names)?;
|
|
65
|
+
check(catalog, &query.limit, &relations, outer, &HashSet::new())?;
|
|
66
|
+
check(catalog, &query.limit_by, &relations, outer, &HashSet::new())?;
|
|
67
|
+
check(catalog, &query.offset, &relations, outer, &HashSet::new())?;
|
|
68
|
+
check(catalog, &query.fetch, &relations, outer, &HashSet::new())?;
|
|
69
|
+
Ok(outputs)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
fn bind_body(
|
|
73
|
+
catalog: &TableCatalog,
|
|
74
|
+
body: &SetExpr,
|
|
75
|
+
outer: &OuterScopes<'_>,
|
|
76
|
+
named_outputs: bool,
|
|
77
|
+
) -> Result<(Vec<Relation>, Vec<String>), RewriteError> {
|
|
78
|
+
match body {
|
|
54
79
|
SetExpr::Query(inner) => {
|
|
55
|
-
let outputs = bind_query(catalog, inner)?;
|
|
56
|
-
(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
80
|
+
let outputs = bind_query(catalog, inner, outer, named_outputs)?;
|
|
81
|
+
Ok((Vec::new(), outputs))
|
|
82
|
+
}
|
|
83
|
+
SetExpr::SetOperation {
|
|
84
|
+
set_quantifier,
|
|
85
|
+
left,
|
|
86
|
+
right,
|
|
87
|
+
..
|
|
88
|
+
} => {
|
|
89
|
+
if !matches!(
|
|
90
|
+
set_quantifier,
|
|
91
|
+
SetQuantifier::None | SetQuantifier::All | SetQuantifier::Distinct
|
|
92
|
+
) {
|
|
93
|
+
return Err(unsupported(
|
|
94
|
+
"does not yet bind non-positional set operations",
|
|
95
|
+
));
|
|
96
|
+
}
|
|
97
|
+
let (_, left) = bind_body(catalog, left, outer, named_outputs)?;
|
|
98
|
+
let (_, right) = bind_body(catalog, right, outer, false)?;
|
|
99
|
+
if left.len() != right.len() {
|
|
100
|
+
return Err(unsupported(
|
|
101
|
+
"requires equal projection widths in set operations",
|
|
102
|
+
));
|
|
103
|
+
}
|
|
104
|
+
// Set result names come from the left arm. Arm relations are not
|
|
105
|
+
// visible to the compound query's ORDER BY or enclosing query.
|
|
106
|
+
Ok((Vec::new(), left))
|
|
63
107
|
}
|
|
64
108
|
SetExpr::Select(select) => {
|
|
65
109
|
if select.into.is_some()
|
|
@@ -95,7 +139,7 @@ fn bind_query(catalog: &TableCatalog, query: &Query) -> Result<Vec<String>, Rewr
|
|
|
95
139
|
// ON can see only the accumulated left side and this right side,
|
|
96
140
|
// never a relation introduced by a later JOIN.
|
|
97
141
|
if let Some(JoinConstraint::On(expr)) = constraint {
|
|
98
|
-
check(expr, &relations, &HashSet::new())?;
|
|
142
|
+
check(catalog, expr, &relations, outer, &HashSet::new())?;
|
|
99
143
|
}
|
|
100
144
|
}
|
|
101
145
|
}
|
|
@@ -104,7 +148,13 @@ fn bind_query(catalog: &TableCatalog, query: &Query) -> Result<Vec<String>, Rewr
|
|
|
104
148
|
// an invalid forward reference and make an earlier valid name ambiguous.
|
|
105
149
|
let mut final_expressions = select.as_ref().clone();
|
|
106
150
|
final_expressions.from.clear();
|
|
107
|
-
check(
|
|
151
|
+
check(
|
|
152
|
+
catalog,
|
|
153
|
+
&final_expressions,
|
|
154
|
+
&relations,
|
|
155
|
+
outer,
|
|
156
|
+
&HashSet::new(),
|
|
157
|
+
)?;
|
|
108
158
|
let mut outputs = Vec::new();
|
|
109
159
|
for projection in &select.projection {
|
|
110
160
|
let name = match projection {
|
|
@@ -113,6 +163,12 @@ fn bind_query(catalog: &TableCatalog, query: &Query) -> Result<Vec<String>, Rewr
|
|
|
113
163
|
SelectItem::UnnamedExpr(Expr::CompoundIdentifier(parts)) => {
|
|
114
164
|
parts.last().unwrap().value.clone()
|
|
115
165
|
}
|
|
166
|
+
SelectItem::UnnamedExpr(_) if !named_outputs => {
|
|
167
|
+
// Expression subqueries need their dependencies and arity
|
|
168
|
+
// checked, but SELECT 1 in EXISTS exports no column name.
|
|
169
|
+
outputs.push(String::new());
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
116
172
|
_ => {
|
|
117
173
|
return Err(unsupported(
|
|
118
174
|
"requires explicitly named projection expressions and does not expand wildcards",
|
|
@@ -120,25 +176,38 @@ fn bind_query(catalog: &TableCatalog, query: &Query) -> Result<Vec<String>, Rewr
|
|
|
120
176
|
}
|
|
121
177
|
};
|
|
122
178
|
let name = ColumnName::new(name).key();
|
|
123
|
-
if outputs.contains(&name) {
|
|
179
|
+
if named_outputs && outputs.contains(&name) {
|
|
124
180
|
return Err(unsupported("requires unambiguous output column names"));
|
|
125
181
|
}
|
|
126
182
|
outputs.push(name);
|
|
127
183
|
}
|
|
128
|
-
(relations, outputs)
|
|
184
|
+
Ok((relations, outputs))
|
|
129
185
|
}
|
|
130
|
-
_ =>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
check(&query.limit, &relations, &HashSet::new())?;
|
|
135
|
-
check(&query.limit_by, &relations, &HashSet::new())?;
|
|
136
|
-
check(&query.offset, &relations, &HashSet::new())?;
|
|
137
|
-
check(&query.fetch, &relations, &HashSet::new())?;
|
|
138
|
-
Ok(outputs)
|
|
186
|
+
_ => Err(unsupported(
|
|
187
|
+
"does not yet bind this query body (including VALUES)",
|
|
188
|
+
)),
|
|
189
|
+
}
|
|
139
190
|
}
|
|
140
191
|
|
|
141
192
|
fn bind_table(catalog: &TableCatalog, factor: &TableFactor) -> Result<Relation, RewriteError> {
|
|
193
|
+
if let TableFactor::Derived {
|
|
194
|
+
lateral: false,
|
|
195
|
+
subquery,
|
|
196
|
+
alias: Some(alias),
|
|
197
|
+
} = factor
|
|
198
|
+
{
|
|
199
|
+
if !alias.columns.is_empty() {
|
|
200
|
+
return Err(unsupported(
|
|
201
|
+
"does not yet bind derived table column alias lists",
|
|
202
|
+
));
|
|
203
|
+
}
|
|
204
|
+
let outputs = bind_query(catalog, subquery, &[], true)?;
|
|
205
|
+
return Ok(Relation {
|
|
206
|
+
qualifiers: HashSet::from([TableKey::new(&alias.name.value)]),
|
|
207
|
+
columns: outputs.into_iter().collect(),
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
142
211
|
let TableFactor::Table {
|
|
143
212
|
name,
|
|
144
213
|
alias,
|
|
@@ -148,7 +217,7 @@ fn bind_table(catalog: &TableCatalog, factor: &TableFactor) -> Result<Relation,
|
|
|
148
217
|
} = factor
|
|
149
218
|
else {
|
|
150
219
|
return Err(unsupported(
|
|
151
|
-
"does not yet bind derived tables, table functions, or
|
|
220
|
+
"does not yet bind unaliased derived tables, table functions, or LATERAL relations",
|
|
152
221
|
));
|
|
153
222
|
};
|
|
154
223
|
if args.is_some() || version.is_some() || alias.as_ref().is_some_and(|a| !a.columns.is_empty())
|
|
@@ -178,13 +247,18 @@ fn bind_table(catalog: &TableCatalog, factor: &TableFactor) -> Result<Relation,
|
|
|
178
247
|
}
|
|
179
248
|
|
|
180
249
|
fn check<T: Visit>(
|
|
250
|
+
catalog: &TableCatalog,
|
|
181
251
|
node: &T,
|
|
182
252
|
relations: &[Relation],
|
|
253
|
+
outer: &OuterScopes<'_>,
|
|
183
254
|
outputs: &HashSet<String>,
|
|
184
255
|
) -> Result<(), RewriteError> {
|
|
185
256
|
struct Binder<'a> {
|
|
257
|
+
catalog: &'a TableCatalog,
|
|
186
258
|
relations: &'a [Relation],
|
|
259
|
+
outer: &'a OuterScopes<'a>,
|
|
187
260
|
outputs: &'a HashSet<String>,
|
|
261
|
+
nested_queries: usize,
|
|
188
262
|
}
|
|
189
263
|
impl Binder<'_> {
|
|
190
264
|
fn column(&self, qualifier: Option<TableKey>, column: &str) -> Result<(), RewriteError> {
|
|
@@ -192,14 +266,30 @@ fn check<T: Visit>(
|
|
|
192
266
|
if qualifier.is_none() && self.outputs.contains(&key) {
|
|
193
267
|
return Ok(());
|
|
194
268
|
}
|
|
195
|
-
let
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
269
|
+
let mut count = 0;
|
|
270
|
+
for scope in std::iter::once(self.relations).chain(self.outer.iter().rev().copied()) {
|
|
271
|
+
let mut qualifiers = 0;
|
|
272
|
+
for relation in scope {
|
|
273
|
+
if qualifier
|
|
274
|
+
.as_ref()
|
|
275
|
+
.is_none_or(|q| relation.qualifiers.contains(q))
|
|
276
|
+
{
|
|
277
|
+
qualifiers += 1;
|
|
278
|
+
count += usize::from(relation.columns.contains(&key));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// A local qualifier shadows an outer qualifier, even if the
|
|
282
|
+
// requested column is absent. Unqualified columns use the
|
|
283
|
+
// nearest scope with a matching column.
|
|
284
|
+
if count != 0 || (qualifier.is_some() && qualifiers != 0) {
|
|
285
|
+
if count == 1 && (qualifier.is_none() || qualifiers == 1) {
|
|
286
|
+
return Ok(());
|
|
287
|
+
}
|
|
288
|
+
if qualifiers > 1 && qualifier.is_some() {
|
|
289
|
+
count = qualifiers;
|
|
290
|
+
}
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
203
293
|
}
|
|
204
294
|
Err(unknown(
|
|
205
295
|
ErrorKind::UnknownColumn,
|
|
@@ -219,30 +309,42 @@ fn check<T: Visit>(
|
|
|
219
309
|
}
|
|
220
310
|
fn qualifier(&self, name: &sqlparser::ast::ObjectName) -> Result<(), RewriteError> {
|
|
221
311
|
let key = TableKey::new(&name.to_string());
|
|
222
|
-
|
|
223
|
-
.
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
{
|
|
229
|
-
Ok(())
|
|
230
|
-
} else {
|
|
231
|
-
Err(unknown(
|
|
232
|
-
ErrorKind::UnknownTable,
|
|
233
|
-
format!("Dimension wildcard qualifier '{name}' is not bound unambiguously"),
|
|
234
|
-
))
|
|
312
|
+
for scope in std::iter::once(self.relations).chain(self.outer.iter().rev().copied()) {
|
|
313
|
+
match scope.iter().filter(|r| r.qualifiers.contains(&key)).count() {
|
|
314
|
+
0 => continue,
|
|
315
|
+
1 => return Ok(()),
|
|
316
|
+
_ => break,
|
|
317
|
+
}
|
|
235
318
|
}
|
|
319
|
+
Err(unknown(
|
|
320
|
+
ErrorKind::UnknownTable,
|
|
321
|
+
format!("Dimension wildcard qualifier '{name}' is not bound unambiguously"),
|
|
322
|
+
))
|
|
236
323
|
}
|
|
237
324
|
}
|
|
238
325
|
impl Visitor for Binder<'_> {
|
|
239
326
|
type Break = RewriteError;
|
|
240
|
-
fn pre_visit_query(&mut self,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
327
|
+
fn pre_visit_query(&mut self, query: &Query) -> ControlFlow<Self::Break> {
|
|
328
|
+
if self.nested_queries == 0 {
|
|
329
|
+
let mut visible = self.outer.to_vec();
|
|
330
|
+
visible.push(self.relations);
|
|
331
|
+
if let Err(error) = bind_query(self.catalog, query, &visible, false) {
|
|
332
|
+
return ControlFlow::Break(error);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
// bind_query checks this subtree in its own scope. The generic
|
|
336
|
+
// visitor still traverses it; skip those duplicate visits here.
|
|
337
|
+
self.nested_queries += 1;
|
|
338
|
+
ControlFlow::Continue(())
|
|
339
|
+
}
|
|
340
|
+
fn post_visit_query(&mut self, _query: &Query) -> ControlFlow<Self::Break> {
|
|
341
|
+
self.nested_queries -= 1;
|
|
342
|
+
ControlFlow::Continue(())
|
|
244
343
|
}
|
|
245
344
|
fn pre_visit_expr(&mut self, expr: &Expr) -> ControlFlow<Self::Break> {
|
|
345
|
+
if self.nested_queries != 0 {
|
|
346
|
+
return ControlFlow::Continue(());
|
|
347
|
+
}
|
|
246
348
|
let result = match expr {
|
|
247
349
|
Expr::Identifier(ident) => self.column(None, &ident.value),
|
|
248
350
|
Expr::CompoundIdentifier(parts) if parts.len() >= 2 => self.column(
|
|
@@ -281,7 +383,13 @@ fn check<T: Visit>(
|
|
|
281
383
|
}
|
|
282
384
|
}
|
|
283
385
|
}
|
|
284
|
-
match node.visit(&mut Binder {
|
|
386
|
+
match node.visit(&mut Binder {
|
|
387
|
+
catalog,
|
|
388
|
+
relations,
|
|
389
|
+
outer,
|
|
390
|
+
outputs,
|
|
391
|
+
nested_queries: 0,
|
|
392
|
+
}) {
|
|
285
393
|
ControlFlow::Continue(()) => Ok(()),
|
|
286
394
|
ControlFlow::Break(error) => Err(error),
|
|
287
395
|
}
|
|
@@ -321,6 +429,11 @@ mod tests {
|
|
|
321
429
|
"SELECT u.id AS uid FROM s.users u JOIN roles r ON u.id=r.id WHERE r.enabled",
|
|
322
430
|
"SELECT MAX(id) AS id FROM s.users HAVING MAX(id) > 0",
|
|
323
431
|
"SELECT 1 AS id",
|
|
432
|
+
"SELECT id FROM s.users UNION SELECT id FROM roles",
|
|
433
|
+
"SELECT d.uid FROM (SELECT id AS uid FROM s.users UNION ALL SELECT id FROM roles) d",
|
|
434
|
+
"SELECT u.id FROM s.users u WHERE NOT EXISTS (SELECT 1 FROM roles r WHERE r.id=u.id)",
|
|
435
|
+
"SELECT u.id FROM s.users u WHERE EXISTS (SELECT 1 FROM roles r WHERE EXISTS (SELECT 1 FROM roles t WHERE t.id=r.id AND t.id=u.id))",
|
|
436
|
+
"SELECT u.id FROM s.users u WHERE EXISTS (SELECT 1 FROM roles r WHERE r.id = u.id AND EXISTS (SELECT 1 WHERE enabled))",
|
|
324
437
|
"SELECT a.id AS id FROM s.users a JOIN roles b ON b.id=a.id JOIN s.users c ON c.id=b.id",
|
|
325
438
|
"SELECT a.id AS id FROM s.users a JOIN roles b ON enabled JOIN roles c ON c.id=b.id",
|
|
326
439
|
] {
|
|
@@ -334,6 +447,14 @@ mod tests {
|
|
|
334
447
|
"WITH d AS (SELECT id FROM ghost) SELECT id FROM d",
|
|
335
448
|
"SELECT d.id FROM (SELECT id FROM ghost) d",
|
|
336
449
|
"SELECT (SELECT ghost.id FROM ghost) AS id",
|
|
450
|
+
"SELECT id FROM s.users UNION SELECT missing FROM roles",
|
|
451
|
+
"SELECT id FROM s.users UNION SELECT id, enabled FROM roles",
|
|
452
|
+
"SELECT id FROM s.users UNION BY NAME SELECT id FROM roles",
|
|
453
|
+
"SELECT u.id FROM s.users u WHERE EXISTS (SELECT 1 FROM roles u WHERE u.\"display name\" IS NOT NULL)",
|
|
454
|
+
"SELECT u.id FROM s.users u WHERE EXISTS (SELECT 1 FROM roles r WHERE r.id = u.missing)",
|
|
455
|
+
"SELECT u.id FROM s.users u WHERE EXISTS (SELECT 1 FROM roles r WHERE EXISTS (SELECT 1 FROM ghost g WHERE g.id = r.id))",
|
|
456
|
+
"SELECT d.id FROM s.users u CROSS JOIN (SELECT u.id AS id) d",
|
|
457
|
+
"SELECT d.id FROM s.users u CROSS JOIN LATERAL (SELECT u.id AS id) d",
|
|
337
458
|
"SELECT u.id FROM s.users u JOIN roles r USING (id)",
|
|
338
459
|
] {
|
|
339
460
|
assert!(bound_projection(&c, sql).is_err(), "{sql}");
|
|
@@ -10,6 +10,7 @@ pub enum Resolution {
|
|
|
10
10
|
Remove,
|
|
11
11
|
Kill,
|
|
12
12
|
Retry(String),
|
|
13
|
+
Notify(String),
|
|
13
14
|
Udf(String),
|
|
14
15
|
RelationUdf(String),
|
|
15
16
|
Ui,
|
|
@@ -25,8 +26,9 @@ impl Resolution {
|
|
|
25
26
|
if upper == "KILL" {
|
|
26
27
|
return Ok(Self::Kill);
|
|
27
28
|
}
|
|
28
|
-
if upper.starts_with("RETRY") {
|
|
29
|
-
let
|
|
29
|
+
if upper.starts_with("RETRY") || upper.starts_with("NOTIFY") {
|
|
30
|
+
let notify = upper.starts_with("NOTIFY");
|
|
31
|
+
let rest = trimmed[if notify { 6 } else { 5 }..].trim();
|
|
30
32
|
let literal = rest
|
|
31
33
|
.strip_prefix('(')
|
|
32
34
|
.and_then(|s| s.strip_suffix(')'))
|
|
@@ -44,7 +46,11 @@ impl Resolution {
|
|
|
44
46
|
}
|
|
45
47
|
message.push(ch);
|
|
46
48
|
}
|
|
47
|
-
return Ok(
|
|
49
|
+
return Ok(if notify {
|
|
50
|
+
Self::Notify(message)
|
|
51
|
+
} else {
|
|
52
|
+
Self::Retry(message)
|
|
53
|
+
});
|
|
48
54
|
}
|
|
49
55
|
if upper == "UI" {
|
|
50
56
|
return Ok(Self::Ui);
|
|
@@ -77,6 +83,7 @@ impl Resolution {
|
|
|
77
83
|
Self::Remove => "REMOVE".to_string(),
|
|
78
84
|
Self::Kill => "KILL".to_string(),
|
|
79
85
|
Self::Retry(message) => format!("RETRY('{}')", message.replace('\'', "''")),
|
|
86
|
+
Self::Notify(message) => format!("NOTIFY('{}')", message.replace('\'', "''")),
|
|
80
87
|
Self::Udf(name) => format!("UDF {name}"),
|
|
81
88
|
Self::RelationUdf(name) => format!("RELATION UDF {name}"),
|
|
82
89
|
Self::Ui => "UI".to_string(),
|
|
@@ -84,7 +91,10 @@ impl Resolution {
|
|
|
84
91
|
}
|
|
85
92
|
|
|
86
93
|
pub fn is_tuple_resolution(&self) -> bool {
|
|
87
|
-
matches!(
|
|
94
|
+
matches!(
|
|
95
|
+
self,
|
|
96
|
+
Self::Kill | Self::Retry(_) | Self::Notify(_) | Self::Udf(_)
|
|
97
|
+
)
|
|
88
98
|
}
|
|
89
99
|
|
|
90
100
|
pub fn is_relation_resolution(&self) -> bool {
|
|
@@ -297,7 +307,10 @@ pub fn parse_policy_text(text: &str) -> Result<PolicyIr, PolicyParseError> {
|
|
|
297
307
|
queries: HashMap::new(),
|
|
298
308
|
});
|
|
299
309
|
let constraint = raw.constraint;
|
|
300
|
-
let resolution = raw.on_fail
|
|
310
|
+
let resolution = Resolution::parse(&raw.on_fail)?;
|
|
311
|
+
if matches!(resolution, Resolution::Notify(_)) && sink.is_none() {
|
|
312
|
+
return Err(PolicyParseError::MissingClause("SINK for NOTIFY"));
|
|
313
|
+
}
|
|
301
314
|
let description = raw.description.and_then(blank_to_none);
|
|
302
315
|
|
|
303
316
|
let parsed_sources = parse_sources(&sources)?;
|
|
@@ -314,7 +327,7 @@ pub fn parse_policy_text(text: &str) -> Result<PolicyIr, PolicyParseError> {
|
|
|
314
327
|
sink_alias,
|
|
315
328
|
source_aliases: parsed_sources.aliases,
|
|
316
329
|
constraint,
|
|
317
|
-
on_fail:
|
|
330
|
+
on_fail: resolution,
|
|
318
331
|
description,
|
|
319
332
|
})
|
|
320
333
|
}
|
|
@@ -8,6 +8,7 @@ pub enum ResolutionPrecedence {
|
|
|
8
8
|
Kill,
|
|
9
9
|
Remove,
|
|
10
10
|
Retry,
|
|
11
|
+
Notify,
|
|
11
12
|
Udf,
|
|
12
13
|
}
|
|
13
14
|
|
|
@@ -71,6 +72,10 @@ impl ResolutionRegistry {
|
|
|
71
72
|
splittable: false,
|
|
72
73
|
precedence: Some(P::Retry),
|
|
73
74
|
},
|
|
75
|
+
Resolution::Notify(_) => ResolutionProperties {
|
|
76
|
+
splittable: false,
|
|
77
|
+
precedence: Some(P::Notify),
|
|
78
|
+
},
|
|
74
79
|
Resolution::Udf(name) | Resolution::RelationUdf(name) => ResolutionProperties {
|
|
75
80
|
splittable: self
|
|
76
81
|
.definitions
|
|
@@ -276,10 +276,11 @@ fn rewrite_action_filter_for_outer(
|
|
|
276
276
|
propagated: &mut HashMap<String, (Expr, String)>,
|
|
277
277
|
) -> PolicyResolutionAction {
|
|
278
278
|
match action {
|
|
279
|
-
PolicyResolutionAction::
|
|
279
|
+
PolicyResolutionAction::Message {
|
|
280
280
|
filter,
|
|
281
281
|
policy_index,
|
|
282
|
-
|
|
282
|
+
notify,
|
|
283
|
+
} => PolicyResolutionAction::Message {
|
|
283
284
|
filter: rewrite_filter_for_outer(
|
|
284
285
|
filter,
|
|
285
286
|
projected_names,
|
|
@@ -288,6 +289,7 @@ fn rewrite_action_filter_for_outer(
|
|
|
288
289
|
propagated,
|
|
289
290
|
),
|
|
290
291
|
policy_index,
|
|
292
|
+
notify,
|
|
291
293
|
},
|
|
292
294
|
PolicyResolutionAction::Filter {
|
|
293
295
|
filter,
|
{data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/plan/actions.rs
RENAMED
|
@@ -29,9 +29,10 @@ use super::applicability::{ScopePlanDiagnostics, resolve_scope_policies};
|
|
|
29
29
|
#[derive(Debug, Clone)]
|
|
30
30
|
#[allow(clippy::large_enum_variant)]
|
|
31
31
|
pub(crate) enum PolicyResolutionAction {
|
|
32
|
-
|
|
32
|
+
Message {
|
|
33
33
|
filter: Expr,
|
|
34
34
|
policy_index: usize,
|
|
35
|
+
notify: bool,
|
|
35
36
|
},
|
|
36
37
|
Filter {
|
|
37
38
|
filter: Expr,
|
|
@@ -65,9 +66,10 @@ pub(crate) fn action_for_resolution(
|
|
|
65
66
|
policy_index: usize,
|
|
66
67
|
) -> Result<PolicyResolutionAction, crate::diagnostics::RewriteError> {
|
|
67
68
|
match on_fail {
|
|
68
|
-
Resolution::Retry(_) => Ok(PolicyResolutionAction::
|
|
69
|
+
Resolution::Retry(_) | Resolution::Notify(_) => Ok(PolicyResolutionAction::Message {
|
|
69
70
|
filter,
|
|
70
71
|
policy_index,
|
|
72
|
+
notify: matches!(on_fail, Resolution::Notify(_)),
|
|
71
73
|
}),
|
|
72
74
|
Resolution::Remove => Ok(PolicyResolutionAction::Filter {
|
|
73
75
|
filter,
|
|
@@ -202,7 +204,7 @@ pub(crate) fn build_policy_resolution_actions(
|
|
|
202
204
|
expr = and_expr(guard, expr);
|
|
203
205
|
}
|
|
204
206
|
let mut action = action_for_resolution(expr, on_fail, description.clone(), policy, index)?;
|
|
205
|
-
if let PolicyResolutionAction::
|
|
207
|
+
if let PolicyResolutionAction::Message { policy_index, .. } = &mut action {
|
|
206
208
|
*policy_index = store.original_policy_index(index).unwrap_or(index);
|
|
207
209
|
}
|
|
208
210
|
actions.push(action);
|
|
@@ -275,7 +277,7 @@ pub(crate) fn apply_policy_resolution_actions(
|
|
|
275
277
|
{
|
|
276
278
|
1
|
|
277
279
|
}
|
|
278
|
-
PolicyResolutionAction::
|
|
280
|
+
PolicyResolutionAction::Message { .. } => 2,
|
|
279
281
|
PolicyResolutionAction::TupleUdf { .. } => 3,
|
|
280
282
|
PolicyResolutionAction::RelationUdf { .. } => 4,
|
|
281
283
|
PolicyResolutionAction::Ui { .. } => 5,
|
|
@@ -295,7 +297,9 @@ pub(crate) fn apply_policy_resolution_actions(
|
|
|
295
297
|
|
|
296
298
|
for action in actions {
|
|
297
299
|
match action {
|
|
298
|
-
PolicyResolutionAction::
|
|
300
|
+
PolicyResolutionAction::Message { .. } => {
|
|
301
|
+
unreachable!("message resolution routed to joint stage")
|
|
302
|
+
}
|
|
299
303
|
PolicyResolutionAction::Filter { filter, .. } => {
|
|
300
304
|
add_filter(select, filter.clone(), is_aggregation)?;
|
|
301
305
|
}
|
{data_flow_control-0.2.4 → data_flow_control-0.3.1}/passant-core/src/rewriter/policy_expr.rs
RENAMED
|
@@ -921,6 +921,11 @@ pub(crate) fn apply_update_resolution(
|
|
|
921
921
|
ui_followup: &crate::rewriter::types::UiFollowupCell,
|
|
922
922
|
) -> Result<(), RewriteError> {
|
|
923
923
|
match on_fail {
|
|
924
|
+
Resolution::Notify(_) => {
|
|
925
|
+
return Err(RewriteError::unsupported_statement(
|
|
926
|
+
"native NOTIFY requires DuckDB INSERT SELECT",
|
|
927
|
+
));
|
|
928
|
+
}
|
|
924
929
|
Resolution::Retry(_) => {
|
|
925
930
|
return Err(RewriteError::unsupported_statement(
|
|
926
931
|
"RETRY resolution on UPDATE requires a statement-wide resolution stage and is not supported yet",
|