duckdb 0.7.2-dev1457.0 → 0.7.2-dev1533.0
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.
- package/binding.gyp +8 -8
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-dateadd.cpp +2 -2
- package/src/duckdb/extension/icu/icu-datepart.cpp +3 -3
- package/src/duckdb/extension/icu/icu-datesub.cpp +2 -2
- package/src/duckdb/extension/icu/icu-datetrunc.cpp +1 -1
- package/src/duckdb/extension/icu/icu-extension.cpp +3 -3
- package/src/duckdb/extension/icu/icu-list-range.cpp +1 -1
- package/src/duckdb/extension/icu/icu-makedate.cpp +1 -1
- package/src/duckdb/extension/icu/icu-strptime.cpp +7 -7
- package/src/duckdb/extension/icu/icu-timebucket.cpp +6 -6
- package/src/duckdb/extension/icu/icu-timezone.cpp +4 -4
- package/src/duckdb/extension/json/include/json_executors.hpp +2 -2
- package/src/duckdb/extension/json/json_functions/copy_json.cpp +4 -4
- package/src/duckdb/extension/json/json_functions/json_create.cpp +3 -3
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +3 -3
- package/src/duckdb/extension/json/json_functions.cpp +2 -2
- package/src/duckdb/extension/parquet/parquet-extension.cpp +28 -28
- package/src/duckdb/extension/parquet/parquet_metadata.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +9 -9
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +17 -17
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +5 -5
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_set.cpp +28 -28
- package/src/duckdb/src/catalog/default/default_functions.cpp +2 -1
- package/src/duckdb/src/catalog/dependency_manager.cpp +4 -4
- package/src/duckdb/src/common/enums/logical_operator_type.cpp +2 -0
- package/src/duckdb/src/common/enums/physical_operator_type.cpp +2 -0
- package/src/duckdb/src/common/hive_partitioning.cpp +1 -1
- package/src/duckdb/src/common/multi_file_reader.cpp +1 -1
- package/src/duckdb/src/common/row_operations/row_aggregate.cpp +3 -0
- package/src/duckdb/src/common/string_util.cpp +24 -2
- package/src/duckdb/src/common/tree_renderer.cpp +2 -4
- package/src/duckdb/src/common/types.cpp +3 -1
- package/src/duckdb/src/execution/column_binding_resolver.cpp +5 -5
- package/src/duckdb/src/execution/expression_executor.cpp +4 -3
- package/src/duckdb/src/execution/expression_executor_state.cpp +1 -1
- package/src/duckdb/src/execution/index/art/art.cpp +6 -8
- package/src/duckdb/src/execution/operator/aggregate/distinct_aggregate_data.cpp +7 -7
- package/src/duckdb/src/execution/operator/aggregate/grouped_aggregate_data.cpp +2 -2
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +33 -33
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +13 -13
- package/src/duckdb/src/execution/operator/aggregate/physical_streaming_window.cpp +3 -3
- package/src/duckdb/src/execution/operator/aggregate/physical_ungrouped_aggregate.cpp +20 -20
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +12 -12
- package/src/duckdb/src/execution/operator/helper/physical_batch_collector.cpp +5 -5
- package/src/duckdb/src/execution/operator/helper/physical_explain_analyze.cpp +2 -2
- package/src/duckdb/src/execution/operator/helper/physical_limit.cpp +5 -5
- package/src/duckdb/src/execution/operator/helper/physical_limit_percent.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_materialized_collector.cpp +4 -4
- package/src/duckdb/src/execution/operator/helper/physical_reservoir_sample.cpp +2 -2
- package/src/duckdb/src/execution/operator/helper/physical_streaming_limit.cpp +2 -2
- package/src/duckdb/src/execution/operator/helper/physical_streaming_sample.cpp +2 -2
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +4 -4
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +8 -8
- package/src/duckdb/src/execution/operator/join/physical_cross_product.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_delim_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/join/physical_hash_join.cpp +12 -12
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +12 -12
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +6 -5
- package/src/duckdb/src/execution/operator/join/physical_join.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/physical_nested_loop_join.cpp +13 -13
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +10 -10
- package/src/duckdb/src/execution/operator/join/physical_positional_join.cpp +3 -3
- package/src/duckdb/src/execution/operator/order/physical_order.cpp +11 -11
- package/src/duckdb/src/execution/operator/order/physical_top_n.cpp +6 -6
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +7 -7
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +8 -8
- package/src/duckdb/src/execution/operator/persistent/physical_delete.cpp +5 -5
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +8 -8
- package/src/duckdb/src/execution/operator/persistent/physical_update.cpp +7 -7
- package/src/duckdb/src/execution/operator/projection/physical_pivot.cpp +81 -0
- package/src/duckdb/src/execution/operator/projection/physical_tableinout_function.cpp +5 -5
- package/src/duckdb/src/execution/operator/projection/physical_unnest.cpp +4 -5
- package/src/duckdb/src/execution/operator/scan/physical_column_data_scan.cpp +1 -1
- package/src/duckdb/src/execution/operator/scan/physical_positional_scan.cpp +4 -4
- package/src/duckdb/src/execution/operator/scan/physical_table_scan.cpp +7 -7
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_attach.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +8 -7
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +3 -3
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +1 -1
- package/src/duckdb/src/execution/operator/set/physical_recursive_cte.cpp +2 -2
- package/src/duckdb/src/execution/physical_operator.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_delim_join.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_distinct.cpp +4 -1
- package/src/duckdb/src/execution/physical_plan/plan_pivot.cpp +14 -0
- package/src/duckdb/src/execution/physical_plan/plan_projection.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_window.cpp +8 -8
- package/src/duckdb/src/execution/physical_plan_generator.cpp +49 -42
- package/src/duckdb/src/execution/radix_partitioned_hashtable.cpp +14 -14
- package/src/duckdb/src/function/aggregate/algebraic/avg.cpp +2 -2
- package/src/duckdb/src/function/aggregate/distributive/bitstring_agg.cpp +1 -1
- package/src/duckdb/src/function/aggregate/distributive/string_agg.cpp +2 -2
- package/src/duckdb/src/function/aggregate/holistic/approximate_quantile.cpp +1 -1
- package/src/duckdb/src/function/aggregate/holistic/quantile.cpp +1 -1
- package/src/duckdb/src/function/aggregate/holistic/reservoir_quantile.cpp +1 -1
- package/src/duckdb/src/function/aggregate/nested/list.cpp +3 -3
- package/src/duckdb/src/function/cast/enum_casts.cpp +3 -3
- package/src/duckdb/src/function/cast/list_casts.cpp +2 -2
- package/src/duckdb/src/function/cast/string_cast.cpp +6 -6
- package/src/duckdb/src/function/cast/struct_cast.cpp +4 -4
- package/src/duckdb/src/function/cast/union_casts.cpp +6 -6
- package/src/duckdb/src/function/function.cpp +4 -4
- package/src/duckdb/src/function/function_binder.cpp +2 -1
- package/src/duckdb/src/function/macro_function.cpp +3 -3
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +1 -1
- package/src/duckdb/src/function/pragma_function.cpp +1 -1
- package/src/duckdb/src/function/scalar/date/date_part.cpp +1 -1
- package/src/duckdb/src/function/scalar/date/strftime.cpp +6 -6
- package/src/duckdb/src/function/scalar/generic/alias.cpp +1 -1
- package/src/duckdb/src/function/scalar/generic/constant_or_null.cpp +3 -3
- package/src/duckdb/src/function/scalar/generic/current_setting.cpp +2 -2
- package/src/duckdb/src/function/scalar/generic/stats.cpp +3 -3
- package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +5 -5
- package/src/duckdb/src/function/scalar/list/list_lambdas.cpp +3 -3
- package/src/duckdb/src/function/scalar/list/list_sort.cpp +3 -3
- package/src/duckdb/src/function/scalar/math/numeric.cpp +3 -3
- package/src/duckdb/src/function/scalar/math/random.cpp +2 -2
- package/src/duckdb/src/function/scalar/math/setseed.cpp +2 -2
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +2 -2
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +4 -4
- package/src/duckdb/src/function/scalar/string/like.cpp +1 -1
- package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +5 -5
- package/src/duckdb/src/function/scalar/string/regexp.cpp +11 -11
- package/src/duckdb/src/function/scalar/string/string_split.cpp +3 -3
- package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +3 -3
- package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +2 -2
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +2 -2
- package/src/duckdb/src/function/scalar/union/union_extract.cpp +2 -2
- package/src/duckdb/src/function/scalar_macro_function.cpp +3 -3
- package/src/duckdb/src/function/table/arrow.cpp +5 -5
- package/src/duckdb/src/function/table/checkpoint.cpp +1 -1
- package/src/duckdb/src/function/table/glob.cpp +1 -1
- package/src/duckdb/src/function/table/pragma_detailed_profiling_output.cpp +1 -1
- package/src/duckdb/src/function/table/pragma_last_profiling_output.cpp +1 -1
- package/src/duckdb/src/function/table/range.cpp +5 -5
- package/src/duckdb/src/function/table/read_csv.cpp +10 -10
- package/src/duckdb/src/function/table/repeat.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +12 -12
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +1 -1
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_views.cpp +1 -1
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +1 -1
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +3 -3
- package/src/duckdb/src/function/table/system/test_vector_types.cpp +1 -1
- package/src/duckdb/src/function/table/table_scan.cpp +31 -31
- package/src/duckdb/src/function/table/unnest.cpp +4 -4
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/table_macro_function.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +13 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +4 -4
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +3 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +14 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/case_insensitive_map.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/enums/logical_operator_type.hpp +1 -0
- package/src/duckdb/src/include/duckdb/common/enums/physical_operator_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/multi_file_reader_options.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_hash_aggregate.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_streaming_window.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_ungrouped_aggregate.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_window.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/filter/physical_filter.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_execute.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_explain_analyze.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_limit_percent.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_load.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_pragma.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_prepare.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_reset.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_set.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_limit.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_streaming_sample.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_transaction.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/helper/physical_vacuum.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_blockwise_nl_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_cross_product.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_delim_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_hash_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_iejoin.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_index_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_nested_loop_join.hpp +3 -4
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/join/physical_positional_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_order.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/order/physical_top_n.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_batch_insert.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_copy_to_file.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_delete.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_insert.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_update.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_pivot.hpp +38 -0
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_projection.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_tableinout_function.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/projection/physical_unnest.hpp +3 -1
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_column_data_scan.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_dummy_scan.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_empty_result.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_expression_scan.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_positional_scan.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/scan/physical_table_scan.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_alter.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_attach.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_function.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_index.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_schema.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_sequence.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_table.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_type.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_create_view.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_detach.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/schema/physical_drop.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_recursive_cte.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/operator/set/physical_union.hpp +4 -0
- package/src/duckdb/src/include/duckdb/execution/physical_operator.hpp +18 -57
- package/src/duckdb/src/include/duckdb/execution/physical_operator_states.hpp +150 -0
- package/src/duckdb/src/include/duckdb/execution/physical_plan_generator.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +11 -0
- package/src/duckdb/src/include/duckdb/function/copy_function.hpp +22 -0
- package/src/duckdb/src/include/duckdb/function/function.hpp +20 -4
- package/src/duckdb/src/include/duckdb/function/macro_function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/function/pragma_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +11 -0
- package/src/duckdb/src/include/duckdb/function/scalar_macro_function.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +22 -0
- package/src/duckdb/src/include/duckdb/function/table_macro_function.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/client_config.hpp +3 -2
- package/src/duckdb/src/include/duckdb/main/settings.hpp +10 -0
- package/src/duckdb/src/include/duckdb/optimizer/rule/like_optimizations.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/base_expression.hpp +18 -0
- package/src/duckdb/src/include/duckdb/parser/constraint.hpp +18 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/check_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/foreign_key_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/not_null_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/constraints/unique_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/default_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/list.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/recursive_cte_node.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/select_node.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/set_operation_node.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/query_node.hpp +18 -0
- package/src/duckdb/src/include/duckdb/parser/sql_statement.hpp +18 -0
- package/src/duckdb/src/include/duckdb/parser/statement/alter_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/attach_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/call_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/copy_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/create_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/delete_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/detach_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/drop_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/execute_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/explain_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/export_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/extension_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/insert_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/statement/load_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/logical_plan_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/multi_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/pragma_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/prepare_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/relation_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/set_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/show_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/transaction_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/update_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/statement/vacuum_statement.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/basetableref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/emptytableref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/expressionlistref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +14 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/subqueryref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +17 -0
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/bound_constraint.hpp +18 -0
- package/src/duckdb/src/include/duckdb/planner/bound_query_node.hpp +17 -0
- package/src/duckdb/src/include/duckdb/planner/bound_result_modifier.hpp +5 -1
- package/src/duckdb/src/include/duckdb/planner/bound_tableref.hpp +17 -0
- package/src/duckdb/src/include/duckdb/planner/bound_tokens.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_check_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_foreign_key_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_not_null_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/constraints/bound_unique_constraint.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_aggregate_expression.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_between_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_case_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_cast_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_columnref_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_comparison_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_conjunction_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_constant_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_default_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_function_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambda_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_lambdaref_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_operator_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_parameter_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_reference_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_subquery_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_unnest_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/expression/bound_window_expression.hpp +4 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder/table_function_binder.hpp +1 -1
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/logical_operator.hpp +17 -0
- package/src/duckdb/src/include/duckdb/planner/logical_tokens.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_aggregate.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_any_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_asof_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_column_data_get.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_comparison_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_copy_to_file.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_index.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_create_table.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cross_product.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_cteref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delete.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_get.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_delim_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_distinct.hpp +12 -4
- package/src/duckdb/src/include/duckdb/planner/operator/logical_dummy_scan.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_empty_result.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_execute.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_explain.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_expression_get.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_extension_operator.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_filter.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_insert.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_limit_percent.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_order.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pivot.hpp +36 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_positional_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_pragma.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_prepare.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_projection.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_recursive_cte.hpp +9 -5
- package/src/duckdb/src/include/duckdb/planner/operator/logical_reset.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_sample.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_set_operation.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_show.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_simple.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_top_n.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unconditional_join.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_unnest.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_update.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_window.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_recursive_cte_node.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_select_node.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/query_node/bound_set_operation_node.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/query_node/list.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_basetableref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_cteref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_dummytableref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_expressionlistref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_joinref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_pivotref.hpp +43 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_pos_join_ref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_subqueryref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/bound_table_function.hpp +3 -0
- package/src/duckdb/src/include/duckdb/planner/tableref/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/index.hpp +15 -2
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +17 -17
- package/src/duckdb/src/include/duckdb/transaction/commit_state.hpp +1 -1
- package/src/duckdb/src/main/capi/table_function-c.cpp +9 -9
- package/src/duckdb/src/main/client_context.cpp +1 -1
- package/src/duckdb/src/main/config.cpp +1 -0
- package/src/duckdb/src/main/query_profiler.cpp +2 -2
- package/src/duckdb/src/main/relation/aggregate_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/filter_relation.cpp +1 -1
- package/src/duckdb/src/main/relation/projection_relation.cpp +1 -1
- package/src/duckdb/src/main/relation.cpp +1 -1
- package/src/duckdb/src/main/settings/settings.cpp +17 -1
- package/src/duckdb/src/optimizer/column_lifetime_analyzer.cpp +3 -3
- package/src/duckdb/src/optimizer/common_aggregate_optimizer.cpp +1 -1
- package/src/duckdb/src/optimizer/cse_optimizer.cpp +1 -1
- package/src/duckdb/src/optimizer/deliminator.cpp +11 -11
- package/src/duckdb/src/optimizer/expression_heuristics.cpp +11 -11
- package/src/duckdb/src/optimizer/expression_rewriter.cpp +1 -1
- package/src/duckdb/src/optimizer/filter_combiner.cpp +40 -38
- package/src/duckdb/src/optimizer/filter_pullup.cpp +2 -2
- package/src/duckdb/src/optimizer/filter_pushdown.cpp +1 -1
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +8 -8
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +24 -24
- package/src/duckdb/src/optimizer/matcher/expression_matcher.cpp +12 -12
- package/src/duckdb/src/optimizer/pullup/pullup_filter.cpp +1 -1
- package/src/duckdb/src/optimizer/pullup/pullup_projection.cpp +2 -2
- package/src/duckdb/src/optimizer/pullup/pullup_set_operation.cpp +3 -3
- package/src/duckdb/src/optimizer/pushdown/pushdown_aggregate.cpp +3 -3
- package/src/duckdb/src/optimizer/pushdown/pushdown_filter.cpp +1 -1
- package/src/duckdb/src/optimizer/pushdown/pushdown_get.cpp +1 -1
- package/src/duckdb/src/optimizer/pushdown/pushdown_inner_join.cpp +3 -3
- package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +3 -3
- package/src/duckdb/src/optimizer/pushdown/pushdown_limit.cpp +1 -1
- package/src/duckdb/src/optimizer/pushdown/pushdown_mark_join.cpp +3 -3
- package/src/duckdb/src/optimizer/pushdown/pushdown_projection.cpp +2 -2
- package/src/duckdb/src/optimizer/pushdown/pushdown_set_operation.cpp +4 -4
- package/src/duckdb/src/optimizer/pushdown/pushdown_single_join.cpp +1 -1
- package/src/duckdb/src/optimizer/regex_range_filter.cpp +2 -2
- package/src/duckdb/src/optimizer/remove_unused_columns.cpp +13 -9
- package/src/duckdb/src/optimizer/rule/arithmetic_simplification.cpp +20 -20
- package/src/duckdb/src/optimizer/rule/case_simplification.cpp +8 -8
- package/src/duckdb/src/optimizer/rule/comparison_simplification.cpp +14 -14
- package/src/duckdb/src/optimizer/rule/conjunction_simplification.cpp +5 -5
- package/src/duckdb/src/optimizer/rule/date_part_simplification.cpp +2 -2
- package/src/duckdb/src/optimizer/rule/distributivity.cpp +16 -16
- package/src/duckdb/src/optimizer/rule/empty_needle_removal.cpp +4 -5
- package/src/duckdb/src/optimizer/rule/enum_comparison.cpp +8 -9
- package/src/duckdb/src/optimizer/rule/in_clause_simplification_rule.cpp +13 -13
- package/src/duckdb/src/optimizer/rule/like_optimizations.cpp +12 -12
- package/src/duckdb/src/optimizer/rule/move_constants.cpp +31 -31
- package/src/duckdb/src/optimizer/rule/ordered_aggregate_optimizer.cpp +4 -4
- package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +10 -10
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +9 -8
- package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics_propagator.cpp +31 -20
- package/src/duckdb/src/optimizer/topn_optimizer.cpp +2 -2
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +13 -13
- package/src/duckdb/src/parser/column_definition.cpp +3 -3
- package/src/duckdb/src/parser/expression/columnref_expression.cpp +2 -5
- package/src/duckdb/src/parser/expression/conjunction_expression.cpp +1 -1
- package/src/duckdb/src/parser/expression/constant_expression.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +1 -1
- package/src/duckdb/src/parser/parsed_expression_iterator.cpp +20 -20
- package/src/duckdb/src/parser/parser.cpp +10 -10
- package/src/duckdb/src/parser/query_node/recursive_cte_node.cpp +4 -4
- package/src/duckdb/src/parser/query_node/select_node.cpp +10 -10
- package/src/duckdb/src/parser/query_node/set_operation_node.cpp +4 -4
- package/src/duckdb/src/parser/statement/insert_statement.cpp +1 -1
- package/src/duckdb/src/parser/statement/select_statement.cpp +2 -2
- package/src/duckdb/src/parser/transform/expression/transform_array_access.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_columnref.cpp +3 -3
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +2 -42
- package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +1 -1
- package/src/duckdb/src/parser/transform/helpers/transform_groupby.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_create_type.cpp +0 -1
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +5 -2
- package/src/duckdb/src/parser/transform/statement/transform_pragma.cpp +5 -5
- package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +20 -20
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +3 -3
- package/src/duckdb/src/planner/bind_context.cpp +11 -0
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +47 -4
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +5 -6
- package/src/duckdb/src/planner/binder/expression/bind_lambda.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +3 -3
- package/src/duckdb/src/planner/binder/expression/bind_star_expression.cpp +8 -8
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +23 -29
- package/src/duckdb/src/planner/binder/query_node/bind_setop_node.cpp +2 -2
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +1 -1
- package/src/duckdb/src/planner/binder/query_node/plan_query_node.cpp +3 -3
- package/src/duckdb/src/planner/binder/query_node/plan_recursive_cte_node.cpp +2 -3
- package/src/duckdb/src/planner/binder/query_node/plan_select_node.cpp +0 -2
- package/src/duckdb/src/planner/binder/query_node/plan_subquery.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_call.cpp +3 -2
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +17 -16
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +7 -6
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +3 -2
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_extension.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_set.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +2 -1
- package/src/duckdb/src/planner/binder/statement/bind_vacuum.cpp +2 -2
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +4 -3
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +303 -78
- package/src/duckdb/src/planner/binder/tableref/bind_subqueryref.cpp +4 -4
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +10 -10
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +6 -6
- package/src/duckdb/src/planner/binder/tableref/plan_pivotref.cpp +13 -0
- package/src/duckdb/src/planner/binder.cpp +52 -48
- package/src/duckdb/src/planner/expression/bound_aggregate_expression.cpp +8 -8
- package/src/duckdb/src/planner/expression/bound_between_expression.cpp +5 -5
- package/src/duckdb/src/planner/expression/bound_case_expression.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_cast_expression.cpp +5 -5
- package/src/duckdb/src/planner/expression/bound_columnref_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_comparison_expression.cpp +3 -4
- package/src/duckdb/src/planner/expression/bound_conjunction_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_constant_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_function_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_lambda_expression.cpp +4 -4
- package/src/duckdb/src/planner/expression/bound_lambdaref_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_operator_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_parameter_expression.cpp +3 -3
- package/src/duckdb/src/planner/expression/bound_reference_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_unnest_expression.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +16 -16
- package/src/duckdb/src/planner/expression_binder/alter_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/base_select_binder.cpp +3 -3
- package/src/duckdb/src/planner/expression_binder/check_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/constant_binder.cpp +11 -1
- package/src/duckdb/src/planner/expression_binder/group_binder.cpp +2 -2
- package/src/duckdb/src/planner/expression_binder/index_binder.cpp +1 -1
- package/src/duckdb/src/planner/expression_binder/lateral_binder.cpp +3 -3
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +3 -3
- package/src/duckdb/src/planner/expression_binder/qualify_binder.cpp +2 -1
- package/src/duckdb/src/planner/expression_binder/table_function_binder.cpp +7 -3
- package/src/duckdb/src/planner/expression_binder.cpp +24 -32
- package/src/duckdb/src/planner/expression_iterator.cpp +17 -17
- package/src/duckdb/src/planner/joinside.cpp +2 -2
- package/src/duckdb/src/planner/logical_operator.cpp +3 -0
- package/src/duckdb/src/planner/logical_operator_visitor.cpp +26 -26
- package/src/duckdb/src/planner/operator/logical_distinct.cpp +3 -1
- package/src/duckdb/src/planner/operator/logical_filter.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_join.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_pivot.cpp +35 -0
- package/src/duckdb/src/planner/operator/logical_recursive_cte.cpp +1 -1
- package/src/duckdb/src/planner/pragma_handler.cpp +2 -2
- package/src/duckdb/src/planner/subquery/flatten_dependent_join.cpp +25 -23
- package/src/duckdb/src/planner/subquery/rewrite_correlated_expressions.cpp +2 -2
- package/src/duckdb/src/planner/table_binding.cpp +8 -8
- package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +1 -1
- package/src/duckdb/src/storage/data_table.cpp +2 -1
- package/src/duckdb/src/storage/index.cpp +4 -5
- package/src/duckdb/src/storage/local_storage.cpp +2 -1
- package/src/duckdb/src/storage/table/row_group_collection.cpp +1 -1
- package/src/duckdb/src/storage/write_ahead_log.cpp +42 -42
- package/src/duckdb/src/transaction/commit_state.cpp +35 -35
- package/src/duckdb/src/transaction/duck_transaction.cpp +1 -1
- package/src/duckdb/src/transaction/rollback_state.cpp +1 -1
- package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +773 -793
- package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +1 -11
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +17408 -17751
- package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +5 -5
- package/src/duckdb/ub_src_execution_operator_projection.cpp +2 -0
- package/src/duckdb/ub_src_execution_physical_plan.cpp +2 -0
- package/src/duckdb/ub_src_planner_binder_tableref.cpp +2 -0
- package/src/duckdb/ub_src_planner_operator.cpp +2 -0
@@ -36,7 +36,7 @@ static bool Disjoint(unordered_set<T> &a, unordered_set<T> &b) {
|
|
36
36
|
//! Extract the set of relations referred to inside an expression
|
37
37
|
bool JoinOrderOptimizer::ExtractBindings(Expression &expression, unordered_set<idx_t> &bindings) {
|
38
38
|
if (expression.type == ExpressionType::BOUND_COLUMN_REF) {
|
39
|
-
auto &colref = (
|
39
|
+
auto &colref = expression.Cast<BoundColumnRefExpression>();
|
40
40
|
D_ASSERT(colref.depth == 0);
|
41
41
|
D_ASSERT(colref.binding.table_index != DConstants::INVALID_INDEX);
|
42
42
|
// map the base table index to the relation index used by the JoinOrderOptimizer
|
@@ -66,7 +66,7 @@ void JoinOrderOptimizer::GetColumnBinding(Expression &expression, ColumnBinding
|
|
66
66
|
if (expression.type == ExpressionType::BOUND_COLUMN_REF) {
|
67
67
|
// Here you have a filter on a single column in a table. Return a binding for the column
|
68
68
|
// being filtered on so the filter estimator knows what HLL count to pull
|
69
|
-
auto &colref = (
|
69
|
+
auto &colref = expression.Cast<BoundColumnRefExpression>();
|
70
70
|
D_ASSERT(colref.depth == 0);
|
71
71
|
D_ASSERT(colref.binding.table_index != DConstants::INVALID_INDEX);
|
72
72
|
// map the base table index to the relation index used by the JoinOrderOptimizer
|
@@ -88,8 +88,8 @@ static unique_ptr<LogicalOperator> PushFilter(unique_ptr<LogicalOperator> node,
|
|
88
88
|
}
|
89
89
|
// push the filter into the LogicalFilter
|
90
90
|
D_ASSERT(node->type == LogicalOperatorType::LOGICAL_FILTER);
|
91
|
-
auto filter =
|
92
|
-
filter
|
91
|
+
auto &filter = node->Cast<LogicalFilter>();
|
92
|
+
filter.expressions.push_back(std::move(expr));
|
93
93
|
return node;
|
94
94
|
}
|
95
95
|
|
@@ -120,7 +120,7 @@ bool JoinOrderOptimizer::ExtractJoinRelations(LogicalOperator &input_op, vector<
|
|
120
120
|
}
|
121
121
|
|
122
122
|
if (op->type == LogicalOperatorType::LOGICAL_COMPARISON_JOIN) {
|
123
|
-
auto &join = (
|
123
|
+
auto &join = op->Cast<LogicalComparisonJoin>();
|
124
124
|
if (join.join_type == JoinType::INNER) {
|
125
125
|
// extract join conditions from inner join
|
126
126
|
filter_operators.push_back(op);
|
@@ -195,35 +195,35 @@ bool JoinOrderOptimizer::ExtractJoinRelations(LogicalOperator &input_op, vector<
|
|
195
195
|
}
|
196
196
|
case LogicalOperatorType::LOGICAL_GET: {
|
197
197
|
// base table scan, add to set of relations
|
198
|
-
auto get = (
|
198
|
+
auto &get = op->Cast<LogicalGet>();
|
199
199
|
auto relation = make_uniq<SingleJoinRelation>(&input_op, parent);
|
200
200
|
idx_t relation_id = relations.size();
|
201
201
|
//! make sure the optimizer has knowledge of the exact column bindings as well.
|
202
|
-
auto table_index = get
|
202
|
+
auto table_index = get.table_index;
|
203
203
|
relation_mapping[table_index] = relation_id;
|
204
|
-
cardinality_estimator.AddRelationColumnMapping(get, relation_id);
|
204
|
+
cardinality_estimator.AddRelationColumnMapping(&get, relation_id);
|
205
205
|
relations.push_back(std::move(relation));
|
206
206
|
return true;
|
207
207
|
}
|
208
208
|
case LogicalOperatorType::LOGICAL_EXPRESSION_GET: {
|
209
209
|
// base table scan, add to set of relations
|
210
|
-
auto get = (
|
210
|
+
auto &get = op->Cast<LogicalExpressionGet>();
|
211
211
|
auto relation = make_uniq<SingleJoinRelation>(&input_op, parent);
|
212
212
|
//! make sure the optimizer has knowledge of the exact column bindings as well.
|
213
|
-
relation_mapping[get
|
213
|
+
relation_mapping[get.table_index] = relations.size();
|
214
214
|
relations.push_back(std::move(relation));
|
215
215
|
return true;
|
216
216
|
}
|
217
217
|
case LogicalOperatorType::LOGICAL_DUMMY_SCAN: {
|
218
218
|
// table function call, add to set of relations
|
219
|
-
auto dummy_scan = (
|
219
|
+
auto &dummy_scan = op->Cast<LogicalDummyScan>();
|
220
220
|
auto relation = make_uniq<SingleJoinRelation>(&input_op, parent);
|
221
|
-
relation_mapping[dummy_scan
|
221
|
+
relation_mapping[dummy_scan.table_index] = relations.size();
|
222
222
|
relations.push_back(std::move(relation));
|
223
223
|
return true;
|
224
224
|
}
|
225
225
|
case LogicalOperatorType::LOGICAL_PROJECTION: {
|
226
|
-
auto proj = (
|
226
|
+
auto &proj = op->Cast<LogicalProjection>();
|
227
227
|
// we run the join order optimizer within the subquery as well
|
228
228
|
JoinOrderOptimizer optimizer(context);
|
229
229
|
op->children[0] = optimizer.Optimize(std::move(op->children[0]));
|
@@ -236,10 +236,10 @@ bool JoinOrderOptimizer::ExtractJoinRelations(LogicalOperator &input_op, vector<
|
|
236
236
|
optimizer.cardinality_estimator.CopyRelationMap(child_binding_maps.at(0));
|
237
237
|
// This logical projection may sit on top of a logical comparison join that has been pushed down
|
238
238
|
// we want to copy the binding info of both tables
|
239
|
-
relation_mapping[proj
|
239
|
+
relation_mapping[proj.table_index] = relation_id;
|
240
240
|
for (auto &binding_info : child_binding_maps.at(0)) {
|
241
241
|
cardinality_estimator.AddRelationToColumnMapping(
|
242
|
-
ColumnBinding(proj
|
242
|
+
ColumnBinding(proj.table_index, binding_info.first.column_index), binding_info.second);
|
243
243
|
cardinality_estimator.AddColumnToRelationMap(binding_info.second.table_index,
|
244
244
|
binding_info.second.column_index);
|
245
245
|
}
|
@@ -762,7 +762,7 @@ JoinOrderOptimizer::GenerateJoins(vector<unique_ptr<LogicalOperator>> &extracted
|
|
762
762
|
JoinRelationSet::IsSubset(right.first, f->left_set)));
|
763
763
|
JoinCondition cond;
|
764
764
|
D_ASSERT(condition->GetExpressionClass() == ExpressionClass::BOUND_COMPARISON);
|
765
|
-
auto &comparison = (
|
765
|
+
auto &comparison = condition->Cast<BoundComparisonExpression>();
|
766
766
|
// we need to figure out which side is which by looking at the relations available to us
|
767
767
|
bool invert = !JoinRelationSet::IsSubset(left.first, f->left_set);
|
768
768
|
cond.left = !invert ? std::move(comparison.left) : std::move(comparison.right);
|
@@ -841,7 +841,7 @@ JoinOrderOptimizer::GenerateJoins(vector<unique_ptr<LogicalOperator>> &extracted
|
|
841
841
|
// create the join condition
|
842
842
|
JoinCondition cond;
|
843
843
|
D_ASSERT(filter->GetExpressionClass() == ExpressionClass::BOUND_COMPARISON);
|
844
|
-
auto &comparison = (
|
844
|
+
auto &comparison = filter->Cast<BoundComparisonExpression>();
|
845
845
|
// we need to figure out which side is which by looking at the relations available to us
|
846
846
|
cond.left = !invert ? std::move(comparison.left) : std::move(comparison.right);
|
847
847
|
cond.right = !invert ? std::move(comparison.right) : std::move(comparison.left);
|
@@ -870,7 +870,7 @@ JoinOrderOptimizer::GenerateJoins(vector<unique_ptr<LogicalOperator>> &extracted
|
|
870
870
|
} else {
|
871
871
|
D_ASSERT(node->type == LogicalOperatorType::LOGICAL_COMPARISON_JOIN ||
|
872
872
|
node->type == LogicalOperatorType::LOGICAL_ASOF_JOIN);
|
873
|
-
auto &comp_join = (
|
873
|
+
auto &comp_join = node->Cast<LogicalComparisonJoin>();
|
874
874
|
comp_join.conditions.push_back(std::move(cond));
|
875
875
|
}
|
876
876
|
}
|
@@ -949,7 +949,7 @@ unique_ptr<LogicalOperator> JoinOrderOptimizer::Optimize(unique_ptr<LogicalOpera
|
|
949
949
|
for (auto &f_op : filter_operators) {
|
950
950
|
if (f_op->type == LogicalOperatorType::LOGICAL_COMPARISON_JOIN ||
|
951
951
|
f_op->type == LogicalOperatorType::LOGICAL_ASOF_JOIN) {
|
952
|
-
auto &join = (
|
952
|
+
auto &join = f_op->Cast<LogicalComparisonJoin>();
|
953
953
|
D_ASSERT(join.join_type == JoinType::INNER);
|
954
954
|
D_ASSERT(join.expressions.empty());
|
955
955
|
for (auto &cond : join.conditions) {
|
@@ -984,13 +984,13 @@ unique_ptr<LogicalOperator> JoinOrderOptimizer::Optimize(unique_ptr<LogicalOpera
|
|
984
984
|
filter_info->filter_index = i;
|
985
985
|
// now check if it can be used as a join predicate
|
986
986
|
if (filter->GetExpressionClass() == ExpressionClass::BOUND_COMPARISON) {
|
987
|
-
auto comparison =
|
987
|
+
auto &comparison = filter->Cast<BoundComparisonExpression>();
|
988
988
|
// extract the bindings that are required for the left and right side of the comparison
|
989
989
|
unordered_set<idx_t> left_bindings, right_bindings;
|
990
|
-
ExtractBindings(*comparison
|
991
|
-
ExtractBindings(*comparison
|
992
|
-
GetColumnBinding(*comparison
|
993
|
-
GetColumnBinding(*comparison
|
990
|
+
ExtractBindings(*comparison.left, left_bindings);
|
991
|
+
ExtractBindings(*comparison.right, right_bindings);
|
992
|
+
GetColumnBinding(*comparison.left, filter_info->left_binding);
|
993
|
+
GetColumnBinding(*comparison.right, filter_info->right_binding);
|
994
994
|
if (!left_bindings.empty() && !right_bindings.empty()) {
|
995
995
|
// both the left and the right side have bindings
|
996
996
|
// first create the relation sets, if they do not exist
|
@@ -37,8 +37,8 @@ bool ComparisonExpressionMatcher::Match(Expression *expr_p, vector<Expression *>
|
|
37
37
|
if (!ExpressionMatcher::Match(expr_p, bindings)) {
|
38
38
|
return false;
|
39
39
|
}
|
40
|
-
auto expr = (
|
41
|
-
vector<Expression *> expressions = {expr
|
40
|
+
auto &expr = expr_p->Cast<BoundComparisonExpression>();
|
41
|
+
vector<Expression *> expressions = {expr.left.get(), expr.right.get()};
|
42
42
|
return SetMatcher::Match(matchers, expressions, bindings, policy);
|
43
43
|
}
|
44
44
|
|
@@ -49,27 +49,27 @@ bool CastExpressionMatcher::Match(Expression *expr_p, vector<Expression *> &bind
|
|
49
49
|
if (!matcher) {
|
50
50
|
return true;
|
51
51
|
}
|
52
|
-
auto expr = (
|
53
|
-
return matcher->Match(expr
|
52
|
+
auto &expr = expr_p->Cast<BoundCastExpression>();
|
53
|
+
return matcher->Match(expr.child.get(), bindings);
|
54
54
|
}
|
55
55
|
|
56
56
|
bool InClauseExpressionMatcher::Match(Expression *expr_p, vector<Expression *> &bindings) {
|
57
57
|
if (!ExpressionMatcher::Match(expr_p, bindings)) {
|
58
58
|
return false;
|
59
59
|
}
|
60
|
-
auto expr = (
|
61
|
-
if (expr
|
60
|
+
auto &expr = expr_p->Cast<BoundOperatorExpression>();
|
61
|
+
if (expr.type != ExpressionType::COMPARE_IN || expr.type == ExpressionType::COMPARE_NOT_IN) {
|
62
62
|
return false;
|
63
63
|
}
|
64
|
-
return SetMatcher::Match(matchers, expr
|
64
|
+
return SetMatcher::Match(matchers, expr.children, bindings, policy);
|
65
65
|
}
|
66
66
|
|
67
67
|
bool ConjunctionExpressionMatcher::Match(Expression *expr_p, vector<Expression *> &bindings) {
|
68
68
|
if (!ExpressionMatcher::Match(expr_p, bindings)) {
|
69
69
|
return false;
|
70
70
|
}
|
71
|
-
auto expr = (
|
72
|
-
if (!SetMatcher::Match(matchers, expr
|
71
|
+
auto &expr = expr_p->Cast<BoundConjunctionExpression>();
|
72
|
+
if (!SetMatcher::Match(matchers, expr.children, bindings, policy)) {
|
73
73
|
return false;
|
74
74
|
}
|
75
75
|
return true;
|
@@ -79,11 +79,11 @@ bool FunctionExpressionMatcher::Match(Expression *expr_p, vector<Expression *> &
|
|
79
79
|
if (!ExpressionMatcher::Match(expr_p, bindings)) {
|
80
80
|
return false;
|
81
81
|
}
|
82
|
-
auto expr = (
|
83
|
-
if (!FunctionMatcher::Match(function, expr
|
82
|
+
auto &expr = expr_p->Cast<BoundFunctionExpression>();
|
83
|
+
if (!FunctionMatcher::Match(function, expr.function.name)) {
|
84
84
|
return false;
|
85
85
|
}
|
86
|
-
if (!SetMatcher::Match(matchers, expr
|
86
|
+
if (!SetMatcher::Match(matchers, expr.children, bindings, policy)) {
|
87
87
|
return false;
|
88
88
|
}
|
89
89
|
return true;
|
@@ -9,7 +9,7 @@ namespace duckdb {
|
|
9
9
|
unique_ptr<LogicalOperator> FilterPullup::PullupFilter(unique_ptr<LogicalOperator> op) {
|
10
10
|
D_ASSERT(op->type == LogicalOperatorType::LOGICAL_FILTER);
|
11
11
|
|
12
|
-
auto &filter = (
|
12
|
+
auto &filter = op->Cast<LogicalFilter>();
|
13
13
|
if (can_pullup && filter.projection_map.empty()) {
|
14
14
|
unique_ptr<LogicalOperator> child = std::move(op->children[0]);
|
15
15
|
child = Rewrite(std::move(child));
|
@@ -21,7 +21,7 @@ static void ReplaceExpressionBinding(vector<unique_ptr<Expression>> &proj_expres
|
|
21
21
|
idx_t proj_table_idx) {
|
22
22
|
if (expr.type == ExpressionType::BOUND_COLUMN_REF) {
|
23
23
|
bool found_proj_col = false;
|
24
|
-
BoundColumnRefExpression &colref = (
|
24
|
+
BoundColumnRefExpression &colref = expr.Cast<BoundColumnRefExpression>();
|
25
25
|
// find the corresponding column index in the projection expressions
|
26
26
|
for (idx_t proj_idx = 0; proj_idx < proj_expressions.size(); proj_idx++) {
|
27
27
|
auto proj_expr = proj_expressions[proj_idx].get();
|
@@ -79,7 +79,7 @@ unique_ptr<LogicalOperator> FilterPullup::PullupProjection(unique_ptr<LogicalOpe
|
|
79
79
|
D_ASSERT(op->type == LogicalOperatorType::LOGICAL_PROJECTION);
|
80
80
|
op->children[0] = Rewrite(std::move(op->children[0]));
|
81
81
|
if (!filters_expr_pullup.empty()) {
|
82
|
-
auto &proj = (
|
82
|
+
auto &proj = op->Cast<LogicalProjection>();
|
83
83
|
// INTERSECT, EXCEPT, and DISTINCT
|
84
84
|
if (!can_add_column) {
|
85
85
|
// special treatment for operators that cannot add columns, e.g., INTERSECT, EXCEPT, and DISTINCT
|
@@ -7,7 +7,7 @@ namespace duckdb {
|
|
7
7
|
|
8
8
|
static void ReplaceFilterTableIndex(Expression &expr, LogicalSetOperation &setop) {
|
9
9
|
if (expr.type == ExpressionType::BOUND_COLUMN_REF) {
|
10
|
-
auto &colref = (
|
10
|
+
auto &colref = expr.Cast<BoundColumnRefExpression>();
|
11
11
|
D_ASSERT(colref.depth == 0);
|
12
12
|
|
13
13
|
colref.binding.table_index = setop.table_index;
|
@@ -27,8 +27,8 @@ unique_ptr<LogicalOperator> FilterPullup::PullupSetOperation(unique_ptr<LogicalO
|
|
27
27
|
op = PullupFromLeft(std::move(op));
|
28
28
|
}
|
29
29
|
if (op->type == LogicalOperatorType::LOGICAL_FILTER) {
|
30
|
-
auto &filter = (
|
31
|
-
auto &setop =
|
30
|
+
auto &filter = op->Cast<LogicalFilter>();
|
31
|
+
auto &setop = filter.children[0]->Cast<LogicalSetOperation>();
|
32
32
|
for (idx_t i = 0; i < filter.expressions.size(); ++i) {
|
33
33
|
ReplaceFilterTableIndex(*filter.expressions[i], setop);
|
34
34
|
}
|
@@ -11,7 +11,7 @@ using Filter = FilterPushdown::Filter;
|
|
11
11
|
|
12
12
|
static void ExtractFilterBindings(Expression &expr, vector<ColumnBinding> &bindings) {
|
13
13
|
if (expr.type == ExpressionType::BOUND_COLUMN_REF) {
|
14
|
-
auto &colref = (
|
14
|
+
auto &colref = expr.Cast<BoundColumnRefExpression>();
|
15
15
|
bindings.push_back(colref.binding);
|
16
16
|
}
|
17
17
|
ExpressionIterator::EnumerateChildren(expr, [&](Expression &child) { ExtractFilterBindings(child, bindings); });
|
@@ -19,7 +19,7 @@ static void ExtractFilterBindings(Expression &expr, vector<ColumnBinding> &bindi
|
|
19
19
|
|
20
20
|
static unique_ptr<Expression> ReplaceGroupBindings(LogicalAggregate &proj, unique_ptr<Expression> expr) {
|
21
21
|
if (expr->type == ExpressionType::BOUND_COLUMN_REF) {
|
22
|
-
auto &colref = (
|
22
|
+
auto &colref = expr->Cast<BoundColumnRefExpression>();
|
23
23
|
D_ASSERT(colref.binding.table_index == proj.group_index);
|
24
24
|
D_ASSERT(colref.binding.column_index < proj.groups.size());
|
25
25
|
D_ASSERT(colref.depth == 0);
|
@@ -33,7 +33,7 @@ static unique_ptr<Expression> ReplaceGroupBindings(LogicalAggregate &proj, uniqu
|
|
33
33
|
|
34
34
|
unique_ptr<LogicalOperator> FilterPushdown::PushdownAggregate(unique_ptr<LogicalOperator> op) {
|
35
35
|
D_ASSERT(op->type == LogicalOperatorType::LOGICAL_AGGREGATE_AND_GROUP_BY);
|
36
|
-
auto &aggr = (
|
36
|
+
auto &aggr = op->Cast<LogicalAggregate>();
|
37
37
|
|
38
38
|
// pushdown into AGGREGATE and GROUP BY
|
39
39
|
// we cannot push expressions that refer to the aggregate
|
@@ -8,7 +8,7 @@ using Filter = FilterPushdown::Filter;
|
|
8
8
|
|
9
9
|
unique_ptr<LogicalOperator> FilterPushdown::PushdownFilter(unique_ptr<LogicalOperator> op) {
|
10
10
|
D_ASSERT(op->type == LogicalOperatorType::LOGICAL_FILTER);
|
11
|
-
auto &filter = (
|
11
|
+
auto &filter = op->Cast<LogicalFilter>();
|
12
12
|
if (!filter.projection_map.empty()) {
|
13
13
|
return FinishPushdown(std::move(op));
|
14
14
|
}
|
@@ -10,7 +10,7 @@ namespace duckdb {
|
|
10
10
|
|
11
11
|
unique_ptr<LogicalOperator> FilterPushdown::PushdownGet(unique_ptr<LogicalOperator> op) {
|
12
12
|
D_ASSERT(op->type == LogicalOperatorType::LOGICAL_GET);
|
13
|
-
auto &get = (
|
13
|
+
auto &get = op->Cast<LogicalGet>();
|
14
14
|
|
15
15
|
if (get.function.pushdown_complex_filter || get.function.filter_pushdown) {
|
16
16
|
// this scan supports some form of filter push-down
|
@@ -11,14 +11,14 @@ using Filter = FilterPushdown::Filter;
|
|
11
11
|
unique_ptr<LogicalOperator> FilterPushdown::PushdownInnerJoin(unique_ptr<LogicalOperator> op,
|
12
12
|
unordered_set<idx_t> &left_bindings,
|
13
13
|
unordered_set<idx_t> &right_bindings) {
|
14
|
-
auto &join = (
|
14
|
+
auto &join = op->Cast<LogicalJoin>();
|
15
15
|
D_ASSERT(join.join_type == JoinType::INNER);
|
16
16
|
if (op->type == LogicalOperatorType::LOGICAL_DELIM_JOIN) {
|
17
17
|
return FinishPushdown(std::move(op));
|
18
18
|
}
|
19
19
|
// inner join: gather all the conditions of the inner join and add to the filter list
|
20
20
|
if (op->type == LogicalOperatorType::LOGICAL_ANY_JOIN) {
|
21
|
-
auto &any_join = (
|
21
|
+
auto &any_join = join.Cast<LogicalAnyJoin>();
|
22
22
|
// any join: only one filter to add
|
23
23
|
if (AddFilter(std::move(any_join.condition)) == FilterResult::UNSATISFIABLE) {
|
24
24
|
// filter statically evaluates to false, strip tree
|
@@ -30,7 +30,7 @@ unique_ptr<LogicalOperator> FilterPushdown::PushdownInnerJoin(unique_ptr<Logical
|
|
30
30
|
} else {
|
31
31
|
// comparison join
|
32
32
|
D_ASSERT(op->type == LogicalOperatorType::LOGICAL_COMPARISON_JOIN);
|
33
|
-
auto &comp_join = (
|
33
|
+
auto &comp_join = join.Cast<LogicalComparisonJoin>();
|
34
34
|
// turn the conditions into filters
|
35
35
|
for (auto &i : comp_join.conditions) {
|
36
36
|
auto condition = JoinCondition::CreateExpression(std::move(i));
|
@@ -14,7 +14,7 @@ using Filter = FilterPushdown::Filter;
|
|
14
14
|
|
15
15
|
static unique_ptr<Expression> ReplaceColRefWithNull(unique_ptr<Expression> expr, unordered_set<idx_t> &right_bindings) {
|
16
16
|
if (expr->type == ExpressionType::BOUND_COLUMN_REF) {
|
17
|
-
auto &bound_colref = (
|
17
|
+
auto &bound_colref = expr->Cast<BoundColumnRefExpression>();
|
18
18
|
if (right_bindings.find(bound_colref.binding.table_index) != right_bindings.end()) {
|
19
19
|
// bound colref belongs to RHS
|
20
20
|
// replace it with a constant NULL
|
@@ -60,7 +60,7 @@ static bool FilterRemovesNull(ClientContext &context, ExpressionRewriter &rewrit
|
|
60
60
|
unique_ptr<LogicalOperator> FilterPushdown::PushdownLeftJoin(unique_ptr<LogicalOperator> op,
|
61
61
|
unordered_set<idx_t> &left_bindings,
|
62
62
|
unordered_set<idx_t> &right_bindings) {
|
63
|
-
auto &join = (
|
63
|
+
auto &join = op->Cast<LogicalJoin>();
|
64
64
|
if (op->type == LogicalOperatorType::LOGICAL_DELIM_JOIN) {
|
65
65
|
return FinishPushdown(std::move(op));
|
66
66
|
}
|
@@ -72,7 +72,7 @@ unique_ptr<LogicalOperator> FilterPushdown::PushdownLeftJoin(unique_ptr<LogicalO
|
|
72
72
|
op->type == LogicalOperatorType::LOGICAL_ASOF_JOIN);
|
73
73
|
if (isComparison) {
|
74
74
|
// add all comparison conditions
|
75
|
-
auto &comparison_join = (
|
75
|
+
auto &comparison_join = op->Cast<LogicalComparisonJoin>();
|
76
76
|
for (auto &cond : comparison_join.conditions) {
|
77
77
|
filter_combiner.AddFilter(
|
78
78
|
make_uniq<BoundComparisonExpression>(cond.comparison, cond.left->Copy(), cond.right->Copy()));
|
@@ -7,7 +7,7 @@
|
|
7
7
|
namespace duckdb {
|
8
8
|
|
9
9
|
unique_ptr<LogicalOperator> FilterPushdown::PushdownLimit(unique_ptr<LogicalOperator> op) {
|
10
|
-
auto &limit = (
|
10
|
+
auto &limit = op->Cast<LogicalLimit>();
|
11
11
|
|
12
12
|
if (!limit.limit && limit.limit_val == 0) {
|
13
13
|
return make_uniq<LogicalEmptyResult>(std::move(op));
|
@@ -9,8 +9,8 @@ using Filter = FilterPushdown::Filter;
|
|
9
9
|
unique_ptr<LogicalOperator> FilterPushdown::PushdownMarkJoin(unique_ptr<LogicalOperator> op,
|
10
10
|
unordered_set<idx_t> &left_bindings,
|
11
11
|
unordered_set<idx_t> &right_bindings) {
|
12
|
-
auto &join = (
|
13
|
-
auto &comp_join = (
|
12
|
+
auto &join = op->Cast<LogicalJoin>();
|
13
|
+
auto &comp_join = op->Cast<LogicalComparisonJoin>();
|
14
14
|
D_ASSERT(join.join_type == JoinType::MARK);
|
15
15
|
D_ASSERT(op->type == LogicalOperatorType::LOGICAL_COMPARISON_JOIN ||
|
16
16
|
op->type == LogicalOperatorType::LOGICAL_DELIM_JOIN || op->type == LogicalOperatorType::LOGICAL_ASOF_JOIN);
|
@@ -50,7 +50,7 @@ unique_ptr<LogicalOperator> FilterPushdown::PushdownMarkJoin(unique_ptr<LogicalO
|
|
50
50
|
// the MARK join is always TRUE or FALSE, and never NULL this happens in the case of a correlated EXISTS
|
51
51
|
// clause
|
52
52
|
if (filters[i]->filter->type == ExpressionType::OPERATOR_NOT) {
|
53
|
-
auto &op_expr =
|
53
|
+
auto &op_expr = filters[i]->filter->Cast<BoundOperatorExpression>();
|
54
54
|
if (op_expr.children[0]->type == ExpressionType::BOUND_COLUMN_REF) {
|
55
55
|
// the filter is NOT(marker), check the join conditions
|
56
56
|
bool all_null_values_are_equal = true;
|
@@ -8,7 +8,7 @@ namespace duckdb {
|
|
8
8
|
|
9
9
|
static unique_ptr<Expression> ReplaceProjectionBindings(LogicalProjection &proj, unique_ptr<Expression> expr) {
|
10
10
|
if (expr->type == ExpressionType::BOUND_COLUMN_REF) {
|
11
|
-
auto &colref = (
|
11
|
+
auto &colref = expr->Cast<BoundColumnRefExpression>();
|
12
12
|
D_ASSERT(colref.binding.table_index == proj.table_index);
|
13
13
|
D_ASSERT(colref.binding.column_index < proj.expressions.size());
|
14
14
|
D_ASSERT(colref.depth == 0);
|
@@ -22,7 +22,7 @@ static unique_ptr<Expression> ReplaceProjectionBindings(LogicalProjection &proj,
|
|
22
22
|
|
23
23
|
unique_ptr<LogicalOperator> FilterPushdown::PushdownProjection(unique_ptr<LogicalOperator> op) {
|
24
24
|
D_ASSERT(op->type == LogicalOperatorType::LOGICAL_PROJECTION);
|
25
|
-
auto &proj = (
|
25
|
+
auto &proj = op->Cast<LogicalProjection>();
|
26
26
|
// push filter through logical projection
|
27
27
|
// all the BoundColumnRefExpressions in the filter should refer to the LogicalProjection
|
28
28
|
// we can rewrite them by replacing those references with the expression of the LogicalProjection node
|
@@ -14,7 +14,7 @@ using Filter = FilterPushdown::Filter;
|
|
14
14
|
static void ReplaceSetOpBindings(vector<ColumnBinding> &bindings, Filter &filter, Expression &expr,
|
15
15
|
LogicalSetOperation &setop) {
|
16
16
|
if (expr.type == ExpressionType::BOUND_COLUMN_REF) {
|
17
|
-
auto &colref = (
|
17
|
+
auto &colref = expr.Cast<BoundColumnRefExpression>();
|
18
18
|
D_ASSERT(colref.binding.table_index == setop.table_index);
|
19
19
|
D_ASSERT(colref.depth == 0);
|
20
20
|
|
@@ -30,7 +30,7 @@ static void ReplaceSetOpBindings(vector<ColumnBinding> &bindings, Filter &filter
|
|
30
30
|
unique_ptr<LogicalOperator> FilterPushdown::PushdownSetOperation(unique_ptr<LogicalOperator> op) {
|
31
31
|
D_ASSERT(op->type == LogicalOperatorType::LOGICAL_UNION || op->type == LogicalOperatorType::LOGICAL_EXCEPT ||
|
32
32
|
op->type == LogicalOperatorType::LOGICAL_INTERSECT);
|
33
|
-
auto &setop = (
|
33
|
+
auto &setop = op->Cast<LogicalSetOperation>();
|
34
34
|
|
35
35
|
D_ASSERT(op->children.size() == 2);
|
36
36
|
auto left_bindings = op->children[0]->GetColumnBindings();
|
@@ -75,7 +75,7 @@ unique_ptr<LogicalOperator> FilterPushdown::PushdownSetOperation(unique_ptr<Logi
|
|
75
75
|
case LogicalOperatorType::LOGICAL_UNION:
|
76
76
|
if (op->children[1]->type == LogicalOperatorType::LOGICAL_PROJECTION) {
|
77
77
|
// union with empty left side: return right child
|
78
|
-
auto &projection =
|
78
|
+
auto &projection = op->children[1]->Cast<LogicalProjection>();
|
79
79
|
projection.table_index = setop.table_index;
|
80
80
|
return std::move(op->children[1]);
|
81
81
|
}
|
@@ -95,7 +95,7 @@ unique_ptr<LogicalOperator> FilterPushdown::PushdownSetOperation(unique_ptr<Logi
|
|
95
95
|
case LogicalOperatorType::LOGICAL_EXCEPT:
|
96
96
|
if (op->children[0]->type == LogicalOperatorType::LOGICAL_PROJECTION) {
|
97
97
|
// union or except with empty right child: return left child
|
98
|
-
auto &projection =
|
98
|
+
auto &projection = op->children[0]->Cast<LogicalProjection>();
|
99
99
|
projection.table_index = setop.table_index;
|
100
100
|
return std::move(op->children[0]);
|
101
101
|
}
|
@@ -8,7 +8,7 @@ using Filter = FilterPushdown::Filter;
|
|
8
8
|
unique_ptr<LogicalOperator> FilterPushdown::PushdownSingleJoin(unique_ptr<LogicalOperator> op,
|
9
9
|
unordered_set<idx_t> &left_bindings,
|
10
10
|
unordered_set<idx_t> &right_bindings) {
|
11
|
-
D_ASSERT((
|
11
|
+
D_ASSERT(op->Cast<LogicalJoin>().join_type == JoinType::SINGLE);
|
12
12
|
FilterPushdown left_pushdown(optimizer), right_pushdown(optimizer);
|
13
13
|
// now check the set of filters
|
14
14
|
for (idx_t i = 0; i < filters.size(); i++) {
|
@@ -29,11 +29,11 @@ unique_ptr<LogicalOperator> RegexRangeFilter::Rewrite(unique_ptr<LogicalOperator
|
|
29
29
|
|
30
30
|
for (auto &expr : op->expressions) {
|
31
31
|
if (expr->type == ExpressionType::BOUND_FUNCTION) {
|
32
|
-
auto &func =
|
32
|
+
auto &func = expr->Cast<BoundFunctionExpression>();
|
33
33
|
if (func.function.name != "regexp_full_match" || func.children.size() != 2) {
|
34
34
|
continue;
|
35
35
|
}
|
36
|
-
auto &info =
|
36
|
+
auto &info = func.bind_info->Cast<RegexpMatchesBindData>();
|
37
37
|
if (!info.range_success) {
|
38
38
|
continue;
|
39
39
|
}
|
@@ -54,7 +54,7 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) {
|
|
54
54
|
// aggregate
|
55
55
|
if (!everything_referenced) {
|
56
56
|
// FIXME: groups that are not referenced need to stay -> but they don't need to be scanned and output!
|
57
|
-
auto &aggr = (
|
57
|
+
auto &aggr = op.Cast<LogicalAggregate>();
|
58
58
|
ClearUnusedExpressions(aggr.expressions, aggr.aggregate_index);
|
59
59
|
if (aggr.expressions.empty() && aggr.groups.empty()) {
|
60
60
|
// removed all expressions from the aggregate: push a COUNT(*)
|
@@ -75,7 +75,7 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) {
|
|
75
75
|
case LogicalOperatorType::LOGICAL_DELIM_JOIN:
|
76
76
|
case LogicalOperatorType::LOGICAL_COMPARISON_JOIN: {
|
77
77
|
if (!everything_referenced) {
|
78
|
-
auto &comp_join = (
|
78
|
+
auto &comp_join = op.Cast<LogicalComparisonJoin>();
|
79
79
|
|
80
80
|
if (comp_join.join_type != JoinType::INNER) {
|
81
81
|
break;
|
@@ -89,8 +89,8 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) {
|
|
89
89
|
cond.right->expression_class == ExpressionClass::BOUND_COLUMN_REF) {
|
90
90
|
// comparison join between two bound column refs
|
91
91
|
// we can replace any reference to the RHS (build-side) with a reference to the LHS (probe-side)
|
92
|
-
auto &lhs_col =
|
93
|
-
auto &rhs_col =
|
92
|
+
auto &lhs_col = cond.left->Cast<BoundColumnRefExpression>();
|
93
|
+
auto &rhs_col = cond.right->Cast<BoundColumnRefExpression>();
|
94
94
|
// if there are any columns that refer to the RHS,
|
95
95
|
auto colrefs = column_references.find(rhs_col.binding);
|
96
96
|
if (colrefs != column_references.end()) {
|
@@ -113,7 +113,7 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) {
|
|
113
113
|
// for UNION we can remove unreferenced columns as long as everything_referenced is false (i.e. we
|
114
114
|
// encounter a UNION node that is not preceded by a DISTINCT)
|
115
115
|
// this happens when UNION ALL is used
|
116
|
-
auto &setop = (
|
116
|
+
auto &setop = op.Cast<LogicalSetOperation>();
|
117
117
|
vector<idx_t> entries;
|
118
118
|
for (idx_t i = 0; i < setop.column_count; i++) {
|
119
119
|
entries.push_back(i);
|
@@ -166,7 +166,7 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) {
|
|
166
166
|
return;
|
167
167
|
case LogicalOperatorType::LOGICAL_ORDER_BY:
|
168
168
|
if (!everything_referenced) {
|
169
|
-
auto &order = (
|
169
|
+
auto &order = op.Cast<LogicalOrder>();
|
170
170
|
D_ASSERT(order.projections.empty()); // should not yet be set
|
171
171
|
const auto all_bindings = order.GetColumnBindings();
|
172
172
|
|
@@ -183,7 +183,7 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) {
|
|
183
183
|
return;
|
184
184
|
case LogicalOperatorType::LOGICAL_PROJECTION: {
|
185
185
|
if (!everything_referenced) {
|
186
|
-
auto &proj = (
|
186
|
+
auto &proj = op.Cast<LogicalProjection>();
|
187
187
|
ClearUnusedExpressions(proj.expressions, proj.table_index);
|
188
188
|
|
189
189
|
if (proj.expressions.empty()) {
|
@@ -215,7 +215,7 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) {
|
|
215
215
|
case LogicalOperatorType::LOGICAL_GET:
|
216
216
|
LogicalOperatorVisitor::VisitOperatorExpressions(op);
|
217
217
|
if (!everything_referenced) {
|
218
|
-
auto &get = (
|
218
|
+
auto &get = op.Cast<LogicalGet>();
|
219
219
|
if (!get.function.projection_pushdown) {
|
220
220
|
return;
|
221
221
|
}
|
@@ -283,7 +283,7 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) {
|
|
283
283
|
}
|
284
284
|
return;
|
285
285
|
case LogicalOperatorType::LOGICAL_FILTER: {
|
286
|
-
auto &filter = (
|
286
|
+
auto &filter = op.Cast<LogicalFilter>();
|
287
287
|
if (!filter.projection_map.empty()) {
|
288
288
|
// if we have any entries in the filter projection map don't prune any columns
|
289
289
|
// FIXME: we can do something more clever here
|
@@ -306,6 +306,10 @@ void RemoveUnusedColumns::VisitOperator(LogicalOperator &op) {
|
|
306
306
|
everything_referenced = true;
|
307
307
|
break;
|
308
308
|
}
|
309
|
+
case LogicalOperatorType::LOGICAL_PIVOT: {
|
310
|
+
everything_referenced = true;
|
311
|
+
break;
|
312
|
+
}
|
309
313
|
default:
|
310
314
|
break;
|
311
315
|
}
|
@@ -24,46 +24,46 @@ ArithmeticSimplificationRule::ArithmeticSimplificationRule(ExpressionRewriter &r
|
|
24
24
|
|
25
25
|
unique_ptr<Expression> ArithmeticSimplificationRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
26
26
|
bool &changes_made, bool is_root) {
|
27
|
-
auto root =
|
28
|
-
auto constant =
|
29
|
-
int constant_child = root
|
30
|
-
D_ASSERT(root
|
27
|
+
auto &root = bindings[0]->Cast<BoundFunctionExpression>();
|
28
|
+
auto &constant = bindings[1]->Cast<BoundConstantExpression>();
|
29
|
+
int constant_child = root.children[0].get() == &constant ? 0 : 1;
|
30
|
+
D_ASSERT(root.children.size() == 2);
|
31
31
|
(void)root;
|
32
32
|
// any arithmetic operator involving NULL is always NULL
|
33
|
-
if (constant
|
34
|
-
return make_uniq<BoundConstantExpression>(Value(root
|
33
|
+
if (constant.value.IsNull()) {
|
34
|
+
return make_uniq<BoundConstantExpression>(Value(root.return_type));
|
35
35
|
}
|
36
|
-
auto &func_name = root
|
36
|
+
auto &func_name = root.function.name;
|
37
37
|
if (func_name == "+") {
|
38
|
-
if (constant
|
38
|
+
if (constant.value == 0) {
|
39
39
|
// addition with 0
|
40
40
|
// we can remove the entire operator and replace it with the non-constant child
|
41
|
-
return std::move(root
|
41
|
+
return std::move(root.children[1 - constant_child]);
|
42
42
|
}
|
43
43
|
} else if (func_name == "-") {
|
44
|
-
if (constant_child == 1 && constant
|
44
|
+
if (constant_child == 1 && constant.value == 0) {
|
45
45
|
// subtraction by 0
|
46
46
|
// we can remove the entire operator and replace it with the non-constant child
|
47
|
-
return std::move(root
|
47
|
+
return std::move(root.children[1 - constant_child]);
|
48
48
|
}
|
49
49
|
} else if (func_name == "*") {
|
50
|
-
if (constant
|
50
|
+
if (constant.value == 1) {
|
51
51
|
// multiply with 1, replace with non-constant child
|
52
|
-
return std::move(root
|
53
|
-
} else if (constant
|
52
|
+
return std::move(root.children[1 - constant_child]);
|
53
|
+
} else if (constant.value == 0) {
|
54
54
|
// multiply by zero: replace with constant or null
|
55
|
-
return ExpressionRewriter::ConstantOrNull(std::move(root
|
56
|
-
Value::Numeric(root
|
55
|
+
return ExpressionRewriter::ConstantOrNull(std::move(root.children[1 - constant_child]),
|
56
|
+
Value::Numeric(root.return_type, 0));
|
57
57
|
}
|
58
58
|
} else {
|
59
59
|
D_ASSERT(func_name == "/");
|
60
60
|
if (constant_child == 1) {
|
61
|
-
if (constant
|
61
|
+
if (constant.value == 1) {
|
62
62
|
// divide by 1, replace with non-constant child
|
63
|
-
return std::move(root
|
64
|
-
} else if (constant
|
63
|
+
return std::move(root.children[1 - constant_child]);
|
64
|
+
} else if (constant.value == 0) {
|
65
65
|
// divide by 0, replace with NULL
|
66
|
-
return make_uniq<BoundConstantExpression>(Value(root
|
66
|
+
return make_uniq<BoundConstantExpression>(Value(root.return_type));
|
67
67
|
}
|
68
68
|
}
|
69
69
|
}
|