duckdb 0.6.1 → 0.6.2-dev13.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 +52 -12
- package/src/duckdb.hpp +10 -2
- package/src/parquet-amalgamation.cpp +28838 -28838
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -652,6 +652,7 @@ static constexpr ExtensionFunction EXTENSION_FUNCTIONS[] = {
|
|
|
652
652
|
{"from_substrait", "substrait"},
|
|
653
653
|
{"get_substrait", "substrait"},
|
|
654
654
|
{"get_substrait_json", "substrait"},
|
|
655
|
+
{"from_substrait_json", "substrait"},
|
|
655
656
|
{"icu_calendar_names", "icu"},
|
|
656
657
|
{"icu_sort_key", "icu"},
|
|
657
658
|
{"json", "json"},
|
|
@@ -53922,7 +53923,7 @@ string LogicalType::ToString() const {
|
|
|
53922
53923
|
string ret = "UNION(";
|
|
53923
53924
|
size_t count = UnionType::GetMemberCount(*this);
|
|
53924
53925
|
for (size_t i = 0; i < count; i++) {
|
|
53925
|
-
ret += UnionType::GetMemberType(*this, i).ToString();
|
|
53926
|
+
ret += UnionType::GetMemberName(*this, i) + " " + UnionType::GetMemberType(*this, i).ToString();
|
|
53926
53927
|
if (i < count - 1) {
|
|
53927
53928
|
ret += ", ";
|
|
53928
53929
|
}
|
|
@@ -103037,18 +103038,9 @@ unique_ptr<BoundCastData> BindUnionToUnionCast(BindCastInput &input, const Logic
|
|
|
103037
103038
|
for (idx_t target_idx = 0; target_idx < UnionType::GetMemberCount(target); target_idx++) {
|
|
103038
103039
|
auto &target_member_name = UnionType::GetMemberName(target, target_idx);
|
|
103039
103040
|
|
|
103040
|
-
// found a matching member
|
|
103041
|
+
// found a matching member
|
|
103041
103042
|
if (source_member_name == target_member_name) {
|
|
103042
103043
|
auto &target_member_type = UnionType::GetMemberType(target, target_idx);
|
|
103043
|
-
|
|
103044
|
-
if (input.function_set.ImplicitCastCost(source_member_type, target_member_type) < 0) {
|
|
103045
|
-
auto message = StringUtil::Format(
|
|
103046
|
-
"Type %s can't be cast as %s. The member '%s' can't be implicitly cast from %s to %s",
|
|
103047
|
-
source.ToString(), target.ToString(), source_member_name, source_member_type.ToString(),
|
|
103048
|
-
target_member_type.ToString());
|
|
103049
|
-
throw CastException(message);
|
|
103050
|
-
}
|
|
103051
|
-
|
|
103052
103044
|
tag_map[source_idx] = target_idx;
|
|
103053
103045
|
member_casts.push_back(input.GetCastFunction(source_member_type, target_member_type));
|
|
103054
103046
|
found = true;
|
|
@@ -103122,6 +103114,14 @@ static bool UnionToUnionCast(Vector &source, Vector &result, idx_t count, CastPa
|
|
|
103122
103114
|
}
|
|
103123
103115
|
} else {
|
|
103124
103116
|
// Otherwise, use the unified vector format to access the source vector.
|
|
103117
|
+
|
|
103118
|
+
// Ensure that all the result members are flat vectors
|
|
103119
|
+
// This is not always the case, e.g. when a member is cast using the default TryNullCast function
|
|
103120
|
+
// the resulting member vector will be a constant null vector.
|
|
103121
|
+
for (idx_t target_member_idx = 0; target_member_idx < target_member_count; target_member_idx++) {
|
|
103122
|
+
UnionVector::GetMember(result, target_member_idx).Flatten(count);
|
|
103123
|
+
}
|
|
103124
|
+
|
|
103125
103125
|
// We assume that a union tag vector validity matches the union vector validity.
|
|
103126
103126
|
UnifiedVectorFormat source_tag_format;
|
|
103127
103127
|
source_tag_vector.ToUnifiedFormat(count, source_tag_format);
|
|
@@ -103134,6 +103134,9 @@ static bool UnionToUnionCast(Vector &source, Vector &result, idx_t count, CastPa
|
|
|
103134
103134
|
auto target_tag = cast_data.tag_map[source_tag];
|
|
103135
103135
|
FlatVector::GetData<union_tag_t>(result_tag_vector)[row_idx] = target_tag;
|
|
103136
103136
|
} else {
|
|
103137
|
+
|
|
103138
|
+
// Issue: The members of the result is not always flatvectors
|
|
103139
|
+
// In the case of TryNullCast, the result member is constant.
|
|
103137
103140
|
FlatVector::SetNull(result, row_idx, true);
|
|
103138
103141
|
}
|
|
103139
103142
|
}
|
|
@@ -138188,6 +138191,34 @@ unique_ptr<MaterializedQueryResult> Connection::Query(const string &query) {
|
|
|
138188
138191
|
return unique_ptr_cast<QueryResult, MaterializedQueryResult>(move(result));
|
|
138189
138192
|
}
|
|
138190
138193
|
|
|
138194
|
+
DUCKDB_API string Connection::GetSubstrait(const string &query) {
|
|
138195
|
+
vector<Value> params;
|
|
138196
|
+
params.emplace_back(query);
|
|
138197
|
+
auto result = TableFunction("get_substrait", params)->Execute();
|
|
138198
|
+
auto protobuf = result->FetchRaw()->GetValue(0, 0);
|
|
138199
|
+
return protobuf.GetValueUnsafe<string_t>().GetString();
|
|
138200
|
+
}
|
|
138201
|
+
|
|
138202
|
+
DUCKDB_API unique_ptr<QueryResult> Connection::FromSubstrait(const string &proto) {
|
|
138203
|
+
vector<Value> params;
|
|
138204
|
+
params.emplace_back(Value::BLOB_RAW(proto));
|
|
138205
|
+
return TableFunction("from_substrait", params)->Execute();
|
|
138206
|
+
}
|
|
138207
|
+
|
|
138208
|
+
DUCKDB_API string Connection::GetSubstraitJSON(const string &query) {
|
|
138209
|
+
vector<Value> params;
|
|
138210
|
+
params.emplace_back(query);
|
|
138211
|
+
auto result = TableFunction("get_substrait_json", params)->Execute();
|
|
138212
|
+
auto protobuf = result->FetchRaw()->GetValue(0, 0);
|
|
138213
|
+
return protobuf.GetValueUnsafe<string_t>().GetString();
|
|
138214
|
+
}
|
|
138215
|
+
|
|
138216
|
+
DUCKDB_API unique_ptr<QueryResult> Connection::FromSubstraitJSON(const string &json) {
|
|
138217
|
+
vector<Value> params;
|
|
138218
|
+
params.emplace_back(json);
|
|
138219
|
+
return TableFunction("from_substrait_json", params)->Execute();
|
|
138220
|
+
}
|
|
138221
|
+
|
|
138191
138222
|
unique_ptr<MaterializedQueryResult> Connection::Query(unique_ptr<SQLStatement> statement) {
|
|
138192
138223
|
auto result = context->Query(move(statement), false);
|
|
138193
138224
|
D_ASSERT(result->type == QueryResultType::MATERIALIZED_RESULT);
|
|
@@ -159096,7 +159127,16 @@ unique_ptr<LogicalOperator> FilterPushdown::PushdownLeftJoin(unique_ptr<LogicalO
|
|
|
159096
159127
|
right_pushdown.GenerateFilters();
|
|
159097
159128
|
op->children[0] = left_pushdown.Rewrite(move(op->children[0]));
|
|
159098
159129
|
op->children[1] = right_pushdown.Rewrite(move(op->children[1]));
|
|
159099
|
-
|
|
159130
|
+
if (filters.empty()) {
|
|
159131
|
+
// no filters to push
|
|
159132
|
+
return op;
|
|
159133
|
+
}
|
|
159134
|
+
auto filter = make_unique<LogicalFilter>();
|
|
159135
|
+
for (auto &f : filters) {
|
|
159136
|
+
filter->expressions.push_back(move(f->filter));
|
|
159137
|
+
}
|
|
159138
|
+
filter->children.push_back(move(op));
|
|
159139
|
+
return move(filter);
|
|
159100
159140
|
}
|
|
159101
159141
|
|
|
159102
159142
|
} // 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.6.
|
|
14
|
+
#define DUCKDB_SOURCE_ID "afeda73278"
|
|
15
|
+
#define DUCKDB_VERSION "v0.6.2-dev13"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -16647,6 +16647,14 @@ public:
|
|
|
16647
16647
|
DUCKDB_API shared_ptr<Relation> RelationFromQuery(unique_ptr<SelectStatement> select_stmt,
|
|
16648
16648
|
const string &alias = "queryrelation");
|
|
16649
16649
|
|
|
16650
|
+
//! Returns a substrait BLOB from a valid query
|
|
16651
|
+
DUCKDB_API string GetSubstrait(const string &query);
|
|
16652
|
+
//! Returns a Query Result from a substrait blob
|
|
16653
|
+
DUCKDB_API unique_ptr<QueryResult> FromSubstrait(const string &proto);
|
|
16654
|
+
//! Returns a substrait BLOB from a valid query
|
|
16655
|
+
DUCKDB_API string GetSubstraitJSON(const string &query);
|
|
16656
|
+
//! Returns a Query Result from a substrait JSON
|
|
16657
|
+
DUCKDB_API unique_ptr<QueryResult> FromSubstraitJSON(const string &json);
|
|
16650
16658
|
DUCKDB_API void BeginTransaction();
|
|
16651
16659
|
DUCKDB_API void Commit();
|
|
16652
16660
|
DUCKDB_API void Rollback();
|