duckdb 0.4.1-dev1556.0 → 0.4.1-dev1564.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/package.json +1 -1
- package/src/duckdb.cpp +54 -23
- package/src/duckdb.hpp +10 -2
- package/src/parquet-amalgamation.cpp +37377 -37377
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -98731,17 +98731,8 @@ void ArraySliceFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
98731
98731
|
|
|
98732
98732
|
|
|
98733
98733
|
|
|
98734
|
-
namespace duckdb {
|
|
98735
|
-
|
|
98736
|
-
template <class T>
|
|
98737
|
-
static inline bool ValueEqualsOrNot(const T &left, const T &right) {
|
|
98738
|
-
return left == right;
|
|
98739
|
-
}
|
|
98740
98734
|
|
|
98741
|
-
|
|
98742
|
-
inline bool ValueEqualsOrNot(const string_t &left, const string_t &right) {
|
|
98743
|
-
return StringComparisonOperators::EqualsOrNot<false>(left, right);
|
|
98744
|
-
}
|
|
98735
|
+
namespace duckdb {
|
|
98745
98736
|
|
|
98746
98737
|
struct ContainsFunctor {
|
|
98747
98738
|
static inline bool Initialize() {
|
|
@@ -98816,15 +98807,16 @@ static void TemplatedContainsOrPosition(DataChunk &args, ExpressionState &state,
|
|
|
98816
98807
|
}
|
|
98817
98808
|
|
|
98818
98809
|
if (!is_nested) {
|
|
98819
|
-
if (
|
|
98810
|
+
if (Equals::Operation(child_value[child_value_idx], values[value_index])) {
|
|
98820
98811
|
result_entries[i] = OP::UpdateResultEntries(child_idx);
|
|
98821
98812
|
break; // Found value in list, no need to look further
|
|
98822
98813
|
}
|
|
98823
98814
|
} else {
|
|
98824
98815
|
// FIXME: using Value is less efficient than modifying the vector comparison code
|
|
98825
98816
|
// to more efficiently compare nested types
|
|
98826
|
-
|
|
98827
|
-
|
|
98817
|
+
auto lvalue = child_vector.GetValue(child_value_idx);
|
|
98818
|
+
auto rvalue = value_vector.GetValue(value_index);
|
|
98819
|
+
if (Value::NotDistinctFrom(lvalue, rvalue)) {
|
|
98828
98820
|
result_entries[i] = OP::UpdateResultEntries(child_idx);
|
|
98829
98821
|
break; // Found value in list, no need to look further
|
|
98830
98822
|
}
|
|
@@ -99340,7 +99332,6 @@ static void ListAggregatesFunction(DataChunk &args, ExpressionState &state, Vect
|
|
|
99340
99332
|
|
|
99341
99333
|
// states vector is full, update
|
|
99342
99334
|
if (states_idx == STANDARD_VECTOR_SIZE) {
|
|
99343
|
-
|
|
99344
99335
|
// update the aggregate state(s)
|
|
99345
99336
|
Vector slice = Vector(child_vector, sel_vector, states_idx);
|
|
99346
99337
|
aggr.function.update(&slice, aggr_input_data, 1, state_vector_update, states_idx);
|
|
@@ -99445,14 +99436,21 @@ static void ListUniqueFunction(DataChunk &args, ExpressionState &state, Vector &
|
|
|
99445
99436
|
}
|
|
99446
99437
|
|
|
99447
99438
|
template <bool IS_AGGR = false>
|
|
99448
|
-
static unique_ptr<FunctionData>
|
|
99449
|
-
|
|
99450
|
-
|
|
99439
|
+
static unique_ptr<FunctionData>
|
|
99440
|
+
ListAggregatesBindFunction(ClientContext &context, ScalarFunction &bound_function, const LogicalType &list_child_type,
|
|
99441
|
+
AggregateFunction &aggr_function, vector<unique_ptr<Expression>> &arguments) {
|
|
99451
99442
|
|
|
99452
99443
|
// create the child expression and its type
|
|
99453
99444
|
vector<unique_ptr<Expression>> children;
|
|
99454
99445
|
auto expr = make_unique<BoundConstantExpression>(Value(list_child_type));
|
|
99455
99446
|
children.push_back(move(expr));
|
|
99447
|
+
// push any extra arguments into the list aggregate bind
|
|
99448
|
+
if (arguments.size() > 2) {
|
|
99449
|
+
for (idx_t i = 2; i < arguments.size(); i++) {
|
|
99450
|
+
children.push_back(move(arguments[i]));
|
|
99451
|
+
}
|
|
99452
|
+
arguments.resize(2);
|
|
99453
|
+
}
|
|
99456
99454
|
|
|
99457
99455
|
auto bound_aggr_function = AggregateFunction::BindAggregateFunction(context, aggr_function, move(children));
|
|
99458
99456
|
bound_function.arguments[0] = LogicalType::LIST(bound_aggr_function->function.arguments[0]);
|
|
@@ -99460,6 +99458,12 @@ static unique_ptr<FunctionData> ListAggregatesBindFunction(ClientContext &contex
|
|
|
99460
99458
|
if (IS_AGGR) {
|
|
99461
99459
|
bound_function.return_type = bound_aggr_function->function.return_type;
|
|
99462
99460
|
}
|
|
99461
|
+
// check if the aggregate function consumed all the extra input arguments
|
|
99462
|
+
if (bound_aggr_function->children.size() > 1) {
|
|
99463
|
+
throw InvalidInputException(
|
|
99464
|
+
"Aggregate function %s is not supported for list_aggr: extra arguments were not removed during bind",
|
|
99465
|
+
bound_aggr_function->ToString());
|
|
99466
|
+
}
|
|
99463
99467
|
|
|
99464
99468
|
return make_unique<ListAggregatesBindData>(bound_function.return_type, move(bound_aggr_function));
|
|
99465
99469
|
}
|
|
@@ -99478,7 +99482,6 @@ static unique_ptr<FunctionData> ListAggregatesBind(ClientContext &context, Scala
|
|
|
99478
99482
|
|
|
99479
99483
|
string function_name = "histogram";
|
|
99480
99484
|
if (IS_AGGR) { // get the name of the aggregate function
|
|
99481
|
-
|
|
99482
99485
|
if (!arguments[1]->IsFoldable()) {
|
|
99483
99486
|
throw InvalidInputException("Aggregate function name must be a constant");
|
|
99484
99487
|
}
|
|
@@ -99503,31 +99506,35 @@ static unique_ptr<FunctionData> ListAggregatesBind(ClientContext &context, Scala
|
|
|
99503
99506
|
string error;
|
|
99504
99507
|
vector<LogicalType> types;
|
|
99505
99508
|
types.push_back(list_child_type);
|
|
99509
|
+
// push any extra arguments into the type list
|
|
99510
|
+
for (idx_t i = 2; i < arguments.size(); i++) {
|
|
99511
|
+
types.push_back(arguments[i]->return_type);
|
|
99512
|
+
}
|
|
99506
99513
|
auto best_function_idx = Function::BindFunction(func->name, func->functions, types, error);
|
|
99507
99514
|
if (best_function_idx == DConstants::INVALID_INDEX) {
|
|
99508
|
-
throw BinderException("No matching aggregate function");
|
|
99515
|
+
throw BinderException("No matching aggregate function\n%s", error);
|
|
99509
99516
|
}
|
|
99510
99517
|
|
|
99511
99518
|
// found a matching function, bind it as an aggregate
|
|
99512
99519
|
auto &best_function = func->functions[best_function_idx];
|
|
99513
99520
|
|
|
99514
99521
|
if (IS_AGGR) {
|
|
99515
|
-
return ListAggregatesBindFunction<IS_AGGR>(context, bound_function, list_child_type, best_function);
|
|
99522
|
+
return ListAggregatesBindFunction<IS_AGGR>(context, bound_function, list_child_type, best_function, arguments);
|
|
99516
99523
|
}
|
|
99517
99524
|
|
|
99518
99525
|
// create the unordered map histogram function
|
|
99519
99526
|
D_ASSERT(best_function.arguments.size() == 1);
|
|
99520
99527
|
auto key_type = best_function.arguments[0];
|
|
99521
99528
|
auto aggr_function = HistogramFun::GetHistogramUnorderedMap(key_type);
|
|
99522
|
-
return ListAggregatesBindFunction<IS_AGGR>(context, bound_function, list_child_type, aggr_function);
|
|
99529
|
+
return ListAggregatesBindFunction<IS_AGGR>(context, bound_function, list_child_type, aggr_function, arguments);
|
|
99523
99530
|
}
|
|
99524
99531
|
|
|
99525
99532
|
static unique_ptr<FunctionData> ListAggregateBind(ClientContext &context, ScalarFunction &bound_function,
|
|
99526
99533
|
vector<unique_ptr<Expression>> &arguments) {
|
|
99527
99534
|
|
|
99528
99535
|
// the list column and the name of the aggregate function
|
|
99529
|
-
D_ASSERT(bound_function.arguments.size()
|
|
99530
|
-
D_ASSERT(arguments.size()
|
|
99536
|
+
D_ASSERT(bound_function.arguments.size() >= 2);
|
|
99537
|
+
D_ASSERT(arguments.size() >= 2);
|
|
99531
99538
|
|
|
99532
99539
|
return ListAggregatesBind<true>(context, bound_function, arguments);
|
|
99533
99540
|
}
|
|
@@ -99556,6 +99563,7 @@ ScalarFunction ListAggregateFun::GetFunction() {
|
|
|
99556
99563
|
auto result = ScalarFunction({LogicalType::LIST(LogicalType::ANY), LogicalType::VARCHAR}, LogicalType::ANY,
|
|
99557
99564
|
ListAggregateFunction, ListAggregateBind);
|
|
99558
99565
|
result.null_handling = FunctionNullHandling::SPECIAL_HANDLING;
|
|
99566
|
+
result.varargs = LogicalType::ANY;
|
|
99559
99567
|
return result;
|
|
99560
99568
|
}
|
|
99561
99569
|
|
|
@@ -120338,6 +120346,7 @@ duckdb_data_chunk duckdb_result_get_chunk(duckdb_result result, idx_t chunk_idx)
|
|
|
120338
120346
|
|
|
120339
120347
|
|
|
120340
120348
|
|
|
120349
|
+
|
|
120341
120350
|
namespace duckdb {
|
|
120342
120351
|
|
|
120343
120352
|
struct CTableFunctionInfo : public TableFunctionInfo {
|
|
@@ -120369,6 +120378,7 @@ struct CTableBindData : public TableFunctionData {
|
|
|
120369
120378
|
CTableFunctionInfo *info = nullptr;
|
|
120370
120379
|
void *bind_data = nullptr;
|
|
120371
120380
|
duckdb_delete_callback_t delete_callback = nullptr;
|
|
120381
|
+
unique_ptr<NodeStatistics> stats;
|
|
120372
120382
|
};
|
|
120373
120383
|
|
|
120374
120384
|
struct CTableInternalBindInfo {
|
|
@@ -120483,6 +120493,14 @@ unique_ptr<LocalTableFunctionState> CTableFunctionLocalInit(ExecutionContext &co
|
|
|
120483
120493
|
return move(result);
|
|
120484
120494
|
}
|
|
120485
120495
|
|
|
120496
|
+
unique_ptr<NodeStatistics> CTableFunctionCardinality(ClientContext &context, const FunctionData *bind_data_p) {
|
|
120497
|
+
auto &bind_data = (const CTableBindData &)*bind_data_p;
|
|
120498
|
+
if (!bind_data.stats) {
|
|
120499
|
+
return nullptr;
|
|
120500
|
+
}
|
|
120501
|
+
return make_unique<NodeStatistics>(*bind_data.stats);
|
|
120502
|
+
}
|
|
120503
|
+
|
|
120486
120504
|
void CTableFunction(ClientContext &context, TableFunctionInput &data_p, DataChunk &output) {
|
|
120487
120505
|
auto &bind_data = (CTableBindData &)*data_p.bind_data;
|
|
120488
120506
|
auto &global_data = (CTableGlobalInitData &)*data_p.global_state;
|
|
@@ -120503,6 +120521,7 @@ duckdb_table_function duckdb_create_table_function() {
|
|
|
120503
120521
|
auto function = new duckdb::TableFunction("", {}, duckdb::CTableFunction, duckdb::CTableFunctionBind,
|
|
120504
120522
|
duckdb::CTableFunctionInit, duckdb::CTableFunctionLocalInit);
|
|
120505
120523
|
function->function_info = duckdb::make_shared<duckdb::CTableFunctionInfo>();
|
|
120524
|
+
function->cardinality = duckdb::CTableFunctionCardinality;
|
|
120506
120525
|
return function;
|
|
120507
120526
|
}
|
|
120508
120527
|
|
|
@@ -120651,6 +120670,18 @@ void duckdb_bind_set_bind_data(duckdb_bind_info info, void *bind_data, duckdb_de
|
|
|
120651
120670
|
bind_info->bind_data.delete_callback = destroy;
|
|
120652
120671
|
}
|
|
120653
120672
|
|
|
120673
|
+
void duckdb_bind_set_cardinality(duckdb_bind_info info, idx_t cardinality, bool is_exact) {
|
|
120674
|
+
if (!info) {
|
|
120675
|
+
return;
|
|
120676
|
+
}
|
|
120677
|
+
auto bind_info = (duckdb::CTableInternalBindInfo *)info;
|
|
120678
|
+
if (is_exact) {
|
|
120679
|
+
bind_info->bind_data.stats = duckdb::make_unique<duckdb::NodeStatistics>(cardinality);
|
|
120680
|
+
} else {
|
|
120681
|
+
bind_info->bind_data.stats = duckdb::make_unique<duckdb::NodeStatistics>(cardinality, cardinality);
|
|
120682
|
+
}
|
|
120683
|
+
}
|
|
120684
|
+
|
|
120654
120685
|
void duckdb_bind_set_error(duckdb_bind_info info, const char *error) {
|
|
120655
120686
|
if (!info || !error) {
|
|
120656
120687
|
return;
|
package/src/duckdb.hpp
CHANGED
|
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
13
|
#define DUCKDB_AMALGAMATION_EXTENDED 1
|
|
14
|
-
#define DUCKDB_SOURCE_ID "
|
|
15
|
-
#define DUCKDB_VERSION "v0.4.1-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "ebe45abbb"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev1564"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -17860,6 +17860,14 @@ Sets the user-provided bind data in the bind object. This object can be retrieve
|
|
|
17860
17860
|
*/
|
|
17861
17861
|
DUCKDB_API void duckdb_bind_set_bind_data(duckdb_bind_info info, void *bind_data, duckdb_delete_callback_t destroy);
|
|
17862
17862
|
|
|
17863
|
+
/*!
|
|
17864
|
+
Sets the cardinality estimate for the table function, used for optimization.
|
|
17865
|
+
|
|
17866
|
+
* info: The bind data object.
|
|
17867
|
+
* is_exact: Whether or not the cardinality estimate is exact, or an approximation
|
|
17868
|
+
*/
|
|
17869
|
+
DUCKDB_API void duckdb_bind_set_cardinality(duckdb_bind_info info, idx_t cardinality, bool is_exact);
|
|
17870
|
+
|
|
17863
17871
|
/*!
|
|
17864
17872
|
Report that an error has occurred while calling bind.
|
|
17865
17873
|
|