duckdb 0.3.2-dev1259.0 → 0.3.2-dev1288.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 +29 -15
- package/src/duckdb.hpp +7 -3
- package/src/parquet-amalgamation.cpp +36370 -36370
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -100463,13 +100463,15 @@ class SelectStatement;
|
|
|
100463
100463
|
|
|
100464
100464
|
class QueryRelation : public Relation {
|
|
100465
100465
|
public:
|
|
100466
|
-
QueryRelation(ClientContext &context,
|
|
100466
|
+
QueryRelation(ClientContext &context, unique_ptr<SelectStatement> select_stmt, string alias);
|
|
100467
|
+
~QueryRelation();
|
|
100467
100468
|
|
|
100468
|
-
|
|
100469
|
+
unique_ptr<SelectStatement> select_stmt;
|
|
100469
100470
|
string alias;
|
|
100470
100471
|
vector<ColumnDefinition> columns;
|
|
100471
100472
|
|
|
100472
100473
|
public:
|
|
100474
|
+
static unique_ptr<SelectStatement> ParseStatement(ClientContext &context, const string &query, const string &error);
|
|
100473
100475
|
unique_ptr<QueryNode> GetQueryNode() override;
|
|
100474
100476
|
unique_ptr<TableRef> GetTableRef() override;
|
|
100475
100477
|
|
|
@@ -100915,8 +100917,12 @@ unordered_set<string> Connection::GetTableNames(const string &query) {
|
|
|
100915
100917
|
return context->GetTableNames(query);
|
|
100916
100918
|
}
|
|
100917
100919
|
|
|
100918
|
-
shared_ptr<Relation> Connection::RelationFromQuery(const string &query, const string &
|
|
100919
|
-
return
|
|
100920
|
+
shared_ptr<Relation> Connection::RelationFromQuery(const string &query, string alias, const string &error) {
|
|
100921
|
+
return RelationFromQuery(QueryRelation::ParseStatement(*context, query, error), move(alias));
|
|
100922
|
+
}
|
|
100923
|
+
|
|
100924
|
+
shared_ptr<Relation> Connection::RelationFromQuery(unique_ptr<SelectStatement> select_stmt, string alias) {
|
|
100925
|
+
return make_shared<QueryRelation>(*context, move(select_stmt), move(alias));
|
|
100920
100926
|
}
|
|
100921
100927
|
|
|
100922
100928
|
void Connection::BeginTransaction() {
|
|
@@ -111513,23 +111519,31 @@ string ProjectionRelation::ToString(idx_t depth) {
|
|
|
111513
111519
|
|
|
111514
111520
|
namespace duckdb {
|
|
111515
111521
|
|
|
111516
|
-
QueryRelation::QueryRelation(ClientContext &context,
|
|
111517
|
-
: Relation(context, RelationType::QUERY_RELATION),
|
|
111522
|
+
QueryRelation::QueryRelation(ClientContext &context, unique_ptr<SelectStatement> select_stmt_p, string alias_p)
|
|
111523
|
+
: Relation(context, RelationType::QUERY_RELATION), select_stmt(move(select_stmt_p)), alias(move(alias_p)) {
|
|
111518
111524
|
context.TryBindRelation(*this, this->columns);
|
|
111519
111525
|
}
|
|
111520
111526
|
|
|
111521
|
-
|
|
111527
|
+
QueryRelation::~QueryRelation() {
|
|
111528
|
+
}
|
|
111529
|
+
|
|
111530
|
+
unique_ptr<SelectStatement> QueryRelation::ParseStatement(ClientContext &context, const string &query,
|
|
111531
|
+
const string &error) {
|
|
111522
111532
|
Parser parser(context.GetParserOptions());
|
|
111523
111533
|
parser.ParseQuery(query);
|
|
111524
111534
|
if (parser.statements.size() != 1) {
|
|
111525
|
-
throw ParserException(
|
|
111535
|
+
throw ParserException(error);
|
|
111526
111536
|
}
|
|
111527
111537
|
if (parser.statements[0]->type != StatementType::SELECT_STATEMENT) {
|
|
111528
|
-
throw ParserException(
|
|
111538
|
+
throw ParserException(error);
|
|
111529
111539
|
}
|
|
111530
111540
|
return unique_ptr_cast<SQLStatement, SelectStatement>(move(parser.statements[0]));
|
|
111531
111541
|
}
|
|
111532
111542
|
|
|
111543
|
+
unique_ptr<SelectStatement> QueryRelation::GetSelectStatement() {
|
|
111544
|
+
return unique_ptr_cast<SQLStatement, SelectStatement>(select_stmt->Copy());
|
|
111545
|
+
}
|
|
111546
|
+
|
|
111533
111547
|
unique_ptr<QueryNode> QueryRelation::GetQueryNode() {
|
|
111534
111548
|
auto select = GetSelectStatement();
|
|
111535
111549
|
return move(select->node);
|
|
@@ -111549,7 +111563,7 @@ const vector<ColumnDefinition> &QueryRelation::Columns() {
|
|
|
111549
111563
|
}
|
|
111550
111564
|
|
|
111551
111565
|
string QueryRelation::ToString(idx_t depth) {
|
|
111552
|
-
return RenderWhitespace(depth) + "Subquery
|
|
111566
|
+
return RenderWhitespace(depth) + "Subquery";
|
|
111553
111567
|
}
|
|
111554
111568
|
|
|
111555
111569
|
} // namespace duckdb
|
|
@@ -167135,8 +167149,8 @@ void UpdateSegment::CleanupUpdate(UpdateInfo *info) {
|
|
|
167135
167149
|
//===--------------------------------------------------------------------===//
|
|
167136
167150
|
// Check for conflicts in update
|
|
167137
167151
|
//===--------------------------------------------------------------------===//
|
|
167138
|
-
static void CheckForConflicts(UpdateInfo *info, Transaction &transaction, row_t *ids,
|
|
167139
|
-
UpdateInfo *&node) {
|
|
167152
|
+
static void CheckForConflicts(UpdateInfo *info, Transaction &transaction, row_t *ids, const SelectionVector &sel,
|
|
167153
|
+
idx_t count, row_t offset, UpdateInfo *&node) {
|
|
167140
167154
|
if (!info) {
|
|
167141
167155
|
return;
|
|
167142
167156
|
}
|
|
@@ -167148,7 +167162,7 @@ static void CheckForConflicts(UpdateInfo *info, Transaction &transaction, row_t
|
|
|
167148
167162
|
// as both ids and info->tuples are sorted, this is similar to a merge join
|
|
167149
167163
|
idx_t i = 0, j = 0;
|
|
167150
167164
|
while (true) {
|
|
167151
|
-
auto id = ids[i] - offset;
|
|
167165
|
+
auto id = ids[sel.get_index(i)] - offset;
|
|
167152
167166
|
if (id == info->tuples[j]) {
|
|
167153
167167
|
throw TransactionException("Conflict on update!");
|
|
167154
167168
|
} else if (id < info->tuples[j]) {
|
|
@@ -167166,7 +167180,7 @@ static void CheckForConflicts(UpdateInfo *info, Transaction &transaction, row_t
|
|
|
167166
167180
|
}
|
|
167167
167181
|
}
|
|
167168
167182
|
}
|
|
167169
|
-
CheckForConflicts(info->next, transaction, ids, count, offset, node);
|
|
167183
|
+
CheckForConflicts(info->next, transaction, ids, sel, count, offset, node);
|
|
167170
167184
|
}
|
|
167171
167185
|
|
|
167172
167186
|
//===--------------------------------------------------------------------===//
|
|
@@ -167699,7 +167713,7 @@ void UpdateSegment::Update(Transaction &transaction, idx_t column_index, Vector
|
|
|
167699
167713
|
// there is already a version here, check if there are any conflicts and search for the node that belongs to
|
|
167700
167714
|
// this transaction in the version chain
|
|
167701
167715
|
auto base_info = root->info[vector_index]->info.get();
|
|
167702
|
-
CheckForConflicts(base_info->next, transaction, ids, count, vector_offset, node);
|
|
167716
|
+
CheckForConflicts(base_info->next, transaction, ids, sel, count, vector_offset, node);
|
|
167703
167717
|
|
|
167704
167718
|
// there are no conflicts
|
|
167705
167719
|
// first, check if this thread has already done any updates
|
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.2-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "0d3fee81b"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.2-dev1288"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -10905,6 +10905,7 @@ class ClientContext;
|
|
|
10905
10905
|
class DatabaseInstance;
|
|
10906
10906
|
class DuckDB;
|
|
10907
10907
|
class LogicalOperator;
|
|
10908
|
+
class SelectStatement;
|
|
10908
10909
|
|
|
10909
10910
|
typedef void (*warning_callback)(std::string);
|
|
10910
10911
|
|
|
@@ -11004,7 +11005,10 @@ public:
|
|
|
11004
11005
|
DUCKDB_API shared_ptr<Relation> ReadCSV(const string &csv_file);
|
|
11005
11006
|
DUCKDB_API shared_ptr<Relation> ReadCSV(const string &csv_file, const vector<string> &columns);
|
|
11006
11007
|
//! Returns a relation from a query
|
|
11007
|
-
DUCKDB_API shared_ptr<Relation> RelationFromQuery(const string &query,
|
|
11008
|
+
DUCKDB_API shared_ptr<Relation> RelationFromQuery(const string &query, string alias = "queryrelation",
|
|
11009
|
+
const string &error = "Expected a single SELECT statement");
|
|
11010
|
+
DUCKDB_API shared_ptr<Relation> RelationFromQuery(unique_ptr<SelectStatement> select_stmt,
|
|
11011
|
+
string alias = "queryrelation");
|
|
11008
11012
|
|
|
11009
11013
|
DUCKDB_API void BeginTransaction();
|
|
11010
11014
|
DUCKDB_API void Commit();
|