duckdb 1.1.2-dev2.0 → 1.1.2-dev6.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 +4 -2
- package/package.json +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/putil.cpp +0 -5
- package/src/duckdb/extension/icu/third_party/icu/common/rbbiscan.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/rbbitblb.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/ucurr.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/uresbund.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/uresimp.h +31 -31
- package/src/duckdb/extension/icu/third_party/icu/common/ustring.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/common/uvector.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/coleitr.cpp +12 -12
- package/src/duckdb/extension/icu/third_party/icu/i18n/format.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/listformatter.cpp +4 -4
- package/src/duckdb/extension/icu/third_party/icu/i18n/number_decimalquantity.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/tzgnames.cpp +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/coleitr.h +28 -28
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/format.h +7 -7
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/ucol.h +1 -1
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/ucoleitr.h +41 -41
- package/src/duckdb/extension/icu/third_party/icu/i18n/unicode/umsg.h +41 -41
- package/src/duckdb/extension/icu/third_party/icu/i18n/usrchimp.h +3 -3
- package/src/duckdb/extension/json/include/json_common.hpp +1 -1
- package/src/duckdb/extension/json/json_functions/json_structure.cpp +13 -7
- package/src/duckdb/extension/parquet/column_writer.cpp +2 -1
- package/src/duckdb/extension/parquet/geo_parquet.cpp +24 -9
- package/src/duckdb/extension/parquet/include/geo_parquet.hpp +3 -1
- package/src/duckdb/extension/parquet/include/parquet_reader.hpp +1 -0
- package/src/duckdb/extension/parquet/include/parquet_rle_bp_decoder.hpp +1 -1
- package/src/duckdb/extension/parquet/include/templated_column_reader.hpp +0 -4
- package/src/duckdb/extension/parquet/parquet_extension.cpp +20 -6
- package/src/duckdb/extension/parquet/parquet_reader.cpp +1 -2
- package/src/duckdb/extension/parquet/parquet_writer.cpp +1 -1
- package/src/duckdb/extension/parquet/serialize_parquet.cpp +0 -2
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +8 -1
- package/src/duckdb/src/catalog/default/default_functions.cpp +5 -5
- package/src/duckdb/src/common/allocator.cpp +3 -2
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +1 -0
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +11 -0
- package/src/duckdb/src/common/arrow/schema_metadata.cpp +6 -4
- package/src/duckdb/src/common/enum_util.cpp +33 -0
- package/src/duckdb/src/common/exception.cpp +3 -0
- package/src/duckdb/src/common/extra_type_info.cpp +1 -44
- package/src/duckdb/src/common/field_writer.cpp +97 -0
- package/src/duckdb/src/common/render_tree.cpp +7 -5
- package/src/duckdb/src/common/row_operations/row_match.cpp +359 -0
- package/src/duckdb/src/common/serializer/buffered_deserializer.cpp +27 -0
- package/src/duckdb/src/common/serializer/buffered_serializer.cpp +36 -0
- package/src/duckdb/src/common/serializer/format_serializer.cpp +15 -0
- package/src/duckdb/src/common/serializer.cpp +24 -0
- package/src/duckdb/src/common/sort/comparators.cpp +2 -2
- package/src/duckdb/src/common/types/bit.cpp +57 -34
- package/src/duckdb/src/common/types/data_chunk.cpp +32 -29
- package/src/duckdb/src/common/types/vector_cache.cpp +12 -6
- package/src/duckdb/src/common/vector_operations/comparison_operators.cpp +14 -0
- package/src/duckdb/src/core_functions/aggregate/distributive/bitstring_agg.cpp +20 -1
- package/src/duckdb/src/core_functions/aggregate/distributive/minmax.cpp +2 -2
- package/src/duckdb/src/core_functions/aggregate/holistic/approx_top_k.cpp +32 -7
- package/src/duckdb/src/core_functions/function_list.cpp +1 -2
- package/src/duckdb/src/core_functions/scalar/bit/bitstring.cpp +23 -5
- package/src/duckdb/src/core_functions/scalar/date/date_diff.cpp +12 -6
- package/src/duckdb/src/core_functions/scalar/date/date_part.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor/execute_between.cpp +4 -3
- package/src/duckdb/src/execution/expression_executor/execute_case.cpp +4 -3
- package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +2 -1
- package/src/duckdb/src/execution/expression_executor/execute_comparison.cpp +3 -2
- package/src/duckdb/src/execution/expression_executor/execute_conjunction.cpp +2 -1
- package/src/duckdb/src/execution/expression_executor/execute_function.cpp +2 -1
- package/src/duckdb/src/execution/expression_executor/execute_operator.cpp +3 -2
- package/src/duckdb/src/execution/expression_executor/execute_reference.cpp +1 -1
- package/src/duckdb/src/execution/expression_executor.cpp +9 -3
- package/src/duckdb/src/execution/expression_executor_state.cpp +11 -9
- package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +238 -0
- package/src/duckdb/src/execution/index/art/plan_art.cpp +94 -0
- package/src/duckdb/src/execution/index/index_type_set.cpp +4 -1
- package/src/duckdb/src/execution/join_hashtable.cpp +7 -8
- package/src/duckdb/src/execution/operator/aggregate/physical_hash_aggregate.cpp +6 -4
- package/src/duckdb/src/execution/operator/csv_scanner/buffer_manager/csv_buffer_manager.cpp +4 -4
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/base_scanner.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/csv_schema.cpp +44 -5
- package/src/duckdb/src/execution/operator/csv_scanner/scanner/string_value_scanner.cpp +28 -24
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/csv_sniffer.cpp +25 -26
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/dialect_detection.cpp +5 -3
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/header_detection.cpp +4 -4
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_detection.cpp +2 -2
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_refinement.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/sniffer/type_replacement.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/state_machine/csv_state_machine_cache.cpp +2 -2
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/csv_file_scanner.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/table_function/global_csv_state.cpp +1 -1
- package/src/duckdb/src/execution/operator/csv_scanner/util/csv_reader_options.cpp +73 -27
- package/src/duckdb/src/execution/operator/helper/physical_buffered_collector.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +695 -0
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +1487 -0
- package/src/duckdb/src/execution/operator/persistent/csv_buffer.cpp +72 -0
- package/src/duckdb/src/execution/operator/persistent/csv_file_handle.cpp +158 -0
- package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +280 -0
- package/src/duckdb/src/execution/operator/persistent/parallel_csv_reader.cpp +666 -0
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +14 -4
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +207 -0
- package/src/duckdb/src/execution/partitionable_hashtable.cpp +207 -0
- package/src/duckdb/src/execution/perfect_aggregate_hashtable.cpp +6 -1
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +0 -4
- package/src/duckdb/src/execution/physical_plan/plan_create_index.cpp +14 -87
- package/src/duckdb/src/execution/physical_plan/plan_export.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_get.cpp +1 -1
- package/src/duckdb/src/execution/reservoir_sample.cpp +1 -1
- package/src/duckdb/src/execution/window_executor.cpp +3 -3
- package/src/duckdb/src/function/pragma/pragma_queries.cpp +1 -1
- package/src/duckdb/src/function/scalar/strftime_format.cpp +1 -2
- package/src/duckdb/src/function/scalar/string/concat.cpp +118 -151
- package/src/duckdb/src/function/table/arrow.cpp +13 -0
- package/src/duckdb/src/function/table/arrow_conversion.cpp +12 -7
- package/src/duckdb/src/function/table/copy_csv.cpp +1 -1
- package/src/duckdb/src/function/table/read_csv.cpp +2 -30
- package/src/duckdb/src/function/table/sniff_csv.cpp +2 -1
- package/src/duckdb/src/function/table/system/duckdb_secrets.cpp +15 -7
- package/src/duckdb/src/function/table/version/pragma_version.cpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry_retriever.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/atomic.hpp +13 -1
- package/src/duckdb/src/include/duckdb/common/bitpacking.hpp +3 -4
- package/src/duckdb/src/include/duckdb/common/enum_util.hpp +8 -0
- package/src/duckdb/src/include/duckdb/common/enums/metric_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/exception.hpp +10 -0
- package/src/duckdb/src/include/duckdb/common/extra_type_info/enum_type_info.hpp +53 -0
- package/src/duckdb/src/include/duckdb/common/insertion_order_preserving_map.hpp +5 -5
- package/src/duckdb/src/include/duckdb/common/multi_file_reader.hpp +5 -0
- package/src/duckdb/src/include/duckdb/common/types/bit.hpp +36 -33
- package/src/duckdb/src/include/duckdb/common/types/data_chunk.hpp +10 -13
- package/src/duckdb/src/include/duckdb/common/types/uhugeint.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types/vector_cache.hpp +7 -5
- package/src/duckdb/src/include/duckdb/common/windows_undefs.hpp +2 -1
- package/src/duckdb/src/include/duckdb/core_functions/aggregate/minmax_n_helpers.hpp +2 -0
- package/src/duckdb/src/include/duckdb/core_functions/scalar/bit_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/core_functions/scalar/list_functions.hpp +0 -6
- package/src/duckdb/src/include/duckdb/core_functions/scalar/math_functions.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/expression_executor_state.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +3 -0
- package/src/duckdb/src/include/duckdb/execution/index/index_type.hpp +16 -1
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp +4 -4
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_reader_options.hpp +4 -2
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/csv_schema.hpp +3 -2
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/csv_sniffer.hpp +91 -36
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/sniffer/sniff_result.hpp +36 -0
- package/src/duckdb/src/include/duckdb/execution/operator/csv_scanner/string_value_scanner.hpp +1 -1
- package/src/duckdb/src/include/duckdb/execution/operator/join/perfect_hash_join_executor.hpp +0 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/physical_export.hpp +2 -5
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/database.hpp +5 -0
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +1 -0
- package/src/duckdb/src/include/duckdb/main/profiling_info.hpp +20 -22
- package/src/duckdb/src/include/duckdb/main/query_profiler.hpp +7 -9
- package/src/duckdb/src/include/duckdb/main/secret/secret.hpp +8 -1
- package/src/duckdb/src/include/duckdb/main/table_description.hpp +14 -0
- package/src/duckdb/src/include/duckdb/optimizer/unnest_rewriter.hpp +5 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/exported_table_data.hpp +15 -5
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/expression_binder/order_binder.hpp +4 -0
- package/src/duckdb/src/include/duckdb/planner/operator/logical_export.hpp +10 -13
- package/src/duckdb/src/include/duckdb/planner/table_filter.hpp +1 -0
- package/src/duckdb/src/include/duckdb/storage/metadata/metadata_manager.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +0 -2
- package/src/duckdb/src/include/duckdb/storage/table/segment_tree.hpp +1 -0
- package/src/duckdb/src/include/duckdb/transaction/duck_transaction.hpp +5 -1
- package/src/duckdb/src/include/duckdb.h +2 -2
- package/src/duckdb/src/main/appender.cpp +3 -0
- package/src/duckdb/src/main/capi/profiling_info-c.cpp +5 -2
- package/src/duckdb/src/main/client_context.cpp +8 -2
- package/src/duckdb/src/main/connection.cpp +1 -1
- package/src/duckdb/src/main/database.cpp +13 -0
- package/src/duckdb/src/main/extension/extension_helper.cpp +1 -1
- package/src/duckdb/src/main/extension/extension_install.cpp +9 -1
- package/src/duckdb/src/main/extension/extension_load.cpp +3 -2
- package/src/duckdb/src/main/extension_install_info.cpp +1 -1
- package/src/duckdb/src/main/profiling_info.cpp +78 -58
- package/src/duckdb/src/main/query_profiler.cpp +79 -89
- package/src/duckdb/src/main/relation/read_csv_relation.cpp +1 -1
- package/src/duckdb/src/main/secret/secret.cpp +2 -1
- package/src/duckdb/src/main/secret/secret_manager.cpp +14 -0
- package/src/duckdb/src/optimizer/cte_filter_pusher.cpp +4 -2
- package/src/duckdb/src/optimizer/deliminator.cpp +0 -7
- package/src/duckdb/src/optimizer/in_clause_rewriter.cpp +7 -0
- package/src/duckdb/src/optimizer/pushdown/pushdown_left_join.cpp +4 -1
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +21 -21
- package/src/duckdb/src/parallel/task_scheduler.cpp +9 -0
- package/src/duckdb/src/parser/parsed_data/exported_table_data.cpp +22 -0
- package/src/duckdb/src/parser/parsed_expression_iterator.cpp +3 -0
- package/src/duckdb/src/parser/statement/insert_statement.cpp +7 -1
- package/src/duckdb/src/parser/transform/expression/transform_boolean_test.cpp +1 -1
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +89 -87
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +4 -9
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +4 -0
- package/src/duckdb/src/planner/binder/query_node/plan_setop.cpp +2 -2
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +4 -1
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +4 -3
- package/src/duckdb/src/planner/expression_binder/order_binder.cpp +13 -3
- package/src/duckdb/src/planner/expression_binder.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_export.cpp +28 -0
- package/src/duckdb/src/planner/table_binding.cpp +1 -2
- package/src/duckdb/src/planner/table_filter.cpp +6 -2
- package/src/duckdb/src/storage/buffer/buffer_pool.cpp +2 -1
- package/src/duckdb/src/storage/checkpoint_manager.cpp +1 -1
- package/src/duckdb/src/storage/compression/bitpacking.cpp +7 -3
- package/src/duckdb/src/storage/compression/dictionary_compression.cpp +1 -1
- package/src/duckdb/src/storage/metadata/metadata_manager.cpp +2 -2
- package/src/duckdb/src/storage/serialization/serialize_logical_operator.cpp +16 -0
- package/src/duckdb/src/storage/serialization/serialize_nodes.cpp +29 -0
- package/src/duckdb/src/storage/serialization/serialize_parse_info.cpp +15 -0
- package/src/duckdb/src/storage/single_file_block_manager.cpp +2 -1
- package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +3 -5
- package/src/duckdb/src/storage/storage_info.cpp +4 -4
- package/src/duckdb/src/storage/table/row_group_collection.cpp +1 -1
- package/src/duckdb/src/storage/table/row_version_manager.cpp +5 -1
- package/src/duckdb/src/storage/temporary_file_manager.cpp +1 -1
- package/src/duckdb/src/transaction/duck_transaction.cpp +15 -14
- package/src/duckdb/third_party/brotli/common/brotli_platform.h +1 -1
- package/src/duckdb/third_party/brotli/dec/decode.cpp +1 -1
- package/src/duckdb/third_party/brotli/enc/memory.cpp +4 -4
- package/src/duckdb/third_party/fsst/libfsst.cpp +1 -1
- package/src/duckdb/third_party/hyperloglog/sds.cpp +1 -1
- package/src/duckdb/third_party/hyperloglog/sds.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/common/keywords.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/datatype/timestamp.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/mb/pg_wchar.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/bitmapset.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/lockoptions.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/makefuncs.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/pg_list.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/nodes/value.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/parser/gramparse.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/parser/parser.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/parser/scanner.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/parser/scansup.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/include/pg_functions.hpp +1 -1
- package/src/duckdb/third_party/libpg_query/pg_functions.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/src_backend_nodes_list.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/src_backend_nodes_makefuncs.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/src_backend_nodes_value.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +1964 -1964
- package/src/duckdb/third_party/libpg_query/src_backend_parser_parser.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/src_backend_parser_scansup.cpp +1 -1
- package/src/duckdb/third_party/libpg_query/src_common_keywords.cpp +1 -1
- package/src/duckdb/third_party/lz4/lz4.cpp +1 -1
- package/src/duckdb/third_party/mbedtls/include/des_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/aes_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/aria_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/asn1write.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/camellia_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/ccm_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/chacha20.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/chachapoly.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/cmac.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/config_psa.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/ecdsa.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/ecp.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/gcm_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/md5.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/nist_kw.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/pkcs12.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/pkcs5.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/psa_util.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/ripemd160.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/threading.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/mbedtls/timing.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/platform_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/psa/crypto.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/rsa_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/sha1_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/sha256_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/sha512_alt.h +1 -1
- package/src/duckdb/third_party/mbedtls/include/ssl_misc.h +1 -1
- package/src/duckdb/third_party/mbedtls/library/aesni.h +1 -1
- package/src/duckdb/third_party/mbedtls/library/padlock.h +1 -1
- package/src/duckdb/third_party/miniz/miniz.cpp +1 -1
- package/src/duckdb/third_party/parquet/parquet_types.cpp +1 -1
- package/src/duckdb/third_party/parquet/windows_compatibility.h +1 -1
- package/src/duckdb/third_party/pcg/pcg_extras.hpp +1 -1
- package/src/duckdb/third_party/pcg/pcg_uint128.hpp +1 -1
- package/src/duckdb/third_party/skiplist/Node.h +4 -4
- package/src/duckdb/third_party/snappy/snappy.cc +1 -1
- package/src/duckdb/third_party/snappy/snappy_version.hpp +1 -1
- package/src/duckdb/third_party/thrift/thrift/thrift-config.h +1 -1
- package/src/duckdb/third_party/zstd/decompress/zstd_decompress_block.cpp +1 -1
- package/src/duckdb/third_party/zstd/include/zstd_static.h +1 -1
- package/src/duckdb/ub_src_execution_index_art.cpp +2 -0
- package/src/duckdb/ub_src_parser_parsed_data.cpp +2 -0
- package/src/duckdb/ub_src_planner_operator.cpp +2 -0
@@ -121,6 +121,7 @@ bool QueryProfiler::OperatorRequiresProfiling(PhysicalOperatorType op_type) {
|
|
121
121
|
case PhysicalOperatorType::UNION:
|
122
122
|
case PhysicalOperatorType::RECURSIVE_CTE:
|
123
123
|
case PhysicalOperatorType::EMPTY_RESULT:
|
124
|
+
case PhysicalOperatorType::EXTENSION:
|
124
125
|
return true;
|
125
126
|
default:
|
126
127
|
return false;
|
@@ -134,9 +135,12 @@ void QueryProfiler::Finalize(ProfilingNode &node) {
|
|
134
135
|
|
135
136
|
auto &info = node.GetProfilingInfo();
|
136
137
|
auto type = PhysicalOperatorType(info.GetMetricValue<uint8_t>(MetricsType::OPERATOR_TYPE));
|
137
|
-
if (type == PhysicalOperatorType::UNION &&
|
138
|
-
|
139
|
-
|
138
|
+
if (type == PhysicalOperatorType::UNION &&
|
139
|
+
info.Enabled(info.expanded_settings, MetricsType::OPERATOR_CARDINALITY)) {
|
140
|
+
|
141
|
+
auto &child_info = child->GetProfilingInfo();
|
142
|
+
auto value = child_info.metrics[MetricsType::OPERATOR_CARDINALITY].GetValue<idx_t>();
|
143
|
+
info.AddToMetric(MetricsType::OPERATOR_CARDINALITY, value);
|
140
144
|
}
|
141
145
|
}
|
142
146
|
}
|
@@ -147,12 +151,14 @@ void QueryProfiler::StartExplainAnalyze() {
|
|
147
151
|
|
148
152
|
template <class METRIC_TYPE>
|
149
153
|
static void GetCumulativeMetric(ProfilingNode &node, MetricsType cumulative_metric, MetricsType child_metric) {
|
150
|
-
|
154
|
+
auto &info = node.GetProfilingInfo();
|
155
|
+
info.metrics[cumulative_metric] = info.metrics[child_metric];
|
156
|
+
|
151
157
|
for (idx_t i = 0; i < node.GetChildCount(); i++) {
|
152
158
|
auto child = node.GetChild(i);
|
153
159
|
GetCumulativeMetric<METRIC_TYPE>(*child, cumulative_metric, child_metric);
|
154
|
-
|
155
|
-
|
160
|
+
auto value = child->GetProfilingInfo().metrics[cumulative_metric].GetValue<METRIC_TYPE>();
|
161
|
+
info.AddToMetric(cumulative_metric, value);
|
156
162
|
}
|
157
163
|
}
|
158
164
|
|
@@ -174,51 +180,52 @@ void QueryProfiler::EndQuery() {
|
|
174
180
|
}
|
175
181
|
|
176
182
|
main_query.End();
|
177
|
-
if (root
|
178
|
-
|
183
|
+
if (root) {
|
184
|
+
auto &info = root->GetProfilingInfo();
|
185
|
+
if (info.Enabled(info.expanded_settings, MetricsType::OPERATOR_CARDINALITY)) {
|
186
|
+
Finalize(*root->GetChild(0));
|
187
|
+
}
|
179
188
|
}
|
180
189
|
running = false;
|
181
190
|
|
182
191
|
// Print or output the query profiling after query termination.
|
183
192
|
// EXPLAIN ANALYZE output is not written by the profiler.
|
184
193
|
if (IsEnabled() && !is_explain_analyze) {
|
185
|
-
// Expand the query info.
|
186
194
|
if (root) {
|
187
195
|
auto &info = root->GetProfilingInfo();
|
188
196
|
info = ProfilingInfo(ClientConfig::GetConfig(context).profiler_settings);
|
197
|
+
auto &child_info = root->children[0]->GetProfilingInfo();
|
189
198
|
info.metrics[MetricsType::QUERY_NAME] = query_info.query_name;
|
190
199
|
|
191
|
-
|
200
|
+
auto &settings = info.expanded_settings;
|
201
|
+
if (info.Enabled(settings, MetricsType::BLOCKED_THREAD_TIME)) {
|
192
202
|
info.metrics[MetricsType::BLOCKED_THREAD_TIME] = query_info.blocked_thread_time;
|
193
203
|
}
|
194
|
-
if (info.Enabled(MetricsType::
|
195
|
-
info.metrics[MetricsType::
|
204
|
+
if (info.Enabled(settings, MetricsType::LATENCY)) {
|
205
|
+
info.metrics[MetricsType::LATENCY] = main_query.Elapsed();
|
206
|
+
}
|
207
|
+
if (info.Enabled(settings, MetricsType::ROWS_RETURNED)) {
|
208
|
+
info.metrics[MetricsType::ROWS_RETURNED] = child_info.metrics[MetricsType::OPERATOR_CARDINALITY];
|
196
209
|
}
|
197
|
-
if (info.Enabled(MetricsType::CPU_TIME)) {
|
210
|
+
if (info.Enabled(settings, MetricsType::CPU_TIME)) {
|
198
211
|
GetCumulativeMetric<double>(*root, MetricsType::CPU_TIME, MetricsType::OPERATOR_TIMING);
|
199
212
|
}
|
200
|
-
if (info.Enabled(MetricsType::CUMULATIVE_CARDINALITY)) {
|
213
|
+
if (info.Enabled(settings, MetricsType::CUMULATIVE_CARDINALITY)) {
|
201
214
|
GetCumulativeMetric<idx_t>(*root, MetricsType::CUMULATIVE_CARDINALITY,
|
202
215
|
MetricsType::OPERATOR_CARDINALITY);
|
203
216
|
}
|
204
|
-
if (info.Enabled(MetricsType::CUMULATIVE_ROWS_SCANNED)) {
|
217
|
+
if (info.Enabled(settings, MetricsType::CUMULATIVE_ROWS_SCANNED)) {
|
205
218
|
GetCumulativeMetric<idx_t>(*root, MetricsType::CUMULATIVE_ROWS_SCANNED,
|
206
219
|
MetricsType::OPERATOR_ROWS_SCANNED);
|
207
220
|
}
|
221
|
+
if (info.Enabled(settings, MetricsType::RESULT_SET_SIZE)) {
|
222
|
+
info.metrics[MetricsType::RESULT_SET_SIZE] = child_info.metrics[MetricsType::RESULT_SET_SIZE];
|
223
|
+
}
|
208
224
|
|
209
225
|
MoveOptimizerPhasesToRoot();
|
210
|
-
if (info.Enabled(MetricsType::CUMULATIVE_OPTIMIZER_TIMING)) {
|
226
|
+
if (info.Enabled(settings, MetricsType::CUMULATIVE_OPTIMIZER_TIMING)) {
|
211
227
|
info.metrics.at(MetricsType::CUMULATIVE_OPTIMIZER_TIMING) = GetCumulativeOptimizers(*root);
|
212
228
|
}
|
213
|
-
|
214
|
-
if (info.Enabled(MetricsType::OPERATOR_TYPE)) {
|
215
|
-
info.settings.erase(MetricsType::OPERATOR_TYPE);
|
216
|
-
}
|
217
|
-
|
218
|
-
if (info.Enabled(MetricsType::RESULT_SET_SIZE)) {
|
219
|
-
info.metrics[MetricsType::RESULT_SET_SIZE] =
|
220
|
-
root->children[0]->GetProfilingInfo().metrics[MetricsType::RESULT_SET_SIZE];
|
221
|
-
}
|
222
229
|
}
|
223
230
|
|
224
231
|
string tree = ToString();
|
@@ -283,34 +290,20 @@ void QueryProfiler::EndPhase() {
|
|
283
290
|
}
|
284
291
|
}
|
285
292
|
|
286
|
-
bool SettingIsEnabled(const profiler_settings_t &settings, MetricsType metric) {
|
287
|
-
if (settings.find(metric) != settings.end()) {
|
288
|
-
return true;
|
289
|
-
}
|
290
|
-
|
291
|
-
switch (metric) {
|
292
|
-
case MetricsType::OPERATOR_TIMING:
|
293
|
-
return SettingIsEnabled(settings, MetricsType::CPU_TIME);
|
294
|
-
case MetricsType::OPERATOR_CARDINALITY:
|
295
|
-
return SettingIsEnabled(settings, MetricsType::CUMULATIVE_CARDINALITY);
|
296
|
-
case MetricsType::OPERATOR_ROWS_SCANNED:
|
297
|
-
return SettingIsEnabled(settings, MetricsType::CUMULATIVE_ROWS_SCANNED);
|
298
|
-
default:
|
299
|
-
break;
|
300
|
-
}
|
301
|
-
|
302
|
-
return false;
|
303
|
-
}
|
304
|
-
|
305
293
|
OperatorProfiler::OperatorProfiler(ClientContext &context) : context(context) {
|
306
294
|
enabled = QueryProfiler::Get(context).IsEnabled();
|
307
|
-
auto &
|
295
|
+
auto &context_metrics = ClientConfig::GetConfig(context).profiler_settings;
|
308
296
|
|
309
|
-
|
310
|
-
for (auto
|
311
|
-
|
312
|
-
|
313
|
-
|
297
|
+
// Expand.
|
298
|
+
for (const auto metric : context_metrics) {
|
299
|
+
settings.insert(metric);
|
300
|
+
ProfilingInfo::Expand(settings, metric);
|
301
|
+
}
|
302
|
+
|
303
|
+
// Reduce.
|
304
|
+
auto root_metrics = ProfilingInfo::DefaultRootSettings();
|
305
|
+
for (const auto metric : root_metrics) {
|
306
|
+
settings.erase(metric);
|
314
307
|
}
|
315
308
|
}
|
316
309
|
|
@@ -318,15 +311,13 @@ void OperatorProfiler::StartOperator(optional_ptr<const PhysicalOperator> phys_o
|
|
318
311
|
if (!enabled) {
|
319
312
|
return;
|
320
313
|
}
|
321
|
-
|
322
314
|
if (active_operator) {
|
323
315
|
throw InternalException("OperatorProfiler: Attempting to call StartOperator while another operator is active");
|
324
316
|
}
|
325
|
-
|
326
317
|
active_operator = phys_op;
|
327
318
|
|
328
|
-
//
|
329
|
-
if (
|
319
|
+
// Start the timing of the current operator.
|
320
|
+
if (ProfilingInfo::Enabled(settings, MetricsType::OPERATOR_TIMING)) {
|
330
321
|
op.Start();
|
331
322
|
}
|
332
323
|
}
|
@@ -335,26 +326,22 @@ void OperatorProfiler::EndOperator(optional_ptr<DataChunk> chunk) {
|
|
335
326
|
if (!enabled) {
|
336
327
|
return;
|
337
328
|
}
|
338
|
-
|
339
329
|
if (!active_operator) {
|
340
330
|
throw InternalException("OperatorProfiler: Attempting to call EndOperator while another operator is active");
|
341
331
|
}
|
342
332
|
|
343
|
-
if (!
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
// finish timing for the current element
|
348
|
-
if (HasOperatorSetting(MetricsType::OPERATOR_TIMING)) {
|
333
|
+
if (!settings.empty()) {
|
334
|
+
auto &info = GetOperatorInfo(*active_operator);
|
335
|
+
if (ProfilingInfo::Enabled(settings, MetricsType::OPERATOR_TIMING)) {
|
349
336
|
op.End();
|
350
|
-
|
337
|
+
info.AddTime(op.Elapsed());
|
351
338
|
}
|
352
|
-
if (
|
353
|
-
|
339
|
+
if (ProfilingInfo::Enabled(settings, MetricsType::OPERATOR_CARDINALITY) && chunk) {
|
340
|
+
info.AddReturnedElements(chunk->size());
|
354
341
|
}
|
355
|
-
if (
|
356
|
-
|
357
|
-
|
342
|
+
if (ProfilingInfo::Enabled(settings, MetricsType::RESULT_SET_SIZE) && chunk) {
|
343
|
+
auto result_set_size = chunk->GetAllocationSize();
|
344
|
+
info.AddResultSetSize(result_set_size);
|
358
345
|
}
|
359
346
|
}
|
360
347
|
active_operator = nullptr;
|
@@ -364,11 +351,10 @@ OperatorInformation &OperatorProfiler::GetOperatorInfo(const PhysicalOperator &p
|
|
364
351
|
auto entry = timings.find(phys_op);
|
365
352
|
if (entry != timings.end()) {
|
366
353
|
return entry->second;
|
367
|
-
} else {
|
368
|
-
// add new entry
|
369
|
-
timings[phys_op] = OperatorInformation();
|
370
|
-
return timings[phys_op];
|
371
354
|
}
|
355
|
+
// Add a new entry.
|
356
|
+
timings[phys_op] = OperatorInformation();
|
357
|
+
return timings[phys_op];
|
372
358
|
}
|
373
359
|
|
374
360
|
void OperatorProfiler::Flush(const PhysicalOperator &phys_op) {
|
@@ -389,30 +375,31 @@ void QueryProfiler::Flush(OperatorProfiler &profiler) {
|
|
389
375
|
auto &op = node.first.get();
|
390
376
|
auto entry = tree_map.find(op);
|
391
377
|
D_ASSERT(entry != tree_map.end());
|
378
|
+
|
392
379
|
auto &tree_node = entry->second.get();
|
380
|
+
auto &info = tree_node.GetProfilingInfo();
|
393
381
|
|
394
|
-
if (profiler.
|
395
|
-
|
382
|
+
if (ProfilingInfo::Enabled(profiler.settings, MetricsType::OPERATOR_TIMING)) {
|
383
|
+
info.AddToMetric<double>(MetricsType::OPERATOR_TIMING, node.second.time);
|
396
384
|
}
|
397
|
-
if (profiler.
|
398
|
-
|
399
|
-
node.second.elements_returned);
|
385
|
+
if (ProfilingInfo::Enabled(profiler.settings, MetricsType::OPERATOR_CARDINALITY)) {
|
386
|
+
info.AddToMetric<idx_t>(MetricsType::OPERATOR_CARDINALITY, node.second.elements_returned);
|
400
387
|
}
|
401
|
-
if (profiler.
|
388
|
+
if (ProfilingInfo::Enabled(profiler.settings, MetricsType::OPERATOR_ROWS_SCANNED)) {
|
402
389
|
if (op.type == PhysicalOperatorType::TABLE_SCAN) {
|
403
390
|
auto &scan_op = op.Cast<PhysicalTableScan>();
|
404
391
|
auto &bind_data = scan_op.bind_data;
|
392
|
+
|
405
393
|
if (bind_data && scan_op.function.cardinality) {
|
406
394
|
auto cardinality = scan_op.function.cardinality(context, &(*bind_data));
|
407
395
|
if (cardinality && cardinality->has_estimated_cardinality) {
|
408
|
-
|
409
|
-
cardinality->estimated_cardinality);
|
396
|
+
info.AddToMetric<idx_t>(MetricsType::OPERATOR_ROWS_SCANNED, cardinality->estimated_cardinality);
|
410
397
|
}
|
411
398
|
}
|
412
399
|
}
|
413
400
|
}
|
414
|
-
if (profiler.
|
415
|
-
|
401
|
+
if (ProfilingInfo::Enabled(profiler.settings, MetricsType::RESULT_SET_SIZE)) {
|
402
|
+
info.AddToMetric<idx_t>(MetricsType::RESULT_SET_SIZE, node.second.result_set_size);
|
416
403
|
}
|
417
404
|
}
|
418
405
|
profiler.timings.clear();
|
@@ -420,10 +407,15 @@ void QueryProfiler::Flush(OperatorProfiler &profiler) {
|
|
420
407
|
|
421
408
|
void QueryProfiler::SetInfo(const double &blocked_thread_time) {
|
422
409
|
lock_guard<mutex> guard(flush_lock);
|
423
|
-
if (!IsEnabled() || !running
|
410
|
+
if (!IsEnabled() || !running) {
|
424
411
|
return;
|
425
412
|
}
|
426
413
|
|
414
|
+
auto &info = root->GetProfilingInfo();
|
415
|
+
auto metric_enabled = info.Enabled(info.expanded_settings, MetricsType::BLOCKED_THREAD_TIME);
|
416
|
+
if (!metric_enabled) {
|
417
|
+
return;
|
418
|
+
}
|
427
419
|
query_info.blocked_thread_time = blocked_thread_time;
|
428
420
|
}
|
429
421
|
|
@@ -701,8 +693,8 @@ profiler_settings_t EraseQueryRootSettings(profiler_settings_t settings) {
|
|
701
693
|
return settings;
|
702
694
|
}
|
703
695
|
|
704
|
-
unique_ptr<ProfilingNode> QueryProfiler::CreateTree(const PhysicalOperator &root_p, profiler_settings_t settings,
|
705
|
-
idx_t depth) {
|
696
|
+
unique_ptr<ProfilingNode> QueryProfiler::CreateTree(const PhysicalOperator &root_p, const profiler_settings_t &settings,
|
697
|
+
const idx_t depth) {
|
706
698
|
if (OperatorRequiresProfiling(root_p.type)) {
|
707
699
|
query_requires_profiling = true;
|
708
700
|
}
|
@@ -718,11 +710,8 @@ unique_ptr<ProfilingNode> QueryProfiler::CreateTree(const PhysicalOperator &root
|
|
718
710
|
|
719
711
|
if (depth != 0) {
|
720
712
|
info.AddToMetric<uint8_t>(MetricsType::OPERATOR_TYPE, static_cast<uint8_t>(root_p.type));
|
721
|
-
if (info.Enabled(MetricsType::QUERY_NAME)) {
|
722
|
-
info.settings.erase(MetricsType::QUERY_NAME);
|
723
|
-
}
|
724
713
|
}
|
725
|
-
if (info.Enabled(MetricsType::EXTRA_INFO)) {
|
714
|
+
if (info.Enabled(info.settings, MetricsType::EXTRA_INFO)) {
|
726
715
|
info.extra_info = root_p.ParamsToString();
|
727
716
|
}
|
728
717
|
|
@@ -769,10 +758,11 @@ void QueryProfiler::Print() {
|
|
769
758
|
void QueryProfiler::MoveOptimizerPhasesToRoot() {
|
770
759
|
auto &root_info = root->GetProfilingInfo();
|
771
760
|
auto &root_metrics = root_info.metrics;
|
761
|
+
|
772
762
|
for (auto &entry : phase_timings) {
|
773
763
|
auto &phase = entry.first;
|
774
764
|
auto &timing = entry.second;
|
775
|
-
if (root_info.Enabled(phase)) {
|
765
|
+
if (root_info.Enabled(root_info.expanded_settings, phase)) {
|
776
766
|
root_metrics[phase] = Value::CreateValue(timing);
|
777
767
|
}
|
778
768
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#include "duckdb/main/relation/read_csv_relation.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/execution/operator/csv_scanner/csv_buffer_manager.hpp"
|
4
|
-
#include "duckdb/execution/operator/csv_scanner/csv_sniffer.hpp"
|
4
|
+
#include "duckdb/execution/operator/csv_scanner/sniffer/csv_sniffer.hpp"
|
5
5
|
#include "duckdb/parser/expression/columnref_expression.hpp"
|
6
6
|
#include "duckdb/parser/expression/comparison_expression.hpp"
|
7
7
|
#include "duckdb/parser/expression/constant_expression.hpp"
|
@@ -87,7 +87,8 @@ void KeyValueSecret::Serialize(Serializer &serializer) const {
|
|
87
87
|
map_values.push_back(Value::STRUCT(map_struct));
|
88
88
|
}
|
89
89
|
|
90
|
-
|
90
|
+
// Warning: the secret map is serialized into a single MAP value with type ANY
|
91
|
+
auto map_type = LogicalType::MAP(LogicalType::VARCHAR, LogicalType::ANY);
|
91
92
|
auto map = Value::MAP(ListType::GetChildType(map_type), map_values);
|
92
93
|
serializer.WriteProperty(201, "secret_map", map);
|
93
94
|
|
@@ -97,6 +97,20 @@ unique_ptr<BaseSecret> SecretManager::DeserializeSecret(Deserializer &deserializ
|
|
97
97
|
vector<string> scope;
|
98
98
|
deserializer.ReadList(103, "scope",
|
99
99
|
[&](Deserializer::List &list, idx_t i) { scope.push_back(list.ReadElement<string>()); });
|
100
|
+
auto serialization_type =
|
101
|
+
deserializer.ReadPropertyWithExplicitDefault(104, "serialization_type", SecretSerializationType::CUSTOM);
|
102
|
+
|
103
|
+
switch (serialization_type) {
|
104
|
+
// This allows us to skip looking up the secret type for deserialization altogether
|
105
|
+
case SecretSerializationType::KEY_VALUE_SECRET:
|
106
|
+
return KeyValueSecret::Deserialize<KeyValueSecret>(deserializer, {scope, type, provider, name});
|
107
|
+
// Continues below: we need to do a type lookup to find the secret deserialize method
|
108
|
+
case SecretSerializationType::CUSTOM:
|
109
|
+
break;
|
110
|
+
default:
|
111
|
+
throw IOException("Unrecognized secret serialization type found in secret '%s': %s", secret_path,
|
112
|
+
EnumUtil::ToString(serialization_type));
|
113
|
+
}
|
100
114
|
|
101
115
|
SecretType deserialized_type;
|
102
116
|
if (!TryLookupTypeInternal(type, deserialized_type)) {
|
@@ -39,8 +39,10 @@ unique_ptr<LogicalOperator> CTEFilterPusher::Optimize(unique_ptr<LogicalOperator
|
|
39
39
|
void CTEFilterPusher::FindCandidates(LogicalOperator &op) {
|
40
40
|
if (op.type == LogicalOperatorType::LOGICAL_MATERIALIZED_CTE) {
|
41
41
|
// We encountered a new CTE, add it to the map
|
42
|
-
|
43
|
-
|
42
|
+
auto key = to_string(op.Cast<LogicalMaterializedCTE>().table_index);
|
43
|
+
auto value = make_uniq<MaterializedCTEInfo>(op);
|
44
|
+
|
45
|
+
cte_info_map.insert(key, std::move(value));
|
44
46
|
} else if (op.type == LogicalOperatorType::LOGICAL_FILTER &&
|
45
47
|
op.children[0]->type == LogicalOperatorType::LOGICAL_CTE_REF) {
|
46
48
|
// We encountered a filtered CTE ref, update the according CTE info
|
@@ -81,13 +81,6 @@ unique_ptr<LogicalOperator> Deliminator::Optimize(unique_ptr<LogicalOperator> op
|
|
81
81
|
if (candidate.joins.size() == candidate.delim_get_count && all_removed) {
|
82
82
|
delim_join.type = LogicalOperatorType::LOGICAL_COMPARISON_JOIN;
|
83
83
|
delim_join.duplicate_eliminated_columns.clear();
|
84
|
-
if (all_equality_conditions) {
|
85
|
-
for (auto &cond : delim_join.conditions) {
|
86
|
-
if (IsEqualityJoinCondition(cond)) {
|
87
|
-
cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM;
|
88
|
-
}
|
89
|
-
}
|
90
|
-
}
|
91
84
|
}
|
92
85
|
|
93
86
|
// Only DelimJoins are ever created as SINGLE joins,
|
@@ -6,12 +6,19 @@
|
|
6
6
|
#include "duckdb/planner/expression/bound_operator_expression.hpp"
|
7
7
|
#include "duckdb/planner/operator/logical_column_data_get.hpp"
|
8
8
|
#include "duckdb/planner/operator/logical_comparison_join.hpp"
|
9
|
+
#include "duckdb/planner/operator/logical_get.hpp"
|
9
10
|
#include "duckdb/execution/expression_executor.hpp"
|
10
11
|
|
11
12
|
namespace duckdb {
|
12
13
|
|
13
14
|
unique_ptr<LogicalOperator> InClauseRewriter::Rewrite(unique_ptr<LogicalOperator> op) {
|
14
15
|
if (op->children.size() == 1) {
|
16
|
+
if (op->children[0]->type == LogicalOperatorType::LOGICAL_GET) {
|
17
|
+
auto &get = op->children[0]->Cast<LogicalGet>();
|
18
|
+
if (get.function.to_string && get.function.to_string(get.bind_data.get()) == "REMOTE") {
|
19
|
+
return op;
|
20
|
+
}
|
21
|
+
}
|
15
22
|
root = std::move(op->children[0]);
|
16
23
|
VisitOperatorExpressions(*op);
|
17
24
|
op->children[0] = std::move(root);
|
@@ -31,7 +31,7 @@ static bool FilterRemovesNull(ClientContext &context, ExpressionRewriter &rewrit
|
|
31
31
|
unordered_set<idx_t> &right_bindings) {
|
32
32
|
// make a copy of the expression
|
33
33
|
auto copy = expr->Copy();
|
34
|
-
// replace all BoundColumnRef expressions
|
34
|
+
// replace all BoundColumnRef expressions from the RHS with NULL constants in the copied expression
|
35
35
|
copy = ReplaceColRefWithNull(std::move(copy), right_bindings);
|
36
36
|
|
37
37
|
// attempt to flatten the expression by running the expression rewriter on it
|
@@ -97,6 +97,9 @@ unique_ptr<LogicalOperator> FilterPushdown::PushdownLeftJoin(unique_ptr<LogicalO
|
|
97
97
|
// bindings match right side or both sides: we cannot directly push it into the right
|
98
98
|
// however, if the filter removes rows with null values from the RHS we can turn the left outer join
|
99
99
|
// in an inner join, and then push down as we would push down an inner join
|
100
|
+
// Edit: This is only possible if the bindings match BOTH sides, so the filter can be pushed down to both
|
101
|
+
// children. If the filter can only be applied to the right side, and the filter filters
|
102
|
+
// all tuples, then the inner join cannot be converted.
|
100
103
|
if (FilterRemovesNull(optimizer.context, optimizer.rewriter, filters[i]->filter.get(), right_bindings)) {
|
101
104
|
// the filter removes NULL values, turn it into an inner join
|
102
105
|
join.join_type = JoinType::INNER;
|
@@ -1,13 +1,13 @@
|
|
1
1
|
#include "duckdb/optimizer/unnest_rewriter.hpp"
|
2
2
|
|
3
3
|
#include "duckdb/common/pair.hpp"
|
4
|
-
#include "duckdb/planner/
|
4
|
+
#include "duckdb/planner/expression/bound_columnref_expression.hpp"
|
5
|
+
#include "duckdb/planner/expression/bound_unnest_expression.hpp"
|
5
6
|
#include "duckdb/planner/operator/logical_comparison_join.hpp"
|
6
|
-
#include "duckdb/planner/operator/
|
7
|
+
#include "duckdb/planner/operator/logical_delim_get.hpp"
|
7
8
|
#include "duckdb/planner/operator/logical_projection.hpp"
|
9
|
+
#include "duckdb/planner/operator/logical_unnest.hpp"
|
8
10
|
#include "duckdb/planner/operator/logical_window.hpp"
|
9
|
-
#include "duckdb/planner/expression/bound_unnest_expression.hpp"
|
10
|
-
#include "duckdb/planner/expression/bound_columnref_expression.hpp"
|
11
11
|
|
12
12
|
namespace duckdb {
|
13
13
|
|
@@ -35,8 +35,8 @@ void UnnestRewriterPlanUpdater::VisitExpression(unique_ptr<Expression> *expressi
|
|
35
35
|
unique_ptr<LogicalOperator> UnnestRewriter::Optimize(unique_ptr<LogicalOperator> op) {
|
36
36
|
|
37
37
|
UnnestRewriterPlanUpdater updater;
|
38
|
-
vector<unique_ptr<LogicalOperator
|
39
|
-
FindCandidates(
|
38
|
+
vector<reference<unique_ptr<LogicalOperator>>> candidates;
|
39
|
+
FindCandidates(op, candidates);
|
40
40
|
|
41
41
|
// rewrite the plan and update the bindings
|
42
42
|
for (auto &candidate : candidates) {
|
@@ -47,7 +47,7 @@ unique_ptr<LogicalOperator> UnnestRewriter::Optimize(unique_ptr<LogicalOperator>
|
|
47
47
|
// update the bindings of the BOUND_UNNEST expression
|
48
48
|
UpdateBoundUnnestBindings(updater, candidate);
|
49
49
|
// update the sequence of LOGICAL_PROJECTION(s)
|
50
|
-
UpdateRHSBindings(
|
50
|
+
UpdateRHSBindings(op, candidate, updater);
|
51
51
|
// reset
|
52
52
|
delim_columns.clear();
|
53
53
|
lhs_bindings.clear();
|
@@ -57,12 +57,11 @@ unique_ptr<LogicalOperator> UnnestRewriter::Optimize(unique_ptr<LogicalOperator>
|
|
57
57
|
return op;
|
58
58
|
}
|
59
59
|
|
60
|
-
void UnnestRewriter::FindCandidates(unique_ptr<LogicalOperator>
|
61
|
-
vector<unique_ptr<LogicalOperator
|
62
|
-
auto op = op_ptr->get();
|
60
|
+
void UnnestRewriter::FindCandidates(unique_ptr<LogicalOperator> &op,
|
61
|
+
vector<reference<unique_ptr<LogicalOperator>>> &candidates) {
|
63
62
|
// search children before adding, so that we add candidates bottom-up
|
64
63
|
for (auto &child : op->children) {
|
65
|
-
FindCandidates(
|
64
|
+
FindCandidates(child, candidates);
|
66
65
|
}
|
67
66
|
|
68
67
|
// search for operator that has a LOGICAL_DELIM_JOIN as its child
|
@@ -100,14 +99,15 @@ void UnnestRewriter::FindCandidates(unique_ptr<LogicalOperator> *op_ptr,
|
|
100
99
|
curr_op = &curr_op->get()->children[0];
|
101
100
|
}
|
102
101
|
|
103
|
-
if (curr_op->get()->type == LogicalOperatorType::LOGICAL_UNNEST
|
104
|
-
|
102
|
+
if (curr_op->get()->type == LogicalOperatorType::LOGICAL_UNNEST &&
|
103
|
+
curr_op->get()->children[0]->type == LogicalOperatorType::LOGICAL_DELIM_GET) {
|
104
|
+
candidates.push_back(op);
|
105
105
|
}
|
106
106
|
}
|
107
107
|
|
108
|
-
bool UnnestRewriter::RewriteCandidate(unique_ptr<LogicalOperator>
|
108
|
+
bool UnnestRewriter::RewriteCandidate(unique_ptr<LogicalOperator> &candidate) {
|
109
109
|
|
110
|
-
auto &topmost_op =
|
110
|
+
auto &topmost_op = *candidate;
|
111
111
|
if (topmost_op.type != LogicalOperatorType::LOGICAL_PROJECTION &&
|
112
112
|
topmost_op.type != LogicalOperatorType::LOGICAL_WINDOW &&
|
113
113
|
topmost_op.type != LogicalOperatorType::LOGICAL_FILTER &&
|
@@ -158,10 +158,10 @@ bool UnnestRewriter::RewriteCandidate(unique_ptr<LogicalOperator> *candidate) {
|
|
158
158
|
return true;
|
159
159
|
}
|
160
160
|
|
161
|
-
void UnnestRewriter::UpdateRHSBindings(unique_ptr<LogicalOperator>
|
161
|
+
void UnnestRewriter::UpdateRHSBindings(unique_ptr<LogicalOperator> &plan, unique_ptr<LogicalOperator> &candidate,
|
162
162
|
UnnestRewriterPlanUpdater &updater) {
|
163
163
|
|
164
|
-
auto &topmost_op =
|
164
|
+
auto &topmost_op = *candidate;
|
165
165
|
idx_t shift = lhs_bindings.size();
|
166
166
|
|
167
167
|
vector<unique_ptr<LogicalOperator> *> path_to_unnest;
|
@@ -189,7 +189,7 @@ void UnnestRewriter::UpdateRHSBindings(unique_ptr<LogicalOperator> *plan_ptr, un
|
|
189
189
|
}
|
190
190
|
|
191
191
|
// update all bindings by shifting them
|
192
|
-
updater.VisitOperator(*
|
192
|
+
updater.VisitOperator(*plan);
|
193
193
|
updater.replace_bindings.clear();
|
194
194
|
|
195
195
|
// update all bindings coming from the LHS to RHS bindings
|
@@ -212,7 +212,7 @@ void UnnestRewriter::UpdateRHSBindings(unique_ptr<LogicalOperator> *plan_ptr, un
|
|
212
212
|
unnest.expressions.clear();
|
213
213
|
unnest.children.clear();
|
214
214
|
// update the bindings of the plan
|
215
|
-
updater.VisitOperator(*
|
215
|
+
updater.VisitOperator(*plan);
|
216
216
|
updater.replace_bindings.clear();
|
217
217
|
// add the children again
|
218
218
|
for (auto &temp_bound_unnest : temp_bound_unnests) {
|
@@ -253,9 +253,9 @@ void UnnestRewriter::UpdateRHSBindings(unique_ptr<LogicalOperator> *plan_ptr, un
|
|
253
253
|
}
|
254
254
|
|
255
255
|
void UnnestRewriter::UpdateBoundUnnestBindings(UnnestRewriterPlanUpdater &updater,
|
256
|
-
unique_ptr<LogicalOperator>
|
256
|
+
unique_ptr<LogicalOperator> &candidate) {
|
257
257
|
|
258
|
-
auto &topmost_op =
|
258
|
+
auto &topmost_op = *candidate;
|
259
259
|
|
260
260
|
// traverse LOGICAL_PROJECTION(s)
|
261
261
|
auto curr_op = &topmost_op.children[0];
|
@@ -335,8 +335,13 @@ idx_t TaskScheduler::GetEstimatedCPUId() {
|
|
335
335
|
#elif defined(_GNU_SOURCE)
|
336
336
|
auto cpu = sched_getcpu();
|
337
337
|
if (cpu < 0) {
|
338
|
+
#ifndef DUCKDB_NO_THREADS
|
338
339
|
// fallback to thread id
|
339
340
|
return (idx_t)std::hash<std::thread::id>()(std::this_thread::get_id());
|
341
|
+
#else
|
342
|
+
|
343
|
+
return 0;
|
344
|
+
#endif
|
340
345
|
}
|
341
346
|
return (idx_t)cpu;
|
342
347
|
#elif defined(__aarch64__) && defined(__APPLE__)
|
@@ -345,8 +350,12 @@ idx_t TaskScheduler::GetEstimatedCPUId() {
|
|
345
350
|
asm volatile("mrs %x0, tpidrro_el0" : "=r"(c)::"memory");
|
346
351
|
return (idx_t)(c & (1 << 3) - 1);
|
347
352
|
#else
|
353
|
+
#ifndef DUCKDB_NO_THREADS
|
348
354
|
// fallback to thread id
|
349
355
|
return (idx_t)std::hash<std::thread::id>()(std::this_thread::get_id());
|
356
|
+
#else
|
357
|
+
return 0;
|
358
|
+
#endif
|
350
359
|
#endif
|
351
360
|
#endif
|
352
361
|
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#include "duckdb/parser/parsed_data/exported_table_data.hpp"
|
2
|
+
#include "duckdb/catalog/catalog.hpp"
|
3
|
+
|
4
|
+
namespace duckdb {
|
5
|
+
|
6
|
+
ExportedTableInfo::ExportedTableInfo(TableCatalogEntry &entry, ExportedTableData table_data_p,
|
7
|
+
vector<string> ¬_null_columns_p)
|
8
|
+
: entry(entry), table_data(std::move(table_data_p)) {
|
9
|
+
table_data.not_null_columns = not_null_columns_p;
|
10
|
+
}
|
11
|
+
|
12
|
+
ExportedTableInfo::ExportedTableInfo(ClientContext &context, ExportedTableData table_data_p)
|
13
|
+
: entry(GetEntry(context, table_data_p)), table_data(std::move(table_data_p)) {
|
14
|
+
}
|
15
|
+
|
16
|
+
TableCatalogEntry &ExportedTableInfo::GetEntry(ClientContext &context, const ExportedTableData &table_data) {
|
17
|
+
return Catalog::GetEntry(context, CatalogType::TABLE_ENTRY, table_data.database_name, table_data.schema_name,
|
18
|
+
table_data.table_name)
|
19
|
+
.Cast<TableCatalogEntry>();
|
20
|
+
}
|
21
|
+
|
22
|
+
} // namespace duckdb
|
@@ -98,8 +98,10 @@ string InsertStatement::ToString() const {
|
|
98
98
|
auto values_list = GetValuesList();
|
99
99
|
if (values_list) {
|
100
100
|
D_ASSERT(!default_values);
|
101
|
+
auto saved_alias = values_list->alias;
|
101
102
|
values_list->alias = string();
|
102
103
|
result += values_list->ToString();
|
104
|
+
values_list->alias = saved_alias;
|
103
105
|
} else if (select_statement) {
|
104
106
|
D_ASSERT(!default_values);
|
105
107
|
result += select_statement->ToString();
|
@@ -154,7 +156,11 @@ string InsertStatement::ToString() const {
|
|
154
156
|
if (i > 0) {
|
155
157
|
result += ", ";
|
156
158
|
}
|
157
|
-
|
159
|
+
auto column = returning_list[i]->ToString();
|
160
|
+
if (!returning_list[i]->alias.empty()) {
|
161
|
+
column += StringUtil::Format(" AS %s", KeywordHelper::WriteOptionallyQuoted(returning_list[i]->alias));
|
162
|
+
}
|
163
|
+
result += column;
|
158
164
|
}
|
159
165
|
}
|
160
166
|
return result;
|
@@ -11,7 +11,7 @@ static unique_ptr<ParsedExpression> TransformBooleanTestInternal(unique_ptr<Pars
|
|
11
11
|
int query_location) {
|
12
12
|
auto bool_value = make_uniq<ConstantExpression>(Value::BOOLEAN(comparison_value));
|
13
13
|
Transformer::SetQueryLocation(*bool_value, query_location);
|
14
|
-
// we cast the argument to bool to remove ambiguity wrt function binding on the
|
14
|
+
// we cast the argument to bool to remove ambiguity wrt function binding on the comparison
|
15
15
|
auto cast_argument = make_uniq<CastExpression>(LogicalType::BOOLEAN, std::move(argument));
|
16
16
|
|
17
17
|
auto result = make_uniq<ComparisonExpression>(comparison_type, std::move(cast_argument), std::move(bool_value));
|