duckdb 0.4.1-dev2371.0 → 0.4.1-dev2385.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 +101 -58
- package/src/duckdb.hpp +11 -2
- package/src/parquet-amalgamation.cpp +37442 -37442
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -9279,6 +9279,12 @@ string StatementReturnTypeToString(StatementReturnType type) {
|
|
|
9279
9279
|
|
|
9280
9280
|
|
|
9281
9281
|
|
|
9282
|
+
#ifdef DUCKDB_CRASH_ON_ASSERT
|
|
9283
|
+
|
|
9284
|
+
#include <stdio.h>
|
|
9285
|
+
#include <stdlib.h>
|
|
9286
|
+
#endif
|
|
9287
|
+
|
|
9282
9288
|
namespace duckdb {
|
|
9283
9289
|
|
|
9284
9290
|
Exception::Exception(const string &msg) : std::exception(), type(ExceptionType::INVALID), raw_message_(msg) {
|
|
@@ -9561,6 +9567,10 @@ FatalException::FatalException(ExceptionType type, const string &msg) : Exceptio
|
|
|
9561
9567
|
}
|
|
9562
9568
|
|
|
9563
9569
|
InternalException::InternalException(const string &msg) : FatalException(ExceptionType::INTERNAL, msg) {
|
|
9570
|
+
#ifdef DUCKDB_CRASH_ON_ASSERT
|
|
9571
|
+
Printer::Print("ABORT THROWN BY INTERNAL EXCEPTION: " + msg);
|
|
9572
|
+
abort();
|
|
9573
|
+
#endif
|
|
9564
9574
|
}
|
|
9565
9575
|
|
|
9566
9576
|
InvalidInputException::InvalidInputException(const string &msg) : Exception(ExceptionType::INVALID_INPUT, msg) {
|
|
@@ -27686,9 +27696,8 @@ void PreservedError::Throw(const string &prepended_message) const {
|
|
|
27686
27696
|
if (!prepended_message.empty()) {
|
|
27687
27697
|
string new_message = prepended_message + raw_message;
|
|
27688
27698
|
Exception::ThrowAsTypeWithMessage(type, new_message);
|
|
27689
|
-
} else {
|
|
27690
|
-
Exception::ThrowAsTypeWithMessage(type, raw_message);
|
|
27691
27699
|
}
|
|
27700
|
+
Exception::ThrowAsTypeWithMessage(type, raw_message);
|
|
27692
27701
|
}
|
|
27693
27702
|
|
|
27694
27703
|
const ExceptionType &PreservedError::Type() const {
|
|
@@ -41401,6 +41410,14 @@ struct ColumnDataMetaData {
|
|
|
41401
41410
|
}
|
|
41402
41411
|
};
|
|
41403
41412
|
|
|
41413
|
+
//! Explicitly initialized without types
|
|
41414
|
+
ColumnDataCollection::ColumnDataCollection(Allocator &allocator_p) {
|
|
41415
|
+
types.clear();
|
|
41416
|
+
count = 0;
|
|
41417
|
+
this->finished_append = false;
|
|
41418
|
+
allocator = make_shared<ColumnDataAllocator>(allocator_p);
|
|
41419
|
+
}
|
|
41420
|
+
|
|
41404
41421
|
ColumnDataCollection::ColumnDataCollection(Allocator &allocator_p, vector<LogicalType> types_p) {
|
|
41405
41422
|
Initialize(move(types_p));
|
|
41406
41423
|
allocator = make_shared<ColumnDataAllocator>(allocator_p);
|
|
@@ -42506,6 +42523,15 @@ void DataChunk::SetValue(idx_t col_idx, idx_t index, const Value &val) {
|
|
|
42506
42523
|
data[col_idx].SetValue(index, val);
|
|
42507
42524
|
}
|
|
42508
42525
|
|
|
42526
|
+
bool DataChunk::AllConstant() const {
|
|
42527
|
+
for (auto &v : data) {
|
|
42528
|
+
if (v.GetVectorType() != VectorType::CONSTANT_VECTOR) {
|
|
42529
|
+
return false;
|
|
42530
|
+
}
|
|
42531
|
+
}
|
|
42532
|
+
return true;
|
|
42533
|
+
}
|
|
42534
|
+
|
|
42509
42535
|
void DataChunk::Reference(DataChunk &chunk) {
|
|
42510
42536
|
D_ASSERT(chunk.ColumnCount() <= ColumnCount());
|
|
42511
42537
|
SetCardinality(chunk);
|
|
@@ -55053,7 +55079,7 @@ static bool ListCastSwitch(Vector &source, Vector &result, idx_t count, string *
|
|
|
55053
55079
|
case LogicalTypeId::LIST: {
|
|
55054
55080
|
// only handle constant and flat vectors here for now
|
|
55055
55081
|
if (source.GetVectorType() == VectorType::CONSTANT_VECTOR) {
|
|
55056
|
-
result.SetVectorType(
|
|
55082
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
55057
55083
|
ConstantVector::SetNull(result, ConstantVector::IsNull(source));
|
|
55058
55084
|
|
|
55059
55085
|
auto ldata = ConstantVector::GetData<list_entry_t>(source);
|
|
@@ -58731,6 +58757,8 @@ bool ExpressionExecutor::TryEvaluateScalar(const Expression &expr, Value &result
|
|
|
58731
58757
|
try {
|
|
58732
58758
|
result = EvaluateScalar(expr);
|
|
58733
58759
|
return true;
|
|
58760
|
+
} catch (InternalException &ex) {
|
|
58761
|
+
throw ex;
|
|
58734
58762
|
} catch (...) {
|
|
58735
58763
|
return false;
|
|
58736
58764
|
}
|
|
@@ -84141,6 +84169,13 @@ protected:
|
|
|
84141
84169
|
void ResolveTypes() override {
|
|
84142
84170
|
types.emplace_back(LogicalType::BOOLEAN);
|
|
84143
84171
|
}
|
|
84172
|
+
|
|
84173
|
+
bool RequireOptimizer() const override {
|
|
84174
|
+
if (!prepared->properties.bound_all_parameters) {
|
|
84175
|
+
return false;
|
|
84176
|
+
}
|
|
84177
|
+
return children[0]->RequireOptimizer();
|
|
84178
|
+
}
|
|
84144
84179
|
};
|
|
84145
84180
|
} // namespace duckdb
|
|
84146
84181
|
|
|
@@ -93174,8 +93209,8 @@ unique_ptr<FunctionData> HistogramBindFunction(ClientContext &context, Aggregate
|
|
|
93174
93209
|
|
|
93175
93210
|
D_ASSERT(arguments.size() == 1);
|
|
93176
93211
|
child_list_t<LogicalType> struct_children;
|
|
93177
|
-
struct_children.push_back({"
|
|
93178
|
-
struct_children.push_back({"
|
|
93212
|
+
struct_children.push_back({"key", LogicalType::LIST(arguments[0]->return_type)});
|
|
93213
|
+
struct_children.push_back({"value", LogicalType::LIST(LogicalType::UBIGINT)});
|
|
93179
93214
|
auto struct_type = LogicalType::MAP(move(struct_children));
|
|
93180
93215
|
|
|
93181
93216
|
function.return_type = struct_type;
|
|
@@ -102462,10 +102497,13 @@ static void ArraySliceFunction(DataChunk &args, ExpressionState &state, Vector &
|
|
|
102462
102497
|
Vector &b = args.data[1];
|
|
102463
102498
|
Vector &e = args.data[2];
|
|
102464
102499
|
|
|
102465
|
-
|
|
102500
|
+
result.SetVectorType(args.AllConstant() ? VectorType::CONSTANT_VECTOR : VectorType::FLAT_VECTOR);
|
|
102466
102501
|
switch (result.GetType().id()) {
|
|
102467
102502
|
case LogicalTypeId::LIST:
|
|
102468
102503
|
// Share the value dictionary as we are just going to slice it
|
|
102504
|
+
if (s.GetVectorType() != VectorType::FLAT_VECTOR && s.GetVectorType() != VectorType::CONSTANT_VECTOR) {
|
|
102505
|
+
s.Flatten(count);
|
|
102506
|
+
}
|
|
102469
102507
|
ListVector::ReferenceEntry(result, s);
|
|
102470
102508
|
ExecuteSlice<list_entry_t, int64_t>(result, s, b, e, count);
|
|
102471
102509
|
break;
|
|
@@ -102475,14 +102513,6 @@ static void ArraySliceFunction(DataChunk &args, ExpressionState &state, Vector &
|
|
|
102475
102513
|
default:
|
|
102476
102514
|
throw NotImplementedException("Specifier type not implemented");
|
|
102477
102515
|
}
|
|
102478
|
-
|
|
102479
|
-
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
102480
|
-
for (idx_t i = 0; i < args.ColumnCount(); i++) {
|
|
102481
|
-
if (args.data[i].GetVectorType() != VectorType::CONSTANT_VECTOR) {
|
|
102482
|
-
result.SetVectorType(VectorType::FLAT_VECTOR);
|
|
102483
|
-
break;
|
|
102484
|
-
}
|
|
102485
|
-
}
|
|
102486
102516
|
}
|
|
102487
102517
|
|
|
102488
102518
|
static unique_ptr<FunctionData> ArraySliceBind(ClientContext &context, ScalarFunction &bound_function,
|
|
@@ -102617,6 +102647,10 @@ static void TemplatedContainsOrPosition(DataChunk &args, ExpressionState &state,
|
|
|
102617
102647
|
}
|
|
102618
102648
|
}
|
|
102619
102649
|
}
|
|
102650
|
+
|
|
102651
|
+
if (args.AllConstant()) {
|
|
102652
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
102653
|
+
}
|
|
102620
102654
|
}
|
|
102621
102655
|
|
|
102622
102656
|
template <class T, class OP>
|
|
@@ -102816,6 +102850,9 @@ void ListFlattenFunction(DataChunk &args, ExpressionState &state, Vector &result
|
|
|
102816
102850
|
result_entries[i].offset = 0;
|
|
102817
102851
|
result_entries[i].length = 0;
|
|
102818
102852
|
}
|
|
102853
|
+
if (args.AllConstant()) {
|
|
102854
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
102855
|
+
}
|
|
102819
102856
|
return;
|
|
102820
102857
|
}
|
|
102821
102858
|
|
|
@@ -102861,7 +102898,7 @@ void ListFlattenFunction(DataChunk &args, ExpressionState &state, Vector &result
|
|
|
102861
102898
|
offset += length;
|
|
102862
102899
|
}
|
|
102863
102900
|
|
|
102864
|
-
if (
|
|
102901
|
+
if (args.AllConstant()) {
|
|
102865
102902
|
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
102866
102903
|
}
|
|
102867
102904
|
}
|
|
@@ -103215,6 +103252,10 @@ static void ListAggregatesFunction(DataChunk &args, ExpressionState &state, Vect
|
|
|
103215
103252
|
throw InternalException("Unimplemented histogram aggregate");
|
|
103216
103253
|
}
|
|
103217
103254
|
}
|
|
103255
|
+
|
|
103256
|
+
if (args.AllConstant()) {
|
|
103257
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
103258
|
+
}
|
|
103218
103259
|
}
|
|
103219
103260
|
|
|
103220
103261
|
static void ListAggregateFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
@@ -104061,6 +104102,10 @@ static void ListLambdaFunction(DataChunk &args, ExpressionState &state, Vector &
|
|
|
104061
104102
|
AppendFilteredToResult(lambda_vector, result_entries, elem_cnt, result, curr_list_len, curr_list_offset,
|
|
104062
104103
|
appended_lists_cnt, lists_len, curr_original_list_len, input_chunk);
|
|
104063
104104
|
}
|
|
104105
|
+
|
|
104106
|
+
if (args.AllConstant()) {
|
|
104107
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
104108
|
+
}
|
|
104064
104109
|
}
|
|
104065
104110
|
|
|
104066
104111
|
static void ListTransformFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
@@ -104264,7 +104309,12 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
|
|
|
104264
104309
|
result.SetVectorType(VectorType::FLAT_VECTOR);
|
|
104265
104310
|
auto &result_validity = FlatVector::Validity(result);
|
|
104266
104311
|
|
|
104267
|
-
args.
|
|
104312
|
+
for (auto &v : args.data) {
|
|
104313
|
+
if (v.GetVectorType() != VectorType::FLAT_VECTOR && v.GetVectorType() != VectorType::CONSTANT_VECTOR) {
|
|
104314
|
+
v.Flatten(count);
|
|
104315
|
+
}
|
|
104316
|
+
}
|
|
104317
|
+
|
|
104268
104318
|
if (lists.GetType().id() == LogicalTypeId::SQLNULL) {
|
|
104269
104319
|
result_validity.SetInvalid(0);
|
|
104270
104320
|
return;
|
|
@@ -104386,6 +104436,10 @@ static void ListSortFunction(DataChunk &args, ExpressionState &state, Vector &re
|
|
|
104386
104436
|
}
|
|
104387
104437
|
|
|
104388
104438
|
result.Reference(lists);
|
|
104439
|
+
|
|
104440
|
+
if (args.AllConstant()) {
|
|
104441
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
104442
|
+
}
|
|
104389
104443
|
}
|
|
104390
104444
|
|
|
104391
104445
|
static unique_ptr<FunctionData> ListSortBind(ClientContext &context, ScalarFunction &bound_function,
|
|
@@ -105318,6 +105372,10 @@ static void MapFromEntriesFunction(DataChunk &args, ExpressionState &state, Vect
|
|
|
105318
105372
|
}
|
|
105319
105373
|
MapConversionVerify(result, count);
|
|
105320
105374
|
result.Verify(count);
|
|
105375
|
+
|
|
105376
|
+
if (args.AllConstant()) {
|
|
105377
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
105378
|
+
}
|
|
105321
105379
|
}
|
|
105322
105380
|
|
|
105323
105381
|
static unique_ptr<FunctionData> MapFromEntriesBind(ClientContext &context, ScalarFunction &bound_function,
|
|
@@ -113280,8 +113338,7 @@ static void StringSplitExecutor(DataChunk &args, ExpressionState &state, Vector
|
|
|
113280
113338
|
}
|
|
113281
113339
|
|
|
113282
113340
|
D_ASSERT(ListVector::GetListSize(result) == total_len);
|
|
113283
|
-
if (args.
|
|
113284
|
-
args.data[1].GetVectorType() == VectorType::CONSTANT_VECTOR) {
|
|
113341
|
+
if (args.AllConstant()) {
|
|
113285
113342
|
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
113286
113343
|
}
|
|
113287
113344
|
}
|
|
@@ -113978,7 +114035,6 @@ static void StructInsertFunction(DataChunk &args, ExpressionState &state, Vector
|
|
|
113978
114035
|
starting_vec.Verify(args.size());
|
|
113979
114036
|
|
|
113980
114037
|
auto &starting_child_entries = StructVector::GetEntries(starting_vec);
|
|
113981
|
-
|
|
113982
114038
|
auto &result_child_entries = StructVector::GetEntries(result);
|
|
113983
114039
|
|
|
113984
114040
|
// Assign the starting vector entries to the result vector
|
|
@@ -113993,6 +114049,10 @@ static void StructInsertFunction(DataChunk &args, ExpressionState &state, Vector
|
|
|
113993
114049
|
}
|
|
113994
114050
|
|
|
113995
114051
|
result.Verify(args.size());
|
|
114052
|
+
|
|
114053
|
+
if (args.AllConstant()) {
|
|
114054
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
114055
|
+
}
|
|
113996
114056
|
}
|
|
113997
114057
|
|
|
113998
114058
|
static unique_ptr<FunctionData> StructInsertBind(ClientContext &context, ScalarFunction &bound_function,
|
|
@@ -114809,10 +114869,8 @@ typedef unique_ptr<ArrowArrayStreamWrapper> (*stream_factory_produce_t)(uintptr_
|
|
|
114809
114869
|
typedef void (*stream_factory_get_schema_t)(uintptr_t stream_factory_ptr, ArrowSchemaWrapper &schema);
|
|
114810
114870
|
|
|
114811
114871
|
struct ArrowScanFunctionData : public PyTableFunctionData {
|
|
114812
|
-
ArrowScanFunctionData(
|
|
114813
|
-
|
|
114814
|
-
: lines_read(0), rows_per_thread(rows_per_thread_p), stream_factory_ptr(stream_factory_ptr_p),
|
|
114815
|
-
scanner_producer(scanner_producer_p), number_of_rows(0) {
|
|
114872
|
+
ArrowScanFunctionData(stream_factory_produce_t scanner_producer_p, uintptr_t stream_factory_ptr_p)
|
|
114873
|
+
: lines_read(0), stream_factory_ptr(stream_factory_ptr_p), scanner_producer(scanner_producer_p) {
|
|
114816
114874
|
}
|
|
114817
114875
|
//! This holds the original list type (col_idx, [ArrowListType,size])
|
|
114818
114876
|
unordered_map<idx_t, unique_ptr<ArrowConvertData>> arrow_convert_data;
|
|
@@ -114823,8 +114881,6 @@ struct ArrowScanFunctionData : public PyTableFunctionData {
|
|
|
114823
114881
|
uintptr_t stream_factory_ptr;
|
|
114824
114882
|
//! Pointer to the scanner factory produce
|
|
114825
114883
|
stream_factory_produce_t scanner_producer;
|
|
114826
|
-
//! Number of rows (Used in cardinality and progress bar)
|
|
114827
|
-
int64_t number_of_rows;
|
|
114828
114884
|
};
|
|
114829
114885
|
|
|
114830
114886
|
struct ArrowScanLocalState : public LocalTableFunctionState {
|
|
@@ -115080,9 +115136,8 @@ unique_ptr<FunctionData> ArrowTableFunction::ArrowScanBind(ClientContext &contex
|
|
|
115080
115136
|
auto stream_factory_ptr = input.inputs[0].GetPointer();
|
|
115081
115137
|
auto stream_factory_produce = (stream_factory_produce_t)input.inputs[1].GetPointer();
|
|
115082
115138
|
auto stream_factory_get_schema = (stream_factory_get_schema_t)input.inputs[2].GetPointer();
|
|
115083
|
-
auto rows_per_thread = input.inputs[3].GetValue<uint64_t>();
|
|
115084
115139
|
|
|
115085
|
-
auto res = make_unique<ArrowScanFunctionData>(
|
|
115140
|
+
auto res = make_unique<ArrowScanFunctionData>(stream_factory_produce, stream_factory_ptr);
|
|
115086
115141
|
|
|
115087
115142
|
auto &data = *res;
|
|
115088
115143
|
stream_factory_get_schema(stream_factory_ptr, data.schema_root);
|
|
@@ -115127,11 +115182,7 @@ unique_ptr<ArrowArrayStreamWrapper> ProduceArrowScan(const ArrowScanFunctionData
|
|
|
115127
115182
|
}
|
|
115128
115183
|
|
|
115129
115184
|
idx_t ArrowTableFunction::ArrowScanMaxThreads(ClientContext &context, const FunctionData *bind_data_p) {
|
|
115130
|
-
|
|
115131
|
-
if (bind_data.number_of_rows <= 0 || ClientConfig::GetConfig(context).verify_parallelism) {
|
|
115132
|
-
return context.db->NumberOfThreads();
|
|
115133
|
-
}
|
|
115134
|
-
return ((bind_data.number_of_rows + bind_data.rows_per_thread - 1) / bind_data.rows_per_thread) + 1;
|
|
115185
|
+
return context.db->NumberOfThreads();
|
|
115135
115186
|
}
|
|
115136
115187
|
|
|
115137
115188
|
bool ArrowScanParallelStateNext(ClientContext &context, const FunctionData *bind_data_p, ArrowScanLocalState &state,
|
|
@@ -115197,28 +115248,15 @@ void ArrowTableFunction::ArrowScanFunction(ClientContext &context, TableFunction
|
|
|
115197
115248
|
}
|
|
115198
115249
|
|
|
115199
115250
|
unique_ptr<NodeStatistics> ArrowTableFunction::ArrowScanCardinality(ClientContext &context, const FunctionData *data) {
|
|
115200
|
-
|
|
115201
|
-
return make_unique<NodeStatistics>(bind_data.number_of_rows, bind_data.number_of_rows);
|
|
115202
|
-
}
|
|
115203
|
-
|
|
115204
|
-
double ArrowTableFunction::ArrowProgress(ClientContext &context, const FunctionData *bind_data_p,
|
|
115205
|
-
const GlobalTableFunctionState *global_state) {
|
|
115206
|
-
auto &bind_data = (const ArrowScanFunctionData &)*bind_data_p;
|
|
115207
|
-
if (bind_data.number_of_rows == 0) {
|
|
115208
|
-
return 100;
|
|
115209
|
-
}
|
|
115210
|
-
auto percentage = bind_data.lines_read * 100.0 / bind_data.number_of_rows;
|
|
115211
|
-
return percentage;
|
|
115251
|
+
return make_unique<NodeStatistics>();
|
|
115212
115252
|
}
|
|
115213
115253
|
|
|
115214
115254
|
void ArrowTableFunction::RegisterFunction(BuiltinFunctions &set) {
|
|
115215
|
-
TableFunction arrow("arrow_scan",
|
|
115216
|
-
{LogicalType::POINTER, LogicalType::POINTER, LogicalType::POINTER, LogicalType::UBIGINT},
|
|
115255
|
+
TableFunction arrow("arrow_scan", {LogicalType::POINTER, LogicalType::POINTER, LogicalType::POINTER},
|
|
115217
115256
|
ArrowScanFunction, ArrowScanBind, ArrowScanInitGlobal, ArrowScanInitLocal);
|
|
115218
115257
|
arrow.cardinality = ArrowScanCardinality;
|
|
115219
115258
|
arrow.projection_pushdown = true;
|
|
115220
115259
|
arrow.filter_pushdown = true;
|
|
115221
|
-
arrow.table_scan_progress = ArrowProgress;
|
|
115222
115260
|
set.AddFunction(arrow);
|
|
115223
115261
|
}
|
|
115224
115262
|
|
|
@@ -126087,7 +126125,7 @@ shared_ptr<PreparedStatementData> ClientContext::CreatePreparedStatement(ClientC
|
|
|
126087
126125
|
#ifdef DEBUG
|
|
126088
126126
|
plan->Verify(*this);
|
|
126089
126127
|
#endif
|
|
126090
|
-
if (config.enable_optimizer) {
|
|
126128
|
+
if (config.enable_optimizer && plan->RequireOptimizer()) {
|
|
126091
126129
|
profiler.StartPhase("optimizer");
|
|
126092
126130
|
Optimizer optimizer(*planner.binder, *this);
|
|
126093
126131
|
plan = optimizer.Optimize(move(plan));
|
|
@@ -126510,9 +126548,8 @@ unique_ptr<QueryResult> ClientContext::Query(const string &query, bool allow_str
|
|
|
126510
126548
|
if (statements.empty()) {
|
|
126511
126549
|
// no statements, return empty successful result
|
|
126512
126550
|
StatementProperties properties;
|
|
126513
|
-
vector<LogicalType> types;
|
|
126514
126551
|
vector<string> names;
|
|
126515
|
-
auto collection = make_unique<ColumnDataCollection>(Allocator::DefaultAllocator()
|
|
126552
|
+
auto collection = make_unique<ColumnDataCollection>(Allocator::DefaultAllocator());
|
|
126516
126553
|
return make_unique<MaterializedQueryResult>(StatementType::INVALID_STATEMENT, properties, move(names),
|
|
126517
126554
|
move(collection), GetClientProperties());
|
|
126518
126555
|
}
|
|
@@ -137483,8 +137520,11 @@ PendingQueryResult::~PendingQueryResult() {
|
|
|
137483
137520
|
|
|
137484
137521
|
unique_ptr<ClientContextLock> PendingQueryResult::LockContext() {
|
|
137485
137522
|
if (!context) {
|
|
137486
|
-
|
|
137487
|
-
|
|
137523
|
+
if (HasError()) {
|
|
137524
|
+
throw InvalidInputException(
|
|
137525
|
+
"Attempting to execute an unsuccessful or closed pending query result\nError: %s", GetError());
|
|
137526
|
+
}
|
|
137527
|
+
throw InvalidInputException("Attempting to execute an unsuccessful or closed pending query result");
|
|
137488
137528
|
}
|
|
137489
137529
|
return context->LockContext();
|
|
137490
137530
|
}
|
|
@@ -137495,8 +137535,11 @@ void PendingQueryResult::CheckExecutableInternal(ClientContextLock &lock) {
|
|
|
137495
137535
|
invalidated = !context->IsActiveResult(lock, this);
|
|
137496
137536
|
}
|
|
137497
137537
|
if (invalidated) {
|
|
137498
|
-
|
|
137499
|
-
|
|
137538
|
+
if (HasError()) {
|
|
137539
|
+
throw InvalidInputException(
|
|
137540
|
+
"Attempting to execute an unsuccessful or closed pending query result\nError: %s", GetError());
|
|
137541
|
+
}
|
|
137542
|
+
throw InvalidInputException("Attempting to execute an unsuccessful or closed pending query result");
|
|
137500
137543
|
}
|
|
137501
137544
|
}
|
|
137502
137545
|
|
|
@@ -166733,12 +166776,12 @@ vector<OrderByNode> Parser::ParseOrderList(const string &select_list, ParserOpti
|
|
|
166733
166776
|
}
|
|
166734
166777
|
auto &select = (SelectStatement &)*parser.statements[0];
|
|
166735
166778
|
if (select.node->type != QueryNodeType::SELECT_NODE) {
|
|
166736
|
-
throw
|
|
166779
|
+
throw ParserException("Expected a single SELECT node");
|
|
166737
166780
|
}
|
|
166738
166781
|
auto &select_node = (SelectNode &)*select.node;
|
|
166739
166782
|
if (select_node.modifiers.empty() || select_node.modifiers[0]->type != ResultModifierType::ORDER_MODIFIER ||
|
|
166740
166783
|
select_node.modifiers.size() != 1) {
|
|
166741
|
-
throw
|
|
166784
|
+
throw ParserException("Expected a single ORDER clause");
|
|
166742
166785
|
}
|
|
166743
166786
|
auto &order = (OrderModifier &)*select_node.modifiers[0];
|
|
166744
166787
|
return move(order.orders);
|
|
@@ -166776,7 +166819,7 @@ vector<vector<unique_ptr<ParsedExpression>>> Parser::ParseValuesList(const strin
|
|
|
166776
166819
|
}
|
|
166777
166820
|
auto &select_node = (SelectNode &)*select.node;
|
|
166778
166821
|
if (!select_node.from_table || select_node.from_table->type != TableReferenceType::EXPRESSION_LIST) {
|
|
166779
|
-
throw
|
|
166822
|
+
throw ParserException("Expected a single VALUES statement");
|
|
166780
166823
|
}
|
|
166781
166824
|
auto &values_list = (ExpressionListRef &)*select_node.from_table;
|
|
166782
166825
|
return move(values_list.values);
|
|
@@ -208021,7 +208064,7 @@ bool PreparedStatementVerifier::Run(
|
|
|
208021
208064
|
}
|
|
208022
208065
|
auto execute_result = run(string(), move(execute_statement));
|
|
208023
208066
|
if (execute_result->HasError()) {
|
|
208024
|
-
|
|
208067
|
+
execute_result->ThrowError("Failed execute during verify: ");
|
|
208025
208068
|
}
|
|
208026
208069
|
materialized_result = unique_ptr_cast<QueryResult, MaterializedQueryResult>(move(execute_result));
|
|
208027
208070
|
} catch (const Exception &ex) {
|
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 "94920472d"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev2385"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -4608,6 +4608,9 @@ public:
|
|
|
4608
4608
|
DUCKDB_API Value GetValue(idx_t col_idx, idx_t index) const;
|
|
4609
4609
|
DUCKDB_API void SetValue(idx_t col_idx, idx_t index, const Value &val);
|
|
4610
4610
|
|
|
4611
|
+
//! Returns true if all vectors in the DataChunk are constant
|
|
4612
|
+
DUCKDB_API bool AllConstant() const;
|
|
4613
|
+
|
|
4611
4614
|
//! Set the DataChunk to reference another data chunk
|
|
4612
4615
|
DUCKDB_API void Reference(DataChunk &chunk);
|
|
4613
4616
|
//! Set the DataChunk to own the data of data chunk, destroying the other chunk in the process
|
|
@@ -9971,6 +9974,10 @@ public:
|
|
|
9971
9974
|
|
|
9972
9975
|
static unique_ptr<LogicalOperator> Deserialize(Deserializer &deserializer, PlanDeserializationState &state);
|
|
9973
9976
|
|
|
9977
|
+
virtual bool RequireOptimizer() const {
|
|
9978
|
+
return true;
|
|
9979
|
+
}
|
|
9980
|
+
|
|
9974
9981
|
protected:
|
|
9975
9982
|
//! Resolve types for this specific operator
|
|
9976
9983
|
virtual void ResolveTypes() = 0;
|
|
@@ -11271,6 +11278,8 @@ class ColumnDataCollection {
|
|
|
11271
11278
|
public:
|
|
11272
11279
|
//! Constructs an in-memory column data collection from an allocator
|
|
11273
11280
|
DUCKDB_API ColumnDataCollection(Allocator &allocator, vector<LogicalType> types);
|
|
11281
|
+
//! Constructs an empty (but valid) in-memory column data collection from an allocator
|
|
11282
|
+
DUCKDB_API ColumnDataCollection(Allocator &allocator);
|
|
11274
11283
|
//! Constructs a buffer-managed column data collection
|
|
11275
11284
|
DUCKDB_API ColumnDataCollection(BufferManager &buffer_manager, vector<LogicalType> types);
|
|
11276
11285
|
//! Constructs either an in-memory or a buffer-managed column data collection
|