duckdb 0.3.5-dev1280.0 → 0.3.5-dev1285.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 -13
- package/src/duckdb.hpp +8 -6
- package/src/parquet-amalgamation.cpp +26697 -26697
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -23775,7 +23775,7 @@ template <typename T>
|
|
|
23775
23775
|
struct IntegerCastData {
|
|
23776
23776
|
using Result = T;
|
|
23777
23777
|
Result result;
|
|
23778
|
-
|
|
23778
|
+
bool seen_decimal;
|
|
23779
23779
|
};
|
|
23780
23780
|
|
|
23781
23781
|
struct IntegerCastOperation {
|
|
@@ -23809,14 +23809,27 @@ struct IntegerCastOperation {
|
|
|
23809
23809
|
|
|
23810
23810
|
template <class T, bool NEGATIVE>
|
|
23811
23811
|
static bool HandleDecimal(T &state, uint8_t digit) {
|
|
23812
|
-
if (
|
|
23813
|
-
|
|
23814
|
-
|
|
23815
|
-
|
|
23816
|
-
|
|
23812
|
+
if (state.seen_decimal) {
|
|
23813
|
+
return true;
|
|
23814
|
+
}
|
|
23815
|
+
state.seen_decimal = true;
|
|
23816
|
+
// round the integer based on what is after the decimal point
|
|
23817
|
+
// if digit >= 5, then we round up (or down in case of negative numbers)
|
|
23818
|
+
auto increment = digit >= 5;
|
|
23819
|
+
if (!increment) {
|
|
23820
|
+
return true;
|
|
23821
|
+
}
|
|
23822
|
+
if (NEGATIVE) {
|
|
23823
|
+
if (state.result == NumericLimits<typename T::Result>::Minimum()) {
|
|
23824
|
+
return false;
|
|
23825
|
+
}
|
|
23826
|
+
state.result--;
|
|
23827
|
+
} else {
|
|
23828
|
+
if (state.result == NumericLimits<typename T::Result>::Maximum()) {
|
|
23829
|
+
return false;
|
|
23817
23830
|
}
|
|
23831
|
+
state.result++;
|
|
23818
23832
|
}
|
|
23819
|
-
++state.decimal_count;
|
|
23820
23833
|
return true;
|
|
23821
23834
|
}
|
|
23822
23835
|
|
|
@@ -24514,7 +24527,7 @@ struct DecimalCastOperation {
|
|
|
24514
24527
|
static bool HandleExponent(T &state, int32_t exponent) {
|
|
24515
24528
|
Finalize<T>(state);
|
|
24516
24529
|
if (exponent < 0) {
|
|
24517
|
-
for (idx_t i = 0; i < idx_t(-exponent); i++) {
|
|
24530
|
+
for (idx_t i = 0; i < idx_t(-int64_t(exponent)); i++) {
|
|
24518
24531
|
state.result /= 10;
|
|
24519
24532
|
if (state.result == 0) {
|
|
24520
24533
|
break;
|
|
@@ -126006,7 +126019,8 @@ PreparedStatementData::~PreparedStatementData() {
|
|
|
126006
126019
|
|
|
126007
126020
|
void PreparedStatementData::Bind(vector<Value> values) {
|
|
126008
126021
|
// set parameters
|
|
126009
|
-
const auto required =
|
|
126022
|
+
const auto required = properties.parameter_count;
|
|
126023
|
+
D_ASSERT(!unbound_statement || unbound_statement->n_param == properties.parameter_count);
|
|
126010
126024
|
if (values.size() != required) {
|
|
126011
126025
|
throw BinderException("Parameter/argument count mismatch for prepared statement. Expected %llu, got %llu",
|
|
126012
126026
|
required, values.size());
|
|
@@ -157861,6 +157875,9 @@ namespace duckdb {
|
|
|
157861
157875
|
unique_ptr<ParsedExpression> Transformer::TransformParamRef(duckdb_libpgquery::PGParamRef *node) {
|
|
157862
157876
|
D_ASSERT(node);
|
|
157863
157877
|
auto expr = make_unique<ParameterExpression>();
|
|
157878
|
+
if (node->number < 0) {
|
|
157879
|
+
throw ParserException("Parameter numbers cannot be negative");
|
|
157880
|
+
}
|
|
157864
157881
|
if (node->number == 0) {
|
|
157865
157882
|
expr->parameter_nr = ParamCount() + 1;
|
|
157866
157883
|
} else {
|
|
@@ -158903,6 +158920,14 @@ static void CheckGroupingSetMax(idx_t count) {
|
|
|
158903
158920
|
}
|
|
158904
158921
|
}
|
|
158905
158922
|
|
|
158923
|
+
static void CheckGroupingSetCubes(idx_t current_count, idx_t cube_count) {
|
|
158924
|
+
idx_t combinations = 1;
|
|
158925
|
+
for (idx_t i = 0; i < cube_count; i++) {
|
|
158926
|
+
combinations *= 2;
|
|
158927
|
+
CheckGroupingSetMax(current_count + combinations);
|
|
158928
|
+
}
|
|
158929
|
+
}
|
|
158930
|
+
|
|
158906
158931
|
struct GroupingExpressionMap {
|
|
158907
158932
|
expression_map_t<idx_t> map;
|
|
158908
158933
|
};
|
|
@@ -159007,6 +159032,8 @@ void Transformer::TransformGroupByNode(duckdb_libpgquery::PGNode *n, GroupingExp
|
|
|
159007
159032
|
cube_sets.push_back(VectorToGroupingSet(cube_set));
|
|
159008
159033
|
}
|
|
159009
159034
|
// generate the subsets of the rollup set and add them to the grouping sets
|
|
159035
|
+
CheckGroupingSetCubes(result_sets.size(), cube_sets.size());
|
|
159036
|
+
|
|
159010
159037
|
GroupingSet current_set;
|
|
159011
159038
|
AddCubeSets(current_set, cube_sets, result_sets, 0);
|
|
159012
159039
|
break;
|
|
@@ -163258,6 +163285,7 @@ BindResult ExpressionBinder::BindExpression(OperatorExpression &op, idx_t depth)
|
|
|
163258
163285
|
namespace duckdb {
|
|
163259
163286
|
|
|
163260
163287
|
BindResult ExpressionBinder::BindExpression(ParameterExpression &expr, idx_t depth) {
|
|
163288
|
+
D_ASSERT(expr.parameter_nr > 0);
|
|
163261
163289
|
auto bound_parameter = make_unique<BoundParameterExpression>(expr.parameter_nr);
|
|
163262
163290
|
if (!binder.parameters) {
|
|
163263
163291
|
throw std::runtime_error("Unexpected prepared parameter. This type of statement can't be prepared!");
|
|
@@ -172832,6 +172860,7 @@ Planner::Planner(ClientContext &context) : binder(Binder::CreateBinder(context))
|
|
|
172832
172860
|
|
|
172833
172861
|
void Planner::CreatePlan(SQLStatement &statement) {
|
|
172834
172862
|
auto &profiler = QueryProfiler::Get(context);
|
|
172863
|
+
auto parameter_count = statement.n_param;
|
|
172835
172864
|
|
|
172836
172865
|
vector<BoundParameterExpression *> bound_parameters;
|
|
172837
172866
|
|
|
@@ -172843,6 +172872,7 @@ void Planner::CreatePlan(SQLStatement &statement) {
|
|
|
172843
172872
|
profiler.EndPhase();
|
|
172844
172873
|
|
|
172845
172874
|
this->properties = binder->properties;
|
|
172875
|
+
this->properties.parameter_count = parameter_count;
|
|
172846
172876
|
this->names = bound_statement.names;
|
|
172847
172877
|
this->types = bound_statement.types;
|
|
172848
172878
|
this->plan = move(bound_statement.plan);
|
|
@@ -172887,6 +172917,7 @@ shared_ptr<PreparedStatementData> Planner::PrepareSQLStatement(unique_ptr<SQLSta
|
|
|
172887
172917
|
|
|
172888
172918
|
void Planner::PlanExecute(unique_ptr<SQLStatement> statement) {
|
|
172889
172919
|
auto &stmt = (ExecuteStatement &)*statement;
|
|
172920
|
+
auto parameter_count = stmt.n_param;
|
|
172890
172921
|
|
|
172891
172922
|
// bind the prepared statement
|
|
172892
172923
|
auto &client_data = ClientData::Get(context);
|
|
@@ -172925,6 +172956,12 @@ void Planner::PlanExecute(unique_ptr<SQLStatement> statement) {
|
|
|
172925
172956
|
D_ASSERT(prepared->properties.bound_all_parameters);
|
|
172926
172957
|
rebound = true;
|
|
172927
172958
|
}
|
|
172959
|
+
// copy the properties of the prepared statement into the planner
|
|
172960
|
+
this->properties = prepared->properties;
|
|
172961
|
+
this->properties.parameter_count = parameter_count;
|
|
172962
|
+
this->names = prepared->names;
|
|
172963
|
+
this->types = prepared->types;
|
|
172964
|
+
|
|
172928
172965
|
// add casts to the prepared statement parameters as required
|
|
172929
172966
|
for (idx_t i = 0; i < bind_values.size(); i++) {
|
|
172930
172967
|
if (prepared->value_map.count(i + 1) == 0) {
|
|
@@ -172941,10 +172978,6 @@ void Planner::PlanExecute(unique_ptr<SQLStatement> statement) {
|
|
|
172941
172978
|
return;
|
|
172942
172979
|
}
|
|
172943
172980
|
|
|
172944
|
-
// copy the properties of the prepared statement into the planner
|
|
172945
|
-
this->properties = prepared->properties;
|
|
172946
|
-
this->names = prepared->names;
|
|
172947
|
-
this->types = prepared->types;
|
|
172948
172981
|
this->plan = make_unique<LogicalExecute>(move(prepared));
|
|
172949
172982
|
}
|
|
172950
172983
|
|
|
@@ -172960,6 +172993,7 @@ void Planner::PlanPrepare(unique_ptr<SQLStatement> statement) {
|
|
|
172960
172993
|
properties.requires_valid_transaction = false;
|
|
172961
172994
|
properties.allow_stream_result = false;
|
|
172962
172995
|
properties.bound_all_parameters = true;
|
|
172996
|
+
properties.parameter_count = 0;
|
|
172963
172997
|
properties.return_type = StatementReturnType::NOTHING;
|
|
172964
172998
|
this->names = {"Success"};
|
|
172965
172999
|
this->types = {LogicalType::BOOLEAN};
|
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.5-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "2c3c08da3"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.5-dev1285"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -9897,7 +9897,7 @@ enum class StatementReturnType : uint8_t {
|
|
|
9897
9897
|
struct StatementProperties {
|
|
9898
9898
|
StatementProperties()
|
|
9899
9899
|
: read_only(true), requires_valid_transaction(true), allow_stream_result(false), bound_all_parameters(true),
|
|
9900
|
-
return_type(StatementReturnType::QUERY_RESULT) {
|
|
9900
|
+
return_type(StatementReturnType::QUERY_RESULT), parameter_count(0) {
|
|
9901
9901
|
}
|
|
9902
9902
|
|
|
9903
9903
|
//! Whether or not the statement is a read-only statement, or whether it can result in changes to the database
|
|
@@ -9911,6 +9911,8 @@ struct StatementProperties {
|
|
|
9911
9911
|
bool bound_all_parameters;
|
|
9912
9912
|
//! What type of data the statement returns
|
|
9913
9913
|
StatementReturnType return_type;
|
|
9914
|
+
//! The number of prepared statement parameters
|
|
9915
|
+
idx_t parameter_count;
|
|
9914
9916
|
};
|
|
9915
9917
|
|
|
9916
9918
|
} // namespace duckdb
|
|
@@ -14157,11 +14159,11 @@ public:
|
|
|
14157
14159
|
//! The statement type
|
|
14158
14160
|
StatementType type;
|
|
14159
14161
|
//! The statement location within the query string
|
|
14160
|
-
idx_t stmt_location;
|
|
14162
|
+
idx_t stmt_location = 0;
|
|
14161
14163
|
//! The statement length within the query string
|
|
14162
|
-
idx_t stmt_length;
|
|
14164
|
+
idx_t stmt_length = 0;
|
|
14163
14165
|
//! The number of prepared statement parameters (if any)
|
|
14164
|
-
idx_t n_param;
|
|
14166
|
+
idx_t n_param = 0;
|
|
14165
14167
|
//! The query text that corresponds to this SQL statement
|
|
14166
14168
|
string query;
|
|
14167
14169
|
|