duckdb 0.7.2-dev2507.0 → 0.7.2-dev2675.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 +7 -7
- package/package.json +2 -2
- package/src/connection.cpp +1 -1
- package/src/duckdb/extension/icu/icu-dateadd.cpp +3 -3
- package/src/duckdb/extension/icu/icu-datepart.cpp +3 -3
- package/src/duckdb/extension/icu/icu-datesub.cpp +2 -2
- package/src/duckdb/extension/icu/icu-datetrunc.cpp +1 -1
- package/src/duckdb/extension/icu/icu-extension.cpp +3 -3
- package/src/duckdb/extension/icu/icu-list-range.cpp +2 -2
- package/src/duckdb/extension/icu/icu-makedate.cpp +1 -1
- package/src/duckdb/extension/icu/icu-strptime.cpp +4 -4
- package/src/duckdb/extension/icu/icu-table-range.cpp +2 -2
- package/src/duckdb/extension/icu/icu-timebucket.cpp +1 -1
- package/src/duckdb/extension/icu/icu-timezone.cpp +4 -4
- package/src/duckdb/extension/json/json-extension.cpp +6 -6
- package/src/duckdb/extension/parquet/parquet-extension.cpp +9 -8
- package/src/duckdb/extension/parquet/parquet_statistics.cpp +3 -0
- package/src/duckdb/src/catalog/catalog.cpp +166 -127
- package/src/duckdb/src/catalog/catalog_entry/copy_function_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/duck_index_entry.cpp +1 -1
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +90 -82
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +65 -67
- package/src/duckdb/src/catalog/catalog_entry/index_catalog_entry.cpp +3 -3
- package/src/duckdb/src/catalog/catalog_entry/pragma_function_catalog_entry.cpp +4 -4
- package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +8 -8
- package/src/duckdb/src/catalog/catalog_entry/scalar_macro_catalog_entry.cpp +10 -10
- package/src/duckdb/src/catalog/catalog_entry/schema_catalog_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_entry/sequence_catalog_entry.cpp +6 -6
- package/src/duckdb/src/catalog/catalog_entry/table_catalog_entry.cpp +4 -4
- package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +9 -9
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +5 -5
- package/src/duckdb/src/catalog/catalog_entry/view_catalog_entry.cpp +23 -23
- package/src/duckdb/src/catalog/catalog_entry.cpp +27 -6
- package/src/duckdb/src/catalog/catalog_search_path.cpp +2 -2
- package/src/duckdb/src/catalog/catalog_set.cpp +84 -87
- package/src/duckdb/src/catalog/catalog_transaction.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_functions.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_schemas.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_types.cpp +1 -1
- package/src/duckdb/src/catalog/default/default_views.cpp +1 -1
- package/src/duckdb/src/catalog/dependency_list.cpp +2 -2
- package/src/duckdb/src/catalog/dependency_manager.cpp +9 -10
- package/src/duckdb/src/catalog/duck_catalog.cpp +30 -26
- package/src/duckdb/src/catalog/similar_catalog_entry.cpp +1 -1
- package/src/duckdb/src/common/radix_partitioning.cpp +1 -1
- package/src/duckdb/src/common/types.cpp +15 -27
- package/src/duckdb/src/execution/index/art/art.cpp +286 -269
- package/src/duckdb/src/execution/index/art/art_key.cpp +22 -32
- package/src/duckdb/src/execution/index/art/fixed_size_allocator.cpp +224 -0
- package/src/duckdb/src/execution/index/art/iterator.cpp +142 -123
- package/src/duckdb/src/execution/index/art/leaf.cpp +319 -170
- package/src/duckdb/src/execution/index/art/leaf_segment.cpp +42 -0
- package/src/duckdb/src/execution/index/art/node.cpp +444 -379
- package/src/duckdb/src/execution/index/art/node16.cpp +178 -114
- package/src/duckdb/src/execution/index/art/node256.cpp +117 -79
- package/src/duckdb/src/execution/index/art/node4.cpp +169 -114
- package/src/duckdb/src/execution/index/art/node48.cpp +175 -105
- package/src/duckdb/src/execution/index/art/prefix.cpp +405 -127
- package/src/duckdb/src/execution/index/art/prefix_segment.cpp +42 -0
- package/src/duckdb/src/execution/index/art/swizzleable_pointer.cpp +10 -85
- package/src/duckdb/src/execution/operator/join/physical_index_join.cpp +4 -3
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +2 -2
- package/src/duckdb/src/execution/operator/persistent/csv_reader_options.cpp +2 -0
- package/src/duckdb/src/execution/operator/persistent/physical_batch_insert.cpp +4 -3
- package/src/duckdb/src/execution/operator/persistent/physical_export.cpp +19 -18
- package/src/duckdb/src/execution/operator/persistent/physical_insert.cpp +5 -5
- package/src/duckdb/src/execution/operator/schema/physical_alter.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_function.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_index.cpp +17 -17
- package/src/duckdb/src/execution/operator/schema/physical_create_schema.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_sequence.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_create_table.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +4 -3
- package/src/duckdb/src/execution/operator/schema/physical_create_view.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_detach.cpp +1 -1
- package/src/duckdb/src/execution/operator/schema/physical_drop.cpp +2 -2
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +4 -4
- package/src/duckdb/src/execution/physical_plan/plan_create_table.cpp +4 -3
- package/src/duckdb/src/execution/physical_plan/plan_delete.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_insert.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_update.cpp +1 -1
- package/src/duckdb/src/function/built_in_functions.cpp +10 -10
- package/src/duckdb/src/function/function_binder.cpp +3 -3
- package/src/duckdb/src/function/scalar/list/list_aggregates.cpp +5 -6
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +2 -2
- package/src/duckdb/src/function/scalar/sequence/nextval.cpp +9 -8
- package/src/duckdb/src/function/scalar/system/aggregate_export.cpp +6 -6
- package/src/duckdb/src/function/table/arrow.cpp +5 -5
- package/src/duckdb/src/function/table/read_csv.cpp +5 -1
- package/src/duckdb/src/function/table/system/duckdb_columns.cpp +8 -7
- package/src/duckdb/src/function/table/system/duckdb_constraints.cpp +14 -14
- package/src/duckdb/src/function/table/system/duckdb_databases.cpp +2 -2
- package/src/duckdb/src/function/table/system/duckdb_functions.cpp +26 -25
- package/src/duckdb/src/function/table/system/duckdb_indexes.cpp +13 -12
- package/src/duckdb/src/function/table/system/duckdb_schemas.cpp +7 -7
- package/src/duckdb/src/function/table/system/duckdb_sequences.cpp +8 -9
- package/src/duckdb/src/function/table/system/duckdb_tables.cpp +10 -9
- package/src/duckdb/src/function/table/system/duckdb_types.cpp +13 -13
- package/src/duckdb/src/function/table/system/duckdb_views.cpp +11 -10
- package/src/duckdb/src/function/table/system/pragma_collations.cpp +2 -2
- package/src/duckdb/src/function/table/system/pragma_database_size.cpp +5 -5
- package/src/duckdb/src/function/table/system/pragma_storage_info.cpp +3 -3
- package/src/duckdb/src/function/table/system/pragma_table_info.cpp +2 -2
- package/src/duckdb/src/function/table/table_scan.cpp +39 -37
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/udf_function.cpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +122 -81
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp +2 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/collate_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/copy_function_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_index_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_schema_entry.hpp +24 -20
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/index_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/pragma_function_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/scalar_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +22 -17
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +2 -2
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/type_catalog_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/view_catalog_entry.hpp +3 -3
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry.hpp +28 -7
- package/src/duckdb/src/include/duckdb/catalog/catalog_set.hpp +20 -19
- package/src/duckdb/src/include/duckdb/catalog/duck_catalog.hpp +9 -9
- package/src/duckdb/src/include/duckdb/catalog/similar_catalog_entry.hpp +2 -1
- package/src/duckdb/src/include/duckdb/catalog/standard_entry.hpp +10 -4
- package/src/duckdb/src/include/duckdb/common/enums/on_entry_not_found.hpp +17 -0
- package/src/duckdb/src/include/duckdb/common/queue.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/types.hpp +3 -4
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +53 -45
- package/src/duckdb/src/include/duckdb/execution/index/art/art_key.hpp +29 -24
- package/src/duckdb/src/include/duckdb/execution/index/art/fixed_size_allocator.hpp +114 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/iterator.hpp +26 -20
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf.hpp +63 -39
- package/src/duckdb/src/include/duckdb/execution/index/art/leaf_segment.hpp +36 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/node.hpp +98 -116
- package/src/duckdb/src/include/duckdb/execution/index/art/node16.hpp +48 -36
- package/src/duckdb/src/include/duckdb/execution/index/art/node256.hpp +52 -35
- package/src/duckdb/src/include/duckdb/execution/index/art/node4.hpp +46 -36
- package/src/duckdb/src/include/duckdb/execution/index/art/node48.hpp +57 -35
- package/src/duckdb/src/include/duckdb/execution/index/art/prefix.hpp +57 -50
- package/src/duckdb/src/include/duckdb/execution/index/art/prefix_segment.hpp +40 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/swizzleable_pointer.hpp +38 -31
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_file_handle.hpp +2 -1
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_reader_options.hpp +2 -0
- package/src/duckdb/src/include/duckdb/function/function_serialization.hpp +4 -4
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +3 -2
- package/src/duckdb/src/include/duckdb/function/table/table_scan.hpp +5 -4
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +28 -15
- package/src/duckdb/src/include/duckdb/main/attached_database.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/client_context.hpp +1 -1
- package/src/duckdb/src/include/duckdb/main/database_manager.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/keyword_helper.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +7 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_view_info.hpp +1 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/detach_info.hpp +3 -2
- package/src/duckdb/src/include/duckdb/parser/parsed_data/drop_info.hpp +5 -5
- package/src/duckdb/src/include/duckdb/parser/parsed_data/parse_info.hpp +13 -0
- package/src/duckdb/src/include/duckdb/parser/statement/insert_statement.hpp +4 -1
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +5 -2
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +4 -1
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +2 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder/base_select_binder.hpp +1 -2
- package/src/duckdb/src/include/duckdb/planner/expression_binder.hpp +4 -7
- package/src/duckdb/src/include/duckdb/planner/operator/logical_get.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +0 -5
- package/src/duckdb/src/include/duckdb/storage/index.hpp +13 -28
- package/src/duckdb/src/include/duckdb/storage/standard_buffer_manager.hpp +0 -2
- package/src/duckdb/src/include/duckdb/transaction/cleanup_state.hpp +5 -0
- package/src/duckdb/src/include/duckdb/transaction/transaction.hpp +12 -0
- package/src/duckdb/src/include/duckdb.h +26 -0
- package/src/duckdb/src/main/attached_database.cpp +12 -6
- package/src/duckdb/src/main/capi/helper-c.cpp +7 -0
- package/src/duckdb/src/main/capi/table_function-c.cpp +17 -16
- package/src/duckdb/src/main/client_context.cpp +12 -11
- package/src/duckdb/src/main/database_manager.cpp +13 -12
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +1 -2
- package/src/duckdb/src/parser/parsed_data/alter_info.cpp +3 -3
- package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/alter_table_info.cpp +9 -9
- package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_table_info.cpp +2 -2
- package/src/duckdb/src/parser/parsed_data/create_view_info.cpp +2 -2
- package/src/duckdb/src/parser/statement/insert_statement.cpp +15 -6
- package/src/duckdb/src/parser/transform/constraint/transform_constraint.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +18 -5
- package/src/duckdb/src/parser/transform/statement/transform_alter_sequence.cpp +3 -2
- package/src/duckdb/src/parser/transform/statement/transform_alter_table.cpp +5 -1
- package/src/duckdb/src/parser/transform/statement/transform_detach.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_drop.cpp +1 -1
- package/src/duckdb/src/parser/transform/statement/transform_insert.cpp +5 -7
- package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +26 -27
- package/src/duckdb/src/planner/binder/expression/bind_between_expression.cpp +17 -17
- package/src/duckdb/src/planner/binder/expression/bind_case_expression.cpp +9 -9
- package/src/duckdb/src/planner/binder/expression/bind_cast_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_collate_expression.cpp +6 -6
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +2 -2
- package/src/duckdb/src/planner/binder/expression/bind_comparison_expression.cpp +21 -21
- package/src/duckdb/src/planner/binder/expression/bind_conjunction_expression.cpp +2 -3
- package/src/duckdb/src/planner/binder/expression/bind_function_expression.cpp +33 -36
- package/src/duckdb/src/planner/binder/expression/bind_macro_expression.cpp +5 -5
- package/src/duckdb/src/planner/binder/expression/bind_operator_expression.cpp +23 -23
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +4 -4
- package/src/duckdb/src/planner/binder/expression/bind_unnest_expression.cpp +7 -7
- package/src/duckdb/src/planner/binder/expression/bind_window_expression.cpp +23 -23
- package/src/duckdb/src/planner/binder/query_node/bind_table_macro_node.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +14 -13
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +56 -42
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +3 -3
- package/src/duckdb/src/planner/binder/statement/bind_delete.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_drop.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_export.cpp +10 -10
- package/src/duckdb/src/planner/binder/statement/bind_insert.cpp +16 -11
- package/src/duckdb/src/planner/binder/statement/bind_pragma.cpp +4 -4
- package/src/duckdb/src/planner/binder/statement/bind_simple.cpp +5 -4
- package/src/duckdb/src/planner/binder/statement/bind_update.cpp +1 -1
- package/src/duckdb/src/planner/binder/tableref/bind_basetableref.cpp +3 -3
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +10 -12
- package/src/duckdb/src/planner/binder.cpp +2 -2
- package/src/duckdb/src/planner/expression/bound_expression.cpp +11 -2
- package/src/duckdb/src/planner/operator/logical_copy_to_file.cpp +2 -5
- package/src/duckdb/src/planner/operator/logical_create.cpp +2 -1
- package/src/duckdb/src/planner/operator/logical_create_index.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_delete.cpp +2 -2
- package/src/duckdb/src/planner/operator/logical_get.cpp +1 -1
- package/src/duckdb/src/planner/operator/logical_insert.cpp +2 -7
- package/src/duckdb/src/planner/operator/logical_update.cpp +2 -6
- package/src/duckdb/src/planner/parsed_data/bound_create_table_info.cpp +2 -2
- package/src/duckdb/src/planner/pragma_handler.cpp +3 -4
- package/src/duckdb/src/storage/checkpoint_manager.cpp +57 -55
- package/src/duckdb/src/storage/data_table.cpp +9 -9
- package/src/duckdb/src/storage/index.cpp +18 -6
- package/src/duckdb/src/storage/local_storage.cpp +8 -2
- package/src/duckdb/src/storage/standard_buffer_manager.cpp +0 -9
- package/src/duckdb/src/storage/table/update_segment.cpp +1 -1
- package/src/duckdb/src/storage/wal_replay.cpp +29 -31
- package/src/duckdb/src/storage/write_ahead_log.cpp +8 -8
- package/src/duckdb/src/transaction/cleanup_state.cpp +7 -1
- package/src/duckdb/src/transaction/commit_state.cpp +3 -4
- package/src/duckdb/src/transaction/transaction_context.cpp +1 -1
- package/src/duckdb/src/transaction/undo_buffer.cpp +8 -0
- package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +4 -4
- package/src/duckdb/ub_src_execution_index_art.cpp +7 -1
@@ -418,10 +418,9 @@ static unique_ptr<FunctionData> ListAggregatesBind(ClientContext &context, Scala
|
|
418
418
|
|
419
419
|
// look up the aggregate function in the catalog
|
420
420
|
QueryErrorContext error_context(nullptr, 0);
|
421
|
-
auto func =
|
422
|
-
|
423
|
-
|
424
|
-
D_ASSERT(func->type == CatalogType::AGGREGATE_FUNCTION_ENTRY);
|
421
|
+
auto &func = Catalog::GetSystemCatalog(context).GetEntry<AggregateFunctionCatalogEntry>(
|
422
|
+
context, DEFAULT_SCHEMA, function_name, error_context);
|
423
|
+
D_ASSERT(func.type == CatalogType::AGGREGATE_FUNCTION_ENTRY);
|
425
424
|
|
426
425
|
if (is_parameter) {
|
427
426
|
bound_function.arguments[0] = LogicalTypeId::UNKNOWN;
|
@@ -439,13 +438,13 @@ static unique_ptr<FunctionData> ListAggregatesBind(ClientContext &context, Scala
|
|
439
438
|
}
|
440
439
|
|
441
440
|
FunctionBinder function_binder(context);
|
442
|
-
auto best_function_idx = function_binder.BindFunction(func
|
441
|
+
auto best_function_idx = function_binder.BindFunction(func.name, func.functions, types, error);
|
443
442
|
if (best_function_idx == DConstants::INVALID_INDEX) {
|
444
443
|
throw BinderException("No matching aggregate function\n%s", error);
|
445
444
|
}
|
446
445
|
|
447
446
|
// found a matching function, bind it as an aggregate
|
448
|
-
auto best_function = func
|
447
|
+
auto best_function = func.functions.GetFunctionByOffset(best_function_idx);
|
449
448
|
if (IS_AGGR) {
|
450
449
|
return ListAggregatesBindFunction<IS_AGGR>(context, bound_function, list_child_type, best_function, arguments);
|
451
450
|
}
|
@@ -167,8 +167,8 @@ static unique_ptr<BaseStatistics> PropagateNumericStats(ClientContext &context,
|
|
167
167
|
} else {
|
168
168
|
// no potential overflow: replace with non-overflowing operator
|
169
169
|
if (input.bind_data) {
|
170
|
-
auto bind_data =
|
171
|
-
bind_data
|
170
|
+
auto &bind_data = input.bind_data->Cast<DecimalArithmeticBindData>();
|
171
|
+
bind_data.check_overflow = false;
|
172
172
|
}
|
173
173
|
expr.function.function = GetScalarIntegerFunction<BASEOP>(expr.return_type.InternalType());
|
174
174
|
}
|
@@ -76,7 +76,7 @@ struct NextSequenceValueOperator {
|
|
76
76
|
}
|
77
77
|
};
|
78
78
|
|
79
|
-
SequenceCatalogEntry
|
79
|
+
SequenceCatalogEntry &BindSequence(ClientContext &context, const string &name) {
|
80
80
|
auto qname = QualifiedName::Parse(name);
|
81
81
|
// fetch the sequence from the catalog
|
82
82
|
Binder::BindSchemaOrCatalog(context, qname.catalog, qname.schema);
|
@@ -91,36 +91,37 @@ static void NextValFunction(DataChunk &args, ExpressionState &state, Vector &res
|
|
91
91
|
|
92
92
|
auto &context = state.GetContext();
|
93
93
|
if (info.sequence) {
|
94
|
-
auto &
|
94
|
+
auto &sequence = *info.sequence;
|
95
|
+
auto &transaction = DuckTransaction::Get(context, sequence.catalog);
|
95
96
|
// sequence to use is hard coded
|
96
97
|
// increment the sequence
|
97
98
|
result.SetVectorType(VectorType::FLAT_VECTOR);
|
98
99
|
auto result_data = FlatVector::GetData<int64_t>(result);
|
99
100
|
for (idx_t i = 0; i < args.size(); i++) {
|
100
101
|
// get the next value from the sequence
|
101
|
-
result_data[i] = OP::Operation(transaction,
|
102
|
+
result_data[i] = OP::Operation(transaction, sequence);
|
102
103
|
}
|
103
104
|
} else {
|
104
105
|
// sequence to use comes from the input
|
105
106
|
UnaryExecutor::Execute<string_t, int64_t>(input, result, args.size(), [&](string_t value) {
|
106
107
|
// fetch the sequence from the catalog
|
107
|
-
auto sequence = BindSequence(context, value.GetString());
|
108
|
+
auto &sequence = BindSequence(context, value.GetString());
|
108
109
|
// finally get the next value from the sequence
|
109
|
-
auto &transaction = DuckTransaction::Get(context,
|
110
|
-
return OP::Operation(transaction,
|
110
|
+
auto &transaction = DuckTransaction::Get(context, sequence.catalog);
|
111
|
+
return OP::Operation(transaction, sequence);
|
111
112
|
});
|
112
113
|
}
|
113
114
|
}
|
114
115
|
|
115
116
|
static unique_ptr<FunctionData> NextValBind(ClientContext &context, ScalarFunction &bound_function,
|
116
117
|
vector<unique_ptr<Expression>> &arguments) {
|
117
|
-
SequenceCatalogEntry
|
118
|
+
optional_ptr<SequenceCatalogEntry> sequence;
|
118
119
|
if (arguments[0]->IsFoldable()) {
|
119
120
|
// parameter to nextval function is a foldable constant
|
120
121
|
// evaluate the constant and perform the catalog lookup already
|
121
122
|
auto seqname = ExpressionExecutor::EvaluateScalar(context, *arguments[0]);
|
122
123
|
if (!seqname.IsNull()) {
|
123
|
-
sequence = BindSequence(context, seqname.ToString());
|
124
|
+
sequence = &BindSequence(context, seqname.ToString());
|
124
125
|
}
|
125
126
|
}
|
126
127
|
return make_uniq<NextvalBindData>(sequence);
|
@@ -197,22 +197,22 @@ static unique_ptr<FunctionData> BindAggregateState(ClientContext &context, Scala
|
|
197
197
|
auto state_type = AggregateStateType::GetStateType(arg_return_type);
|
198
198
|
|
199
199
|
// now we can look up the function in the catalog again and bind it
|
200
|
-
auto func = Catalog::GetSystemCatalog(context).GetEntry(context, CatalogType::SCALAR_FUNCTION_ENTRY,
|
201
|
-
|
202
|
-
if (func
|
200
|
+
auto &func = Catalog::GetSystemCatalog(context).GetEntry(context, CatalogType::SCALAR_FUNCTION_ENTRY,
|
201
|
+
DEFAULT_SCHEMA, state_type.function_name);
|
202
|
+
if (func.type != CatalogType::AGGREGATE_FUNCTION_ENTRY) {
|
203
203
|
throw InternalException("Could not find aggregate %s", state_type.function_name);
|
204
204
|
}
|
205
|
-
auto aggr = (
|
205
|
+
auto &aggr = func.Cast<AggregateFunctionCatalogEntry>();
|
206
206
|
|
207
207
|
string error;
|
208
208
|
|
209
209
|
FunctionBinder function_binder(context);
|
210
210
|
idx_t best_function =
|
211
|
-
function_binder.BindFunction(aggr
|
211
|
+
function_binder.BindFunction(aggr.name, aggr.functions, state_type.bound_argument_types, error);
|
212
212
|
if (best_function == DConstants::INVALID_INDEX) {
|
213
213
|
throw InternalException("Could not re-bind exported aggregate %s: %s", state_type.function_name, error);
|
214
214
|
}
|
215
|
-
auto bound_aggr = aggr
|
215
|
+
auto bound_aggr = aggr.functions.GetFunctionByOffset(best_function);
|
216
216
|
if (bound_aggr.bind) {
|
217
217
|
// FIXME: this is really hacky
|
218
218
|
// but the aggregate state export needs a rework around how it handles more complex aggregates anyway
|
@@ -271,8 +271,8 @@ unique_ptr<GlobalTableFunctionState> ArrowTableFunction::ArrowScanInitGlobal(Cli
|
|
271
271
|
TableFunctionInitInput &input) {
|
272
272
|
auto &bind_data = (const ArrowScanFunctionData &)*input.bind_data;
|
273
273
|
auto result = make_uniq<ArrowScanGlobalState>();
|
274
|
-
result->stream = ProduceArrowScan(bind_data, input.column_ids, input.filters);
|
275
|
-
result->max_threads = ArrowScanMaxThreads(context, input.bind_data);
|
274
|
+
result->stream = ProduceArrowScan(bind_data, input.column_ids, input.filters.get());
|
275
|
+
result->max_threads = ArrowScanMaxThreads(context, input.bind_data.get());
|
276
276
|
if (input.CanRemoveFilterColumns()) {
|
277
277
|
result->projection_ids = input.projection_ids;
|
278
278
|
for (const auto &col_idx : input.column_ids) {
|
@@ -293,12 +293,12 @@ unique_ptr<LocalTableFunctionState> ArrowTableFunction::ArrowScanInitLocal(Execu
|
|
293
293
|
auto current_chunk = make_uniq<ArrowArrayWrapper>();
|
294
294
|
auto result = make_uniq<ArrowScanLocalState>(std::move(current_chunk));
|
295
295
|
result->column_ids = input.column_ids;
|
296
|
-
result->filters = input.filters;
|
296
|
+
result->filters = input.filters.get();
|
297
297
|
if (input.CanRemoveFilterColumns()) {
|
298
298
|
auto &asgs = global_state_p->Cast<ArrowScanGlobalState>();
|
299
299
|
result->all_columns.Initialize(context.client, asgs.scanned_types);
|
300
300
|
}
|
301
|
-
if (!ArrowScanParallelStateNext(context.client, input.bind_data, *result, global_state)) {
|
301
|
+
if (!ArrowScanParallelStateNext(context.client, input.bind_data.get(), *result, global_state)) {
|
302
302
|
return nullptr;
|
303
303
|
}
|
304
304
|
return std::move(result);
|
@@ -314,7 +314,7 @@ void ArrowTableFunction::ArrowScanFunction(ClientContext &context, TableFunction
|
|
314
314
|
|
315
315
|
//! Out of tuples in this chunk
|
316
316
|
if (state.chunk_offset >= (idx_t)state.chunk->arrow_array.length) {
|
317
|
-
if (!ArrowScanParallelStateNext(context, data_p.bind_data, state, global_state)) {
|
317
|
+
if (!ArrowScanParallelStateNext(context, data_p.bind_data.get(), state, global_state)) {
|
318
318
|
return;
|
319
319
|
}
|
320
320
|
}
|
@@ -27,7 +27,7 @@ unique_ptr<CSVFileHandle> ReadCSV::OpenCSV(const string &file_path, FileCompress
|
|
27
27
|
if (file_handle->CanSeek()) {
|
28
28
|
file_handle->Reset();
|
29
29
|
}
|
30
|
-
return make_uniq<CSVFileHandle>(std::move(file_handle));
|
30
|
+
return make_uniq<CSVFileHandle>(std::move(file_handle), false);
|
31
31
|
}
|
32
32
|
|
33
33
|
void ReadCSVData::FinalizeRead(ClientContext &context) {
|
@@ -259,6 +259,7 @@ public:
|
|
259
259
|
idx_t rows_to_skip, bool force_parallelism_p, vector<column_t> column_ids_p)
|
260
260
|
: file_handle(std::move(file_handle_p)), system_threads(system_threads_p), buffer_size(buffer_size_p),
|
261
261
|
force_parallelism(force_parallelism_p), column_ids(std::move(column_ids_p)) {
|
262
|
+
file_handle->DisableReset();
|
262
263
|
current_file_path = files_path_p[0];
|
263
264
|
estimated_linenr = rows_to_skip;
|
264
265
|
file_size = file_handle->FileSize();
|
@@ -861,6 +862,7 @@ static void ReadCSVAddNamedParameters(TableFunction &table_function) {
|
|
861
862
|
table_function.named_parameters["decimal_separator"] = LogicalType::VARCHAR;
|
862
863
|
table_function.named_parameters["parallel"] = LogicalType::BOOLEAN;
|
863
864
|
table_function.named_parameters["null_padding"] = LogicalType::BOOLEAN;
|
865
|
+
table_function.named_parameters["allow_quoted_nulls"] = LogicalType::BOOLEAN;
|
864
866
|
table_function.named_parameters["column_types"] = LogicalType::ANY;
|
865
867
|
table_function.named_parameters["dtypes"] = LogicalType::ANY;
|
866
868
|
table_function.named_parameters["types"] = LogicalType::ANY;
|
@@ -920,6 +922,7 @@ void BufferedCSVReaderOptions::Serialize(FieldWriter &writer) const {
|
|
920
922
|
writer.WriteString(null_str);
|
921
923
|
writer.WriteField<FileCompressionType>(compression);
|
922
924
|
writer.WriteField<NewLineIdentifier>(new_line);
|
925
|
+
writer.WriteField<bool>(allow_quoted_nulls);
|
923
926
|
// read options
|
924
927
|
writer.WriteField<idx_t>(skip_rows);
|
925
928
|
writer.WriteField<bool>(skip_rows_set);
|
@@ -954,6 +957,7 @@ void BufferedCSVReaderOptions::Deserialize(FieldReader &reader) {
|
|
954
957
|
null_str = reader.ReadRequired<string>();
|
955
958
|
compression = reader.ReadRequired<FileCompressionType>();
|
956
959
|
new_line = reader.ReadRequired<NewLineIdentifier>();
|
960
|
+
allow_quoted_nulls = reader.ReadRequired<bool>();
|
957
961
|
// read options
|
958
962
|
skip_rows = reader.ReadRequired<idx_t>();
|
959
963
|
skip_rows_set = reader.ReadRequired<bool>();
|
@@ -16,7 +16,7 @@ struct DuckDBColumnsData : public GlobalTableFunctionState {
|
|
16
16
|
DuckDBColumnsData() : offset(0), column_offset(0) {
|
17
17
|
}
|
18
18
|
|
19
|
-
vector<
|
19
|
+
vector<reference<CatalogEntry>> entries;
|
20
20
|
idx_t offset;
|
21
21
|
idx_t column_offset;
|
22
22
|
};
|
@@ -83,7 +83,8 @@ unique_ptr<GlobalTableFunctionState> DuckDBColumnsInit(ClientContext &context, T
|
|
83
83
|
// scan all the schemas for tables and views and collect them
|
84
84
|
auto schemas = Catalog::GetAllSchemas(context);
|
85
85
|
for (auto &schema : schemas) {
|
86
|
-
schema
|
86
|
+
schema.get().Scan(context, CatalogType::TABLE_ENTRY,
|
87
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry); });
|
87
88
|
}
|
88
89
|
return std::move(result);
|
89
90
|
}
|
@@ -190,13 +191,13 @@ void ColumnHelper::WriteColumns(idx_t start_index, idx_t start_col, idx_t end_co
|
|
190
191
|
|
191
192
|
idx_t col = 0;
|
192
193
|
// database_name, VARCHAR
|
193
|
-
output.SetValue(col++, index, entry.catalog
|
194
|
+
output.SetValue(col++, index, entry.catalog.GetName());
|
194
195
|
// database_oid, BIGINT
|
195
|
-
output.SetValue(col++, index, Value::BIGINT(entry.catalog
|
196
|
+
output.SetValue(col++, index, Value::BIGINT(entry.catalog.GetOid()));
|
196
197
|
// schema_name, VARCHAR
|
197
|
-
output.SetValue(col++, index, entry.schema
|
198
|
+
output.SetValue(col++, index, entry.schema.name);
|
198
199
|
// schema_oid, BIGINT
|
199
|
-
output.SetValue(col++, index, Value::BIGINT(entry.schema
|
200
|
+
output.SetValue(col++, index, Value::BIGINT(entry.schema.oid));
|
200
201
|
// table_name, VARCHAR
|
201
202
|
output.SetValue(col++, index, entry.name);
|
202
203
|
// table_oid, BIGINT
|
@@ -298,7 +299,7 @@ void DuckDBColumnsFunction(ClientContext &context, TableFunctionInput &data_p, D
|
|
298
299
|
idx_t column_offset = data.column_offset;
|
299
300
|
idx_t index = 0;
|
300
301
|
while (next < data.entries.size() && index < STANDARD_VECTOR_SIZE) {
|
301
|
-
auto column_helper = ColumnHelper::Create(
|
302
|
+
auto column_helper = ColumnHelper::Create(data.entries[next].get());
|
302
303
|
idx_t columns = column_helper->NumColumns();
|
303
304
|
|
304
305
|
// Check to see if we are going to exceed the maximum index for a DataChunk
|
@@ -53,7 +53,7 @@ struct DuckDBConstraintsData : public GlobalTableFunctionState {
|
|
53
53
|
DuckDBConstraintsData() : offset(0), constraint_offset(0), unique_constraint_offset(0) {
|
54
54
|
}
|
55
55
|
|
56
|
-
vector<
|
56
|
+
vector<reference<CatalogEntry>> entries;
|
57
57
|
idx_t offset;
|
58
58
|
idx_t constraint_offset;
|
59
59
|
idx_t unique_constraint_offset;
|
@@ -109,15 +109,15 @@ unique_ptr<GlobalTableFunctionState> DuckDBConstraintsInit(ClientContext &contex
|
|
109
109
|
auto schemas = Catalog::GetAllSchemas(context);
|
110
110
|
|
111
111
|
for (auto &schema : schemas) {
|
112
|
-
vector<CatalogEntry
|
112
|
+
vector<reference<CatalogEntry>> entries;
|
113
113
|
|
114
|
-
schema
|
115
|
-
if (entry
|
114
|
+
schema.get().Scan(context, CatalogType::TABLE_ENTRY, [&](CatalogEntry &entry) {
|
115
|
+
if (entry.type == CatalogType::TABLE_ENTRY) {
|
116
116
|
entries.push_back(entry);
|
117
117
|
}
|
118
118
|
});
|
119
119
|
|
120
|
-
sort(entries.begin(), entries.end(), [&](CatalogEntry
|
120
|
+
sort(entries.begin(), entries.end(), [&](CatalogEntry &x, CatalogEntry &y) { return (x.name < y.name); });
|
121
121
|
|
122
122
|
result->entries.insert(result->entries.end(), entries.begin(), entries.end());
|
123
123
|
};
|
@@ -135,7 +135,7 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
135
135
|
// either fill up the chunk or return all the remaining columns
|
136
136
|
idx_t count = 0;
|
137
137
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
138
|
-
auto &entry =
|
138
|
+
auto &entry = data.entries[data.offset].get();
|
139
139
|
D_ASSERT(entry.type == CatalogType::TABLE_ENTRY);
|
140
140
|
|
141
141
|
auto &table = entry.Cast<TableCatalogEntry>();
|
@@ -178,13 +178,13 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
178
178
|
|
179
179
|
idx_t col = 0;
|
180
180
|
// database_name, LogicalType::VARCHAR
|
181
|
-
output.SetValue(col++, count, Value(table.schema
|
181
|
+
output.SetValue(col++, count, Value(table.schema.catalog.GetName()));
|
182
182
|
// database_oid, LogicalType::BIGINT
|
183
|
-
output.SetValue(col++, count, Value::BIGINT(table.schema
|
183
|
+
output.SetValue(col++, count, Value::BIGINT(table.schema.catalog.GetOid()));
|
184
184
|
// schema_name, LogicalType::VARCHAR
|
185
|
-
output.SetValue(col++, count, Value(table.schema
|
185
|
+
output.SetValue(col++, count, Value(table.schema.name));
|
186
186
|
// schema_oid, LogicalType::BIGINT
|
187
|
-
output.SetValue(col++, count, Value::BIGINT(table.schema
|
187
|
+
output.SetValue(col++, count, Value::BIGINT(table.schema.oid));
|
188
188
|
// table_name, LogicalType::VARCHAR
|
189
189
|
output.SetValue(col++, count, Value(table.name));
|
190
190
|
// table_oid, LogicalType::BIGINT
|
@@ -198,15 +198,15 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
198
198
|
switch (bound_constraint.type) {
|
199
199
|
case ConstraintType::UNIQUE: {
|
200
200
|
auto &bound_unique = bound_constraint.Cast<BoundUniqueConstraint>();
|
201
|
-
uk_info = {table.schema
|
201
|
+
uk_info = {table.schema.name, table.name, bound_unique.keys};
|
202
202
|
break;
|
203
203
|
}
|
204
204
|
case ConstraintType::FOREIGN_KEY: {
|
205
205
|
const auto &bound_foreign_key = bound_constraint.Cast<BoundForeignKeyConstraint>();
|
206
206
|
const auto &info = bound_foreign_key.info;
|
207
207
|
// find the other table
|
208
|
-
auto table_entry = Catalog::GetEntry<TableCatalogEntry>(
|
209
|
-
|
208
|
+
auto table_entry = Catalog::GetEntry<TableCatalogEntry>(
|
209
|
+
context, table.catalog.GetName(), info.schema, info.table, OnEntryNotFound::RETURN_NULL);
|
210
210
|
if (!table_entry) {
|
211
211
|
throw InternalException("dukdb_constraints: entry %s.%s referenced in foreign key not found",
|
212
212
|
info.schema, info.table);
|
@@ -215,7 +215,7 @@ void DuckDBConstraintsFunction(ClientContext &context, TableFunctionInput &data_
|
|
215
215
|
for (auto &key : info.pk_keys) {
|
216
216
|
index.push_back(table_entry->GetColumns().PhysicalToLogical(key));
|
217
217
|
}
|
218
|
-
uk_info = {table_entry->schema
|
218
|
+
uk_info = {table_entry->schema.name, table_entry->name, index};
|
219
219
|
break;
|
220
220
|
}
|
221
221
|
default:
|
@@ -8,7 +8,7 @@ struct DuckDBDatabasesData : public GlobalTableFunctionState {
|
|
8
8
|
DuckDBDatabasesData() : offset(0) {
|
9
9
|
}
|
10
10
|
|
11
|
-
vector<
|
11
|
+
vector<reference<AttachedDatabase>> entries;
|
12
12
|
idx_t offset;
|
13
13
|
};
|
14
14
|
|
@@ -53,7 +53,7 @@ void DuckDBDatabasesFunction(ClientContext &context, TableFunctionInput &data_p,
|
|
53
53
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
54
54
|
auto &entry = data.entries[data.offset++];
|
55
55
|
|
56
|
-
auto &attached = entry
|
56
|
+
auto &attached = entry.get().Cast<AttachedDatabase>();
|
57
57
|
// return values:
|
58
58
|
|
59
59
|
idx_t col = 0;
|
@@ -21,7 +21,7 @@ struct DuckDBFunctionsData : public GlobalTableFunctionState {
|
|
21
21
|
DuckDBFunctionsData() : offset(0), offset_in_entry(0) {
|
22
22
|
}
|
23
23
|
|
24
|
-
vector<CatalogEntry
|
24
|
+
vector<reference<CatalogEntry>> entries;
|
25
25
|
idx_t offset;
|
26
26
|
idx_t offset_in_entry;
|
27
27
|
};
|
@@ -73,24 +73,26 @@ static unique_ptr<FunctionData> DuckDBFunctionsBind(ClientContext &context, Tabl
|
|
73
73
|
static void ExtractFunctionsFromSchema(ClientContext &context, SchemaCatalogEntry &schema,
|
74
74
|
DuckDBFunctionsData &result) {
|
75
75
|
schema.Scan(context, CatalogType::SCALAR_FUNCTION_ENTRY,
|
76
|
-
[&](CatalogEntry
|
76
|
+
[&](CatalogEntry &entry) { result.entries.push_back(entry); });
|
77
77
|
schema.Scan(context, CatalogType::TABLE_FUNCTION_ENTRY,
|
78
|
-
[&](CatalogEntry
|
78
|
+
[&](CatalogEntry &entry) { result.entries.push_back(entry); });
|
79
79
|
schema.Scan(context, CatalogType::PRAGMA_FUNCTION_ENTRY,
|
80
|
-
[&](CatalogEntry
|
80
|
+
[&](CatalogEntry &entry) { result.entries.push_back(entry); });
|
81
81
|
}
|
82
82
|
|
83
83
|
unique_ptr<GlobalTableFunctionState> DuckDBFunctionsInit(ClientContext &context, TableFunctionInitInput &input) {
|
84
84
|
auto result = make_uniq<DuckDBFunctionsData>();
|
85
85
|
|
86
|
-
// scan all the schemas for tables and collect
|
86
|
+
// scan all the schemas for tables and collect them and collect them
|
87
87
|
auto schemas = Catalog::GetAllSchemas(context);
|
88
88
|
for (auto &schema : schemas) {
|
89
|
-
ExtractFunctionsFromSchema(context,
|
89
|
+
ExtractFunctionsFromSchema(context, schema.get(), *result);
|
90
90
|
};
|
91
91
|
|
92
92
|
std::sort(result->entries.begin(), result->entries.end(),
|
93
|
-
[&](CatalogEntry
|
93
|
+
[&](reference<CatalogEntry> a, reference<CatalogEntry> b) {
|
94
|
+
return (int32_t)a.get().type < (int32_t)b.get().type;
|
95
|
+
});
|
94
96
|
return std::move(result);
|
95
97
|
}
|
96
98
|
|
@@ -420,18 +422,18 @@ struct PragmaFunctionExtractor {
|
|
420
422
|
};
|
421
423
|
|
422
424
|
template <class T, class OP>
|
423
|
-
bool ExtractFunctionData(
|
424
|
-
auto &function = (
|
425
|
+
bool ExtractFunctionData(CatalogEntry &entry, idx_t function_idx, DataChunk &output, idx_t output_offset) {
|
426
|
+
auto &function = entry.Cast<T>();
|
425
427
|
idx_t col = 0;
|
426
428
|
|
427
429
|
// database_name, LogicalType::VARCHAR
|
428
|
-
output.SetValue(col++, output_offset, Value(
|
430
|
+
output.SetValue(col++, output_offset, Value(function.schema.catalog.GetName()));
|
429
431
|
|
430
432
|
// schema_name, LogicalType::VARCHAR
|
431
|
-
output.SetValue(col++, output_offset, Value(
|
433
|
+
output.SetValue(col++, output_offset, Value(function.schema.name));
|
432
434
|
|
433
435
|
// function_name, LogicalType::VARCHAR
|
434
|
-
output.SetValue(col++, output_offset, Value(
|
436
|
+
output.SetValue(col++, output_offset, Value(function.name));
|
435
437
|
|
436
438
|
// function_type, LogicalType::VARCHAR
|
437
439
|
output.SetValue(col++, output_offset, Value(OP::GetFunctionType()));
|
@@ -458,10 +460,10 @@ bool ExtractFunctionData(StandardEntry *entry, idx_t function_idx, DataChunk &ou
|
|
458
460
|
output.SetValue(col++, output_offset, OP::HasSideEffects(function, function_idx));
|
459
461
|
|
460
462
|
// internal, LogicalType::BOOLEAN
|
461
|
-
output.SetValue(col++, output_offset, Value::BOOLEAN(
|
463
|
+
output.SetValue(col++, output_offset, Value::BOOLEAN(function.internal));
|
462
464
|
|
463
465
|
// function_oid, LogicalType::BIGINT
|
464
|
-
output.SetValue(col++, output_offset, Value::BIGINT(
|
466
|
+
output.SetValue(col++, output_offset, Value::BIGINT(function.oid));
|
465
467
|
|
466
468
|
return function_idx + 1 == OP::FunctionCount(function);
|
467
469
|
}
|
@@ -476,35 +478,34 @@ void DuckDBFunctionsFunction(ClientContext &context, TableFunctionInput &data_p,
|
|
476
478
|
// either fill up the chunk or return all the remaining columns
|
477
479
|
idx_t count = 0;
|
478
480
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
479
|
-
auto &entry = data.entries[data.offset];
|
480
|
-
auto standard_entry = (StandardEntry *)entry;
|
481
|
+
auto &entry = data.entries[data.offset].get();
|
481
482
|
bool finished;
|
482
483
|
|
483
|
-
switch (entry
|
484
|
+
switch (entry.type) {
|
484
485
|
case CatalogType::SCALAR_FUNCTION_ENTRY:
|
485
486
|
finished = ExtractFunctionData<ScalarFunctionCatalogEntry, ScalarFunctionExtractor>(
|
486
|
-
|
487
|
+
entry, data.offset_in_entry, output, count);
|
487
488
|
break;
|
488
489
|
case CatalogType::AGGREGATE_FUNCTION_ENTRY:
|
489
490
|
finished = ExtractFunctionData<AggregateFunctionCatalogEntry, AggregateFunctionExtractor>(
|
490
|
-
|
491
|
+
entry, data.offset_in_entry, output, count);
|
491
492
|
break;
|
492
493
|
case CatalogType::TABLE_MACRO_ENTRY:
|
493
|
-
finished = ExtractFunctionData<TableMacroCatalogEntry, TableMacroExtractor>(
|
494
|
-
|
494
|
+
finished = ExtractFunctionData<TableMacroCatalogEntry, TableMacroExtractor>(entry, data.offset_in_entry,
|
495
|
+
output, count);
|
495
496
|
break;
|
496
497
|
|
497
498
|
case CatalogType::MACRO_ENTRY:
|
498
|
-
finished = ExtractFunctionData<ScalarMacroCatalogEntry, MacroExtractor>(
|
499
|
-
|
499
|
+
finished = ExtractFunctionData<ScalarMacroCatalogEntry, MacroExtractor>(entry, data.offset_in_entry, output,
|
500
|
+
count);
|
500
501
|
break;
|
501
502
|
case CatalogType::TABLE_FUNCTION_ENTRY:
|
502
503
|
finished = ExtractFunctionData<TableFunctionCatalogEntry, TableFunctionExtractor>(
|
503
|
-
|
504
|
+
entry, data.offset_in_entry, output, count);
|
504
505
|
break;
|
505
506
|
case CatalogType::PRAGMA_FUNCTION_ENTRY:
|
506
507
|
finished = ExtractFunctionData<PragmaFunctionCatalogEntry, PragmaFunctionExtractor>(
|
507
|
-
|
508
|
+
entry, data.offset_in_entry, output, count);
|
508
509
|
break;
|
509
510
|
default:
|
510
511
|
throw InternalException("FIXME: unrecognized function type in duckdb_functions");
|
@@ -15,7 +15,7 @@ struct DuckDBIndexesData : public GlobalTableFunctionState {
|
|
15
15
|
DuckDBIndexesData() : offset(0) {
|
16
16
|
}
|
17
17
|
|
18
|
-
vector<CatalogEntry
|
18
|
+
vector<reference<CatalogEntry>> entries;
|
19
19
|
idx_t offset;
|
20
20
|
};
|
21
21
|
|
@@ -66,7 +66,8 @@ unique_ptr<GlobalTableFunctionState> DuckDBIndexesInit(ClientContext &context, T
|
|
66
66
|
// scan all the schemas for tables and collect them and collect them
|
67
67
|
auto schemas = Catalog::GetAllSchemas(context);
|
68
68
|
for (auto &schema : schemas) {
|
69
|
-
schema
|
69
|
+
schema.get().Scan(context, CatalogType::INDEX_ENTRY,
|
70
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry); });
|
70
71
|
};
|
71
72
|
return std::move(result);
|
72
73
|
}
|
@@ -81,31 +82,31 @@ void DuckDBIndexesFunction(ClientContext &context, TableFunctionInput &data_p, D
|
|
81
82
|
// either fill up the chunk or return all the remaining columns
|
82
83
|
idx_t count = 0;
|
83
84
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
84
|
-
auto &entry = data.entries[data.offset++];
|
85
|
+
auto &entry = data.entries[data.offset++].get();
|
85
86
|
|
86
|
-
auto &index = entry
|
87
|
+
auto &index = entry.Cast<IndexCatalogEntry>();
|
87
88
|
// return values:
|
88
89
|
|
89
90
|
idx_t col = 0;
|
90
91
|
// database_name, VARCHAR
|
91
|
-
output.SetValue(col++, count, index.catalog
|
92
|
+
output.SetValue(col++, count, index.catalog.GetName());
|
92
93
|
// database_oid, BIGINT
|
93
|
-
output.SetValue(col++, count, Value::BIGINT(index.catalog
|
94
|
+
output.SetValue(col++, count, Value::BIGINT(index.catalog.GetOid()));
|
94
95
|
// schema_name, VARCHAR
|
95
|
-
output.SetValue(col++, count, Value(index.schema
|
96
|
+
output.SetValue(col++, count, Value(index.schema.name));
|
96
97
|
// schema_oid, BIGINT
|
97
|
-
output.SetValue(col++, count, Value::BIGINT(index.schema
|
98
|
+
output.SetValue(col++, count, Value::BIGINT(index.schema.oid));
|
98
99
|
// index_name, VARCHAR
|
99
100
|
output.SetValue(col++, count, Value(index.name));
|
100
101
|
// index_oid, BIGINT
|
101
102
|
output.SetValue(col++, count, Value::BIGINT(index.oid));
|
102
103
|
// find the table in the catalog
|
103
|
-
auto table_entry =
|
104
|
-
index.schema
|
104
|
+
auto &table_entry =
|
105
|
+
index.schema.catalog.GetEntry<TableCatalogEntry>(context, index.GetSchemaName(), index.GetTableName());
|
105
106
|
// table_name, VARCHAR
|
106
|
-
output.SetValue(col++, count, Value(table_entry
|
107
|
+
output.SetValue(col++, count, Value(table_entry.name));
|
107
108
|
// table_oid, BIGINT
|
108
|
-
output.SetValue(col++, count, Value::BIGINT(table_entry
|
109
|
+
output.SetValue(col++, count, Value::BIGINT(table_entry.oid));
|
109
110
|
if (index.index) {
|
110
111
|
// is_unique, BOOLEAN
|
111
112
|
output.SetValue(col++, count, Value::BOOLEAN(index.index->IsUnique()));
|
@@ -12,7 +12,7 @@ struct DuckDBSchemasData : public GlobalTableFunctionState {
|
|
12
12
|
DuckDBSchemasData() : offset(0) {
|
13
13
|
}
|
14
14
|
|
15
|
-
vector<SchemaCatalogEntry
|
15
|
+
vector<reference<SchemaCatalogEntry>> entries;
|
16
16
|
idx_t offset;
|
17
17
|
};
|
18
18
|
|
@@ -58,20 +58,20 @@ void DuckDBSchemasFunction(ClientContext &context, TableFunctionInput &data_p, D
|
|
58
58
|
// either fill up the chunk or return all the remaining columns
|
59
59
|
idx_t count = 0;
|
60
60
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
61
|
-
auto &entry = data.entries[data.offset];
|
61
|
+
auto &entry = data.entries[data.offset].get();
|
62
62
|
|
63
63
|
// return values:
|
64
64
|
idx_t col = 0;
|
65
65
|
// "oid", PhysicalType::BIGINT
|
66
|
-
output.SetValue(col++, count, Value::BIGINT(entry
|
66
|
+
output.SetValue(col++, count, Value::BIGINT(entry.oid));
|
67
67
|
// database_name, VARCHAR
|
68
|
-
output.SetValue(col++, count, entry
|
68
|
+
output.SetValue(col++, count, entry.catalog.GetName());
|
69
69
|
// database_oid, BIGINT
|
70
|
-
output.SetValue(col++, count, Value::BIGINT(entry
|
70
|
+
output.SetValue(col++, count, Value::BIGINT(entry.catalog.GetOid()));
|
71
71
|
// "schema_name", PhysicalType::VARCHAR
|
72
|
-
output.SetValue(col++, count, Value(entry
|
72
|
+
output.SetValue(col++, count, Value(entry.name));
|
73
73
|
// "internal", PhysicalType::BOOLEAN
|
74
|
-
output.SetValue(col++, count, Value::BOOLEAN(entry
|
74
|
+
output.SetValue(col++, count, Value::BOOLEAN(entry.internal));
|
75
75
|
// "sql", PhysicalType::VARCHAR
|
76
76
|
output.SetValue(col++, count, Value());
|
77
77
|
|
@@ -13,7 +13,7 @@ struct DuckDBSequencesData : public GlobalTableFunctionState {
|
|
13
13
|
DuckDBSequencesData() : offset(0) {
|
14
14
|
}
|
15
15
|
|
16
|
-
vector<SequenceCatalogEntry
|
16
|
+
vector<reference<SequenceCatalogEntry>> entries;
|
17
17
|
idx_t offset;
|
18
18
|
};
|
19
19
|
|
@@ -70,8 +70,8 @@ unique_ptr<GlobalTableFunctionState> DuckDBSequencesInit(ClientContext &context,
|
|
70
70
|
// scan all the schemas for tables and collect themand collect them
|
71
71
|
auto schemas = Catalog::GetAllSchemas(context);
|
72
72
|
for (auto &schema : schemas) {
|
73
|
-
schema
|
74
|
-
|
73
|
+
schema.get().Scan(context, CatalogType::SEQUENCE_ENTRY,
|
74
|
+
[&](CatalogEntry &entry) { result->entries.push_back(entry.Cast<SequenceCatalogEntry>()); });
|
75
75
|
};
|
76
76
|
return std::move(result);
|
77
77
|
}
|
@@ -86,19 +86,18 @@ void DuckDBSequencesFunction(ClientContext &context, TableFunctionInput &data_p,
|
|
86
86
|
// either fill up the chunk or return all the remaining columns
|
87
87
|
idx_t count = 0;
|
88
88
|
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
89
|
-
auto &
|
89
|
+
auto &seq = data.entries[data.offset++].get();
|
90
90
|
|
91
|
-
auto &seq = entry->Cast<SequenceCatalogEntry>();
|
92
91
|
// return values:
|
93
92
|
idx_t col = 0;
|
94
93
|
// database_name, VARCHAR
|
95
|
-
output.SetValue(col++, count,
|
94
|
+
output.SetValue(col++, count, seq.catalog.GetName());
|
96
95
|
// database_oid, BIGINT
|
97
|
-
output.SetValue(col++, count, Value::BIGINT(
|
96
|
+
output.SetValue(col++, count, Value::BIGINT(seq.catalog.GetOid()));
|
98
97
|
// schema_name, VARCHAR
|
99
|
-
output.SetValue(col++, count, Value(seq.schema
|
98
|
+
output.SetValue(col++, count, Value(seq.schema.name));
|
100
99
|
// schema_oid, BIGINT
|
101
|
-
output.SetValue(col++, count, Value::BIGINT(seq.schema
|
100
|
+
output.SetValue(col++, count, Value::BIGINT(seq.schema.oid));
|
102
101
|
// sequence_name, VARCHAR
|
103
102
|
output.SetValue(col++, count, Value(seq.name));
|
104
103
|
// sequence_oid, BIGINT
|