duckdb 0.7.2-dev16.0 → 0.7.2-dev314.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 +2 -0
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-extension.cpp +2 -0
- package/src/duckdb/extension/icu/icu-table-range.cpp +194 -0
- package/src/duckdb/extension/icu/include/icu-table-range.hpp +17 -0
- package/src/duckdb/extension/parquet/column_reader.cpp +5 -6
- package/src/duckdb/extension/parquet/column_writer.cpp +0 -1
- package/src/duckdb/extension/parquet/include/column_reader.hpp +1 -2
- package/src/duckdb/extension/parquet/include/generated_column_reader.hpp +1 -11
- package/src/duckdb/extension/parquet/parquet-extension.cpp +11 -2
- package/src/duckdb/extension/parquet/parquet_statistics.cpp +26 -32
- package/src/duckdb/src/catalog/catalog_entry/duck_schema_entry.cpp +4 -0
- package/src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp +7 -6
- package/src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp +20 -1
- package/src/duckdb/src/common/enums/statement_type.cpp +2 -0
- package/src/duckdb/src/common/sort/sort_state.cpp +5 -7
- package/src/duckdb/src/common/types/bit.cpp +95 -58
- package/src/duckdb/src/common/types/value.cpp +149 -53
- package/src/duckdb/src/common/types/vector.cpp +13 -10
- package/src/duckdb/src/execution/column_binding_resolver.cpp +6 -0
- package/src/duckdb/src/execution/operator/aggregate/physical_perfecthash_aggregate.cpp +4 -5
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +1 -1
- package/src/duckdb/src/execution/operator/helper/physical_vacuum.cpp +2 -3
- package/src/duckdb/src/execution/operator/join/physical_blockwise_nl_join.cpp +32 -6
- package/src/duckdb/src/execution/operator/persistent/buffered_csv_reader.cpp +1 -1
- package/src/duckdb/src/execution/physical_plan/plan_aggregate.cpp +15 -15
- package/src/duckdb/src/execution/physical_plan/plan_comparison_join.cpp +18 -12
- package/src/duckdb/src/function/aggregate/algebraic/avg.cpp +0 -6
- package/src/duckdb/src/function/aggregate/distributive/bitagg.cpp +99 -95
- package/src/duckdb/src/function/aggregate/distributive/bitstring_agg.cpp +254 -0
- package/src/duckdb/src/function/aggregate/distributive/count.cpp +2 -4
- package/src/duckdb/src/function/aggregate/distributive/sum.cpp +11 -16
- package/src/duckdb/src/function/aggregate/distributive_functions.cpp +1 -0
- package/src/duckdb/src/function/aggregate/sorted_aggregate_function.cpp +16 -5
- package/src/duckdb/src/function/cast/bit_cast.cpp +0 -2
- package/src/duckdb/src/function/cast/blob_cast.cpp +0 -1
- package/src/duckdb/src/function/scalar/bit/bitstring.cpp +99 -0
- package/src/duckdb/src/function/scalar/date/date_diff.cpp +0 -1
- package/src/duckdb/src/function/scalar/date/date_part.cpp +17 -25
- package/src/duckdb/src/function/scalar/date/date_sub.cpp +0 -1
- package/src/duckdb/src/function/scalar/date/date_trunc.cpp +10 -14
- package/src/duckdb/src/function/scalar/generic/stats.cpp +2 -4
- package/src/duckdb/src/function/scalar/list/flatten.cpp +5 -12
- package/src/duckdb/src/function/scalar/list/list_concat.cpp +3 -8
- package/src/duckdb/src/function/scalar/list/list_extract.cpp +5 -12
- package/src/duckdb/src/function/scalar/list/list_value.cpp +5 -9
- package/src/duckdb/src/function/scalar/map/map_entries.cpp +61 -0
- package/src/duckdb/src/function/scalar/map/map_keys_values.cpp +97 -0
- package/src/duckdb/src/function/scalar/math/numeric.cpp +14 -17
- package/src/duckdb/src/function/scalar/nested_functions.cpp +3 -0
- package/src/duckdb/src/function/scalar/operators/add.cpp +0 -9
- package/src/duckdb/src/function/scalar/operators/arithmetic.cpp +29 -48
- package/src/duckdb/src/function/scalar/operators/bitwise.cpp +0 -63
- package/src/duckdb/src/function/scalar/operators/multiply.cpp +0 -6
- package/src/duckdb/src/function/scalar/operators/subtract.cpp +0 -6
- package/src/duckdb/src/function/scalar/string/caseconvert.cpp +2 -6
- package/src/duckdb/src/function/scalar/string/instr.cpp +2 -6
- package/src/duckdb/src/function/scalar/string/length.cpp +2 -6
- package/src/duckdb/src/function/scalar/string/like.cpp +2 -6
- package/src/duckdb/src/function/scalar/string/substring.cpp +2 -6
- package/src/duckdb/src/function/scalar/string_functions.cpp +1 -0
- package/src/duckdb/src/function/scalar/struct/struct_extract.cpp +4 -9
- package/src/duckdb/src/function/scalar/struct/struct_insert.cpp +10 -13
- package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +5 -6
- package/src/duckdb/src/function/table/read_csv.cpp +9 -0
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/table_function.cpp +19 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +6 -8
- package/src/duckdb/src/include/duckdb/common/constants.hpp +0 -19
- package/src/duckdb/src/include/duckdb/common/enums/statement_type.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/enums/tableref_type.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/types/bit.hpp +5 -1
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +2 -8
- package/src/duckdb/src/include/duckdb/common/types.hpp +1 -2
- package/src/duckdb/src/include/duckdb/execution/operator/aggregate/physical_perfecthash_aggregate.hpp +1 -1
- package/src/duckdb/src/include/duckdb/function/aggregate/distributive_functions.hpp +5 -0
- package/src/duckdb/src/include/duckdb/function/aggregate_function.hpp +12 -3
- package/src/duckdb/src/include/duckdb/function/scalar/bit_functions.hpp +4 -0
- package/src/duckdb/src/include/duckdb/function/scalar/nested_functions.hpp +12 -0
- package/src/duckdb/src/include/duckdb/function/scalar_function.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/capi/capi_internal.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/config.hpp +3 -0
- package/src/duckdb/src/include/duckdb/main/database.hpp +1 -0
- package/src/duckdb/src/include/duckdb/optimizer/join_order/cardinality_estimator.hpp +2 -2
- package/src/duckdb/src/include/duckdb/parser/common_table_expression_info.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/parsed_data/{alter_function_info.hpp → alter_scalar_function_info.hpp} +13 -13
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_function_info.hpp +47 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/create_table_function_info.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/query_node.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/statement/multi_statement.hpp +28 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/list.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +76 -0
- package/src/duckdb/src/include/duckdb/parser/tokens.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/transformer.hpp +28 -0
- package/src/duckdb/src/include/duckdb/planner/bind_context.hpp +2 -0
- package/src/duckdb/src/include/duckdb/planner/binder.hpp +8 -0
- package/src/duckdb/src/include/duckdb/storage/buffer/block_handle.hpp +2 -0
- package/src/duckdb/src/include/duckdb/storage/buffer_manager.hpp +76 -44
- package/src/duckdb/src/include/duckdb/storage/checkpoint/table_data_writer.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_compress.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/chimp/chimp_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_compress.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_fetch.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/compression/patas/patas_scan.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/data_pointer.hpp +5 -2
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/statistics/base_statistics.hpp +93 -29
- package/src/duckdb/src/include/duckdb/storage/statistics/column_statistics.hpp +22 -3
- package/src/duckdb/src/include/duckdb/storage/statistics/distinct_statistics.hpp +6 -6
- package/src/duckdb/src/include/duckdb/storage/statistics/list_stats.hpp +41 -0
- package/src/duckdb/src/include/duckdb/storage/statistics/node_statistics.hpp +26 -0
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_stats.hpp +157 -0
- package/src/duckdb/src/include/duckdb/storage/statistics/segment_statistics.hpp +2 -7
- package/src/duckdb/src/include/duckdb/storage/statistics/string_stats.hpp +74 -0
- package/src/duckdb/src/include/duckdb/storage/statistics/struct_stats.hpp +42 -0
- package/src/duckdb/src/include/duckdb/storage/string_uncompressed.hpp +2 -3
- package/src/duckdb/src/include/duckdb/storage/table/column_segment.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/table/list_column_data.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/table/persistent_table_data.hpp +2 -1
- package/src/duckdb/src/include/duckdb/storage/table/row_group.hpp +4 -3
- package/src/duckdb/src/include/duckdb/storage/table/row_group_collection.hpp +3 -2
- package/src/duckdb/src/include/duckdb/storage/table/scan_state.hpp +2 -0
- package/src/duckdb/src/include/duckdb/storage/table/table_statistics.hpp +5 -0
- package/src/duckdb/src/include/duckdb.h +49 -1
- package/src/duckdb/src/include/duckdb.hpp +0 -1
- package/src/duckdb/src/main/capi/pending-c.cpp +16 -3
- package/src/duckdb/src/main/capi/result-c.cpp +27 -1
- package/src/duckdb/src/main/capi/stream-c.cpp +25 -0
- package/src/duckdb/src/main/client_context.cpp +8 -1
- package/src/duckdb/src/main/config.cpp +66 -1
- package/src/duckdb/src/main/database.cpp +10 -2
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +98 -67
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +16 -3
- package/src/duckdb/src/optimizer/statistics/expression/propagate_aggregate.cpp +9 -3
- package/src/duckdb/src/optimizer/statistics/expression/propagate_and_compress.cpp +6 -7
- package/src/duckdb/src/optimizer/statistics/expression/propagate_cast.cpp +14 -11
- package/src/duckdb/src/optimizer/statistics/expression/propagate_columnref.cpp +1 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_comparison.cpp +13 -15
- package/src/duckdb/src/optimizer/statistics/expression/propagate_conjunction.cpp +0 -1
- package/src/duckdb/src/optimizer/statistics/expression/propagate_constant.cpp +3 -75
- package/src/duckdb/src/optimizer/statistics/expression/propagate_function.cpp +7 -2
- package/src/duckdb/src/optimizer/statistics/expression/propagate_operator.cpp +10 -0
- package/src/duckdb/src/optimizer/statistics/operator/propagate_aggregate.cpp +2 -3
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +28 -31
- package/src/duckdb/src/optimizer/statistics/operator/propagate_join.cpp +4 -5
- package/src/duckdb/src/optimizer/statistics/operator/propagate_set_operation.cpp +3 -3
- package/src/duckdb/src/optimizer/statistics_propagator.cpp +1 -1
- package/src/duckdb/src/parser/parsed_data/alter_info.cpp +7 -3
- package/src/duckdb/src/parser/parsed_data/alter_scalar_function_info.cpp +56 -0
- package/src/duckdb/src/parser/parsed_data/alter_table_function_info.cpp +51 -0
- package/src/duckdb/src/parser/parsed_data/create_scalar_function_info.cpp +3 -2
- package/src/duckdb/src/parser/parsed_data/create_table_function_info.cpp +6 -0
- package/src/duckdb/src/parser/parsed_expression_iterator.cpp +8 -0
- package/src/duckdb/src/parser/query_node.cpp +1 -1
- package/src/duckdb/src/parser/statement/multi_statement.cpp +18 -0
- package/src/duckdb/src/parser/tableref/pivotref.cpp +296 -0
- package/src/duckdb/src/parser/tableref.cpp +3 -0
- package/src/duckdb/src/parser/transform/helpers/transform_alias.cpp +12 -6
- package/src/duckdb/src/parser/transform/helpers/transform_cte.cpp +24 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_function.cpp +4 -0
- package/src/duckdb/src/parser/transform/statement/transform_create_view.cpp +4 -0
- package/src/duckdb/src/parser/transform/statement/transform_pivot_stmt.cpp +150 -0
- package/src/duckdb/src/parser/transform/statement/transform_select.cpp +8 -0
- package/src/duckdb/src/parser/transform/statement/transform_select_node.cpp +1 -1
- package/src/duckdb/src/parser/transform/tableref/transform_join.cpp +4 -0
- package/src/duckdb/src/parser/transform/tableref/transform_pivot.cpp +105 -0
- package/src/duckdb/src/parser/transform/tableref/transform_tableref.cpp +2 -0
- package/src/duckdb/src/parser/transformer.cpp +15 -3
- package/src/duckdb/src/planner/bind_context.cpp +16 -0
- package/src/duckdb/src/planner/binder/query_node/bind_select_node.cpp +11 -3
- package/src/duckdb/src/planner/binder/query_node/plan_select_node.cpp +0 -1
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +1 -1
- package/src/duckdb/src/planner/binder/statement/bind_logical_plan.cpp +17 -0
- package/src/duckdb/src/planner/binder/tableref/bind_joinref.cpp +9 -0
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +365 -0
- package/src/duckdb/src/planner/binder.cpp +7 -1
- package/src/duckdb/src/planner/bound_result_modifier.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_window_expression.cpp +1 -1
- package/src/duckdb/src/planner/filter/constant_filter.cpp +4 -6
- package/src/duckdb/src/planner/pragma_handler.cpp +10 -2
- package/src/duckdb/src/storage/buffer_manager.cpp +44 -46
- package/src/duckdb/src/storage/checkpoint/row_group_writer.cpp +1 -1
- package/src/duckdb/src/storage/checkpoint/table_data_reader.cpp +1 -4
- package/src/duckdb/src/storage/checkpoint/table_data_writer.cpp +4 -4
- package/src/duckdb/src/storage/compression/bitpacking.cpp +28 -24
- package/src/duckdb/src/storage/compression/fixed_size_uncompressed.cpp +43 -45
- package/src/duckdb/src/storage/compression/numeric_constant.cpp +9 -10
- package/src/duckdb/src/storage/compression/patas.cpp +1 -1
- package/src/duckdb/src/storage/compression/rle.cpp +19 -15
- package/src/duckdb/src/storage/compression/validity_uncompressed.cpp +5 -5
- package/src/duckdb/src/storage/data_table.cpp +4 -6
- package/src/duckdb/src/storage/statistics/base_statistics.cpp +373 -128
- package/src/duckdb/src/storage/statistics/column_statistics.cpp +58 -3
- package/src/duckdb/src/storage/statistics/distinct_statistics.cpp +4 -9
- package/src/duckdb/src/storage/statistics/list_stats.cpp +117 -0
- package/src/duckdb/src/storage/statistics/numeric_stats.cpp +529 -0
- package/src/duckdb/src/storage/statistics/segment_statistics.cpp +2 -11
- package/src/duckdb/src/storage/statistics/string_stats.cpp +273 -0
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +131 -0
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/src/storage/table/column_checkpoint_state.cpp +3 -4
- package/src/duckdb/src/storage/table/column_data.cpp +16 -11
- package/src/duckdb/src/storage/table/column_data_checkpointer.cpp +2 -3
- package/src/duckdb/src/storage/table/column_segment.cpp +6 -8
- package/src/duckdb/src/storage/table/list_column_data.cpp +39 -58
- package/src/duckdb/src/storage/table/row_group.cpp +24 -23
- package/src/duckdb/src/storage/table/row_group_collection.cpp +12 -12
- package/src/duckdb/src/storage/table/standard_column_data.cpp +6 -6
- package/src/duckdb/src/storage/table/struct_column_data.cpp +15 -16
- package/src/duckdb/src/storage/table/table_statistics.cpp +27 -7
- package/src/duckdb/src/storage/table/update_segment.cpp +10 -12
- package/src/duckdb/third_party/libpg_query/include/nodes/nodes.hpp +3 -0
- package/src/duckdb/third_party/libpg_query/include/nodes/parsenodes.hpp +34 -1
- package/src/duckdb/third_party/libpg_query/include/parser/gram.hpp +1020 -530
- package/src/duckdb/third_party/libpg_query/include/parser/kwlist.hpp +7 -0
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +23560 -22737
- package/src/duckdb/ub_src_function_aggregate_distributive.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_bit.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_map.cpp +4 -0
- package/src/duckdb/ub_src_main_capi.cpp +2 -0
- package/src/duckdb/ub_src_parser_parsed_data.cpp +4 -2
- package/src/duckdb/ub_src_parser_statement.cpp +2 -0
- package/src/duckdb/ub_src_parser_tableref.cpp +2 -0
- package/src/duckdb/ub_src_parser_transform_statement.cpp +2 -0
- package/src/duckdb/ub_src_parser_transform_tableref.cpp +2 -0
- package/src/duckdb/ub_src_planner_binder_tableref.cpp +2 -0
- package/src/duckdb/ub_src_storage_statistics.cpp +4 -6
- package/src/duckdb/src/include/duckdb/main/loadable_extension.hpp +0 -59
- package/src/duckdb/src/include/duckdb/storage/statistics/list_statistics.hpp +0 -36
- package/src/duckdb/src/include/duckdb/storage/statistics/numeric_statistics.hpp +0 -75
- package/src/duckdb/src/include/duckdb/storage/statistics/string_statistics.hpp +0 -49
- package/src/duckdb/src/include/duckdb/storage/statistics/struct_statistics.hpp +0 -36
- package/src/duckdb/src/include/duckdb/storage/statistics/validity_statistics.hpp +0 -45
- package/src/duckdb/src/parser/parsed_data/alter_function_info.cpp +0 -55
- package/src/duckdb/src/storage/statistics/list_statistics.cpp +0 -94
- package/src/duckdb/src/storage/statistics/numeric_statistics.cpp +0 -307
- package/src/duckdb/src/storage/statistics/string_statistics.cpp +0 -220
- package/src/duckdb/src/storage/statistics/struct_statistics.cpp +0 -108
- package/src/duckdb/src/storage/statistics/validity_statistics.cpp +0 -91
@@ -107,7 +107,6 @@ void BitwiseAndFun::RegisterFunction(BuiltinFunctions &set) {
|
|
107
107
|
ScalarFunction({type, type}, type, GetScalarIntegerBinaryFunction<BitwiseANDOperator>(type)));
|
108
108
|
}
|
109
109
|
functions.AddFunction(ScalarFunction({LogicalType::BIT, LogicalType::BIT}, LogicalType::BIT, BitwiseANDOperation));
|
110
|
-
|
111
110
|
set.AddFunction(functions);
|
112
111
|
}
|
113
112
|
|
@@ -306,66 +305,4 @@ void RightShiftFun::RegisterFunction(BuiltinFunctions &set) {
|
|
306
305
|
set.AddFunction(functions);
|
307
306
|
}
|
308
307
|
|
309
|
-
//===--------------------------------------------------------------------===//
|
310
|
-
// get_bit
|
311
|
-
//===--------------------------------------------------------------------===//
|
312
|
-
struct GetBitOperator {
|
313
|
-
template <class TA, class TB, class TR>
|
314
|
-
static inline TR Operation(TA input, TB n) {
|
315
|
-
if (n < 0 || (idx_t)n > Bit::BitLength(input) - 1) {
|
316
|
-
throw OutOfRangeException("bit index %s out of valid range (0..%s)", NumericHelper::ToString(n),
|
317
|
-
NumericHelper::ToString(Bit::BitLength(input) - 1));
|
318
|
-
}
|
319
|
-
return Bit::GetBit(input, n);
|
320
|
-
}
|
321
|
-
};
|
322
|
-
|
323
|
-
void GetBitFun::RegisterFunction(BuiltinFunctions &set) {
|
324
|
-
set.AddFunction(ScalarFunction("get_bit", {LogicalType::BIT, LogicalType::INTEGER}, LogicalType::INTEGER,
|
325
|
-
ScalarFunction::BinaryFunction<string_t, int32_t, int32_t, GetBitOperator>));
|
326
|
-
}
|
327
|
-
|
328
|
-
//===--------------------------------------------------------------------===//
|
329
|
-
// set_bit
|
330
|
-
//===--------------------------------------------------------------------===//
|
331
|
-
static void SetBitOperation(DataChunk &args, ExpressionState &state, Vector &result) {
|
332
|
-
TernaryExecutor::Execute<string_t, int32_t, int32_t, string_t>(
|
333
|
-
args.data[0], args.data[1], args.data[2], result, args.size(),
|
334
|
-
[&](string_t input, int32_t n, int32_t new_value) {
|
335
|
-
if (new_value != 0 && new_value != 1) {
|
336
|
-
throw InvalidInputException("The new bit must be 1 or 0");
|
337
|
-
}
|
338
|
-
if (n < 0 || (idx_t)n > Bit::BitLength(input) - 1) {
|
339
|
-
throw OutOfRangeException("bit index %s out of valid range (0..%s)", NumericHelper::ToString(n),
|
340
|
-
NumericHelper::ToString(Bit::BitLength(input) - 1));
|
341
|
-
}
|
342
|
-
string_t target = StringVector::EmptyString(result, input.GetSize());
|
343
|
-
Bit::SetBit(input, n, new_value, target);
|
344
|
-
return target;
|
345
|
-
});
|
346
|
-
}
|
347
|
-
|
348
|
-
void SetBitFun::RegisterFunction(BuiltinFunctions &set) {
|
349
|
-
set.AddFunction(ScalarFunction("set_bit", {LogicalType::BIT, LogicalType::INTEGER, LogicalType::INTEGER},
|
350
|
-
LogicalType::BIT, SetBitOperation));
|
351
|
-
}
|
352
|
-
|
353
|
-
//===--------------------------------------------------------------------===//
|
354
|
-
// bit_position
|
355
|
-
//===--------------------------------------------------------------------===//
|
356
|
-
struct BitPositionOperator {
|
357
|
-
template <class TA, class TB, class TR>
|
358
|
-
static inline TR Operation(TA substring, TB input) {
|
359
|
-
if (substring.GetSize() > input.GetSize()) {
|
360
|
-
return 0;
|
361
|
-
}
|
362
|
-
return Bit::BitPosition(substring, input);
|
363
|
-
}
|
364
|
-
};
|
365
|
-
|
366
|
-
void BitPositionFun::RegisterFunction(BuiltinFunctions &set) {
|
367
|
-
set.AddFunction(ScalarFunction("bit_position", {LogicalType::BIT, LogicalType::BIT}, LogicalType::INTEGER,
|
368
|
-
ScalarFunction::BinaryFunction<string_t, string_t, int32_t, BitPositionOperator>));
|
369
|
-
}
|
370
|
-
|
371
308
|
} // namespace duckdb
|
@@ -16,18 +16,12 @@ namespace duckdb {
|
|
16
16
|
template <>
|
17
17
|
float MultiplyOperator::Operation(float left, float right) {
|
18
18
|
auto result = left * right;
|
19
|
-
if (!Value::FloatIsFinite(result)) {
|
20
|
-
throw OutOfRangeException("Overflow in multiplication of float!");
|
21
|
-
}
|
22
19
|
return result;
|
23
20
|
}
|
24
21
|
|
25
22
|
template <>
|
26
23
|
double MultiplyOperator::Operation(double left, double right) {
|
27
24
|
auto result = left * right;
|
28
|
-
if (!Value::DoubleIsFinite(result)) {
|
29
|
-
throw OutOfRangeException("Overflow in multiplication of double!");
|
30
|
-
}
|
31
25
|
return result;
|
32
26
|
}
|
33
27
|
|
@@ -15,18 +15,12 @@ namespace duckdb {
|
|
15
15
|
template <>
|
16
16
|
float SubtractOperator::Operation(float left, float right) {
|
17
17
|
auto result = left - right;
|
18
|
-
if (!Value::FloatIsFinite(result)) {
|
19
|
-
throw OutOfRangeException("Overflow in subtraction of float!");
|
20
|
-
}
|
21
18
|
return result;
|
22
19
|
}
|
23
20
|
|
24
21
|
template <>
|
25
22
|
double SubtractOperator::Operation(double left, double right) {
|
26
23
|
auto result = left - right;
|
27
|
-
if (!Value::DoubleIsFinite(result)) {
|
28
|
-
throw OutOfRangeException("Overflow in subtraction of double!");
|
29
|
-
}
|
30
24
|
return result;
|
31
25
|
}
|
32
26
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
5
5
|
#include "duckdb/common/vector_operations/unary_executor.hpp"
|
6
6
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
7
|
-
|
7
|
+
|
8
8
|
#include "utf8proc.hpp"
|
9
9
|
|
10
10
|
#include <string.h>
|
@@ -153,11 +153,7 @@ static unique_ptr<BaseStatistics> CaseConvertPropagateStats(ClientContext &conte
|
|
153
153
|
auto &expr = input.expr;
|
154
154
|
D_ASSERT(child_stats.size() == 1);
|
155
155
|
// can only propagate stats if the children have stats
|
156
|
-
if (!child_stats[0]) {
|
157
|
-
return nullptr;
|
158
|
-
}
|
159
|
-
auto &sstats = (StringStatistics &)*child_stats[0];
|
160
|
-
if (!sstats.has_unicode) {
|
156
|
+
if (!StringStats::CanContainUnicode(child_stats[0])) {
|
161
157
|
expr.function.function = CaseConvertFunctionASCII<IS_UPPER>;
|
162
158
|
}
|
163
159
|
return nullptr;
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#include "duckdb/common/exception.hpp"
|
4
4
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
5
5
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
6
|
-
|
6
|
+
|
7
7
|
#include "utf8proc.hpp"
|
8
8
|
|
9
9
|
namespace duckdb {
|
@@ -42,12 +42,8 @@ static unique_ptr<BaseStatistics> InStrPropagateStats(ClientContext &context, Fu
|
|
42
42
|
auto &expr = input.expr;
|
43
43
|
D_ASSERT(child_stats.size() == 2);
|
44
44
|
// can only propagate stats if the children have stats
|
45
|
-
if (!child_stats[0]) {
|
46
|
-
return nullptr;
|
47
|
-
}
|
48
45
|
// for strpos, we only care if the FIRST string has unicode or not
|
49
|
-
|
50
|
-
if (!sstats.has_unicode) {
|
46
|
+
if (!StringStats::CanContainUnicode(child_stats[0])) {
|
51
47
|
expr.function.function = ScalarFunction::BinaryFunction<string_t, string_t, int64_t, InstrAsciiOperator>;
|
52
48
|
}
|
53
49
|
return nullptr;
|
@@ -4,7 +4,7 @@
|
|
4
4
|
#include "duckdb/common/exception.hpp"
|
5
5
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
6
6
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
7
|
-
|
7
|
+
|
8
8
|
#include "duckdb/planner/expression/bound_parameter_expression.hpp"
|
9
9
|
#include "utf8proc.hpp"
|
10
10
|
|
@@ -78,11 +78,7 @@ static unique_ptr<BaseStatistics> LengthPropagateStats(ClientContext &context, F
|
|
78
78
|
auto &expr = input.expr;
|
79
79
|
D_ASSERT(child_stats.size() == 1);
|
80
80
|
// can only propagate stats if the children have stats
|
81
|
-
if (!child_stats[0]) {
|
82
|
-
return nullptr;
|
83
|
-
}
|
84
|
-
auto &sstats = (StringStatistics &)*child_stats[0];
|
85
|
-
if (!sstats.has_unicode) {
|
81
|
+
if (!StringStats::CanContainUnicode(child_stats[0])) {
|
86
82
|
expr.function.function = ScalarFunction::UnaryFunction<string_t, int64_t, StrLenOperator>;
|
87
83
|
}
|
88
84
|
return nullptr;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
3
3
|
#include "duckdb/function/scalar/string_functions.hpp"
|
4
4
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
5
|
-
|
5
|
+
|
6
6
|
#include "duckdb/execution/expression_executor.hpp"
|
7
7
|
|
8
8
|
namespace duckdb {
|
@@ -482,11 +482,7 @@ static unique_ptr<BaseStatistics> ILikePropagateStats(ClientContext &context, Fu
|
|
482
482
|
auto &expr = input.expr;
|
483
483
|
D_ASSERT(child_stats.size() >= 1);
|
484
484
|
// can only propagate stats if the children have stats
|
485
|
-
if (!child_stats[0]) {
|
486
|
-
return nullptr;
|
487
|
-
}
|
488
|
-
auto &sstats = (StringStatistics &)*child_stats[0];
|
489
|
-
if (!sstats.has_unicode) {
|
485
|
+
if (!StringStats::CanContainUnicode(child_stats[0])) {
|
490
486
|
expr.function.function = ScalarFunction::BinaryFunction<string_t, string_t, bool, ASCII_OP>;
|
491
487
|
}
|
492
488
|
return nullptr;
|
@@ -4,7 +4,7 @@
|
|
4
4
|
#include "duckdb/common/exception.hpp"
|
5
5
|
#include "duckdb/common/vector_operations/vector_operations.hpp"
|
6
6
|
#include "duckdb/common/vector_operations/ternary_executor.hpp"
|
7
|
-
|
7
|
+
|
8
8
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
9
9
|
#include "utf8proc.hpp"
|
10
10
|
#include "duckdb/common/types/blob.hpp"
|
@@ -307,12 +307,8 @@ static unique_ptr<BaseStatistics> SubstringPropagateStats(ClientContext &context
|
|
307
307
|
auto &child_stats = input.child_stats;
|
308
308
|
auto &expr = input.expr;
|
309
309
|
// can only propagate stats if the children have stats
|
310
|
-
if (!child_stats[0]) {
|
311
|
-
return nullptr;
|
312
|
-
}
|
313
310
|
// we only care about the stats of the first child (i.e. the string)
|
314
|
-
|
315
|
-
if (!sstats.has_unicode) {
|
311
|
+
if (!StringStats::CanContainUnicode(child_stats[0])) {
|
316
312
|
expr.function.function = SubstringFunctionASCII;
|
317
313
|
}
|
318
314
|
return nullptr;
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#include "duckdb/function/scalar/nested_functions.hpp"
|
4
4
|
#include "duckdb/planner/expression/bound_function_expression.hpp"
|
5
5
|
#include "duckdb/planner/expression/bound_parameter_expression.hpp"
|
6
|
-
#include "duckdb/storage/statistics/
|
6
|
+
#include "duckdb/storage/statistics/struct_stats.hpp"
|
7
7
|
|
8
8
|
namespace duckdb {
|
9
9
|
|
@@ -102,15 +102,10 @@ static unique_ptr<FunctionData> StructExtractBind(ClientContext &context, Scalar
|
|
102
102
|
static unique_ptr<BaseStatistics> PropagateStructExtractStats(ClientContext &context, FunctionStatisticsInput &input) {
|
103
103
|
auto &child_stats = input.child_stats;
|
104
104
|
auto &bind_data = input.bind_data;
|
105
|
-
|
106
|
-
return nullptr;
|
107
|
-
}
|
108
|
-
auto &struct_stats = (StructStatistics &)*child_stats[0];
|
105
|
+
|
109
106
|
auto &info = (StructExtractBindData &)*bind_data;
|
110
|
-
|
111
|
-
|
112
|
-
}
|
113
|
-
return struct_stats.child_stats[info.index]->Copy();
|
107
|
+
auto struct_child_stats = StructStats::GetChildStats(child_stats[0]);
|
108
|
+
return struct_child_stats[info.index].ToUnique();
|
114
109
|
}
|
115
110
|
|
116
111
|
ScalarFunction StructExtractFun::GetFunction() {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#include "duckdb/parser/expression/bound_expression.hpp"
|
4
4
|
#include "duckdb/function/scalar/nested_functions.hpp"
|
5
5
|
#include "duckdb/common/case_insensitive_map.hpp"
|
6
|
-
#include "duckdb/storage/statistics/
|
6
|
+
#include "duckdb/storage/statistics/struct_stats.hpp"
|
7
7
|
#include "duckdb/planner/expression_binder.hpp"
|
8
8
|
|
9
9
|
namespace duckdb {
|
@@ -81,22 +81,19 @@ static unique_ptr<FunctionData> StructInsertBind(ClientContext &context, ScalarF
|
|
81
81
|
unique_ptr<BaseStatistics> StructInsertStats(ClientContext &context, FunctionStatisticsInput &input) {
|
82
82
|
auto &child_stats = input.child_stats;
|
83
83
|
auto &expr = input.expr;
|
84
|
-
|
85
|
-
return nullptr;
|
86
|
-
}
|
87
|
-
auto &existing_struct_stats = (StructStatistics &)*child_stats[0];
|
88
|
-
auto new_struct_stats = make_unique<StructStatistics>(expr.return_type);
|
84
|
+
auto new_struct_stats = StructStats::CreateUnknown(expr.return_type);
|
89
85
|
|
90
|
-
|
91
|
-
|
92
|
-
|
86
|
+
auto existing_count = StructType::GetChildCount(child_stats[0].GetType());
|
87
|
+
auto existing_stats = StructStats::GetChildStats(child_stats[0]);
|
88
|
+
for (idx_t i = 0; i < existing_count; i++) {
|
89
|
+
StructStats::SetChildStats(new_struct_stats, i, existing_stats[i]);
|
93
90
|
}
|
94
|
-
|
95
|
-
auto offset =
|
91
|
+
auto new_count = StructType::GetChildCount(expr.return_type);
|
92
|
+
auto offset = new_count - child_stats.size();
|
96
93
|
for (idx_t i = 1; i < child_stats.size(); i++) {
|
97
|
-
new_struct_stats
|
94
|
+
StructStats::SetChildStats(new_struct_stats, offset + i, child_stats[i]);
|
98
95
|
}
|
99
|
-
return
|
96
|
+
return new_struct_stats.ToUnique();
|
100
97
|
}
|
101
98
|
|
102
99
|
void StructInsertFun::RegisterFunction(BuiltinFunctions &set) {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#include "duckdb/parser/expression/bound_expression.hpp"
|
4
4
|
#include "duckdb/function/scalar/nested_functions.hpp"
|
5
5
|
#include "duckdb/common/case_insensitive_map.hpp"
|
6
|
-
#include "duckdb/storage/statistics/
|
6
|
+
#include "duckdb/storage/statistics/struct_stats.hpp"
|
7
7
|
#include "duckdb/planner/expression_binder.hpp"
|
8
8
|
|
9
9
|
namespace duckdb {
|
@@ -61,12 +61,11 @@ static unique_ptr<FunctionData> StructPackBind(ClientContext &context, ScalarFun
|
|
61
61
|
unique_ptr<BaseStatistics> StructPackStats(ClientContext &context, FunctionStatisticsInput &input) {
|
62
62
|
auto &child_stats = input.child_stats;
|
63
63
|
auto &expr = input.expr;
|
64
|
-
auto struct_stats =
|
65
|
-
|
66
|
-
|
67
|
-
struct_stats->child_stats[i] = child_stats[i] ? child_stats[i]->Copy() : nullptr;
|
64
|
+
auto struct_stats = StructStats::CreateUnknown(expr.return_type);
|
65
|
+
for (idx_t i = 0; i < child_stats.size(); i++) {
|
66
|
+
StructStats::SetChildStats(struct_stats, i, child_stats[i]);
|
68
67
|
}
|
69
|
-
return
|
68
|
+
return struct_stats.ToUnique();
|
70
69
|
}
|
71
70
|
|
72
71
|
void StructPackFun::RegisterFunction(BuiltinFunctions &set) {
|
@@ -31,6 +31,9 @@ void ReadCSVData::InitializeFiles(ClientContext &context, const vector<string> &
|
|
31
31
|
auto found_files = fs.GlobFiles(file_pattern, context);
|
32
32
|
files.insert(files.end(), found_files.begin(), found_files.end());
|
33
33
|
}
|
34
|
+
if (files.empty()) {
|
35
|
+
throw IOException("CSV reader needs at least one file to read");
|
36
|
+
}
|
34
37
|
}
|
35
38
|
|
36
39
|
void ReadCSVData::FinalizeRead(ClientContext &context) {
|
@@ -61,9 +64,15 @@ static unique_ptr<FunctionData> ReadCSVBind(ClientContext &context, TableFunctio
|
|
61
64
|
auto &options = result->options;
|
62
65
|
|
63
66
|
vector<string> patterns;
|
67
|
+
if (input.inputs[0].IsNull()) {
|
68
|
+
throw ParserException("CSV reader cannot take NULL as parameter");
|
69
|
+
}
|
64
70
|
if (input.inputs[0].type().id() == LogicalTypeId::LIST) {
|
65
71
|
// list of globs
|
66
72
|
for (auto &val : ListValue::GetChildren(input.inputs[0])) {
|
73
|
+
if (val.IsNull()) {
|
74
|
+
throw ParserException("CSV reader cannot take NULL input as parameter");
|
75
|
+
}
|
67
76
|
patterns.push_back(StringValue::Get(val));
|
68
77
|
}
|
69
78
|
} else {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.7.2-
|
2
|
+
#define DUCKDB_VERSION "0.7.2-dev314"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "7e05c8c034"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
@@ -35,4 +35,23 @@ TableFunction::TableFunction()
|
|
35
35
|
filter_pushdown(false), filter_prune(false) {
|
36
36
|
}
|
37
37
|
|
38
|
+
bool TableFunction::Equal(const TableFunction &rhs) const {
|
39
|
+
// number of types
|
40
|
+
if (this->arguments.size() != rhs.arguments.size()) {
|
41
|
+
return false;
|
42
|
+
}
|
43
|
+
// argument types
|
44
|
+
for (idx_t i = 0; i < this->arguments.size(); ++i) {
|
45
|
+
if (this->arguments[i] != rhs.arguments[i]) {
|
46
|
+
return false;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
// varargs
|
50
|
+
if (this->varargs != rhs.varargs) {
|
51
|
+
return false;
|
52
|
+
}
|
53
|
+
|
54
|
+
return true; // they are equal
|
55
|
+
}
|
56
|
+
|
38
57
|
} // namespace duckdb
|
package/src/duckdb/src/include/duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp
CHANGED
@@ -9,17 +9,12 @@
|
|
9
9
|
#pragma once
|
10
10
|
|
11
11
|
#include "duckdb/catalog/standard_entry.hpp"
|
12
|
-
#include "duckdb/
|
13
|
-
#include "duckdb/
|
14
|
-
#include "duckdb/
|
12
|
+
#include "duckdb/catalog/catalog_set.hpp"
|
13
|
+
#include "duckdb/function/function.hpp"
|
14
|
+
#include "duckdb/parser/parsed_data/create_table_function_info.hpp"
|
15
15
|
|
16
16
|
namespace duckdb {
|
17
17
|
|
18
|
-
class Catalog;
|
19
|
-
class Constraint;
|
20
|
-
|
21
|
-
struct CreateTableFunctionInfo;
|
22
|
-
|
23
18
|
//! A table function in the catalog
|
24
19
|
class TableFunctionCatalogEntry : public StandardEntry {
|
25
20
|
public:
|
@@ -31,5 +26,8 @@ public:
|
|
31
26
|
|
32
27
|
//! The table function
|
33
28
|
TableFunctionSet functions;
|
29
|
+
|
30
|
+
public:
|
31
|
+
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo *info) override;
|
34
32
|
};
|
35
33
|
} // namespace duckdb
|
@@ -15,25 +15,6 @@
|
|
15
15
|
|
16
16
|
namespace duckdb {
|
17
17
|
|
18
|
-
// API versions
|
19
|
-
// if no explicit API version is defined, the latest API version is used
|
20
|
-
// Note that using older API versions (i.e. not using DUCKDB_API_LATEST) is deprecated.
|
21
|
-
// These will not be supported long-term, and will be removed in future versions.
|
22
|
-
|
23
|
-
#ifndef DUCKDB_API_0_3_1
|
24
|
-
#define DUCKDB_API_0_3_1 1
|
25
|
-
#endif
|
26
|
-
#ifndef DUCKDB_API_0_3_2
|
27
|
-
#define DUCKDB_API_0_3_2 2
|
28
|
-
#endif
|
29
|
-
#ifndef DUCKDB_API_LATEST
|
30
|
-
#define DUCKDB_API_LATEST DUCKDB_API_0_3_2
|
31
|
-
#endif
|
32
|
-
|
33
|
-
#ifndef DUCKDB_API_VERSION
|
34
|
-
#define DUCKDB_API_VERSION DUCKDB_API_LATEST
|
35
|
-
#endif
|
36
|
-
|
37
18
|
//! inline std directives that we use frequently
|
38
19
|
#ifndef DUCKDB_DEBUG_MOVE
|
39
20
|
using std::move;
|
@@ -23,7 +23,8 @@ enum class TableReferenceType : uint8_t {
|
|
23
23
|
TABLE_FUNCTION = 5, // table producing function
|
24
24
|
EXPRESSION_LIST = 6, // expression list
|
25
25
|
CTE = 7, // Recursive CTE
|
26
|
-
EMPTY = 8
|
26
|
+
EMPTY = 8, // placeholder for empty FROM
|
27
|
+
PIVOT = 9 // pivot statement
|
27
28
|
};
|
28
29
|
|
29
30
|
} // namespace duckdb
|
@@ -26,6 +26,7 @@ public:
|
|
26
26
|
DUCKDB_API static idx_t GetBit(string_t bit_string, idx_t n);
|
27
27
|
//! Sets the nth bit in bit string to newvalue; the first (leftmost) bit is indexed 0
|
28
28
|
DUCKDB_API static void SetBit(const string_t &bit_string, idx_t n, idx_t new_value, string_t &result);
|
29
|
+
DUCKDB_API static void SetBit(string_t &bit_string, idx_t n, idx_t new_value);
|
29
30
|
//! Returns first starting index of the specified substring within bits, or zero if it's not present.
|
30
31
|
DUCKDB_API static idx_t BitPosition(string_t substring, string_t bits);
|
31
32
|
//! Converts bits to a string, writing the output to the designated output string.
|
@@ -38,7 +39,11 @@ public:
|
|
38
39
|
//! perform data validation.
|
39
40
|
DUCKDB_API static void ToBit(string_t str, data_ptr_t output);
|
40
41
|
DUCKDB_API static string ToBit(string_t str);
|
42
|
+
//! Creates a new bitstring of determined length
|
43
|
+
DUCKDB_API static void BitString(const string_t &input, const idx_t &len, string_t &result);
|
41
44
|
DUCKDB_API static void SetEmptyBitString(string_t &target, string_t &input);
|
45
|
+
DUCKDB_API static void SetEmptyBitString(string_t &target, idx_t len);
|
46
|
+
DUCKDB_API static idx_t ComputeBitstringLen(idx_t len);
|
42
47
|
|
43
48
|
DUCKDB_API static void RightShift(const string_t &bit_string, const idx_t &shif, string_t &result);
|
44
49
|
DUCKDB_API static void LeftShift(const string_t &bit_string, const idx_t &shift, string_t &result);
|
@@ -52,6 +57,5 @@ private:
|
|
52
57
|
//! the bitstring.
|
53
58
|
DUCKDB_API static idx_t GetPadding(const string_t &bit_string);
|
54
59
|
DUCKDB_API static idx_t GetBitSize(string_t str);
|
55
|
-
DUCKDB_API static void SetBit(string_t &bit_string, idx_t n, idx_t new_value);
|
56
60
|
};
|
57
61
|
} // namespace duckdb
|
@@ -23,6 +23,7 @@ class CastFunctionSet;
|
|
23
23
|
class Deserializer;
|
24
24
|
class Serializer;
|
25
25
|
struct GetCastFunctionInput;
|
26
|
+
struct ExtraValueInfo;
|
26
27
|
|
27
28
|
//! The Value object holds a single arbitrary value of any type that can be
|
28
29
|
//! stored in the database.
|
@@ -279,9 +280,6 @@ private:
|
|
279
280
|
//! The logical of the value
|
280
281
|
LogicalType type_;
|
281
282
|
|
282
|
-
#if DUCKDB_API_VERSION < DUCKDB_API_0_3_2
|
283
|
-
public:
|
284
|
-
#endif
|
285
283
|
//! Whether or not the value is NULL
|
286
284
|
bool is_null;
|
287
285
|
|
@@ -307,11 +305,7 @@ public:
|
|
307
305
|
interval_t interval;
|
308
306
|
} value_;
|
309
307
|
|
310
|
-
|
311
|
-
string str_value;
|
312
|
-
|
313
|
-
vector<Value> struct_value;
|
314
|
-
vector<Value> list_value;
|
308
|
+
shared_ptr<ExtraValueInfo> value_info_;
|
315
309
|
|
316
310
|
private:
|
317
311
|
template <class T>
|
@@ -261,7 +261,6 @@ enum class LogicalTypeId : uint8_t {
|
|
261
261
|
|
262
262
|
HUGEINT = 50,
|
263
263
|
POINTER = 51,
|
264
|
-
// HASH = 52, // deprecated, uses UBIGINT instead
|
265
264
|
VALIDITY = 53,
|
266
265
|
UUID = 54,
|
267
266
|
|
@@ -314,7 +313,7 @@ struct LogicalType {
|
|
314
313
|
inline LogicalType& operator=(LogicalType&& other) noexcept {
|
315
314
|
id_ = other.id_;
|
316
315
|
physical_type_ = other.physical_type_;
|
317
|
-
|
316
|
+
std::swap(type_info_, other.type_info_);
|
318
317
|
return *this;
|
319
318
|
}
|
320
319
|
|
@@ -20,7 +20,7 @@ class PhysicalPerfectHashAggregate : public PhysicalOperator {
|
|
20
20
|
public:
|
21
21
|
PhysicalPerfectHashAggregate(ClientContext &context, vector<LogicalType> types,
|
22
22
|
vector<unique_ptr<Expression>> aggregates, vector<unique_ptr<Expression>> groups,
|
23
|
-
vector<unique_ptr<BaseStatistics>> group_stats, vector<idx_t> required_bits,
|
23
|
+
const vector<unique_ptr<BaseStatistics>> &group_stats, vector<idx_t> required_bits,
|
24
24
|
idx_t estimated_cardinality);
|
25
25
|
|
26
26
|
//! The groups
|
@@ -27,6 +27,11 @@ struct BitXorFun {
|
|
27
27
|
static void RegisterFunction(BuiltinFunctions &set);
|
28
28
|
};
|
29
29
|
|
30
|
+
struct BitStringAggFun {
|
31
|
+
static void GetBitStringAggregate(const LogicalType &type, AggregateFunctionSet &bitstring_agg);
|
32
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
33
|
+
};
|
34
|
+
|
30
35
|
struct CountStarFun {
|
31
36
|
static AggregateFunction GetFunction();
|
32
37
|
|
@@ -29,6 +29,17 @@ struct AggregateInputData {
|
|
29
29
|
Allocator &allocator;
|
30
30
|
};
|
31
31
|
|
32
|
+
struct AggregateStatisticsInput {
|
33
|
+
AggregateStatisticsInput(FunctionData *bind_data_p, vector<BaseStatistics> &child_stats_p,
|
34
|
+
NodeStatistics *node_stats_p)
|
35
|
+
: bind_data(bind_data_p), child_stats(child_stats_p), node_stats(node_stats_p) {
|
36
|
+
}
|
37
|
+
|
38
|
+
FunctionData *bind_data;
|
39
|
+
vector<BaseStatistics> &child_stats;
|
40
|
+
NodeStatistics *node_stats;
|
41
|
+
};
|
42
|
+
|
32
43
|
//! The type used for sizing hashed aggregate function states
|
33
44
|
typedef idx_t (*aggregate_size_t)();
|
34
45
|
//! The type used for initializing hashed aggregate function states
|
@@ -43,9 +54,7 @@ typedef void (*aggregate_finalize_t)(Vector &state, AggregateInputData &aggr_inp
|
|
43
54
|
idx_t offset);
|
44
55
|
//! The type used for propagating statistics in aggregate functions (optional)
|
45
56
|
typedef unique_ptr<BaseStatistics> (*aggregate_statistics_t)(ClientContext &context, BoundAggregateExpression &expr,
|
46
|
-
|
47
|
-
vector<unique_ptr<BaseStatistics>> &child_stats,
|
48
|
-
NodeStatistics *node_stats);
|
57
|
+
AggregateStatisticsInput &input);
|
49
58
|
//! Binds the scalar function and creates the function data
|
50
59
|
typedef unique_ptr<FunctionData> (*bind_aggregate_function_t)(ClientContext &context, AggregateFunction &function,
|
51
60
|
vector<unique_ptr<Expression>> &arguments);
|
@@ -80,6 +80,18 @@ struct MapFromEntriesFun {
|
|
80
80
|
static void RegisterFunction(BuiltinFunctions &set);
|
81
81
|
};
|
82
82
|
|
83
|
+
struct MapEntriesFun {
|
84
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
85
|
+
};
|
86
|
+
|
87
|
+
struct MapValuesFun {
|
88
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
89
|
+
};
|
90
|
+
|
91
|
+
struct MapKeysFun {
|
92
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
93
|
+
};
|
94
|
+
|
83
95
|
struct MapExtractFun {
|
84
96
|
static void RegisterFunction(BuiltinFunctions &set);
|
85
97
|
};
|
@@ -29,13 +29,13 @@ class ScalarFunctionCatalogEntry;
|
|
29
29
|
|
30
30
|
struct FunctionStatisticsInput {
|
31
31
|
FunctionStatisticsInput(BoundFunctionExpression &expr_p, FunctionData *bind_data_p,
|
32
|
-
vector<
|
32
|
+
vector<BaseStatistics> &child_stats_p, unique_ptr<Expression> *expr_ptr_p)
|
33
33
|
: expr(expr_p), bind_data(bind_data_p), child_stats(child_stats_p), expr_ptr(expr_ptr_p) {
|
34
34
|
}
|
35
35
|
|
36
36
|
BoundFunctionExpression &expr;
|
37
37
|
FunctionData *bind_data;
|
38
|
-
vector<
|
38
|
+
vector<BaseStatistics> &child_stats;
|
39
39
|
unique_ptr<Expression> *expr_ptr;
|
40
40
|
};
|
41
41
|
|