duckdb 0.5.2-dev2236.0 → 0.5.2-dev2245.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 +62 -148
- package/src/duckdb.hpp +5062 -4871
- package/src/parquet-amalgamation.cpp +37525 -37525
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -10467,6 +10467,8 @@ string LogicalOperatorToString(LogicalOperatorType type) {
|
|
|
10467
10467
|
return "LOAD";
|
|
10468
10468
|
case LogicalOperatorType::LOGICAL_INVALID:
|
|
10469
10469
|
break;
|
|
10470
|
+
case LogicalOperatorType::LOGICAL_EXTENSION_OPERATOR:
|
|
10471
|
+
return "CUSTOM_OP";
|
|
10470
10472
|
}
|
|
10471
10473
|
return "INVALID";
|
|
10472
10474
|
}
|
|
@@ -71833,153 +71835,6 @@ string PhysicalReservoirSample::ParamsToString() const {
|
|
|
71833
71835
|
|
|
71834
71836
|
|
|
71835
71837
|
|
|
71836
|
-
//===----------------------------------------------------------------------===//
|
|
71837
|
-
// DuckDB
|
|
71838
|
-
//
|
|
71839
|
-
// duckdb/execution/physical_plan_generator.hpp
|
|
71840
|
-
//
|
|
71841
|
-
//
|
|
71842
|
-
//===----------------------------------------------------------------------===//
|
|
71843
|
-
|
|
71844
|
-
|
|
71845
|
-
|
|
71846
|
-
|
|
71847
|
-
|
|
71848
|
-
|
|
71849
|
-
|
|
71850
|
-
//===----------------------------------------------------------------------===//
|
|
71851
|
-
// DuckDB
|
|
71852
|
-
//
|
|
71853
|
-
// duckdb/planner/operator/logical_limit_percent.hpp
|
|
71854
|
-
//
|
|
71855
|
-
//
|
|
71856
|
-
//===----------------------------------------------------------------------===//
|
|
71857
|
-
|
|
71858
|
-
|
|
71859
|
-
|
|
71860
|
-
|
|
71861
|
-
|
|
71862
|
-
namespace duckdb {
|
|
71863
|
-
|
|
71864
|
-
//! LogicalLimitPercent represents a LIMIT PERCENT clause
|
|
71865
|
-
class LogicalLimitPercent : public LogicalOperator {
|
|
71866
|
-
public:
|
|
71867
|
-
LogicalLimitPercent(double limit_percent, int64_t offset_val, unique_ptr<Expression> limit,
|
|
71868
|
-
unique_ptr<Expression> offset)
|
|
71869
|
-
: LogicalOperator(LogicalOperatorType::LOGICAL_LIMIT_PERCENT), limit_percent(limit_percent),
|
|
71870
|
-
offset_val(offset_val), limit(move(limit)), offset(move(offset)) {
|
|
71871
|
-
}
|
|
71872
|
-
|
|
71873
|
-
//! Limit percent and offset values in case they are constants, used in optimizations.
|
|
71874
|
-
double limit_percent;
|
|
71875
|
-
int64_t offset_val;
|
|
71876
|
-
//! The maximum amount of elements to emit
|
|
71877
|
-
unique_ptr<Expression> limit;
|
|
71878
|
-
//! The offset from the start to begin emitting elements
|
|
71879
|
-
unique_ptr<Expression> offset;
|
|
71880
|
-
|
|
71881
|
-
public:
|
|
71882
|
-
vector<ColumnBinding> GetColumnBindings() override {
|
|
71883
|
-
return children[0]->GetColumnBindings();
|
|
71884
|
-
}
|
|
71885
|
-
|
|
71886
|
-
void Serialize(FieldWriter &writer) const override;
|
|
71887
|
-
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
|
71888
|
-
|
|
71889
|
-
protected:
|
|
71890
|
-
void ResolveTypes() override {
|
|
71891
|
-
types = children[0]->types;
|
|
71892
|
-
}
|
|
71893
|
-
};
|
|
71894
|
-
} // namespace duckdb
|
|
71895
|
-
|
|
71896
|
-
|
|
71897
|
-
|
|
71898
|
-
|
|
71899
|
-
namespace duckdb {
|
|
71900
|
-
class ClientContext;
|
|
71901
|
-
class ColumnDataCollection;
|
|
71902
|
-
|
|
71903
|
-
//! The physical plan generator generates a physical execution plan from a
|
|
71904
|
-
//! logical query plan
|
|
71905
|
-
class PhysicalPlanGenerator {
|
|
71906
|
-
public:
|
|
71907
|
-
explicit PhysicalPlanGenerator(ClientContext &context);
|
|
71908
|
-
~PhysicalPlanGenerator();
|
|
71909
|
-
|
|
71910
|
-
unordered_set<CatalogEntry *> dependencies;
|
|
71911
|
-
//! Recursive CTEs require at least one ChunkScan, referencing the working_table.
|
|
71912
|
-
//! This data structure is used to establish it.
|
|
71913
|
-
unordered_map<idx_t, std::shared_ptr<ColumnDataCollection>> recursive_cte_tables;
|
|
71914
|
-
|
|
71915
|
-
public:
|
|
71916
|
-
//! Creates a plan from the logical operator. This involves resolving column bindings and generating physical
|
|
71917
|
-
//! operator nodes.
|
|
71918
|
-
unique_ptr<PhysicalOperator> CreatePlan(unique_ptr<LogicalOperator> logical);
|
|
71919
|
-
|
|
71920
|
-
//! Whether or not we can (or should) use a batch-index based operator for executing the given sink
|
|
71921
|
-
static bool UseBatchIndex(ClientContext &context, PhysicalOperator &plan);
|
|
71922
|
-
//! Whether or not we should preserve insertion order for executing the given sink
|
|
71923
|
-
static bool PreserveInsertionOrder(ClientContext &context, PhysicalOperator &plan);
|
|
71924
|
-
|
|
71925
|
-
protected:
|
|
71926
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalOperator &op);
|
|
71927
|
-
|
|
71928
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalAggregate &op);
|
|
71929
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalAnyJoin &op);
|
|
71930
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalColumnDataGet &op);
|
|
71931
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalComparisonJoin &op);
|
|
71932
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalCreate &op);
|
|
71933
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalCreateTable &op);
|
|
71934
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalCreateIndex &op);
|
|
71935
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalCrossProduct &op);
|
|
71936
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalDelete &op);
|
|
71937
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalDelimGet &op);
|
|
71938
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalDelimJoin &op);
|
|
71939
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalDistinct &op);
|
|
71940
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalDummyScan &expr);
|
|
71941
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalEmptyResult &op);
|
|
71942
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalExpressionGet &op);
|
|
71943
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalExport &op);
|
|
71944
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalFilter &op);
|
|
71945
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalGet &op);
|
|
71946
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalLimit &op);
|
|
71947
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalLimitPercent &op);
|
|
71948
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalOrder &op);
|
|
71949
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalTopN &op);
|
|
71950
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalProjection &op);
|
|
71951
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalInsert &op);
|
|
71952
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalCopyToFile &op);
|
|
71953
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalExplain &op);
|
|
71954
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalSetOperation &op);
|
|
71955
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalUpdate &op);
|
|
71956
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalPrepare &expr);
|
|
71957
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalWindow &expr);
|
|
71958
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalExecute &op);
|
|
71959
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalPragma &op);
|
|
71960
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalSample &op);
|
|
71961
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalSet &op);
|
|
71962
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalShow &op);
|
|
71963
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalSimple &op);
|
|
71964
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalUnnest &op);
|
|
71965
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalRecursiveCTE &op);
|
|
71966
|
-
unique_ptr<PhysicalOperator> CreatePlan(LogicalCTERef &op);
|
|
71967
|
-
|
|
71968
|
-
unique_ptr<PhysicalOperator> CreateDistinctOn(unique_ptr<PhysicalOperator> child,
|
|
71969
|
-
vector<unique_ptr<Expression>> distinct_targets);
|
|
71970
|
-
|
|
71971
|
-
unique_ptr<PhysicalOperator> ExtractAggregateExpressions(unique_ptr<PhysicalOperator> child,
|
|
71972
|
-
vector<unique_ptr<Expression>> &expressions,
|
|
71973
|
-
vector<unique_ptr<Expression>> &groups);
|
|
71974
|
-
|
|
71975
|
-
private:
|
|
71976
|
-
bool PreserveInsertionOrder(PhysicalOperator &plan);
|
|
71977
|
-
bool UseBatchIndex(PhysicalOperator &plan);
|
|
71978
|
-
|
|
71979
|
-
private:
|
|
71980
|
-
ClientContext &context;
|
|
71981
|
-
};
|
|
71982
|
-
} // namespace duckdb
|
|
71983
71838
|
|
|
71984
71839
|
|
|
71985
71840
|
|
|
@@ -90586,6 +90441,35 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalWindow &op
|
|
|
90586
90441
|
|
|
90587
90442
|
|
|
90588
90443
|
|
|
90444
|
+
|
|
90445
|
+
//===----------------------------------------------------------------------===//
|
|
90446
|
+
// DuckDB
|
|
90447
|
+
//
|
|
90448
|
+
// duckdb/planner/operator/logical_extension.operator.hpp
|
|
90449
|
+
//
|
|
90450
|
+
//
|
|
90451
|
+
//===----------------------------------------------------------------------===//
|
|
90452
|
+
|
|
90453
|
+
|
|
90454
|
+
|
|
90455
|
+
|
|
90456
|
+
|
|
90457
|
+
|
|
90458
|
+
namespace duckdb {
|
|
90459
|
+
|
|
90460
|
+
struct LogicalExtensionOperator : public LogicalOperator {
|
|
90461
|
+
|
|
90462
|
+
LogicalExtensionOperator() : LogicalOperator(LogicalOperatorType::LOGICAL_EXTENSION_OPERATOR) {
|
|
90463
|
+
}
|
|
90464
|
+
LogicalExtensionOperator(vector<unique_ptr<Expression>> expressions)
|
|
90465
|
+
: LogicalOperator(LogicalOperatorType::LOGICAL_EXTENSION_OPERATOR, move(expressions)) {
|
|
90466
|
+
}
|
|
90467
|
+
|
|
90468
|
+
virtual unique_ptr<PhysicalOperator> CreatePlan(ClientContext &context, PhysicalPlanGenerator &generator) = 0;
|
|
90469
|
+
};
|
|
90470
|
+
} // namespace duckdb
|
|
90471
|
+
|
|
90472
|
+
|
|
90589
90473
|
namespace duckdb {
|
|
90590
90474
|
|
|
90591
90475
|
class DependencyExtractor : public LogicalOperatorVisitor {
|
|
@@ -90771,6 +90655,13 @@ unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalOperator &
|
|
|
90771
90655
|
case LogicalOperatorType::LOGICAL_SET:
|
|
90772
90656
|
plan = CreatePlan((LogicalSet &)op);
|
|
90773
90657
|
break;
|
|
90658
|
+
case LogicalOperatorType::LOGICAL_EXTENSION_OPERATOR:
|
|
90659
|
+
plan = ((LogicalExtensionOperator &)op).CreatePlan(context, *this);
|
|
90660
|
+
|
|
90661
|
+
if (!plan) {
|
|
90662
|
+
throw InternalException("Missing PhysicalOperator for Extension Operator");
|
|
90663
|
+
}
|
|
90664
|
+
break;
|
|
90774
90665
|
default: {
|
|
90775
90666
|
throw NotImplementedException("Unimplemented logical operator type!");
|
|
90776
90667
|
}
|
|
@@ -171799,6 +171690,10 @@ unique_ptr<CreateInfo> CreateInfo::Deserialize(Deserializer &deserializer) {
|
|
|
171799
171690
|
}
|
|
171800
171691
|
}
|
|
171801
171692
|
|
|
171693
|
+
unique_ptr<CreateInfo> CreateInfo::Deserialize(Deserializer &source, PlanDeserializationState &state) {
|
|
171694
|
+
return Deserialize(source);
|
|
171695
|
+
}
|
|
171696
|
+
|
|
171802
171697
|
void CreateInfo::CopyProperties(CreateInfo &other) const {
|
|
171803
171698
|
other.type = type;
|
|
171804
171699
|
other.schema = schema;
|
|
@@ -194109,6 +194004,7 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundTableFunction &ref) {
|
|
|
194109
194004
|
|
|
194110
194005
|
|
|
194111
194006
|
|
|
194007
|
+
|
|
194112
194008
|
#include <algorithm>
|
|
194113
194009
|
|
|
194114
194010
|
namespace duckdb {
|
|
@@ -198302,6 +198198,8 @@ unique_ptr<LogicalOperator> LogicalOperator::Deserialize(Deserializer &deseriali
|
|
|
198302
198198
|
case LogicalOperatorType::LOGICAL_LOAD:
|
|
198303
198199
|
result = LogicalSimple::Deserialize(state, reader);
|
|
198304
198200
|
break;
|
|
198201
|
+
case LogicalOperatorType::LOGICAL_EXTENSION_OPERATOR:
|
|
198202
|
+
throw SerializationException("Invalid type for operator deserialization");
|
|
198305
198203
|
case LogicalOperatorType::LOGICAL_INVALID:
|
|
198306
198204
|
/* no default here to trigger a warning if we forget to implement deserialize for a new operator */
|
|
198307
198205
|
throw SerializationException("Invalid type for operator deserialization");
|
|
@@ -200123,7 +200021,23 @@ void Planner::CreatePlan(SQLStatement &statement) {
|
|
|
200123
200021
|
this->plan = nullptr;
|
|
200124
200022
|
parameters_resolved = false;
|
|
200125
200023
|
} catch (const Exception &ex) {
|
|
200126
|
-
|
|
200024
|
+
auto &config = DBConfig::GetConfig(context);
|
|
200025
|
+
|
|
200026
|
+
this->plan = nullptr;
|
|
200027
|
+
for (auto &extension_op : config.operator_extensions) {
|
|
200028
|
+
auto bound_statement =
|
|
200029
|
+
extension_op.Bind(context, *this->binder, extension_op.operator_info.get(), statement);
|
|
200030
|
+
if (bound_statement.plan != nullptr) {
|
|
200031
|
+
this->names = bound_statement.names;
|
|
200032
|
+
this->types = bound_statement.types;
|
|
200033
|
+
this->plan = move(bound_statement.plan);
|
|
200034
|
+
break;
|
|
200035
|
+
}
|
|
200036
|
+
}
|
|
200037
|
+
|
|
200038
|
+
if (!this->plan) {
|
|
200039
|
+
throw;
|
|
200040
|
+
}
|
|
200127
200041
|
} catch (std::exception &ex) {
|
|
200128
200042
|
throw;
|
|
200129
200043
|
}
|