duckdb 0.4.1-dev144.0 → 0.4.1-dev160.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 +118 -2
- package/src/duckdb.hpp +34 -24
- package/src/parquet-amalgamation.cpp +36499 -36499
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -45834,6 +45834,10 @@ struct StructPackFun {
|
|
|
45834
45834
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
45835
45835
|
};
|
|
45836
45836
|
|
|
45837
|
+
struct StructInsertFun {
|
|
45838
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
45839
|
+
};
|
|
45840
|
+
|
|
45837
45841
|
struct ListValueFun {
|
|
45838
45842
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
45839
45843
|
};
|
|
@@ -98812,6 +98816,7 @@ void BuiltinFunctions::RegisterNestedFunctions() {
|
|
|
98812
98816
|
Register<ArraySliceFun>();
|
|
98813
98817
|
Register<StructPackFun>();
|
|
98814
98818
|
Register<StructExtractFun>();
|
|
98819
|
+
Register<StructInsertFun>();
|
|
98815
98820
|
Register<ListConcatFun>();
|
|
98816
98821
|
Register<ListContainsFun>();
|
|
98817
98822
|
Register<ListPositionFun>();
|
|
@@ -104604,6 +104609,111 @@ void StructExtractFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
104604
104609
|
|
|
104605
104610
|
|
|
104606
104611
|
|
|
104612
|
+
namespace duckdb {
|
|
104613
|
+
|
|
104614
|
+
static void StructInsertFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
104615
|
+
auto &starting_vec = args.data[0];
|
|
104616
|
+
|
|
104617
|
+
starting_vec.Verify(args.size());
|
|
104618
|
+
|
|
104619
|
+
auto &starting_child_entries = StructVector::GetEntries(starting_vec);
|
|
104620
|
+
|
|
104621
|
+
auto &result_child_entries = StructVector::GetEntries(result);
|
|
104622
|
+
|
|
104623
|
+
// Assign the starting vector entries to the result vector
|
|
104624
|
+
for (size_t i = 0; i < starting_child_entries.size(); i++) {
|
|
104625
|
+
auto &starting_child = starting_child_entries[i];
|
|
104626
|
+
result_child_entries[i]->Reference(*starting_child);
|
|
104627
|
+
}
|
|
104628
|
+
|
|
104629
|
+
// Assign the new entries to the result vector
|
|
104630
|
+
for (size_t i = 1; i < args.ColumnCount(); i++) {
|
|
104631
|
+
result_child_entries[starting_child_entries.size() + i - 1]->Reference(args.data[i]);
|
|
104632
|
+
}
|
|
104633
|
+
|
|
104634
|
+
result.Verify(args.size());
|
|
104635
|
+
}
|
|
104636
|
+
|
|
104637
|
+
static unique_ptr<FunctionData> StructInsertBind(ClientContext &context, ScalarFunction &bound_function,
|
|
104638
|
+
vector<unique_ptr<Expression>> &arguments) {
|
|
104639
|
+
case_insensitive_set_t name_collision_set;
|
|
104640
|
+
|
|
104641
|
+
if (arguments.empty()) {
|
|
104642
|
+
throw Exception("Missing required arguments for struct_insert function.");
|
|
104643
|
+
}
|
|
104644
|
+
|
|
104645
|
+
if (LogicalTypeId::STRUCT != arguments[0]->return_type.id()) {
|
|
104646
|
+
throw Exception("The first argument to struct_insert must be a STRUCT");
|
|
104647
|
+
}
|
|
104648
|
+
|
|
104649
|
+
if (arguments.size() < 2) {
|
|
104650
|
+
throw Exception("Can't insert nothing into a struct");
|
|
104651
|
+
}
|
|
104652
|
+
|
|
104653
|
+
child_list_t<LogicalType> new_struct_children;
|
|
104654
|
+
|
|
104655
|
+
auto &existing_struct_children = StructType::GetChildTypes(arguments[0]->return_type);
|
|
104656
|
+
|
|
104657
|
+
for (size_t i = 0; i < existing_struct_children.size(); i++) {
|
|
104658
|
+
auto &child = existing_struct_children[i];
|
|
104659
|
+
name_collision_set.insert(child.first);
|
|
104660
|
+
new_struct_children.push_back(make_pair(child.first, child.second));
|
|
104661
|
+
}
|
|
104662
|
+
|
|
104663
|
+
// Loop through the additional arguments (name/value pairs)
|
|
104664
|
+
for (idx_t i = 1; i < arguments.size(); i++) {
|
|
104665
|
+
auto &child = arguments[i];
|
|
104666
|
+
if (child->alias.empty() && bound_function.name == "struct_insert") {
|
|
104667
|
+
throw BinderException("Need named argument for struct insert, e.g. STRUCT_PACK(a := b)");
|
|
104668
|
+
}
|
|
104669
|
+
if (name_collision_set.find(child->alias) != name_collision_set.end()) {
|
|
104670
|
+
throw BinderException("Duplicate struct entry name \"%s\"", child->alias);
|
|
104671
|
+
}
|
|
104672
|
+
name_collision_set.insert(child->alias);
|
|
104673
|
+
new_struct_children.push_back(make_pair(child->alias, arguments[i]->return_type));
|
|
104674
|
+
}
|
|
104675
|
+
|
|
104676
|
+
// this is more for completeness reasons
|
|
104677
|
+
bound_function.return_type = LogicalType::STRUCT(move(new_struct_children));
|
|
104678
|
+
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
104679
|
+
}
|
|
104680
|
+
|
|
104681
|
+
unique_ptr<BaseStatistics> StructInsertStats(ClientContext &context, FunctionStatisticsInput &input) {
|
|
104682
|
+
auto &child_stats = input.child_stats;
|
|
104683
|
+
auto &expr = input.expr;
|
|
104684
|
+
|
|
104685
|
+
auto &existing_struct_stats = (StructStatistics &)*child_stats[0];
|
|
104686
|
+
auto new_struct_stats = make_unique<StructStatistics>(expr.return_type);
|
|
104687
|
+
|
|
104688
|
+
for (idx_t i = 0; i < existing_struct_stats.child_stats.size(); i++) {
|
|
104689
|
+
new_struct_stats->child_stats[i] =
|
|
104690
|
+
existing_struct_stats.child_stats[i] ? existing_struct_stats.child_stats[i]->Copy() : nullptr;
|
|
104691
|
+
}
|
|
104692
|
+
|
|
104693
|
+
auto offset = new_struct_stats->child_stats.size() - child_stats.size();
|
|
104694
|
+
for (idx_t i = 1; i < child_stats.size(); i++) {
|
|
104695
|
+
new_struct_stats->child_stats[offset + i] = child_stats[i] ? child_stats[i]->Copy() : nullptr;
|
|
104696
|
+
}
|
|
104697
|
+
return move(new_struct_stats);
|
|
104698
|
+
}
|
|
104699
|
+
|
|
104700
|
+
void StructInsertFun::RegisterFunction(BuiltinFunctions &set) {
|
|
104701
|
+
// the arguments and return types are actually set in the binder function
|
|
104702
|
+
ScalarFunction fun("struct_insert", {}, LogicalTypeId::STRUCT, StructInsertFunction, false, StructInsertBind,
|
|
104703
|
+
nullptr, StructInsertStats);
|
|
104704
|
+
fun.varargs = LogicalType::ANY;
|
|
104705
|
+
set.AddFunction(fun);
|
|
104706
|
+
}
|
|
104707
|
+
|
|
104708
|
+
} // namespace duckdb
|
|
104709
|
+
|
|
104710
|
+
|
|
104711
|
+
|
|
104712
|
+
|
|
104713
|
+
|
|
104714
|
+
|
|
104715
|
+
|
|
104716
|
+
|
|
104607
104717
|
namespace duckdb {
|
|
104608
104718
|
|
|
104609
104719
|
static void StructPackFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
@@ -105270,7 +105380,7 @@ typedef unique_ptr<ArrowArrayStreamWrapper> (*stream_factory_produce_t)(
|
|
|
105270
105380
|
TableFilterSet *filters);
|
|
105271
105381
|
typedef void (*stream_factory_get_schema_t)(uintptr_t stream_factory_ptr, ArrowSchemaWrapper &schema);
|
|
105272
105382
|
|
|
105273
|
-
struct ArrowScanFunctionData : public
|
|
105383
|
+
struct ArrowScanFunctionData : public PyTableFunctionData {
|
|
105274
105384
|
ArrowScanFunctionData(idx_t rows_per_thread_p, stream_factory_produce_t scanner_producer_p,
|
|
105275
105385
|
uintptr_t stream_factory_ptr_p)
|
|
105276
105386
|
: lines_read(0), rows_per_thread(rows_per_thread_p), stream_factory_ptr(stream_factory_ptr_p),
|
|
@@ -169723,6 +169833,10 @@ unique_ptr<BoundTableRef> Binder::Bind(TableFunctionRef &ref) {
|
|
|
169723
169833
|
TableFunctionBindInput bind_input(parameters, named_parameters, input_table_types, input_table_names,
|
|
169724
169834
|
table_function.function_info.get());
|
|
169725
169835
|
bind_data = table_function.bind(context, bind_input, return_types, return_names);
|
|
169836
|
+
if (table_function.name == "pandas_scan" || table_function.name == "arrow_scan") {
|
|
169837
|
+
auto arrow_bind = (PyTableFunctionData *)bind_data.get();
|
|
169838
|
+
arrow_bind->external_dependency = move(ref.external_dependency);
|
|
169839
|
+
}
|
|
169726
169840
|
}
|
|
169727
169841
|
if (return_types.size() != return_names.size()) {
|
|
169728
169842
|
throw InternalException(
|
|
@@ -173982,7 +174096,9 @@ void Planner::CreatePlan(SQLStatement &statement) {
|
|
|
173982
174096
|
value_map[expr->parameter_nr] = vector<unique_ptr<Value>>();
|
|
173983
174097
|
} else if (entry->second.back()->type() != value->type()) {
|
|
173984
174098
|
// used before, but types are inconsistent
|
|
173985
|
-
throw BinderException(
|
|
174099
|
+
throw BinderException(
|
|
174100
|
+
"Inconsistent types found for parameter with index %llu, current type %s, new type %s",
|
|
174101
|
+
expr->parameter_nr, entry->second.back()->type().ToString(), value->type().ToString());
|
|
173986
174102
|
}
|
|
173987
174103
|
value_map[expr->parameter_nr].push_back(move(value));
|
|
173988
174104
|
}
|
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 "babe830d3"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev160"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -5453,7 +5453,6 @@ private:
|
|
|
5453
5453
|
|
|
5454
5454
|
|
|
5455
5455
|
|
|
5456
|
-
|
|
5457
5456
|
//===----------------------------------------------------------------------===//
|
|
5458
5457
|
// DuckDB
|
|
5459
5458
|
//
|
|
@@ -5659,6 +5658,29 @@ using named_parameter_map_t = case_insensitive_map_t<Value>;
|
|
|
5659
5658
|
} // namespace duckdb
|
|
5660
5659
|
|
|
5661
5660
|
|
|
5661
|
+
|
|
5662
|
+
//===----------------------------------------------------------------------===//
|
|
5663
|
+
// DuckDB
|
|
5664
|
+
//
|
|
5665
|
+
// duckdb/main/external_dependencies.hpp
|
|
5666
|
+
//
|
|
5667
|
+
//
|
|
5668
|
+
//===----------------------------------------------------------------------===//
|
|
5669
|
+
|
|
5670
|
+
|
|
5671
|
+
|
|
5672
|
+
namespace duckdb {
|
|
5673
|
+
|
|
5674
|
+
enum ExternalDependenciesType { PYTHON_DEPENDENCY };
|
|
5675
|
+
class ExternalDependency {
|
|
5676
|
+
public:
|
|
5677
|
+
explicit ExternalDependency(ExternalDependenciesType type_p) : type(type_p) {};
|
|
5678
|
+
virtual ~ExternalDependency() {};
|
|
5679
|
+
ExternalDependenciesType type;
|
|
5680
|
+
};
|
|
5681
|
+
|
|
5682
|
+
} // namespace duckdb
|
|
5683
|
+
|
|
5662
5684
|
//===----------------------------------------------------------------------===//
|
|
5663
5685
|
// DuckDB
|
|
5664
5686
|
//
|
|
@@ -6362,6 +6384,11 @@ struct TableFunctionData : public FunctionData {
|
|
|
6362
6384
|
DUCKDB_API bool Equals(const FunctionData &other) const override;
|
|
6363
6385
|
};
|
|
6364
6386
|
|
|
6387
|
+
struct PyTableFunctionData : public TableFunctionData {
|
|
6388
|
+
//! External dependencies of this table function
|
|
6389
|
+
unique_ptr<ExternalDependency> external_dependency;
|
|
6390
|
+
};
|
|
6391
|
+
|
|
6365
6392
|
struct FunctionParameters {
|
|
6366
6393
|
vector<Value> values;
|
|
6367
6394
|
named_parameter_map_t named_parameters;
|
|
@@ -17701,27 +17728,6 @@ public:
|
|
|
17701
17728
|
|
|
17702
17729
|
} // namespace duckdb
|
|
17703
17730
|
|
|
17704
|
-
//===----------------------------------------------------------------------===//
|
|
17705
|
-
// DuckDB
|
|
17706
|
-
//
|
|
17707
|
-
// duckdb/main/external_dependencies.hpp
|
|
17708
|
-
//
|
|
17709
|
-
//
|
|
17710
|
-
//===----------------------------------------------------------------------===//
|
|
17711
|
-
|
|
17712
|
-
|
|
17713
|
-
|
|
17714
|
-
namespace duckdb {
|
|
17715
|
-
|
|
17716
|
-
enum ExternalDependenciesType { PYTHON_DEPENDENCY };
|
|
17717
|
-
class ExternalDependency {
|
|
17718
|
-
public:
|
|
17719
|
-
explicit ExternalDependency(ExternalDependenciesType type_p) : type(type_p) {};
|
|
17720
|
-
virtual ~ExternalDependency() {};
|
|
17721
|
-
ExternalDependenciesType type;
|
|
17722
|
-
};
|
|
17723
|
-
|
|
17724
|
-
} // namespace duckdb
|
|
17725
17731
|
|
|
17726
17732
|
|
|
17727
17733
|
namespace duckdb {
|
|
@@ -24562,6 +24568,7 @@ public:
|
|
|
24562
24568
|
|
|
24563
24569
|
|
|
24564
24570
|
|
|
24571
|
+
|
|
24565
24572
|
namespace duckdb {
|
|
24566
24573
|
//! Represents a Table producing function
|
|
24567
24574
|
class TableFunctionRef : public TableRef {
|
|
@@ -24574,6 +24581,9 @@ public:
|
|
|
24574
24581
|
// if the function takes a subquery as argument its in here
|
|
24575
24582
|
unique_ptr<SelectStatement> subquery;
|
|
24576
24583
|
|
|
24584
|
+
// External dependencies of this table funcion
|
|
24585
|
+
unique_ptr<ExternalDependency> external_dependency;
|
|
24586
|
+
|
|
24577
24587
|
public:
|
|
24578
24588
|
string ToString() const override;
|
|
24579
24589
|
|