duckdb 0.3.3-dev562.0 → 0.3.3-dev575.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 +142 -1
- package/src/duckdb.hpp +2 -2
- package/src/parquet-amalgamation.cpp +36670 -36670
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -75773,6 +75773,11 @@ struct ListContainsFun {
|
|
|
75773
75773
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
75774
75774
|
};
|
|
75775
75775
|
|
|
75776
|
+
struct ListFlattenFun {
|
|
75777
|
+
static ScalarFunction GetFunction();
|
|
75778
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
75779
|
+
};
|
|
75780
|
+
|
|
75776
75781
|
struct ListPositionFun {
|
|
75777
75782
|
static ScalarFunction GetFunction();
|
|
75778
75783
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
@@ -84005,7 +84010,6 @@ void ListPositionFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
84005
84010
|
} // namespace duckdb
|
|
84006
84011
|
|
|
84007
84012
|
|
|
84008
|
-
|
|
84009
84013
|
//===----------------------------------------------------------------------===//
|
|
84010
84014
|
// DuckDB
|
|
84011
84015
|
//
|
|
@@ -84044,6 +84048,142 @@ public:
|
|
|
84044
84048
|
} // namespace duckdb
|
|
84045
84049
|
|
|
84046
84050
|
|
|
84051
|
+
namespace duckdb {
|
|
84052
|
+
|
|
84053
|
+
void ListFlattenFunction(DataChunk &args, ExpressionState &state, Vector &result) {
|
|
84054
|
+
D_ASSERT(args.ColumnCount() == 1);
|
|
84055
|
+
|
|
84056
|
+
Vector &input = args.data[0];
|
|
84057
|
+
if (input.GetType().id() == LogicalTypeId::SQLNULL) {
|
|
84058
|
+
result.Reference(input);
|
|
84059
|
+
return;
|
|
84060
|
+
}
|
|
84061
|
+
|
|
84062
|
+
idx_t count = args.size();
|
|
84063
|
+
|
|
84064
|
+
VectorData list_data;
|
|
84065
|
+
input.Orrify(count, list_data);
|
|
84066
|
+
auto list_entries = (list_entry_t *)list_data.data;
|
|
84067
|
+
|
|
84068
|
+
auto &child_vector = ListVector::GetEntry(input);
|
|
84069
|
+
|
|
84070
|
+
result.SetVectorType(VectorType::FLAT_VECTOR);
|
|
84071
|
+
auto result_entries = FlatVector::GetData<list_entry_t>(result);
|
|
84072
|
+
auto &result_validity = FlatVector::Validity(result);
|
|
84073
|
+
|
|
84074
|
+
if (child_vector.GetType().id() == LogicalTypeId::SQLNULL) {
|
|
84075
|
+
auto result_entries = FlatVector::GetData<list_entry_t>(result);
|
|
84076
|
+
for (idx_t i = 0; i < count; i++) {
|
|
84077
|
+
auto list_index = list_data.sel->get_index(i);
|
|
84078
|
+
if (!list_data.validity.RowIsValid(list_index)) {
|
|
84079
|
+
result_validity.SetInvalid(i);
|
|
84080
|
+
continue;
|
|
84081
|
+
}
|
|
84082
|
+
result_entries[i].offset = 0;
|
|
84083
|
+
result_entries[i].length = 0;
|
|
84084
|
+
}
|
|
84085
|
+
return;
|
|
84086
|
+
}
|
|
84087
|
+
|
|
84088
|
+
auto child_size = ListVector::GetListSize(input);
|
|
84089
|
+
VectorData child_data;
|
|
84090
|
+
child_vector.Orrify(child_size, child_data);
|
|
84091
|
+
auto child_entries = (list_entry_t *)child_data.data;
|
|
84092
|
+
auto &data_vector = ListVector::GetEntry(child_vector);
|
|
84093
|
+
|
|
84094
|
+
idx_t offset = 0;
|
|
84095
|
+
for (idx_t i = 0; i < count; i++) {
|
|
84096
|
+
auto list_index = list_data.sel->get_index(i);
|
|
84097
|
+
if (!list_data.validity.RowIsValid(list_index)) {
|
|
84098
|
+
result_validity.SetInvalid(i);
|
|
84099
|
+
continue;
|
|
84100
|
+
}
|
|
84101
|
+
auto list_entry = list_entries[list_index];
|
|
84102
|
+
|
|
84103
|
+
idx_t source_offset = 0;
|
|
84104
|
+
// Find first valid child list entry to get offset
|
|
84105
|
+
for (idx_t j = 0; j < list_entry.length; j++) {
|
|
84106
|
+
auto child_list_index = child_data.sel->get_index(list_entry.offset + j);
|
|
84107
|
+
if (child_data.validity.RowIsValid(child_list_index)) {
|
|
84108
|
+
source_offset = child_entries[child_list_index].offset;
|
|
84109
|
+
break;
|
|
84110
|
+
}
|
|
84111
|
+
}
|
|
84112
|
+
|
|
84113
|
+
idx_t length = 0;
|
|
84114
|
+
// Find last valid child list entry to get length
|
|
84115
|
+
for (idx_t j = list_entry.length - 1; j != (idx_t)-1; j--) {
|
|
84116
|
+
auto child_list_index = child_data.sel->get_index(list_entry.offset + j);
|
|
84117
|
+
if (child_data.validity.RowIsValid(child_list_index)) {
|
|
84118
|
+
auto child_entry = child_entries[child_list_index];
|
|
84119
|
+
length = child_entry.offset + child_entry.length - source_offset;
|
|
84120
|
+
break;
|
|
84121
|
+
}
|
|
84122
|
+
}
|
|
84123
|
+
ListVector::Append(result, data_vector, source_offset + length, source_offset);
|
|
84124
|
+
|
|
84125
|
+
result_entries[i].offset = offset;
|
|
84126
|
+
result_entries[i].length = length;
|
|
84127
|
+
offset += length;
|
|
84128
|
+
}
|
|
84129
|
+
|
|
84130
|
+
if (input.GetVectorType() == VectorType::CONSTANT_VECTOR) {
|
|
84131
|
+
result.SetVectorType(VectorType::CONSTANT_VECTOR);
|
|
84132
|
+
}
|
|
84133
|
+
}
|
|
84134
|
+
|
|
84135
|
+
static unique_ptr<FunctionData> ListFlattenBind(ClientContext &context, ScalarFunction &bound_function,
|
|
84136
|
+
vector<unique_ptr<Expression>> &arguments) {
|
|
84137
|
+
D_ASSERT(bound_function.arguments.size() == 1);
|
|
84138
|
+
|
|
84139
|
+
auto &input_type = arguments[0]->return_type;
|
|
84140
|
+
bound_function.arguments[0] = input_type;
|
|
84141
|
+
if (input_type.id() == LogicalTypeId::SQLNULL) {
|
|
84142
|
+
bound_function.return_type = LogicalType(LogicalTypeId::SQLNULL);
|
|
84143
|
+
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
84144
|
+
}
|
|
84145
|
+
D_ASSERT(input_type.id() == LogicalTypeId::LIST);
|
|
84146
|
+
|
|
84147
|
+
auto child_type = ListType::GetChildType(input_type);
|
|
84148
|
+
if (child_type.id() == LogicalType::SQLNULL) {
|
|
84149
|
+
bound_function.return_type = input_type;
|
|
84150
|
+
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
84151
|
+
}
|
|
84152
|
+
D_ASSERT(child_type.id() == LogicalTypeId::LIST);
|
|
84153
|
+
|
|
84154
|
+
bound_function.return_type = child_type;
|
|
84155
|
+
return make_unique<VariableReturnBindData>(bound_function.return_type);
|
|
84156
|
+
}
|
|
84157
|
+
|
|
84158
|
+
static unique_ptr<BaseStatistics> ListFlattenStats(ClientContext &context, BoundFunctionExpression &expr,
|
|
84159
|
+
FunctionData *bind_data,
|
|
84160
|
+
vector<unique_ptr<BaseStatistics>> &child_stats) {
|
|
84161
|
+
if (!child_stats[0]) {
|
|
84162
|
+
return nullptr;
|
|
84163
|
+
}
|
|
84164
|
+
auto &list_stats = (ListStatistics &)*child_stats[0];
|
|
84165
|
+
if (!list_stats.child_stats || list_stats.child_stats->type == LogicalTypeId::SQLNULL) {
|
|
84166
|
+
return nullptr;
|
|
84167
|
+
}
|
|
84168
|
+
|
|
84169
|
+
auto child_copy = list_stats.child_stats->Copy();
|
|
84170
|
+
child_copy->validity_stats = make_unique<ValidityStatistics>(true);
|
|
84171
|
+
return child_copy;
|
|
84172
|
+
}
|
|
84173
|
+
|
|
84174
|
+
void ListFlattenFun::RegisterFunction(BuiltinFunctions &set) {
|
|
84175
|
+
ScalarFunction fun({LogicalType::LIST(LogicalType::LIST(LogicalType::ANY))}, LogicalType::LIST(LogicalType::ANY),
|
|
84176
|
+
ListFlattenFunction, false, ListFlattenBind, nullptr, ListFlattenStats);
|
|
84177
|
+
set.AddFunction({"flatten"}, fun);
|
|
84178
|
+
}
|
|
84179
|
+
|
|
84180
|
+
} // namespace duckdb
|
|
84181
|
+
|
|
84182
|
+
|
|
84183
|
+
|
|
84184
|
+
|
|
84185
|
+
|
|
84186
|
+
|
|
84047
84187
|
|
|
84048
84188
|
namespace duckdb {
|
|
84049
84189
|
|
|
@@ -86233,6 +86373,7 @@ void BuiltinFunctions::RegisterNestedFunctions() {
|
|
|
86233
86373
|
Register<ListValueFun>();
|
|
86234
86374
|
Register<ListExtractFun>();
|
|
86235
86375
|
Register<ListRangeFun>();
|
|
86376
|
+
Register<ListFlattenFun>();
|
|
86236
86377
|
Register<MapFun>();
|
|
86237
86378
|
Register<MapExtractFun>();
|
|
86238
86379
|
Register<CardinalityFun>();
|
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 "12c852719"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.3-dev575"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|