duckdb 1.1.2-dev4.0 → 1.1.3
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/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
@@ -22,7 +22,7 @@ idx_t Bit::ComputeBitstringLen(idx_t len) {
|
|
22
22
|
return result;
|
23
23
|
}
|
24
24
|
|
25
|
-
static inline idx_t GetBitPadding(const
|
25
|
+
static inline idx_t GetBitPadding(const bitstring_t &bit_string) {
|
26
26
|
auto data = const_data_ptr_cast(bit_string.GetData());
|
27
27
|
D_ASSERT(idx_t(data[0]) <= 8);
|
28
28
|
return data[0];
|
@@ -37,14 +37,14 @@ static inline idx_t GetBitSize(const string_t &str) {
|
|
37
37
|
return str_len;
|
38
38
|
}
|
39
39
|
|
40
|
-
uint8_t Bit::GetFirstByte(const
|
40
|
+
uint8_t Bit::GetFirstByte(const bitstring_t &str) {
|
41
41
|
D_ASSERT(str.GetSize() > 1);
|
42
42
|
|
43
43
|
auto data = const_data_ptr_cast(str.GetData());
|
44
44
|
return data[1] & ((1 << (8 - data[0])) - 1);
|
45
45
|
}
|
46
46
|
|
47
|
-
void Bit::Finalize(
|
47
|
+
void Bit::Finalize(bitstring_t &str) {
|
48
48
|
// bit strings require all padding bits to be set to 1
|
49
49
|
// this method sets all padding bits to 1
|
50
50
|
auto padding = GetBitPadding(str);
|
@@ -55,7 +55,7 @@ void Bit::Finalize(string_t &str) {
|
|
55
55
|
Bit::Verify(str);
|
56
56
|
}
|
57
57
|
|
58
|
-
void Bit::SetEmptyBitString(
|
58
|
+
void Bit::SetEmptyBitString(bitstring_t &target, string_t &input) {
|
59
59
|
char *res_buf = target.GetDataWriteable();
|
60
60
|
const char *buf = input.GetData();
|
61
61
|
memset(res_buf, 0, input.GetSize());
|
@@ -63,7 +63,7 @@ void Bit::SetEmptyBitString(string_t &target, string_t &input) {
|
|
63
63
|
Bit::Finalize(target);
|
64
64
|
}
|
65
65
|
|
66
|
-
void Bit::SetEmptyBitString(
|
66
|
+
void Bit::SetEmptyBitString(bitstring_t &target, idx_t len) {
|
67
67
|
char *res_buf = target.GetDataWriteable();
|
68
68
|
memset(res_buf, 0, target.GetSize());
|
69
69
|
res_buf[0] = ComputePadding(len);
|
@@ -71,7 +71,7 @@ void Bit::SetEmptyBitString(string_t &target, idx_t len) {
|
|
71
71
|
}
|
72
72
|
|
73
73
|
// **** casting functions ****
|
74
|
-
void Bit::ToString(
|
74
|
+
void Bit::ToString(bitstring_t bits, char *output) {
|
75
75
|
auto data = const_data_ptr_cast(bits.GetData());
|
76
76
|
auto len = bits.GetSize();
|
77
77
|
|
@@ -87,7 +87,7 @@ void Bit::ToString(string_t bits, char *output) {
|
|
87
87
|
}
|
88
88
|
}
|
89
89
|
|
90
|
-
string Bit::ToString(
|
90
|
+
string Bit::ToString(bitstring_t str) {
|
91
91
|
auto len = BitLength(str);
|
92
92
|
auto buffer = make_unsafe_uniq_array_uninitialized<char>(len);
|
93
93
|
ToString(str, buffer.get());
|
@@ -117,7 +117,7 @@ bool Bit::TryGetBitStringSize(string_t str, idx_t &str_len, string *error_messag
|
|
117
117
|
return true;
|
118
118
|
}
|
119
119
|
|
120
|
-
void Bit::ToBit(string_t str,
|
120
|
+
void Bit::ToBit(string_t str, bitstring_t &output_str) {
|
121
121
|
auto data = const_data_ptr_cast(str.GetData());
|
122
122
|
auto len = str.GetSize();
|
123
123
|
auto output = output_str.GetDataWriteable();
|
@@ -151,12 +151,12 @@ void Bit::ToBit(string_t str, string_t &output_str) {
|
|
151
151
|
string Bit::ToBit(string_t str) {
|
152
152
|
auto bit_len = GetBitSize(str);
|
153
153
|
auto buffer = make_unsafe_uniq_array_uninitialized<char>(bit_len);
|
154
|
-
|
154
|
+
bitstring_t output_str(buffer.get(), UnsafeNumericCast<uint32_t>(bit_len));
|
155
155
|
Bit::ToBit(str, output_str);
|
156
156
|
return output_str.GetString();
|
157
157
|
}
|
158
158
|
|
159
|
-
void Bit::BlobToBit(string_t blob,
|
159
|
+
void Bit::BlobToBit(string_t blob, bitstring_t &output_str) {
|
160
160
|
auto data = const_data_ptr_cast(blob.GetData());
|
161
161
|
auto output = output_str.GetDataWriteable();
|
162
162
|
idx_t size = blob.GetSize();
|
@@ -167,12 +167,12 @@ void Bit::BlobToBit(string_t blob, string_t &output_str) {
|
|
167
167
|
|
168
168
|
string Bit::BlobToBit(string_t blob) {
|
169
169
|
auto buffer = make_unsafe_uniq_array_uninitialized<char>(blob.GetSize() + 1);
|
170
|
-
|
170
|
+
bitstring_t output_str(buffer.get(), UnsafeNumericCast<uint32_t>(blob.GetSize() + 1));
|
171
171
|
Bit::BlobToBit(blob, output_str);
|
172
172
|
return output_str.GetString();
|
173
173
|
}
|
174
174
|
|
175
|
-
void Bit::BitToBlob(
|
175
|
+
void Bit::BitToBlob(bitstring_t bit, string_t &output_blob) {
|
176
176
|
D_ASSERT(bit.GetSize() == output_blob.GetSize() + 1);
|
177
177
|
|
178
178
|
auto data = const_data_ptr_cast(bit.GetData());
|
@@ -189,7 +189,7 @@ void Bit::BitToBlob(string_t bit, string_t &output_blob) {
|
|
189
189
|
}
|
190
190
|
}
|
191
191
|
|
192
|
-
string Bit::BitToBlob(
|
192
|
+
string Bit::BitToBlob(bitstring_t bit) {
|
193
193
|
D_ASSERT(bit.GetSize() > 1);
|
194
194
|
|
195
195
|
auto buffer = make_unsafe_uniq_array_uninitialized<char>(bit.GetSize() - 1);
|
@@ -199,32 +199,53 @@ string Bit::BitToBlob(string_t bit) {
|
|
199
199
|
}
|
200
200
|
|
201
201
|
// **** scalar functions ****
|
202
|
-
void Bit::BitString(const string_t &input,
|
202
|
+
void Bit::BitString(const string_t &input, idx_t bit_length, bitstring_t &result) {
|
203
203
|
char *res_buf = result.GetDataWriteable();
|
204
204
|
const char *buf = input.GetData();
|
205
205
|
|
206
206
|
auto padding = ComputePadding(bit_length);
|
207
207
|
res_buf[0] = padding;
|
208
|
+
auto padding_len = UnsafeNumericCast<idx_t>(padding);
|
208
209
|
for (idx_t i = 0; i < bit_length; i++) {
|
209
210
|
if (i < bit_length - input.GetSize()) {
|
210
|
-
Bit::
|
211
|
+
Bit::SetBitInternal(result, i + padding_len, 0);
|
211
212
|
} else {
|
212
213
|
idx_t bit = buf[i - (bit_length - input.GetSize())] == '1' ? 1 : 0;
|
214
|
+
Bit::SetBitInternal(result, i + padding_len, bit);
|
215
|
+
}
|
216
|
+
}
|
217
|
+
Bit::Finalize(result);
|
218
|
+
}
|
219
|
+
|
220
|
+
void Bit::ExtendBitString(const bitstring_t &input, idx_t bit_length, bitstring_t &result) {
|
221
|
+
uint8_t *res_buf = reinterpret_cast<uint8_t *>(result.GetDataWriteable());
|
222
|
+
|
223
|
+
auto padding = ComputePadding(bit_length);
|
224
|
+
res_buf[0] = static_cast<uint8_t>(padding);
|
225
|
+
|
226
|
+
idx_t original_length = Bit::BitLength(input);
|
227
|
+
D_ASSERT(bit_length >= original_length);
|
228
|
+
idx_t shift = bit_length - original_length;
|
229
|
+
for (idx_t i = 0; i < bit_length; i++) {
|
230
|
+
if (i < shift) {
|
231
|
+
Bit::SetBit(result, i, 0);
|
232
|
+
} else {
|
233
|
+
idx_t bit = Bit::GetBit(input, i - shift);
|
213
234
|
Bit::SetBit(result, i, bit);
|
214
235
|
}
|
215
236
|
}
|
216
237
|
Bit::Finalize(result);
|
217
238
|
}
|
218
239
|
|
219
|
-
idx_t Bit::BitLength(
|
240
|
+
idx_t Bit::BitLength(bitstring_t bits) {
|
220
241
|
return ((bits.GetSize() - 1) * 8) - GetBitPadding(bits);
|
221
242
|
}
|
222
243
|
|
223
|
-
idx_t Bit::OctetLength(
|
244
|
+
idx_t Bit::OctetLength(bitstring_t bits) {
|
224
245
|
return bits.GetSize() - 1;
|
225
246
|
}
|
226
247
|
|
227
|
-
idx_t Bit::BitCount(
|
248
|
+
idx_t Bit::BitCount(bitstring_t bits) {
|
228
249
|
idx_t count = 0;
|
229
250
|
const char *buf = bits.GetData();
|
230
251
|
for (idx_t byte_idx = 1; byte_idx < OctetLength(bits) + 1; byte_idx++) {
|
@@ -235,7 +256,7 @@ idx_t Bit::BitCount(string_t bits) {
|
|
235
256
|
return count - GetBitPadding(bits);
|
236
257
|
}
|
237
258
|
|
238
|
-
idx_t Bit::BitPosition(
|
259
|
+
idx_t Bit::BitPosition(bitstring_t substring, bitstring_t bits) {
|
239
260
|
const char *buf = bits.GetData();
|
240
261
|
auto len = bits.GetSize();
|
241
262
|
auto substr_len = BitLength(substring);
|
@@ -269,7 +290,7 @@ idx_t Bit::BitPosition(string_t substring, string_t bits) {
|
|
269
290
|
return 0;
|
270
291
|
}
|
271
292
|
|
272
|
-
idx_t Bit::GetBit(
|
293
|
+
idx_t Bit::GetBit(bitstring_t bit_string, idx_t n) {
|
273
294
|
return Bit::GetBitInternal(bit_string, n + GetBitPadding(bit_string));
|
274
295
|
}
|
275
296
|
|
@@ -277,7 +298,7 @@ idx_t Bit::GetBitIndex(idx_t n) {
|
|
277
298
|
return n / 8 + 1;
|
278
299
|
}
|
279
300
|
|
280
|
-
idx_t Bit::GetBitInternal(
|
301
|
+
idx_t Bit::GetBitInternal(bitstring_t bit_string, idx_t n) {
|
281
302
|
const char *buf = bit_string.GetData();
|
282
303
|
auto idx = Bit::GetBitIndex(n);
|
283
304
|
D_ASSERT(idx < bit_string.GetSize());
|
@@ -285,12 +306,12 @@ idx_t Bit::GetBitInternal(string_t bit_string, idx_t n) {
|
|
285
306
|
return (byte & 1 ? 1 : 0);
|
286
307
|
}
|
287
308
|
|
288
|
-
void Bit::SetBit(
|
309
|
+
void Bit::SetBit(bitstring_t &bit_string, idx_t n, idx_t new_value) {
|
289
310
|
SetBitInternal(bit_string, n + GetBitPadding(bit_string), new_value);
|
290
311
|
Bit::Finalize(bit_string);
|
291
312
|
}
|
292
313
|
|
293
|
-
void Bit::SetBitInternal(
|
314
|
+
void Bit::SetBitInternal(bitstring_t &bit_string, idx_t n, idx_t new_value) {
|
294
315
|
uint8_t *buf = reinterpret_cast<uint8_t *>(bit_string.GetDataWriteable());
|
295
316
|
|
296
317
|
auto idx = Bit::GetBitIndex(n);
|
@@ -305,39 +326,41 @@ void Bit::SetBitInternal(string_t &bit_string, idx_t n, idx_t new_value) {
|
|
305
326
|
}
|
306
327
|
|
307
328
|
// **** BITWISE operators ****
|
308
|
-
void Bit::RightShift(const
|
329
|
+
void Bit::RightShift(const bitstring_t &bit_string, idx_t shift, bitstring_t &result) {
|
309
330
|
uint8_t *res_buf = reinterpret_cast<uint8_t *>(result.GetDataWriteable());
|
310
331
|
const uint8_t *buf = reinterpret_cast<const uint8_t *>(bit_string.GetData());
|
311
332
|
|
312
333
|
res_buf[0] = buf[0];
|
334
|
+
auto padding = GetBitPadding(result);
|
313
335
|
for (idx_t i = 0; i < Bit::BitLength(result); i++) {
|
314
336
|
if (i < shift) {
|
315
|
-
Bit::
|
337
|
+
Bit::SetBitInternal(result, i + padding, 0);
|
316
338
|
} else {
|
317
339
|
idx_t bit = Bit::GetBit(bit_string, i - shift);
|
318
|
-
Bit::
|
340
|
+
Bit::SetBitInternal(result, i + padding, bit);
|
319
341
|
}
|
320
342
|
}
|
321
343
|
Bit::Finalize(result);
|
322
344
|
}
|
323
345
|
|
324
|
-
void Bit::LeftShift(const
|
346
|
+
void Bit::LeftShift(const bitstring_t &bit_string, idx_t shift, bitstring_t &result) {
|
325
347
|
uint8_t *res_buf = reinterpret_cast<uint8_t *>(result.GetDataWriteable());
|
326
348
|
const uint8_t *buf = reinterpret_cast<const uint8_t *>(bit_string.GetData());
|
327
349
|
|
328
350
|
res_buf[0] = buf[0];
|
351
|
+
auto padding = GetBitPadding(result);
|
329
352
|
for (idx_t i = 0; i < Bit::BitLength(bit_string); i++) {
|
330
353
|
if (i < (Bit::BitLength(bit_string) - shift)) {
|
331
354
|
idx_t bit = Bit::GetBit(bit_string, shift + i);
|
332
|
-
Bit::
|
355
|
+
Bit::SetBitInternal(result, i + padding, bit);
|
333
356
|
} else {
|
334
|
-
Bit::
|
357
|
+
Bit::SetBitInternal(result, i + padding, 0);
|
335
358
|
}
|
336
359
|
}
|
337
360
|
Bit::Finalize(result);
|
338
361
|
}
|
339
362
|
|
340
|
-
void Bit::BitwiseAnd(const
|
363
|
+
void Bit::BitwiseAnd(const bitstring_t &rhs, const bitstring_t &lhs, bitstring_t &result) {
|
341
364
|
if (Bit::BitLength(lhs) != Bit::BitLength(rhs)) {
|
342
365
|
throw InvalidInputException("Cannot AND bit strings of different sizes");
|
343
366
|
}
|
@@ -353,7 +376,7 @@ void Bit::BitwiseAnd(const string_t &rhs, const string_t &lhs, string_t &result)
|
|
353
376
|
Bit::Finalize(result);
|
354
377
|
}
|
355
378
|
|
356
|
-
void Bit::BitwiseOr(const
|
379
|
+
void Bit::BitwiseOr(const bitstring_t &rhs, const bitstring_t &lhs, bitstring_t &result) {
|
357
380
|
if (Bit::BitLength(lhs) != Bit::BitLength(rhs)) {
|
358
381
|
throw InvalidInputException("Cannot OR bit strings of different sizes");
|
359
382
|
}
|
@@ -369,7 +392,7 @@ void Bit::BitwiseOr(const string_t &rhs, const string_t &lhs, string_t &result)
|
|
369
392
|
Bit::Finalize(result);
|
370
393
|
}
|
371
394
|
|
372
|
-
void Bit::BitwiseXor(const
|
395
|
+
void Bit::BitwiseXor(const bitstring_t &rhs, const bitstring_t &lhs, bitstring_t &result) {
|
373
396
|
if (Bit::BitLength(lhs) != Bit::BitLength(rhs)) {
|
374
397
|
throw InvalidInputException("Cannot XOR bit strings of different sizes");
|
375
398
|
}
|
@@ -385,7 +408,7 @@ void Bit::BitwiseXor(const string_t &rhs, const string_t &lhs, string_t &result)
|
|
385
408
|
Bit::Finalize(result);
|
386
409
|
}
|
387
410
|
|
388
|
-
void Bit::BitwiseNot(const
|
411
|
+
void Bit::BitwiseNot(const bitstring_t &input, bitstring_t &result) {
|
389
412
|
uint8_t *result_buf = reinterpret_cast<uint8_t *>(result.GetDataWriteable());
|
390
413
|
const uint8_t *buf = reinterpret_cast<const uint8_t *>(input.GetData());
|
391
414
|
|
@@ -396,7 +419,7 @@ void Bit::BitwiseNot(const string_t &input, string_t &result) {
|
|
396
419
|
Bit::Finalize(result);
|
397
420
|
}
|
398
421
|
|
399
|
-
void Bit::Verify(const
|
422
|
+
void Bit::Verify(const bitstring_t &input) {
|
400
423
|
#ifdef DEBUG
|
401
424
|
// bit strings require all padding bits to be set to 1
|
402
425
|
auto padding = GetBitPadding(input);
|
@@ -26,50 +26,53 @@ DataChunk::~DataChunk() {
|
|
26
26
|
}
|
27
27
|
|
28
28
|
void DataChunk::InitializeEmpty(const vector<LogicalType> &types) {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
29
|
+
D_ASSERT(data.empty());
|
30
|
+
capacity = STANDARD_VECTOR_SIZE;
|
31
|
+
for (idx_t i = 0; i < types.size(); i++) {
|
32
|
+
data.emplace_back(types[i], nullptr);
|
33
|
+
}
|
34
34
|
}
|
35
35
|
|
36
36
|
void DataChunk::Initialize(ClientContext &context, const vector<LogicalType> &types, idx_t capacity_p) {
|
37
37
|
Initialize(Allocator::Get(context), types, capacity_p);
|
38
38
|
}
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
for (auto &vec : data) {
|
44
|
-
total_size += vec.GetAllocationSize(cardinality);
|
45
|
-
}
|
46
|
-
return total_size;
|
40
|
+
void DataChunk::Initialize(Allocator &allocator, const vector<LogicalType> &types, idx_t capacity_p) {
|
41
|
+
auto initialize = vector<bool>(types.size(), true);
|
42
|
+
Initialize(allocator, types, initialize, capacity_p);
|
47
43
|
}
|
48
44
|
|
49
|
-
void DataChunk::Initialize(
|
50
|
-
|
51
|
-
|
52
|
-
|
45
|
+
void DataChunk::Initialize(ClientContext &context, const vector<LogicalType> &types, const vector<bool> &initialize,
|
46
|
+
idx_t capacity_p) {
|
47
|
+
Initialize(Allocator::Get(context), types, initialize, capacity_p);
|
48
|
+
}
|
49
|
+
|
50
|
+
void DataChunk::Initialize(Allocator &allocator, const vector<LogicalType> &types, const vector<bool> &initialize,
|
51
|
+
idx_t capacity_p) {
|
52
|
+
D_ASSERT(types.size() == initialize.size());
|
53
|
+
D_ASSERT(data.empty());
|
54
|
+
|
53
55
|
capacity = capacity_p;
|
54
|
-
for (;
|
55
|
-
|
56
|
+
for (idx_t i = 0; i < types.size(); i++) {
|
57
|
+
if (!initialize[i]) {
|
58
|
+
data.emplace_back(types[i], nullptr);
|
59
|
+
vector_caches.emplace_back();
|
60
|
+
continue;
|
61
|
+
}
|
62
|
+
|
63
|
+
VectorCache cache(allocator, types[i], capacity);
|
56
64
|
data.emplace_back(cache);
|
57
65
|
vector_caches.push_back(std::move(cache));
|
58
66
|
}
|
59
67
|
}
|
60
68
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
void DataChunk::InitializeEmpty(vector<LogicalType>::const_iterator begin, vector<LogicalType>::const_iterator end) {
|
67
|
-
capacity = STANDARD_VECTOR_SIZE;
|
68
|
-
D_ASSERT(data.empty()); // can only be initialized once
|
69
|
-
D_ASSERT(std::distance(begin, end) != 0); // empty chunk not allowed
|
70
|
-
for (; begin != end; begin++) {
|
71
|
-
data.emplace_back(*begin, nullptr);
|
69
|
+
idx_t DataChunk::GetAllocationSize() const {
|
70
|
+
idx_t total_size = 0;
|
71
|
+
auto cardinality = size();
|
72
|
+
for (auto &vec : data) {
|
73
|
+
total_size += vec.GetAllocationSize(cardinality);
|
72
74
|
}
|
75
|
+
return total_size;
|
73
76
|
}
|
74
77
|
|
75
78
|
void DataChunk::Reset() {
|
@@ -118,19 +118,25 @@ private:
|
|
118
118
|
idx_t capacity;
|
119
119
|
};
|
120
120
|
|
121
|
-
VectorCache::VectorCache(
|
121
|
+
VectorCache::VectorCache() : buffer(nullptr) {
|
122
|
+
}
|
123
|
+
|
124
|
+
VectorCache::VectorCache(Allocator &allocator, const LogicalType &type_p, const idx_t capacity_p) {
|
122
125
|
buffer = make_buffer<VectorCacheBuffer>(allocator, type_p, capacity_p);
|
123
126
|
}
|
124
127
|
|
125
128
|
void VectorCache::ResetFromCache(Vector &result) const {
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
+
if (!buffer) {
|
130
|
+
return;
|
131
|
+
}
|
132
|
+
auto &vector_cache = buffer->Cast<VectorCacheBuffer>();
|
133
|
+
vector_cache.ResetFromCache(result, buffer);
|
129
134
|
}
|
130
135
|
|
131
136
|
const LogicalType &VectorCache::GetType() const {
|
132
|
-
|
133
|
-
|
137
|
+
D_ASSERT(buffer);
|
138
|
+
auto &vector_cache = buffer->Cast<VectorCacheBuffer>();
|
139
|
+
return vector_cache.GetType();
|
134
140
|
}
|
135
141
|
|
136
142
|
} // namespace duckdb
|
@@ -167,6 +167,9 @@ static void NestedComparisonExecutor(Vector &left, Vector &right, Vector &result
|
|
167
167
|
auto &result_validity = ConstantVector::Validity(result);
|
168
168
|
SelectionVector true_sel(1);
|
169
169
|
auto match_count = ComparisonSelector::Select<OP>(left, right, nullptr, 1, &true_sel, nullptr, result_validity);
|
170
|
+
// since we are dealing with nested types where the values are not NULL, the result is always valid (i.e true or
|
171
|
+
// false)
|
172
|
+
result_validity.SetAllValid(1);
|
170
173
|
auto result_data = ConstantVector::GetData<bool>(result);
|
171
174
|
result_data[0] = match_count > 0;
|
172
175
|
return;
|
@@ -182,6 +185,10 @@ static void NestedComparisonExecutor(Vector &left, Vector &right, Vector &result
|
|
182
185
|
if (!leftv.validity.AllValid() || !rightv.validity.AllValid()) {
|
183
186
|
ComparesNotNull(leftv, rightv, result_validity, count);
|
184
187
|
}
|
188
|
+
ValidityMask original_mask;
|
189
|
+
original_mask.SetAllValid(count);
|
190
|
+
original_mask.Copy(result_validity, count);
|
191
|
+
|
185
192
|
SelectionVector true_sel(count);
|
186
193
|
SelectionVector false_sel(count);
|
187
194
|
idx_t match_count =
|
@@ -190,12 +197,19 @@ static void NestedComparisonExecutor(Vector &left, Vector &right, Vector &result
|
|
190
197
|
for (idx_t i = 0; i < match_count; ++i) {
|
191
198
|
const auto idx = true_sel.get_index(i);
|
192
199
|
result_data[idx] = true;
|
200
|
+
// if the row was valid during the null check, set it to valid here as well
|
201
|
+
if (original_mask.RowIsValid(idx)) {
|
202
|
+
result_validity.SetValid(idx);
|
203
|
+
}
|
193
204
|
}
|
194
205
|
|
195
206
|
const idx_t no_match_count = count - match_count;
|
196
207
|
for (idx_t i = 0; i < no_match_count; ++i) {
|
197
208
|
const auto idx = false_sel.get_index(i);
|
198
209
|
result_data[idx] = false;
|
210
|
+
if (original_mask.RowIsValid(idx)) {
|
211
|
+
result_validity.SetValid(idx);
|
212
|
+
}
|
199
213
|
}
|
200
214
|
}
|
201
215
|
|
@@ -8,6 +8,8 @@
|
|
8
8
|
#include "duckdb/execution/expression_executor.hpp"
|
9
9
|
#include "duckdb/common/types/cast_helpers.hpp"
|
10
10
|
#include "duckdb/common/operator/subtract.hpp"
|
11
|
+
#include "duckdb/common/serializer/deserializer.hpp"
|
12
|
+
#include "duckdb/common/serializer/serializer.hpp"
|
11
13
|
|
12
14
|
namespace duckdb {
|
13
15
|
|
@@ -43,6 +45,21 @@ struct BitstringAggBindData : public FunctionData {
|
|
43
45
|
}
|
44
46
|
return false;
|
45
47
|
}
|
48
|
+
|
49
|
+
static void Serialize(Serializer &serializer, const optional_ptr<FunctionData> bind_data_p,
|
50
|
+
const AggregateFunction &) {
|
51
|
+
auto &bind_data = bind_data_p->Cast<BitstringAggBindData>();
|
52
|
+
serializer.WriteProperty(100, "min", bind_data.min);
|
53
|
+
serializer.WriteProperty(101, "max", bind_data.max);
|
54
|
+
}
|
55
|
+
|
56
|
+
static unique_ptr<FunctionData> Deserialize(Deserializer &deserializer, AggregateFunction &) {
|
57
|
+
Value min;
|
58
|
+
Value max;
|
59
|
+
deserializer.ReadProperty(100, "min", min);
|
60
|
+
deserializer.ReadProperty(101, "max", max);
|
61
|
+
return make_uniq<BitstringAggBindData>(min, max);
|
62
|
+
}
|
46
63
|
};
|
47
64
|
|
48
65
|
struct BitStringAggOperation {
|
@@ -247,7 +264,9 @@ static void BindBitString(AggregateFunctionSet &bitstring_agg, const LogicalType
|
|
247
264
|
auto function =
|
248
265
|
AggregateFunction::UnaryAggregateDestructor<BitAggState<TYPE>, TYPE, string_t, BitStringAggOperation>(
|
249
266
|
type, LogicalType::BIT);
|
250
|
-
function.bind = BindBitstringAgg;
|
267
|
+
function.bind = BindBitstringAgg; // create new a 'BitstringAggBindData'
|
268
|
+
function.serialize = BitstringAggBindData::Serialize;
|
269
|
+
function.deserialize = BitstringAggBindData::Deserialize;
|
251
270
|
function.statistics = BitstringPropagateStats; // stores min and max from column stats in BitstringAggBindData
|
252
271
|
bitstring_agg.AddFunction(function); // uses the BitstringAggBindData to access statistics for creating bitstring
|
253
272
|
function.arguments = {type, type, type};
|
@@ -315,8 +315,8 @@ static AggregateFunction GetMinMaxOperator(const LogicalType &type) {
|
|
315
315
|
auto internal_type = type.InternalType();
|
316
316
|
switch (internal_type) {
|
317
317
|
case PhysicalType::VARCHAR:
|
318
|
-
return AggregateFunction::UnaryAggregateDestructor<MinMaxStringState, string_t, string_t, OP_STRING>(type
|
319
|
-
type
|
318
|
+
return AggregateFunction::UnaryAggregateDestructor<MinMaxStringState, string_t, string_t, OP_STRING>(type,
|
319
|
+
type);
|
320
320
|
case PhysicalType::LIST:
|
321
321
|
case PhysicalType::STRUCT:
|
322
322
|
case PhysicalType::ARRAY:
|
@@ -48,7 +48,7 @@ struct ApproxTopKValue {
|
|
48
48
|
uint32_t capacity = 0;
|
49
49
|
};
|
50
50
|
|
51
|
-
struct
|
51
|
+
struct InternalApproxTopKState {
|
52
52
|
// the top-k data structure has two components
|
53
53
|
// a list of k values sorted on "count" (i.e. values[0] has the lowest count)
|
54
54
|
// a lookup map: string_t -> idx in "values" array
|
@@ -169,15 +169,34 @@ struct ApproxTopKState {
|
|
169
169
|
}
|
170
170
|
};
|
171
171
|
|
172
|
+
struct ApproxTopKState {
|
173
|
+
InternalApproxTopKState *state;
|
174
|
+
|
175
|
+
InternalApproxTopKState &GetState() {
|
176
|
+
if (!state) {
|
177
|
+
state = new InternalApproxTopKState();
|
178
|
+
}
|
179
|
+
return *state;
|
180
|
+
}
|
181
|
+
|
182
|
+
const InternalApproxTopKState &GetState() const {
|
183
|
+
if (!state) {
|
184
|
+
throw InternalException("No state available");
|
185
|
+
}
|
186
|
+
return *state;
|
187
|
+
}
|
188
|
+
};
|
189
|
+
|
172
190
|
struct ApproxTopKOperation {
|
173
191
|
template <class STATE>
|
174
192
|
static void Initialize(STATE &state) {
|
175
|
-
|
193
|
+
state.state = nullptr;
|
176
194
|
}
|
177
195
|
|
178
196
|
template <class TYPE, class STATE>
|
179
|
-
static void Operation(STATE &
|
197
|
+
static void Operation(STATE &aggr_state, const TYPE &input, AggregateInputData &aggr_input, Vector &top_k_vector,
|
180
198
|
idx_t offset, idx_t count) {
|
199
|
+
auto &state = aggr_state.GetState();
|
181
200
|
if (state.values.empty()) {
|
182
201
|
static constexpr int64_t MAX_APPROX_K = 1000000;
|
183
202
|
// not initialized yet - initialize the K value and set all counters to 0
|
@@ -208,7 +227,13 @@ struct ApproxTopKOperation {
|
|
208
227
|
}
|
209
228
|
|
210
229
|
template <class STATE, class OP>
|
211
|
-
static void Combine(const STATE &
|
230
|
+
static void Combine(const STATE &aggr_source, STATE &aggr_target, AggregateInputData &aggr_input) {
|
231
|
+
if (!aggr_source.state) {
|
232
|
+
// source state is empty
|
233
|
+
return;
|
234
|
+
}
|
235
|
+
auto &source = aggr_source.GetState();
|
236
|
+
auto &target = aggr_target.GetState();
|
212
237
|
if (source.values.empty()) {
|
213
238
|
// source is empty
|
214
239
|
return;
|
@@ -279,7 +304,7 @@ struct ApproxTopKOperation {
|
|
279
304
|
|
280
305
|
template <class STATE>
|
281
306
|
static void Destroy(STATE &state, AggregateInputData &aggr_input_data) {
|
282
|
-
state
|
307
|
+
delete state.state;
|
283
308
|
}
|
284
309
|
|
285
310
|
static bool IgnoreNull() {
|
@@ -324,7 +349,7 @@ static void ApproxTopKFinalize(Vector &state_vector, AggregateInputData &, Vecto
|
|
324
349
|
idx_t new_entries = 0;
|
325
350
|
// figure out how much space we need
|
326
351
|
for (idx_t i = 0; i < count; i++) {
|
327
|
-
auto &state =
|
352
|
+
auto &state = states[sdata.sel->get_index(i)]->GetState();
|
328
353
|
if (state.values.empty()) {
|
329
354
|
continue;
|
330
355
|
}
|
@@ -340,7 +365,7 @@ static void ApproxTopKFinalize(Vector &state_vector, AggregateInputData &, Vecto
|
|
340
365
|
idx_t current_offset = old_len;
|
341
366
|
for (idx_t i = 0; i < count; i++) {
|
342
367
|
const auto rid = i + offset;
|
343
|
-
auto &state =
|
368
|
+
auto &state = states[sdata.sel->get_index(i)]->GetState();
|
344
369
|
if (state.values.empty()) {
|
345
370
|
mask.SetInvalid(rid);
|
346
371
|
continue;
|
@@ -52,7 +52,6 @@ static const StaticFunctionDefinition internal_functions[] = {
|
|
52
52
|
DUCKDB_SCALAR_FUNCTION_SET(BitwiseAndFun),
|
53
53
|
DUCKDB_SCALAR_FUNCTION_ALIAS(ListHasAnyFunAlias),
|
54
54
|
DUCKDB_SCALAR_FUNCTION(PowOperatorFun),
|
55
|
-
DUCKDB_SCALAR_FUNCTION_SET_ALIAS(ListNegativeInnerProductFunAlias),
|
56
55
|
DUCKDB_SCALAR_FUNCTION_SET_ALIAS(ListDistanceFunAlias),
|
57
56
|
DUCKDB_SCALAR_FUNCTION_SET(LeftShiftFun),
|
58
57
|
DUCKDB_SCALAR_FUNCTION_SET_ALIAS(ListCosineDistanceFunAlias),
|
@@ -117,7 +116,7 @@ static const StaticFunctionDefinition internal_functions[] = {
|
|
117
116
|
DUCKDB_AGGREGATE_FUNCTION_SET(BitOrFun),
|
118
117
|
DUCKDB_SCALAR_FUNCTION(BitPositionFun),
|
119
118
|
DUCKDB_AGGREGATE_FUNCTION_SET(BitXorFun),
|
120
|
-
|
119
|
+
DUCKDB_SCALAR_FUNCTION_SET(BitStringFun),
|
121
120
|
DUCKDB_AGGREGATE_FUNCTION_SET(BitstringAggFun),
|
122
121
|
DUCKDB_AGGREGATE_FUNCTION(BoolAndFun),
|
123
122
|
DUCKDB_AGGREGATE_FUNCTION(BoolOrFun),
|
@@ -7,28 +7,46 @@ namespace duckdb {
|
|
7
7
|
//===--------------------------------------------------------------------===//
|
8
8
|
// BitStringFunction
|
9
9
|
//===--------------------------------------------------------------------===//
|
10
|
+
template <bool FROM_STRING>
|
10
11
|
static void BitStringFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
11
12
|
BinaryExecutor::Execute<string_t, int32_t, string_t>(
|
12
13
|
args.data[0], args.data[1], result, args.size(), [&](string_t input, int32_t n) {
|
13
14
|
if (n < 0) {
|
14
15
|
throw InvalidInputException("The bitstring length cannot be negative");
|
15
16
|
}
|
16
|
-
|
17
|
+
idx_t input_length;
|
18
|
+
if (FROM_STRING) {
|
19
|
+
input_length = input.GetSize();
|
20
|
+
} else {
|
21
|
+
input_length = Bit::BitLength(input);
|
22
|
+
}
|
23
|
+
if (idx_t(n) < input_length) {
|
17
24
|
throw InvalidInputException("Length must be equal or larger than input string");
|
18
25
|
}
|
19
26
|
idx_t len;
|
20
|
-
|
27
|
+
if (FROM_STRING) {
|
28
|
+
Bit::TryGetBitStringSize(input, len, nullptr); // string verification
|
29
|
+
}
|
21
30
|
|
22
31
|
len = Bit::ComputeBitstringLen(UnsafeNumericCast<idx_t>(n));
|
23
32
|
string_t target = StringVector::EmptyString(result, len);
|
24
|
-
|
33
|
+
if (FROM_STRING) {
|
34
|
+
Bit::BitString(input, UnsafeNumericCast<idx_t>(n), target);
|
35
|
+
} else {
|
36
|
+
Bit::ExtendBitString(input, UnsafeNumericCast<idx_t>(n), target);
|
37
|
+
}
|
25
38
|
target.Finalize();
|
26
39
|
return target;
|
27
40
|
});
|
28
41
|
}
|
29
42
|
|
30
|
-
|
31
|
-
|
43
|
+
ScalarFunctionSet BitStringFun::GetFunctions() {
|
44
|
+
ScalarFunctionSet bitstring;
|
45
|
+
bitstring.AddFunction(
|
46
|
+
ScalarFunction({LogicalType::VARCHAR, LogicalType::INTEGER}, LogicalType::BIT, BitStringFunction<true>));
|
47
|
+
bitstring.AddFunction(
|
48
|
+
ScalarFunction({LogicalType::BIT, LogicalType::INTEGER}, LogicalType::BIT, BitStringFunction<false>));
|
49
|
+
return bitstring;
|
32
50
|
}
|
33
51
|
|
34
52
|
//===--------------------------------------------------------------------===//
|