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
@@ -13,9 +13,9 @@ CaseSimplificationRule::CaseSimplificationRule(ExpressionRewriter &rewriter) : R
|
|
13
13
|
|
14
14
|
unique_ptr<Expression> CaseSimplificationRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
15
15
|
bool &changes_made, bool is_root) {
|
16
|
-
auto root =
|
17
|
-
for (idx_t i = 0; i < root
|
18
|
-
auto &case_check = root
|
16
|
+
auto &root = bindings[0]->Cast<BoundCaseExpression>();
|
17
|
+
for (idx_t i = 0; i < root.case_checks.size(); i++) {
|
18
|
+
auto &case_check = root.case_checks[i];
|
19
19
|
if (case_check.when_expr->IsFoldable()) {
|
20
20
|
// the WHEN check is a foldable expression
|
21
21
|
// use an ExpressionExecutor to execute the expression
|
@@ -25,21 +25,21 @@ unique_ptr<Expression> CaseSimplificationRule::Apply(LogicalOperator &op, vector
|
|
25
25
|
auto condition = constant_value.DefaultCastAs(LogicalType::BOOLEAN);
|
26
26
|
if (condition.IsNull() || !BooleanValue::Get(condition)) {
|
27
27
|
// the condition is always false: remove this case check
|
28
|
-
root
|
28
|
+
root.case_checks.erase(root.case_checks.begin() + i);
|
29
29
|
i--;
|
30
30
|
} else {
|
31
31
|
// the condition is always true
|
32
32
|
// move the THEN clause to the ELSE of the case
|
33
|
-
root
|
33
|
+
root.else_expr = std::move(case_check.then_expr);
|
34
34
|
// remove this case check and any case checks after this one
|
35
|
-
root
|
35
|
+
root.case_checks.erase(root.case_checks.begin() + i, root.case_checks.end());
|
36
36
|
break;
|
37
37
|
}
|
38
38
|
}
|
39
39
|
}
|
40
|
-
if (root
|
40
|
+
if (root.case_checks.empty()) {
|
41
41
|
// no case checks left: return the ELSE expression
|
42
|
-
return std::move(root
|
42
|
+
return std::move(root.else_expr);
|
43
43
|
}
|
44
44
|
return nullptr;
|
45
45
|
}
|
@@ -17,10 +17,10 @@ ComparisonSimplificationRule::ComparisonSimplificationRule(ExpressionRewriter &r
|
|
17
17
|
unique_ptr<Expression> ComparisonSimplificationRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
18
18
|
bool &changes_made, bool is_root) {
|
19
19
|
D_ASSERT(bindings[0]->expression_class == ExpressionClass::BOUND_COMPARISON);
|
20
|
-
auto expr =
|
20
|
+
auto &expr = bindings[0]->Cast<BoundComparisonExpression>();
|
21
21
|
auto constant_expr = bindings[1];
|
22
|
-
bool column_ref_left = expr
|
23
|
-
auto column_ref_expr = !column_ref_left ? expr
|
22
|
+
bool column_ref_left = expr.left.get() != constant_expr;
|
23
|
+
auto column_ref_expr = !column_ref_left ? expr.right.get() : expr.left.get();
|
24
24
|
// the constant_expr is a scalar expression that we have to fold
|
25
25
|
// use an ExpressionExecutor to execute the expression
|
26
26
|
D_ASSERT(constant_expr->IsFoldable());
|
@@ -28,8 +28,8 @@ unique_ptr<Expression> ComparisonSimplificationRule::Apply(LogicalOperator &op,
|
|
28
28
|
if (!ExpressionExecutor::TryEvaluateScalar(GetContext(), *constant_expr, constant_value)) {
|
29
29
|
return nullptr;
|
30
30
|
}
|
31
|
-
if (constant_value.IsNull() && !(expr
|
32
|
-
expr
|
31
|
+
if (constant_value.IsNull() && !(expr.type == ExpressionType::COMPARE_NOT_DISTINCT_FROM ||
|
32
|
+
expr.type == ExpressionType::COMPARE_DISTINCT_FROM)) {
|
33
33
|
// comparison with constant NULL, return NULL
|
34
34
|
return make_uniq<BoundConstantExpression>(Value(LogicalType::BOOLEAN));
|
35
35
|
}
|
@@ -37,9 +37,9 @@ unique_ptr<Expression> ComparisonSimplificationRule::Apply(LogicalOperator &op,
|
|
37
37
|
//! Here we check if we can apply the expression on the constant side
|
38
38
|
//! We can do this if the cast itself is invertible and casting the constant is
|
39
39
|
//! invertible in practice.
|
40
|
-
auto cast_expression = (
|
41
|
-
auto target_type = cast_expression
|
42
|
-
if (!BoundCastExpression::CastIsInvertible(target_type, cast_expression
|
40
|
+
auto &cast_expression = column_ref_expr->Cast<BoundCastExpression>();
|
41
|
+
auto target_type = cast_expression.source_type();
|
42
|
+
if (!BoundCastExpression::CastIsInvertible(target_type, cast_expression.return_type)) {
|
43
43
|
return nullptr;
|
44
44
|
}
|
45
45
|
|
@@ -53,7 +53,7 @@ unique_ptr<Expression> ComparisonSimplificationRule::Apply(LogicalOperator &op,
|
|
53
53
|
|
54
54
|
// Is the constant cast invertible?
|
55
55
|
if (!cast_constant.IsNull() &&
|
56
|
-
!BoundCastExpression::CastIsInvertible(cast_expression
|
56
|
+
!BoundCastExpression::CastIsInvertible(cast_expression.return_type, target_type)) {
|
57
57
|
// Is it actually invertible?
|
58
58
|
Value uncast_constant;
|
59
59
|
if (!cast_constant.DefaultTryCastAs(constant_value.type(), uncast_constant, &error_message, true) ||
|
@@ -63,14 +63,14 @@ unique_ptr<Expression> ComparisonSimplificationRule::Apply(LogicalOperator &op,
|
|
63
63
|
}
|
64
64
|
|
65
65
|
//! We can cast, now we change our column_ref_expression from an operator cast to a column reference
|
66
|
-
auto child_expression = std::move(cast_expression
|
66
|
+
auto child_expression = std::move(cast_expression.child);
|
67
67
|
auto new_constant_expr = make_uniq<BoundConstantExpression>(cast_constant);
|
68
68
|
if (column_ref_left) {
|
69
|
-
expr
|
70
|
-
expr
|
69
|
+
expr.left = std::move(child_expression);
|
70
|
+
expr.right = std::move(new_constant_expr);
|
71
71
|
} else {
|
72
|
-
expr
|
73
|
-
expr
|
72
|
+
expr.left = std::move(new_constant_expr);
|
73
|
+
expr.right = std::move(child_expression);
|
74
74
|
}
|
75
75
|
}
|
76
76
|
return nullptr;
|
@@ -32,7 +32,7 @@ unique_ptr<Expression> ConjunctionSimplificationRule::RemoveExpression(BoundConj
|
|
32
32
|
|
33
33
|
unique_ptr<Expression> ConjunctionSimplificationRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
34
34
|
bool &changes_made, bool is_root) {
|
35
|
-
auto conjunction =
|
35
|
+
auto &conjunction = bindings[0]->Cast<BoundConjunctionExpression>();
|
36
36
|
auto constant_expr = bindings[1];
|
37
37
|
// the constant_expr is a scalar expression that we have to fold
|
38
38
|
// use an ExpressionExecutor to execute the expression
|
@@ -46,19 +46,19 @@ unique_ptr<Expression> ConjunctionSimplificationRule::Apply(LogicalOperator &op,
|
|
46
46
|
// we can't simplify conjunctions with a constant NULL
|
47
47
|
return nullptr;
|
48
48
|
}
|
49
|
-
if (conjunction
|
49
|
+
if (conjunction.type == ExpressionType::CONJUNCTION_AND) {
|
50
50
|
if (!BooleanValue::Get(constant_value)) {
|
51
51
|
// FALSE in AND, result of expression is false
|
52
52
|
return make_uniq<BoundConstantExpression>(Value::BOOLEAN(false));
|
53
53
|
} else {
|
54
54
|
// TRUE in AND, remove the expression from the set
|
55
|
-
return RemoveExpression(
|
55
|
+
return RemoveExpression(conjunction, constant_expr);
|
56
56
|
}
|
57
57
|
} else {
|
58
|
-
D_ASSERT(conjunction
|
58
|
+
D_ASSERT(conjunction.type == ExpressionType::CONJUNCTION_OR);
|
59
59
|
if (!BooleanValue::Get(constant_value)) {
|
60
60
|
// FALSE in OR, remove the expression from the set
|
61
|
-
return RemoveExpression(
|
61
|
+
return RemoveExpression(conjunction, constant_expr);
|
62
62
|
} else {
|
63
63
|
// TRUE in OR, result of expression is true
|
64
64
|
return make_uniq<BoundConstantExpression>(Value::BOOLEAN(true));
|
@@ -22,8 +22,8 @@ DatePartSimplificationRule::DatePartSimplificationRule(ExpressionRewriter &rewri
|
|
22
22
|
|
23
23
|
unique_ptr<Expression> DatePartSimplificationRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
24
24
|
bool &changes_made, bool is_root) {
|
25
|
-
auto &date_part =
|
26
|
-
auto &constant_expr =
|
25
|
+
auto &date_part = bindings[0]->Cast<BoundFunctionExpression>();
|
26
|
+
auto &constant_expr = bindings[1]->Cast<BoundConstantExpression>();
|
27
27
|
auto &constant = constant_expr.value;
|
28
28
|
|
29
29
|
if (constant.IsNull()) {
|
@@ -16,7 +16,7 @@ DistributivityRule::DistributivityRule(ExpressionRewriter &rewriter) : Rule(rewr
|
|
16
16
|
|
17
17
|
void DistributivityRule::AddExpressionSet(Expression &expr, expression_set_t &set) {
|
18
18
|
if (expr.type == ExpressionType::CONJUNCTION_AND) {
|
19
|
-
auto &and_expr = (
|
19
|
+
auto &and_expr = expr.Cast<BoundConjunctionExpression>();
|
20
20
|
for (auto &child : and_expr.children) {
|
21
21
|
set.insert(child.get());
|
22
22
|
}
|
@@ -31,7 +31,7 @@ unique_ptr<Expression> DistributivityRule::ExtractExpression(BoundConjunctionExp
|
|
31
31
|
unique_ptr<Expression> result;
|
32
32
|
if (child->type == ExpressionType::CONJUNCTION_AND) {
|
33
33
|
// AND, remove expression from the list
|
34
|
-
auto &and_expr = (
|
34
|
+
auto &and_expr = child->Cast<BoundConjunctionExpression>();
|
35
35
|
for (idx_t i = 0; i < and_expr.children.size(); i++) {
|
36
36
|
if (Expression::Equals(and_expr.children[i].get(), &expr)) {
|
37
37
|
result = std::move(and_expr.children[i]);
|
@@ -55,20 +55,20 @@ unique_ptr<Expression> DistributivityRule::ExtractExpression(BoundConjunctionExp
|
|
55
55
|
|
56
56
|
unique_ptr<Expression> DistributivityRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
57
57
|
bool &changes_made, bool is_root) {
|
58
|
-
auto initial_or =
|
58
|
+
auto &initial_or = bindings[0]->Cast<BoundConjunctionExpression>();
|
59
59
|
|
60
60
|
// we want to find expressions that occur in each of the children of the OR
|
61
61
|
// i.e. (X AND A) OR (X AND B) => X occurs in all branches
|
62
62
|
// first, for the initial child, we create an expression set of which expressions occur
|
63
63
|
// this is our initial candidate set (in the example: [X, A])
|
64
64
|
expression_set_t candidate_set;
|
65
|
-
AddExpressionSet(*initial_or
|
65
|
+
AddExpressionSet(*initial_or.children[0], candidate_set);
|
66
66
|
// now for each of the remaining children, we create a set again and intersect them
|
67
67
|
// in our example: the second set would be [X, B]
|
68
68
|
// the intersection would leave [X]
|
69
|
-
for (idx_t i = 1; i < initial_or
|
69
|
+
for (idx_t i = 1; i < initial_or.children.size(); i++) {
|
70
70
|
expression_set_t next_set;
|
71
|
-
AddExpressionSet(*initial_or
|
71
|
+
AddExpressionSet(*initial_or.children[i], next_set);
|
72
72
|
expression_set_t intersect_result;
|
73
73
|
for (auto &expr : candidate_set) {
|
74
74
|
if (next_set.find(expr) != next_set.end()) {
|
@@ -85,13 +85,13 @@ unique_ptr<Expression> DistributivityRule::Apply(LogicalOperator &op, vector<Exp
|
|
85
85
|
// the OR
|
86
86
|
auto new_root = make_uniq<BoundConjunctionExpression>(ExpressionType::CONJUNCTION_AND);
|
87
87
|
for (auto &expr : candidate_set) {
|
88
|
-
D_ASSERT(initial_or
|
88
|
+
D_ASSERT(initial_or.children.size() > 0);
|
89
89
|
|
90
90
|
// extract the expression from the first child of the OR
|
91
|
-
auto result = ExtractExpression(
|
91
|
+
auto result = ExtractExpression(initial_or, 0, (Expression &)*expr);
|
92
92
|
// now for the subsequent expressions, simply remove the expression
|
93
|
-
for (idx_t i = 1; i < initial_or
|
94
|
-
ExtractExpression(
|
93
|
+
for (idx_t i = 1; i < initial_or.children.size(); i++) {
|
94
|
+
ExtractExpression(initial_or, i, *result);
|
95
95
|
}
|
96
96
|
// now we add the expression to the new root
|
97
97
|
new_root->children.push_back(std::move(result));
|
@@ -104,8 +104,8 @@ unique_ptr<Expression> DistributivityRule::Apply(LogicalOperator &op, vector<Exp
|
|
104
104
|
// X OR (X AND A) is the same as "X"
|
105
105
|
// since (1) only tuples that do not qualify "X" will not pass this predicate
|
106
106
|
// and (2) all tuples that qualify "X" will pass this predicate
|
107
|
-
for (idx_t i = 0; i < initial_or
|
108
|
-
if (!initial_or
|
107
|
+
for (idx_t i = 0; i < initial_or.children.size(); i++) {
|
108
|
+
if (!initial_or.children[i]) {
|
109
109
|
if (new_root->children.size() <= 1) {
|
110
110
|
return std::move(new_root->children[0]);
|
111
111
|
} else {
|
@@ -114,13 +114,13 @@ unique_ptr<Expression> DistributivityRule::Apply(LogicalOperator &op, vector<Exp
|
|
114
114
|
}
|
115
115
|
}
|
116
116
|
// finally we need to add the remaining expressions in the OR to the new root
|
117
|
-
if (initial_or
|
117
|
+
if (initial_or.children.size() == 1) {
|
118
118
|
// one child: skip the OR entirely and only add the single child
|
119
|
-
new_root->children.push_back(std::move(initial_or
|
120
|
-
} else if (initial_or
|
119
|
+
new_root->children.push_back(std::move(initial_or.children[0]));
|
120
|
+
} else if (initial_or.children.size() > 1) {
|
121
121
|
// multiple children still remain: push them into a new OR and add that to the new root
|
122
122
|
auto new_or = make_uniq<BoundConjunctionExpression>(ExpressionType::CONJUNCTION_OR);
|
123
|
-
for (auto &child : initial_or
|
123
|
+
for (auto &child : initial_or.children) {
|
124
124
|
new_or->children.push_back(std::move(child));
|
125
125
|
}
|
126
126
|
new_root->children.push_back(std::move(new_or));
|
@@ -23,16 +23,15 @@ EmptyNeedleRemovalRule::EmptyNeedleRemovalRule(ExpressionRewriter &rewriter) : R
|
|
23
23
|
|
24
24
|
unique_ptr<Expression> EmptyNeedleRemovalRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
25
25
|
bool &changes_made, bool is_root) {
|
26
|
-
auto root =
|
27
|
-
D_ASSERT(root
|
28
|
-
(void)root;
|
26
|
+
auto &root = bindings[0]->Cast<BoundFunctionExpression>();
|
27
|
+
D_ASSERT(root.children.size() == 2);
|
29
28
|
auto prefix_expr = bindings[2];
|
30
29
|
|
31
30
|
// the constant_expr is a scalar expression that we have to fold
|
32
31
|
if (!prefix_expr->IsFoldable()) {
|
33
32
|
return nullptr;
|
34
33
|
}
|
35
|
-
D_ASSERT(root
|
34
|
+
D_ASSERT(root.return_type.id() == LogicalTypeId::BOOLEAN);
|
36
35
|
|
37
36
|
auto prefix_value = ExpressionExecutor::EvaluateScalar(GetContext(), *prefix_expr);
|
38
37
|
|
@@ -47,7 +46,7 @@ unique_ptr<Expression> EmptyNeedleRemovalRule::Apply(LogicalOperator &op, vector
|
|
47
46
|
// PREFIX(NULL, '') is NULL
|
48
47
|
// so rewrite PREFIX(x, '') to TRUE_OR_NULL(x)
|
49
48
|
if (needle_string.empty()) {
|
50
|
-
return ExpressionRewriter::ConstantOrNull(std::move(root
|
49
|
+
return ExpressionRewriter::ConstantOrNull(std::move(root.children[0]), Value::BOOLEAN(true));
|
51
50
|
}
|
52
51
|
return nullptr;
|
53
52
|
}
|
@@ -47,14 +47,14 @@ bool AreMatchesPossible(LogicalType &left, LogicalType &right) {
|
|
47
47
|
unique_ptr<Expression> EnumComparisonRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
48
48
|
bool &changes_made, bool is_root) {
|
49
49
|
|
50
|
-
auto root =
|
51
|
-
auto left_child =
|
52
|
-
auto right_child =
|
50
|
+
auto &root = bindings[0]->Cast<BoundComparisonExpression>();
|
51
|
+
auto &left_child = bindings[1]->Cast<BoundCastExpression>();
|
52
|
+
auto &right_child = bindings[3]->Cast<BoundCastExpression>();
|
53
53
|
|
54
|
-
if (!AreMatchesPossible(left_child
|
54
|
+
if (!AreMatchesPossible(left_child.child->return_type, right_child.child->return_type)) {
|
55
55
|
vector<unique_ptr<Expression>> children;
|
56
|
-
children.push_back(std::move(root
|
57
|
-
children.push_back(std::move(root
|
56
|
+
children.push_back(std::move(root.left));
|
57
|
+
children.push_back(std::move(root.right));
|
58
58
|
return ExpressionRewriter::ConstantOrNull(std::move(children), Value::BOOLEAN(false));
|
59
59
|
}
|
60
60
|
|
@@ -63,9 +63,8 @@ unique_ptr<Expression> EnumComparisonRule::Apply(LogicalOperator &op, vector<Exp
|
|
63
63
|
}
|
64
64
|
|
65
65
|
auto cast_left_to_right =
|
66
|
-
BoundCastExpression::AddDefaultCastToType(std::move(left_child
|
67
|
-
return make_uniq<BoundComparisonExpression>(root
|
68
|
-
std::move(right_child->child));
|
66
|
+
BoundCastExpression::AddDefaultCastToType(std::move(left_child.child), right_child.child->return_type, true);
|
67
|
+
return make_uniq<BoundComparisonExpression>(root.type, std::move(cast_left_to_right), std::move(right_child.child));
|
69
68
|
}
|
70
69
|
|
71
70
|
} // namespace duckdb
|
@@ -15,27 +15,27 @@ InClauseSimplificationRule::InClauseSimplificationRule(ExpressionRewriter &rewri
|
|
15
15
|
unique_ptr<Expression> InClauseSimplificationRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
16
16
|
bool &changes_made, bool is_root) {
|
17
17
|
D_ASSERT(bindings[0]->expression_class == ExpressionClass::BOUND_OPERATOR);
|
18
|
-
auto expr =
|
19
|
-
if (expr
|
18
|
+
auto &expr = bindings[0]->Cast<BoundOperatorExpression>();
|
19
|
+
if (expr.children[0]->expression_class != ExpressionClass::BOUND_CAST) {
|
20
20
|
return nullptr;
|
21
21
|
}
|
22
|
-
auto cast_expression =
|
23
|
-
if (cast_expression
|
22
|
+
auto &cast_expression = expr.children[0]->Cast<BoundCastExpression>();
|
23
|
+
if (cast_expression.child->expression_class != ExpressionClass::BOUND_COLUMN_REF) {
|
24
24
|
return nullptr;
|
25
25
|
}
|
26
26
|
//! Here we check if we can apply the expression on the constant side
|
27
|
-
auto target_type = cast_expression
|
28
|
-
if (!BoundCastExpression::CastIsInvertible(cast_expression
|
27
|
+
auto target_type = cast_expression.source_type();
|
28
|
+
if (!BoundCastExpression::CastIsInvertible(cast_expression.return_type, target_type)) {
|
29
29
|
return nullptr;
|
30
30
|
}
|
31
31
|
vector<unique_ptr<BoundConstantExpression>> cast_list;
|
32
32
|
//! First check if we can cast all children
|
33
|
-
for (size_t i = 1; i < expr
|
34
|
-
if (expr
|
33
|
+
for (size_t i = 1; i < expr.children.size(); i++) {
|
34
|
+
if (expr.children[i]->expression_class != ExpressionClass::BOUND_CONSTANT) {
|
35
35
|
return nullptr;
|
36
36
|
}
|
37
|
-
D_ASSERT(expr
|
38
|
-
auto constant_value = ExpressionExecutor::EvaluateScalar(GetContext(), *expr
|
37
|
+
D_ASSERT(expr.children[i]->IsFoldable());
|
38
|
+
auto constant_value = ExpressionExecutor::EvaluateScalar(GetContext(), *expr.children[i]);
|
39
39
|
auto new_constant = constant_value.DefaultTryCastAs(target_type);
|
40
40
|
if (!new_constant) {
|
41
41
|
return nullptr;
|
@@ -45,13 +45,13 @@ unique_ptr<Expression> InClauseSimplificationRule::Apply(LogicalOperator &op, ve
|
|
45
45
|
}
|
46
46
|
}
|
47
47
|
//! We can cast, so we move the new constant
|
48
|
-
for (size_t i = 1; i < expr
|
49
|
-
expr
|
48
|
+
for (size_t i = 1; i < expr.children.size(); i++) {
|
49
|
+
expr.children[i] = std::move(cast_list[i - 1]);
|
50
50
|
|
51
51
|
// expr->children[i] = std::move(new_constant_expr);
|
52
52
|
}
|
53
53
|
//! We can cast the full list, so we move the column
|
54
|
-
expr
|
54
|
+
expr.children[0] = std::move(cast_expression.child);
|
55
55
|
return nullptr;
|
56
56
|
}
|
57
57
|
|
@@ -101,29 +101,29 @@ static bool PatternIsContains(const string &pattern) {
|
|
101
101
|
|
102
102
|
unique_ptr<Expression> LikeOptimizationRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
103
103
|
bool &changes_made, bool is_root) {
|
104
|
-
auto root =
|
105
|
-
auto constant_expr =
|
106
|
-
D_ASSERT(root
|
104
|
+
auto &root = bindings[0]->Cast<BoundFunctionExpression>();
|
105
|
+
auto &constant_expr = bindings[2]->Cast<BoundConstantExpression>();
|
106
|
+
D_ASSERT(root.children.size() == 2);
|
107
107
|
|
108
|
-
if (constant_expr
|
109
|
-
return make_uniq<BoundConstantExpression>(Value(root
|
108
|
+
if (constant_expr.value.IsNull()) {
|
109
|
+
return make_uniq<BoundConstantExpression>(Value(root.return_type));
|
110
110
|
}
|
111
111
|
|
112
112
|
// the constant_expr is a scalar expression that we have to fold
|
113
|
-
if (!constant_expr
|
113
|
+
if (!constant_expr.IsFoldable()) {
|
114
114
|
return nullptr;
|
115
115
|
}
|
116
116
|
|
117
|
-
auto constant_value = ExpressionExecutor::EvaluateScalar(GetContext(),
|
118
|
-
D_ASSERT(constant_value.type() == constant_expr
|
117
|
+
auto constant_value = ExpressionExecutor::EvaluateScalar(GetContext(), constant_expr);
|
118
|
+
D_ASSERT(constant_value.type() == constant_expr.return_type);
|
119
119
|
auto &patt_str = StringValue::Get(constant_value);
|
120
120
|
|
121
|
-
bool is_not_like = root
|
121
|
+
bool is_not_like = root.function.name == "!~~";
|
122
122
|
if (PatternIsConstant(patt_str)) {
|
123
123
|
// Pattern is constant
|
124
124
|
return make_uniq<BoundComparisonExpression>(is_not_like ? ExpressionType::COMPARE_NOTEQUAL
|
125
125
|
: ExpressionType::COMPARE_EQUAL,
|
126
|
-
std::move(root
|
126
|
+
std::move(root.children[0]), std::move(root.children[1]));
|
127
127
|
} else if (PatternIsPrefix(patt_str)) {
|
128
128
|
// Prefix LIKE pattern : [^%_]*[%]+, ignoring underscore
|
129
129
|
return ApplyRule(root, PrefixFun::GetFunction(), patt_str, is_not_like);
|
@@ -137,12 +137,12 @@ unique_ptr<Expression> LikeOptimizationRule::Apply(LogicalOperator &op, vector<E
|
|
137
137
|
return nullptr;
|
138
138
|
}
|
139
139
|
|
140
|
-
unique_ptr<Expression> LikeOptimizationRule::ApplyRule(BoundFunctionExpression
|
140
|
+
unique_ptr<Expression> LikeOptimizationRule::ApplyRule(BoundFunctionExpression &expr, ScalarFunction function,
|
141
141
|
string pattern, bool is_not_like) {
|
142
142
|
// replace LIKE by an optimized function
|
143
143
|
unique_ptr<Expression> result;
|
144
144
|
auto new_function =
|
145
|
-
make_uniq<BoundFunctionExpression>(expr
|
145
|
+
make_uniq<BoundFunctionExpression>(expr.return_type, std::move(function), std::move(expr.children), nullptr);
|
146
146
|
|
147
147
|
// removing "%" from the pattern
|
148
148
|
pattern.erase(std::remove(pattern.begin(), pattern.end(), '%'), pattern.end());
|
@@ -30,22 +30,22 @@ MoveConstantsRule::MoveConstantsRule(ExpressionRewriter &rewriter) : Rule(rewrit
|
|
30
30
|
|
31
31
|
unique_ptr<Expression> MoveConstantsRule::Apply(LogicalOperator &op, vector<Expression *> &bindings, bool &changes_made,
|
32
32
|
bool is_root) {
|
33
|
-
auto comparison =
|
34
|
-
auto outer_constant =
|
35
|
-
auto arithmetic =
|
36
|
-
auto inner_constant =
|
37
|
-
if (!TypeIsIntegral(arithmetic
|
33
|
+
auto &comparison = bindings[0]->Cast<BoundComparisonExpression>();
|
34
|
+
auto &outer_constant = bindings[1]->Cast<BoundConstantExpression>();
|
35
|
+
auto &arithmetic = bindings[2]->Cast<BoundFunctionExpression>();
|
36
|
+
auto &inner_constant = bindings[3]->Cast<BoundConstantExpression>();
|
37
|
+
if (!TypeIsIntegral(arithmetic.return_type.InternalType())) {
|
38
38
|
return nullptr;
|
39
39
|
}
|
40
|
-
if (inner_constant
|
41
|
-
return make_uniq<BoundConstantExpression>(Value(comparison
|
40
|
+
if (inner_constant.value.IsNull() || outer_constant.value.IsNull()) {
|
41
|
+
return make_uniq<BoundConstantExpression>(Value(comparison.return_type));
|
42
42
|
}
|
43
|
-
auto &constant_type = outer_constant
|
44
|
-
hugeint_t outer_value = IntegralValue::Get(outer_constant
|
45
|
-
hugeint_t inner_value = IntegralValue::Get(inner_constant
|
43
|
+
auto &constant_type = outer_constant.return_type;
|
44
|
+
hugeint_t outer_value = IntegralValue::Get(outer_constant.value);
|
45
|
+
hugeint_t inner_value = IntegralValue::Get(inner_constant.value);
|
46
46
|
|
47
|
-
idx_t arithmetic_child_index = arithmetic
|
48
|
-
auto &op_type = arithmetic
|
47
|
+
idx_t arithmetic_child_index = arithmetic.children[0].get() == &inner_constant ? 1 : 0;
|
48
|
+
auto &op_type = arithmetic.function.name;
|
49
49
|
if (op_type == "+") {
|
50
50
|
// [x + 1 COMP 10] OR [1 + x COMP 10]
|
51
51
|
// order does not matter in addition:
|
@@ -58,10 +58,10 @@ unique_ptr<Expression> MoveConstantsRule::Apply(LogicalOperator &op, vector<Expr
|
|
58
58
|
// if the cast is not possible then the comparison is not possible
|
59
59
|
// for example, if we have x + 5 = 3, where x is an unsigned number, we will get x = -2
|
60
60
|
// since this is not possible we can remove the entire branch here
|
61
|
-
return ExpressionRewriter::ConstantOrNull(std::move(arithmetic
|
61
|
+
return ExpressionRewriter::ConstantOrNull(std::move(arithmetic.children[arithmetic_child_index]),
|
62
62
|
Value::BOOLEAN(false));
|
63
63
|
}
|
64
|
-
outer_constant
|
64
|
+
outer_constant.value = std::move(result_value);
|
65
65
|
} else if (op_type == "-") {
|
66
66
|
// [x - 1 COMP 10] O R [1 - x COMP 10]
|
67
67
|
// order matters in subtraction:
|
@@ -74,13 +74,13 @@ unique_ptr<Expression> MoveConstantsRule::Apply(LogicalOperator &op, vector<Expr
|
|
74
74
|
auto result_value = Value::HUGEINT(outer_value);
|
75
75
|
if (!result_value.DefaultTryCastAs(constant_type)) {
|
76
76
|
// if the cast is not possible then an equality comparison is not possible
|
77
|
-
if (comparison
|
77
|
+
if (comparison.type != ExpressionType::COMPARE_EQUAL) {
|
78
78
|
return nullptr;
|
79
79
|
}
|
80
|
-
return ExpressionRewriter::ConstantOrNull(std::move(arithmetic
|
80
|
+
return ExpressionRewriter::ConstantOrNull(std::move(arithmetic.children[arithmetic_child_index]),
|
81
81
|
Value::BOOLEAN(false));
|
82
82
|
}
|
83
|
-
outer_constant
|
83
|
+
outer_constant.value = std::move(result_value);
|
84
84
|
} else {
|
85
85
|
// [1 - x COMP 10]
|
86
86
|
// change right side to 1-10=-9
|
@@ -90,16 +90,16 @@ unique_ptr<Expression> MoveConstantsRule::Apply(LogicalOperator &op, vector<Expr
|
|
90
90
|
auto result_value = Value::HUGEINT(inner_value);
|
91
91
|
if (!result_value.DefaultTryCastAs(constant_type)) {
|
92
92
|
// if the cast is not possible then an equality comparison is not possible
|
93
|
-
if (comparison
|
93
|
+
if (comparison.type != ExpressionType::COMPARE_EQUAL) {
|
94
94
|
return nullptr;
|
95
95
|
}
|
96
|
-
return ExpressionRewriter::ConstantOrNull(std::move(arithmetic
|
96
|
+
return ExpressionRewriter::ConstantOrNull(std::move(arithmetic.children[arithmetic_child_index]),
|
97
97
|
Value::BOOLEAN(false));
|
98
98
|
}
|
99
|
-
outer_constant
|
99
|
+
outer_constant.value = std::move(result_value);
|
100
100
|
// in this case, we should also flip the comparison
|
101
101
|
// e.g. if we have [4 - x < 2] then we should have [x > 2]
|
102
|
-
comparison
|
102
|
+
comparison.type = FlipComparisonExpression(comparison.type);
|
103
103
|
}
|
104
104
|
} else {
|
105
105
|
D_ASSERT(op_type == "*");
|
@@ -114,13 +114,13 @@ unique_ptr<Expression> MoveConstantsRule::Apply(LogicalOperator &op, vector<Expr
|
|
114
114
|
}
|
115
115
|
if (outer_value % inner_value != 0) {
|
116
116
|
// not cleanly divisible
|
117
|
-
bool is_equality = comparison
|
118
|
-
bool is_inequality = comparison
|
117
|
+
bool is_equality = comparison.type == ExpressionType::COMPARE_EQUAL;
|
118
|
+
bool is_inequality = comparison.type == ExpressionType::COMPARE_NOTEQUAL;
|
119
119
|
if (is_equality || is_inequality) {
|
120
120
|
// we know the values are not equal
|
121
121
|
// the result will be either FALSE or NULL (if COMPARE_EQUAL)
|
122
122
|
// or TRUE or NULL (if COMPARE_NOTEQUAL)
|
123
|
-
return ExpressionRewriter::ConstantOrNull(std::move(arithmetic
|
123
|
+
return ExpressionRewriter::ConstantOrNull(std::move(arithmetic.children[arithmetic_child_index]),
|
124
124
|
Value::BOOLEAN(is_inequality));
|
125
125
|
} else {
|
126
126
|
// not cleanly divisible and we are doing > >= < <=, skip the simplification for now
|
@@ -129,26 +129,26 @@ unique_ptr<Expression> MoveConstantsRule::Apply(LogicalOperator &op, vector<Expr
|
|
129
129
|
}
|
130
130
|
if (inner_value < 0) {
|
131
131
|
// multiply by negative value, need to flip expression
|
132
|
-
comparison
|
132
|
+
comparison.type = FlipComparisonExpression(comparison.type);
|
133
133
|
}
|
134
134
|
// else divide the RHS by the LHS
|
135
135
|
// we need to do a range check on the cast even though we do a division
|
136
136
|
// because e.g. -128 / -1 = 128, which is out of range
|
137
137
|
auto result_value = Value::HUGEINT(outer_value / inner_value);
|
138
138
|
if (!result_value.DefaultTryCastAs(constant_type)) {
|
139
|
-
return ExpressionRewriter::ConstantOrNull(std::move(arithmetic
|
139
|
+
return ExpressionRewriter::ConstantOrNull(std::move(arithmetic.children[arithmetic_child_index]),
|
140
140
|
Value::BOOLEAN(false));
|
141
141
|
}
|
142
|
-
outer_constant
|
142
|
+
outer_constant.value = std::move(result_value);
|
143
143
|
}
|
144
144
|
// replace left side with x
|
145
145
|
// first extract x from the arithmetic expression
|
146
|
-
auto arithmetic_child = std::move(arithmetic
|
146
|
+
auto arithmetic_child = std::move(arithmetic.children[arithmetic_child_index]);
|
147
147
|
// then place in the comparison
|
148
|
-
if (comparison
|
149
|
-
comparison
|
148
|
+
if (comparison.left.get() == &outer_constant) {
|
149
|
+
comparison.right = std::move(arithmetic_child);
|
150
150
|
} else {
|
151
|
-
comparison
|
151
|
+
comparison.left = std::move(arithmetic_child);
|
152
152
|
}
|
153
153
|
changes_made = true;
|
154
154
|
return nullptr;
|
@@ -13,14 +13,14 @@ OrderedAggregateOptimizer::OrderedAggregateOptimizer(ExpressionRewriter &rewrite
|
|
13
13
|
|
14
14
|
unique_ptr<Expression> OrderedAggregateOptimizer::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
15
15
|
bool &changes_made, bool is_root) {
|
16
|
-
auto aggr =
|
17
|
-
if (!aggr
|
16
|
+
auto &aggr = bindings[0]->Cast<BoundAggregateExpression>();
|
17
|
+
if (!aggr.order_bys) {
|
18
18
|
// no ORDER BYs defined
|
19
19
|
return nullptr;
|
20
20
|
}
|
21
|
-
if (aggr
|
21
|
+
if (aggr.function.order_dependent == AggregateOrderDependent::NOT_ORDER_DEPENDENT) {
|
22
22
|
// not an order dependent aggregate but we have an ORDER BY clause - remove it
|
23
|
-
aggr
|
23
|
+
aggr.order_bys.reset();
|
24
24
|
changes_made = true;
|
25
25
|
return nullptr;
|
26
26
|
}
|
@@ -20,21 +20,21 @@ RegexOptimizationRule::RegexOptimizationRule(ExpressionRewriter &rewriter) : Rul
|
|
20
20
|
|
21
21
|
unique_ptr<Expression> RegexOptimizationRule::Apply(LogicalOperator &op, vector<Expression *> &bindings,
|
22
22
|
bool &changes_made, bool is_root) {
|
23
|
-
auto root =
|
24
|
-
auto constant_expr =
|
25
|
-
D_ASSERT(root
|
23
|
+
auto &root = bindings[0]->Cast<BoundFunctionExpression>();
|
24
|
+
auto &constant_expr = bindings[2]->Cast<BoundConstantExpression>();
|
25
|
+
D_ASSERT(root.children.size() == 2);
|
26
26
|
|
27
|
-
if (constant_expr
|
28
|
-
return make_uniq<BoundConstantExpression>(Value(root
|
27
|
+
if (constant_expr.value.IsNull()) {
|
28
|
+
return make_uniq<BoundConstantExpression>(Value(root.return_type));
|
29
29
|
}
|
30
30
|
|
31
31
|
// the constant_expr is a scalar expression that we have to fold
|
32
|
-
if (!constant_expr
|
32
|
+
if (!constant_expr.IsFoldable()) {
|
33
33
|
return nullptr;
|
34
34
|
}
|
35
35
|
|
36
|
-
auto constant_value = ExpressionExecutor::EvaluateScalar(GetContext(),
|
37
|
-
D_ASSERT(constant_value.type() == constant_expr
|
36
|
+
auto constant_value = ExpressionExecutor::EvaluateScalar(GetContext(), constant_expr);
|
37
|
+
D_ASSERT(constant_value.type() == constant_expr.return_type);
|
38
38
|
auto patt_str = StringValue::Get(constant_value);
|
39
39
|
|
40
40
|
duckdb_re2::RE2 pattern(patt_str);
|
@@ -44,8 +44,8 @@ unique_ptr<Expression> RegexOptimizationRule::Apply(LogicalOperator &op, vector<
|
|
44
44
|
|
45
45
|
if (pattern.Regexp()->op() == duckdb_re2::kRegexpLiteralString ||
|
46
46
|
pattern.Regexp()->op() == duckdb_re2::kRegexpLiteral) {
|
47
|
-
auto contains = make_uniq<BoundFunctionExpression>(root
|
48
|
-
std::move(root
|
47
|
+
auto contains = make_uniq<BoundFunctionExpression>(root.return_type, ContainsFun::GetFunction(),
|
48
|
+
std::move(root.children), nullptr);
|
49
49
|
|
50
50
|
string min;
|
51
51
|
string max;
|