duckdb 0.3.3-dev1297.0 → 0.3.3-dev1300.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 +47 -43
- package/src/duckdb.hpp +8 -11
- package/src/parquet-amalgamation.cpp +35413 -35413
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -153811,6 +153811,8 @@ public:
|
|
|
153811
153811
|
return max_count;
|
|
153812
153812
|
}
|
|
153813
153813
|
|
|
153814
|
+
unique_ptr<Expression> CreateExtraReference(unique_ptr<ParsedExpression> expr);
|
|
153815
|
+
|
|
153814
153816
|
private:
|
|
153815
153817
|
unique_ptr<Expression> CreateProjectionReference(ParsedExpression &expr, idx_t index);
|
|
153816
153818
|
|
|
@@ -153844,9 +153846,13 @@ unique_ptr<Expression> Binder::BindOrderExpression(OrderBinder &order_binder, un
|
|
|
153844
153846
|
return bound_expr;
|
|
153845
153847
|
}
|
|
153846
153848
|
|
|
153847
|
-
unique_ptr<Expression> Binder::BindDelimiter(ClientContext &context,
|
|
153848
|
-
const LogicalType &type,
|
|
153849
|
+
unique_ptr<Expression> Binder::BindDelimiter(ClientContext &context, OrderBinder &order_binder,
|
|
153850
|
+
unique_ptr<ParsedExpression> delimiter, const LogicalType &type,
|
|
153851
|
+
Value &delimiter_value) {
|
|
153849
153852
|
auto new_binder = Binder::CreateBinder(context, this, true);
|
|
153853
|
+
if (delimiter->HasSubquery()) {
|
|
153854
|
+
return order_binder.CreateExtraReference(move(delimiter));
|
|
153855
|
+
}
|
|
153850
153856
|
ExpressionBinder expr_binder(*new_binder, context);
|
|
153851
153857
|
expr_binder.target_type = type;
|
|
153852
153858
|
auto expr = expr_binder.Bind(delimiter);
|
|
@@ -153858,11 +153864,11 @@ unique_ptr<Expression> Binder::BindDelimiter(ClientContext &context, unique_ptr<
|
|
|
153858
153864
|
return expr;
|
|
153859
153865
|
}
|
|
153860
153866
|
|
|
153861
|
-
unique_ptr<BoundResultModifier> Binder::BindLimit(LimitModifier &limit_mod) {
|
|
153867
|
+
unique_ptr<BoundResultModifier> Binder::BindLimit(OrderBinder &order_binder, LimitModifier &limit_mod) {
|
|
153862
153868
|
auto result = make_unique<BoundLimitModifier>();
|
|
153863
153869
|
if (limit_mod.limit) {
|
|
153864
153870
|
Value val;
|
|
153865
|
-
result->limit = BindDelimiter(context, move(limit_mod.limit), LogicalType::BIGINT, val);
|
|
153871
|
+
result->limit = BindDelimiter(context, order_binder, move(limit_mod.limit), LogicalType::BIGINT, val);
|
|
153866
153872
|
if (!result->limit) {
|
|
153867
153873
|
result->limit_val = val.GetValue<int64_t>();
|
|
153868
153874
|
if (result->limit_val < 0) {
|
|
@@ -153872,7 +153878,7 @@ unique_ptr<BoundResultModifier> Binder::BindLimit(LimitModifier &limit_mod) {
|
|
|
153872
153878
|
}
|
|
153873
153879
|
if (limit_mod.offset) {
|
|
153874
153880
|
Value val;
|
|
153875
|
-
result->offset = BindDelimiter(context, move(limit_mod.offset), LogicalType::BIGINT, val);
|
|
153881
|
+
result->offset = BindDelimiter(context, order_binder, move(limit_mod.offset), LogicalType::BIGINT, val);
|
|
153876
153882
|
if (!result->offset) {
|
|
153877
153883
|
result->offset_val = val.GetValue<int64_t>();
|
|
153878
153884
|
if (result->offset_val < 0) {
|
|
@@ -153883,11 +153889,11 @@ unique_ptr<BoundResultModifier> Binder::BindLimit(LimitModifier &limit_mod) {
|
|
|
153883
153889
|
return move(result);
|
|
153884
153890
|
}
|
|
153885
153891
|
|
|
153886
|
-
unique_ptr<BoundResultModifier> Binder::BindLimitPercent(LimitPercentModifier &limit_mod) {
|
|
153892
|
+
unique_ptr<BoundResultModifier> Binder::BindLimitPercent(OrderBinder &order_binder, LimitPercentModifier &limit_mod) {
|
|
153887
153893
|
auto result = make_unique<BoundLimitPercentModifier>();
|
|
153888
153894
|
if (limit_mod.limit) {
|
|
153889
153895
|
Value val;
|
|
153890
|
-
result->limit = BindDelimiter(context, move(limit_mod.limit), LogicalType::DOUBLE, val);
|
|
153896
|
+
result->limit = BindDelimiter(context, order_binder, move(limit_mod.limit), LogicalType::DOUBLE, val);
|
|
153891
153897
|
if (!result->limit) {
|
|
153892
153898
|
result->limit_percent = val.GetValue<double>();
|
|
153893
153899
|
if (result->limit_percent < 0.0) {
|
|
@@ -153897,7 +153903,7 @@ unique_ptr<BoundResultModifier> Binder::BindLimitPercent(LimitPercentModifier &l
|
|
|
153897
153903
|
}
|
|
153898
153904
|
if (limit_mod.offset) {
|
|
153899
153905
|
Value val;
|
|
153900
|
-
result->offset = BindDelimiter(context, move(limit_mod.offset), LogicalType::BIGINT, val);
|
|
153906
|
+
result->offset = BindDelimiter(context, order_binder, move(limit_mod.offset), LogicalType::BIGINT, val);
|
|
153901
153907
|
if (!result->offset) {
|
|
153902
153908
|
result->offset_val = val.GetValue<int64_t>();
|
|
153903
153909
|
}
|
|
@@ -153962,10 +153968,10 @@ void Binder::BindModifiers(OrderBinder &order_binder, QueryNode &statement, Boun
|
|
|
153962
153968
|
break;
|
|
153963
153969
|
}
|
|
153964
153970
|
case ResultModifierType::LIMIT_MODIFIER:
|
|
153965
|
-
bound_modifier = BindLimit((LimitModifier &)*mod);
|
|
153971
|
+
bound_modifier = BindLimit(order_binder, (LimitModifier &)*mod);
|
|
153966
153972
|
break;
|
|
153967
153973
|
case ResultModifierType::LIMIT_PERCENT_MODIFIER:
|
|
153968
|
-
bound_modifier = BindLimitPercent((LimitPercentModifier &)*mod);
|
|
153974
|
+
bound_modifier = BindLimitPercent(order_binder, (LimitPercentModifier &)*mod);
|
|
153969
153975
|
break;
|
|
153970
153976
|
default:
|
|
153971
153977
|
throw Exception("Unsupported result modifier");
|
|
@@ -153976,6 +153982,18 @@ void Binder::BindModifiers(OrderBinder &order_binder, QueryNode &statement, Boun
|
|
|
153976
153982
|
}
|
|
153977
153983
|
}
|
|
153978
153984
|
|
|
153985
|
+
static void AssignReturnType(unique_ptr<Expression> &expr, const vector<LogicalType> &sql_types,
|
|
153986
|
+
idx_t projection_index) {
|
|
153987
|
+
if (!expr) {
|
|
153988
|
+
return;
|
|
153989
|
+
}
|
|
153990
|
+
if (expr->type != ExpressionType::BOUND_COLUMN_REF) {
|
|
153991
|
+
return;
|
|
153992
|
+
}
|
|
153993
|
+
auto &bound_colref = (BoundColumnRefExpression &)*expr;
|
|
153994
|
+
bound_colref.return_type = sql_types[bound_colref.binding.column_index];
|
|
153995
|
+
}
|
|
153996
|
+
|
|
153979
153997
|
void Binder::BindModifierTypes(BoundQueryNode &result, const vector<LogicalType> &sql_types, idx_t projection_index) {
|
|
153980
153998
|
for (auto &bound_mod : result.modifiers) {
|
|
153981
153999
|
switch (bound_mod->type) {
|
|
@@ -154009,6 +154027,18 @@ void Binder::BindModifierTypes(BoundQueryNode &result, const vector<LogicalType>
|
|
|
154009
154027
|
}
|
|
154010
154028
|
break;
|
|
154011
154029
|
}
|
|
154030
|
+
case ResultModifierType::LIMIT_MODIFIER: {
|
|
154031
|
+
auto &limit = (BoundLimitModifier &)*bound_mod;
|
|
154032
|
+
AssignReturnType(limit.limit, sql_types, projection_index);
|
|
154033
|
+
AssignReturnType(limit.offset, sql_types, projection_index);
|
|
154034
|
+
break;
|
|
154035
|
+
}
|
|
154036
|
+
case ResultModifierType::LIMIT_PERCENT_MODIFIER: {
|
|
154037
|
+
auto &limit = (BoundLimitPercentModifier &)*bound_mod;
|
|
154038
|
+
AssignReturnType(limit.limit, sql_types, projection_index);
|
|
154039
|
+
AssignReturnType(limit.offset, sql_types, projection_index);
|
|
154040
|
+
break;
|
|
154041
|
+
}
|
|
154012
154042
|
case ResultModifierType::ORDER_MODIFIER: {
|
|
154013
154043
|
auto &order = (BoundOrderModifier &)*bound_mod;
|
|
154014
154044
|
for (auto &order_node : order.orders) {
|
|
@@ -154637,36 +154667,6 @@ unique_ptr<LogicalOperator> Binder::CreatePlan(BoundSelectNode &statement) {
|
|
|
154637
154667
|
PlanSubqueries(&expr, &root);
|
|
154638
154668
|
}
|
|
154639
154669
|
|
|
154640
|
-
for (size_t i = 0; i < statement.modifiers.size(); i++) {
|
|
154641
|
-
auto &modifier = statement.modifiers[i];
|
|
154642
|
-
unique_ptr<LogicalOperator> limit = nullptr;
|
|
154643
|
-
if (modifier->type == ResultModifierType::LIMIT_MODIFIER) {
|
|
154644
|
-
auto &limit_modifier = (BoundLimitModifier &)*modifier;
|
|
154645
|
-
if (limit_modifier.limit || limit_modifier.offset) {
|
|
154646
|
-
PlanSubqueries(&limit_modifier.limit, &root);
|
|
154647
|
-
PlanSubqueries(&limit_modifier.offset, &root);
|
|
154648
|
-
limit = make_unique<LogicalLimit>(limit_modifier.limit_val, limit_modifier.offset_val,
|
|
154649
|
-
move(limit_modifier.limit), move(limit_modifier.offset));
|
|
154650
|
-
}
|
|
154651
|
-
} else if (modifier->type == ResultModifierType::LIMIT_PERCENT_MODIFIER) {
|
|
154652
|
-
auto &limit_modifier = (BoundLimitPercentModifier &)*modifier;
|
|
154653
|
-
if (limit_modifier.limit || limit_modifier.offset) {
|
|
154654
|
-
PlanSubqueries(&limit_modifier.limit, &root);
|
|
154655
|
-
PlanSubqueries(&limit_modifier.offset, &root);
|
|
154656
|
-
limit = make_unique<LogicalLimitPercent>(limit_modifier.limit_percent, limit_modifier.offset_val,
|
|
154657
|
-
move(limit_modifier.limit), move(limit_modifier.offset));
|
|
154658
|
-
}
|
|
154659
|
-
}
|
|
154660
|
-
if (limit) {
|
|
154661
|
-
limit->AddChild(move(root));
|
|
154662
|
-
root = move(limit);
|
|
154663
|
-
// Delete from modifiers
|
|
154664
|
-
std::swap(statement.modifiers[i], statement.modifiers.back());
|
|
154665
|
-
statement.modifiers.erase(statement.modifiers.end() - 1);
|
|
154666
|
-
i--;
|
|
154667
|
-
}
|
|
154668
|
-
}
|
|
154669
|
-
|
|
154670
154670
|
// create the projection
|
|
154671
154671
|
auto proj = make_unique<LogicalProjection>(statement.projection_index, move(statement.select_list));
|
|
154672
154672
|
auto &projection = *proj;
|
|
@@ -160241,6 +160241,12 @@ unique_ptr<Expression> OrderBinder::CreateProjectionReference(ParsedExpression &
|
|
|
160241
160241
|
ColumnBinding(projection_index, index));
|
|
160242
160242
|
}
|
|
160243
160243
|
|
|
160244
|
+
unique_ptr<Expression> OrderBinder::CreateExtraReference(unique_ptr<ParsedExpression> expr) {
|
|
160245
|
+
auto result = CreateProjectionReference(*expr, extra_list->size());
|
|
160246
|
+
extra_list->push_back(move(expr));
|
|
160247
|
+
return result;
|
|
160248
|
+
}
|
|
160249
|
+
|
|
160244
160250
|
unique_ptr<Expression> OrderBinder::Bind(unique_ptr<ParsedExpression> expr) {
|
|
160245
160251
|
// in the ORDER BY clause we do not bind children
|
|
160246
160252
|
// we bind ONLY to the select list
|
|
@@ -160311,9 +160317,7 @@ unique_ptr<Expression> OrderBinder::Bind(unique_ptr<ParsedExpression> expr) {
|
|
|
160311
160317
|
expr->ToString());
|
|
160312
160318
|
}
|
|
160313
160319
|
// otherwise we need to push the ORDER BY entry into the select list
|
|
160314
|
-
|
|
160315
|
-
extra_list->push_back(move(expr));
|
|
160316
|
-
return result;
|
|
160320
|
+
return CreateExtraReference(move(expr));
|
|
160317
160321
|
}
|
|
160318
160322
|
|
|
160319
160323
|
} // namespace duckdb
|
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.3.3-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "299fe7466"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.3-dev1300"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -13540,9 +13540,10 @@ private:
|
|
|
13540
13540
|
private:
|
|
13541
13541
|
//! Bind the default values of the columns of a table
|
|
13542
13542
|
void BindDefaultValues(vector<ColumnDefinition> &columns, vector<unique_ptr<Expression>> &bound_defaults);
|
|
13543
|
-
//! Bind a
|
|
13544
|
-
unique_ptr<Expression> BindDelimiter(ClientContext &context,
|
|
13545
|
-
const LogicalType &type,
|
|
13543
|
+
//! Bind a limit value (LIMIT or OFFSET)
|
|
13544
|
+
unique_ptr<Expression> BindDelimiter(ClientContext &context, OrderBinder &order_binder,
|
|
13545
|
+
unique_ptr<ParsedExpression> delimiter, const LogicalType &type,
|
|
13546
|
+
Value &delimiter_value);
|
|
13546
13547
|
|
|
13547
13548
|
//! Move correlated expressions from the child binder to this binder
|
|
13548
13549
|
void MoveCorrelatedExpressions(Binder &other);
|
|
@@ -13603,10 +13604,6 @@ private:
|
|
|
13603
13604
|
unique_ptr<LogicalOperator> CreatePlan(BoundExpressionListRef &ref);
|
|
13604
13605
|
unique_ptr<LogicalOperator> CreatePlan(BoundCTERef &ref);
|
|
13605
13606
|
|
|
13606
|
-
unique_ptr<LogicalOperator> BindTable(TableCatalogEntry &table, BaseTableRef &ref);
|
|
13607
|
-
unique_ptr<LogicalOperator> BindView(ViewCatalogEntry &view, BaseTableRef &ref);
|
|
13608
|
-
unique_ptr<LogicalOperator> BindTableOrView(BaseTableRef &ref);
|
|
13609
|
-
|
|
13610
13607
|
BoundStatement BindCopyTo(CopyStatement &stmt);
|
|
13611
13608
|
BoundStatement BindCopyFrom(CopyStatement &stmt);
|
|
13612
13609
|
|
|
@@ -13614,8 +13611,8 @@ private:
|
|
|
13614
13611
|
void BindModifierTypes(BoundQueryNode &result, const vector<LogicalType> &sql_types, idx_t projection_index);
|
|
13615
13612
|
|
|
13616
13613
|
BoundStatement BindSummarize(ShowStatement &stmt);
|
|
13617
|
-
unique_ptr<BoundResultModifier> BindLimit(LimitModifier &limit_mod);
|
|
13618
|
-
unique_ptr<BoundResultModifier> BindLimitPercent(LimitPercentModifier &limit_mod);
|
|
13614
|
+
unique_ptr<BoundResultModifier> BindLimit(OrderBinder &order_binder, LimitModifier &limit_mod);
|
|
13615
|
+
unique_ptr<BoundResultModifier> BindLimitPercent(OrderBinder &order_binder, LimitPercentModifier &limit_mod);
|
|
13619
13616
|
unique_ptr<Expression> BindOrderExpression(OrderBinder &order_binder, unique_ptr<ParsedExpression> expr);
|
|
13620
13617
|
|
|
13621
13618
|
unique_ptr<LogicalOperator> PlanFilter(unique_ptr<Expression> condition, unique_ptr<LogicalOperator> root);
|