duckdb 0.7.2-dev457.0 → 0.7.2-dev614.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/binding.gyp +9 -9
- package/package.json +1 -1
- package/src/duckdb/extension/icu/icu-table-range.cpp +7 -7
- package/src/duckdb/extension/parquet/parquet-extension.cpp +1 -0
- package/src/duckdb/extension/parquet/parquet_reader.cpp +1 -1
- package/src/duckdb/src/catalog/catalog.cpp +13 -0
- package/src/duckdb/src/catalog/catalog_entry/duck_table_entry.cpp +2 -21
- package/src/duckdb/src/catalog/catalog_entry/type_catalog_entry.cpp +8 -2
- package/src/duckdb/src/catalog/catalog_set.cpp +1 -0
- package/src/duckdb/src/common/arrow/arrow_appender.cpp +48 -4
- package/src/duckdb/src/common/arrow/arrow_converter.cpp +1 -1
- package/src/duckdb/src/common/field_writer.cpp +1 -0
- package/src/duckdb/src/common/serializer/buffered_deserializer.cpp +4 -0
- package/src/duckdb/src/common/serializer/buffered_file_reader.cpp +15 -2
- package/src/duckdb/src/common/types/blob.cpp +1 -1
- package/src/duckdb/src/common/types/chunk_collection.cpp +2 -2
- package/src/duckdb/src/common/types/data_chunk.cpp +1 -1
- package/src/duckdb/src/common/types/value.cpp +8 -8
- package/src/duckdb/src/common/types.cpp +147 -64
- package/src/duckdb/src/execution/operator/aggregate/physical_window.cpp +12 -3
- package/src/duckdb/src/execution/operator/join/physical_iejoin.cpp +2 -2
- package/src/duckdb/src/execution/operator/join/physical_piecewise_merge_join.cpp +6 -11
- package/src/duckdb/src/execution/operator/join/physical_range_join.cpp +1 -1
- package/src/duckdb/src/execution/operator/persistent/physical_copy_to_file.cpp +2 -2
- package/src/duckdb/src/execution/operator/schema/physical_create_type.cpp +20 -40
- package/src/duckdb/src/function/aggregate/holistic/quantile.cpp +1 -1
- package/src/duckdb/src/function/aggregate/nested/list.cpp +8 -8
- package/src/duckdb/src/function/cast/struct_cast.cpp +1 -1
- package/src/duckdb/src/function/scalar/date/date_part.cpp +1 -1
- package/src/duckdb/src/function/scalar/list/list_concat.cpp +5 -4
- package/src/duckdb/src/function/scalar/list/list_lambdas.cpp +3 -3
- package/src/duckdb/src/function/scalar/list/list_value.cpp +1 -1
- package/src/duckdb/src/function/scalar/map/map_entries.cpp +1 -1
- package/src/duckdb/src/function/scalar/struct/struct_insert.cpp +1 -1
- package/src/duckdb/src/function/scalar/struct/struct_pack.cpp +1 -1
- package/src/duckdb/src/function/table/arrow.cpp +5 -2
- package/src/duckdb/src/function/table/arrow_conversion.cpp +18 -0
- package/src/duckdb/src/function/table/system/test_all_types.cpp +2 -2
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/function/table_function.cpp +11 -11
- package/src/duckdb/src/include/duckdb/catalog/catalog.hpp +3 -0
- package/src/duckdb/src/include/duckdb/catalog/catalog_entry/duck_table_entry.hpp +1 -1
- package/src/duckdb/src/include/duckdb/common/field_writer.hpp +12 -4
- package/src/duckdb/src/include/duckdb/common/{http_stats.hpp → http_state.hpp} +18 -4
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_deserializer.hpp +4 -2
- package/src/duckdb/src/include/duckdb/common/serializer/buffered_file_reader.hpp +8 -2
- package/src/duckdb/src/include/duckdb/common/serializer.hpp +13 -0
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +3 -3
- package/src/duckdb/src/include/duckdb/common/types.hpp +30 -4
- package/src/duckdb/src/include/duckdb/execution/operator/persistent/csv_file_handle.hpp +1 -0
- package/src/duckdb/src/include/duckdb/function/table/arrow.hpp +12 -1
- package/src/duckdb/src/include/duckdb/function/table_function.hpp +8 -0
- package/src/duckdb/src/include/duckdb/main/client_data.hpp +3 -3
- package/src/duckdb/src/include/duckdb/main/connection_manager.hpp +2 -0
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_info.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/alter_table_info.hpp +6 -0
- package/src/duckdb/src/include/duckdb/storage/checkpoint_manager.hpp +1 -1
- package/src/duckdb/src/include/duckdb/storage/meta_block_reader.hpp +7 -0
- package/src/duckdb/src/include/duckdb/storage/table/update_segment.hpp +0 -1
- package/src/duckdb/src/include/duckdb/storage/write_ahead_log.hpp +1 -1
- package/src/duckdb/src/main/client_context.cpp +30 -32
- package/src/duckdb/src/main/client_data.cpp +7 -6
- package/src/duckdb/src/main/config.cpp +4 -0
- package/src/duckdb/src/main/database.cpp +9 -0
- package/src/duckdb/src/main/query_profiler.cpp +17 -15
- package/src/duckdb/src/optimizer/join_order/cardinality_estimator.cpp +3 -4
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +5 -3
- package/src/duckdb/src/optimizer/rule/regex_optimizations.cpp +9 -2
- package/src/duckdb/src/optimizer/unnest_rewriter.cpp +2 -2
- package/src/duckdb/src/parser/expression/conjunction_expression.cpp +2 -0
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +1 -1
- package/src/duckdb/src/parser/transform/helpers/transform_typename.cpp +3 -2
- package/src/duckdb/src/parser/transform/statement/transform_rename.cpp +3 -4
- package/src/duckdb/src/planner/binder/expression/bind_aggregate_expression.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_columnref_expression.cpp +4 -3
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +2 -1
- package/src/duckdb/src/planner/binder/statement/bind_create_table.cpp +2 -1
- package/src/duckdb/src/planner/binder/tableref/bind_pivot.cpp +1 -0
- package/src/duckdb/src/planner/binder/tableref/bind_table_function.cpp +11 -1
- package/src/duckdb/src/planner/binder/tableref/plan_cteref.cpp +1 -0
- package/src/duckdb/src/planner/expression_binder.cpp +1 -1
- package/src/duckdb/src/planner/logical_operator.cpp +4 -2
- package/src/duckdb/src/planner/planner.cpp +2 -1
- package/src/duckdb/src/storage/checkpoint_manager.cpp +8 -3
- package/src/duckdb/src/storage/meta_block_reader.cpp +22 -0
- package/src/duckdb/src/storage/statistics/list_stats.cpp +6 -2
- package/src/duckdb/src/storage/statistics/struct_stats.cpp +3 -1
- package/src/duckdb/src/storage/storage_info.cpp +1 -1
- package/src/duckdb/src/storage/table/update_segment.cpp +11 -7
- package/src/duckdb/src/storage/wal_replay.cpp +8 -5
- package/src/duckdb/src/storage/write_ahead_log.cpp +2 -2
- package/src/duckdb/src/transaction/commit_state.cpp +11 -7
- package/src/duckdb/third_party/libpg_query/src_backend_parser_gram.cpp +1152 -1152
- package/src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp +4 -4
package/binding.gyp
CHANGED
@@ -223,18 +223,18 @@
|
|
223
223
|
"src/duckdb/third_party/zstd/compress/zstd_lazy.cpp",
|
224
224
|
"src/duckdb/third_party/zstd/compress/zstd_ldm.cpp",
|
225
225
|
"src/duckdb/third_party/zstd/compress/zstd_opt.cpp",
|
226
|
-
"src/duckdb/extension/icu/./icu-dateadd.cpp",
|
227
|
-
"src/duckdb/extension/icu/./icu-table-range.cpp",
|
228
|
-
"src/duckdb/extension/icu/./icu-datetrunc.cpp",
|
229
|
-
"src/duckdb/extension/icu/./icu-strptime.cpp",
|
230
|
-
"src/duckdb/extension/icu/./icu-datefunc.cpp",
|
231
|
-
"src/duckdb/extension/icu/./icu-extension.cpp",
|
232
|
-
"src/duckdb/extension/icu/./icu-makedate.cpp",
|
233
226
|
"src/duckdb/extension/icu/./icu-list-range.cpp",
|
227
|
+
"src/duckdb/extension/icu/./icu-datepart.cpp",
|
228
|
+
"src/duckdb/extension/icu/./icu-timebucket.cpp",
|
234
229
|
"src/duckdb/extension/icu/./icu-timezone.cpp",
|
230
|
+
"src/duckdb/extension/icu/./icu-datefunc.cpp",
|
231
|
+
"src/duckdb/extension/icu/./icu-makedate.cpp",
|
232
|
+
"src/duckdb/extension/icu/./icu-datetrunc.cpp",
|
233
|
+
"src/duckdb/extension/icu/./icu-table-range.cpp",
|
234
|
+
"src/duckdb/extension/icu/./icu-extension.cpp",
|
235
|
+
"src/duckdb/extension/icu/./icu-dateadd.cpp",
|
235
236
|
"src/duckdb/extension/icu/./icu-datesub.cpp",
|
236
|
-
"src/duckdb/extension/icu/./icu-
|
237
|
-
"src/duckdb/extension/icu/./icu-datepart.cpp",
|
237
|
+
"src/duckdb/extension/icu/./icu-strptime.cpp",
|
238
238
|
"src/duckdb/ub_extension_icu_third_party_icu_common.cpp",
|
239
239
|
"src/duckdb/ub_extension_icu_third_party_icu_i18n.cpp",
|
240
240
|
"src/duckdb/extension/icu/third_party/icu/stubdata/stubdata.cpp",
|
package/package.json
CHANGED
@@ -13,13 +13,13 @@ struct ICUTableRange {
|
|
13
13
|
using CalendarPtr = unique_ptr<icu::Calendar>;
|
14
14
|
|
15
15
|
struct BindData : public TableFunctionData {
|
16
|
-
|
17
|
-
:
|
18
|
-
start(other.start), end(other.end), increment(other.increment),
|
19
|
-
greater_than_check(other.greater_than_check) {
|
16
|
+
BindData(const BindData &other)
|
17
|
+
: TableFunctionData(other), tz_setting(other.tz_setting), cal_setting(other.cal_setting),
|
18
|
+
calendar(other.calendar->clone()), start(other.start), end(other.end), increment(other.increment),
|
19
|
+
inclusive_bound(other.inclusive_bound), greater_than_check(other.greater_than_check) {
|
20
20
|
}
|
21
21
|
|
22
|
-
BindData(ClientContext &context) {
|
22
|
+
explicit BindData(ClientContext &context) {
|
23
23
|
Value tz_value;
|
24
24
|
if (context.TryGetCurrentSetting("TimeZone", tz_value)) {
|
25
25
|
tz_setting = tz_value.ToString();
|
@@ -54,14 +54,14 @@ struct ICUTableRange {
|
|
54
54
|
bool inclusive_bound;
|
55
55
|
bool greater_than_check;
|
56
56
|
|
57
|
-
bool Equals(const FunctionData &other_p) const {
|
57
|
+
bool Equals(const FunctionData &other_p) const override {
|
58
58
|
auto &other = (const BindData &)other_p;
|
59
59
|
return other.start == start && other.end == end && other.increment == increment &&
|
60
60
|
other.inclusive_bound == inclusive_bound && other.greater_than_check == greater_than_check &&
|
61
61
|
*calendar == *other.calendar;
|
62
62
|
}
|
63
63
|
|
64
|
-
unique_ptr<FunctionData> Copy() const {
|
64
|
+
unique_ptr<FunctionData> Copy() const override {
|
65
65
|
return make_unique<BindData>(*this);
|
66
66
|
}
|
67
67
|
|
@@ -354,6 +354,7 @@ public:
|
|
354
354
|
return_types.assign(union_col_types.begin(), union_col_types.end());
|
355
355
|
result->SetInitialReader(result->union_readers[0]);
|
356
356
|
D_ASSERT(names.size() == return_types.size());
|
357
|
+
result->types = union_col_types;
|
357
358
|
|
358
359
|
return std::move(result);
|
359
360
|
}
|
@@ -320,7 +320,7 @@ unique_ptr<ColumnReader> ParquetReader::CreateReaderRecursive(const FileMetaData
|
|
320
320
|
std::move(struct_reader));
|
321
321
|
}
|
322
322
|
if (child_types.size() > 1 || (!is_list && !is_map && !is_repeated)) {
|
323
|
-
result_type = LogicalType::STRUCT(
|
323
|
+
result_type = LogicalType::STRUCT(child_types);
|
324
324
|
result = make_unique<StructColumnReader>(*this, result_type, s_ele, this_idx, max_define, max_repeat,
|
325
325
|
std::move(child_readers));
|
326
326
|
} else {
|
@@ -625,6 +625,19 @@ vector<SchemaCatalogEntry *> Catalog::GetSchemas(ClientContext &context) {
|
|
625
625
|
return schemas;
|
626
626
|
}
|
627
627
|
|
628
|
+
bool Catalog::TypeExists(ClientContext &context, const string &catalog_name, const string &schema, const string &name) {
|
629
|
+
CatalogEntry *entry;
|
630
|
+
entry = GetEntry(context, CatalogType::TYPE_ENTRY, catalog_name, schema, name, true);
|
631
|
+
if (!entry) {
|
632
|
+
// look in the system catalog
|
633
|
+
entry = GetEntry(context, CatalogType::TYPE_ENTRY, SYSTEM_CATALOG, schema, name, true);
|
634
|
+
if (!entry) {
|
635
|
+
return false;
|
636
|
+
}
|
637
|
+
}
|
638
|
+
return true;
|
639
|
+
}
|
640
|
+
|
628
641
|
vector<SchemaCatalogEntry *> Catalog::GetSchemas(ClientContext &context, const string &catalog_name) {
|
629
642
|
vector<Catalog *> catalogs;
|
630
643
|
if (IsInvalidCatalog(catalog_name)) {
|
@@ -682,27 +682,8 @@ void DuckTableEntry::SetAsRoot() {
|
|
682
682
|
storage->info->table = name;
|
683
683
|
}
|
684
684
|
|
685
|
-
void DuckTableEntry::CommitAlter(
|
686
|
-
D_ASSERT(
|
687
|
-
auto &alter_table = (AlterTableInfo &)info;
|
688
|
-
string column_name;
|
689
|
-
switch (alter_table.alter_table_type) {
|
690
|
-
case AlterTableType::REMOVE_COLUMN: {
|
691
|
-
auto &remove_info = (RemoveColumnInfo &)alter_table;
|
692
|
-
column_name = remove_info.removed_column;
|
693
|
-
break;
|
694
|
-
}
|
695
|
-
case AlterTableType::ALTER_COLUMN_TYPE: {
|
696
|
-
auto &change_info = (ChangeColumnTypeInfo &)alter_table;
|
697
|
-
column_name = change_info.column_name;
|
698
|
-
break;
|
699
|
-
}
|
700
|
-
default:
|
701
|
-
break;
|
702
|
-
}
|
703
|
-
if (column_name.empty()) {
|
704
|
-
return;
|
705
|
-
}
|
685
|
+
void DuckTableEntry::CommitAlter(string &column_name) {
|
686
|
+
D_ASSERT(!column_name.empty());
|
706
687
|
idx_t removed_index = DConstants::INVALID_INDEX;
|
707
688
|
for (auto &col : columns.Logical()) {
|
708
689
|
if (col.Name() == column_name) {
|
@@ -23,7 +23,13 @@ void TypeCatalogEntry::Serialize(Serializer &serializer) {
|
|
23
23
|
FieldWriter writer(serializer);
|
24
24
|
writer.WriteString(schema->name);
|
25
25
|
writer.WriteString(name);
|
26
|
-
|
26
|
+
if (user_type.id() == LogicalTypeId::ENUM) {
|
27
|
+
// We have to serialize Enum Values
|
28
|
+
writer.AddField();
|
29
|
+
user_type.SerializeEnumType(writer.GetSerializer());
|
30
|
+
} else {
|
31
|
+
writer.WriteSerializable(user_type);
|
32
|
+
}
|
27
33
|
writer.Finalize();
|
28
34
|
}
|
29
35
|
|
@@ -43,7 +49,7 @@ string TypeCatalogEntry::ToSQL() {
|
|
43
49
|
std::stringstream ss;
|
44
50
|
switch (user_type.id()) {
|
45
51
|
case (LogicalTypeId::ENUM): {
|
46
|
-
|
52
|
+
auto &values_insert_order = EnumType::GetValuesInsertOrder(user_type);
|
47
53
|
idx_t size = EnumType::GetSize(user_type);
|
48
54
|
ss << "CREATE TYPE ";
|
49
55
|
ss << KeywordHelper::WriteOptionallyQuoted(name);
|
@@ -258,6 +258,7 @@ bool CatalogSet::AlterEntry(CatalogTransaction transaction, const string &name,
|
|
258
258
|
|
259
259
|
// serialize the AlterInfo into a temporary buffer
|
260
260
|
BufferedSerializer serializer;
|
261
|
+
serializer.WriteString(alter_info->GetColumnName());
|
261
262
|
alter_info->Serialize(serializer);
|
262
263
|
BinaryData serialized_alter = serializer.GetData();
|
263
264
|
|
@@ -4,6 +4,7 @@
|
|
4
4
|
#include "duckdb/common/array.hpp"
|
5
5
|
#include "duckdb/common/types/interval.hpp"
|
6
6
|
#include "duckdb/common/types/uuid.hpp"
|
7
|
+
#include "duckdb/function/table/arrow.hpp"
|
7
8
|
|
8
9
|
namespace duckdb {
|
9
10
|
|
@@ -127,7 +128,11 @@ struct ArrowScalarConverter {
|
|
127
128
|
struct ArrowIntervalConverter {
|
128
129
|
template <class TGT, class SRC>
|
129
130
|
static TGT Operation(SRC input) {
|
130
|
-
|
131
|
+
ArrowInterval result;
|
132
|
+
result.months = input.months;
|
133
|
+
result.days = input.days;
|
134
|
+
result.nanoseconds = input.micros * Interval::NANOS_PER_MICRO;
|
135
|
+
return result;
|
131
136
|
}
|
132
137
|
|
133
138
|
static bool SkipNulls() {
|
@@ -136,7 +141,6 @@ struct ArrowIntervalConverter {
|
|
136
141
|
|
137
142
|
template <class TGT>
|
138
143
|
static void SetNull(TGT &value) {
|
139
|
-
value = 0;
|
140
144
|
}
|
141
145
|
};
|
142
146
|
|
@@ -185,11 +189,51 @@ struct ArrowScalarData : public ArrowScalarBaseData<TGT, SRC, OP> {
|
|
185
189
|
//===--------------------------------------------------------------------===//
|
186
190
|
template <class TGT>
|
187
191
|
struct ArrowEnumData : public ArrowScalarBaseData<TGT> {
|
192
|
+
static idx_t GetLength(string_t input) {
|
193
|
+
return input.GetSize();
|
194
|
+
}
|
195
|
+
static void WriteData(data_ptr_t target, string_t input) {
|
196
|
+
memcpy(target, input.GetDataUnsafe(), input.GetSize());
|
197
|
+
}
|
198
|
+
static void EnumAppendVector(ArrowAppendData &append_data, const Vector &input, idx_t size) {
|
199
|
+
D_ASSERT(input.GetVectorType() == VectorType::FLAT_VECTOR);
|
200
|
+
|
201
|
+
// resize the validity mask and set up the validity buffer for iteration
|
202
|
+
ResizeValidity(append_data.validity, append_data.row_count + size);
|
203
|
+
|
204
|
+
// resize the offset buffer - the offset buffer holds the offsets into the child array
|
205
|
+
append_data.main_buffer.resize(append_data.main_buffer.size() + sizeof(uint32_t) * (size + 1));
|
206
|
+
auto data = (string_t *)FlatVector::GetData<string_t>(input);
|
207
|
+
auto offset_data = (uint32_t *)append_data.main_buffer.data();
|
208
|
+
if (append_data.row_count == 0) {
|
209
|
+
// first entry
|
210
|
+
offset_data[0] = 0;
|
211
|
+
}
|
212
|
+
// now append the string data to the auxiliary buffer
|
213
|
+
// the auxiliary buffer's length depends on the string lengths, so we resize as required
|
214
|
+
auto last_offset = offset_data[append_data.row_count];
|
215
|
+
for (idx_t i = 0; i < size; i++) {
|
216
|
+
auto offset_idx = append_data.row_count + i + 1;
|
217
|
+
|
218
|
+
auto string_length = GetLength(data[i]);
|
219
|
+
|
220
|
+
// append the offset data
|
221
|
+
auto current_offset = last_offset + string_length;
|
222
|
+
offset_data[offset_idx] = current_offset;
|
223
|
+
|
224
|
+
// resize the string buffer if required, and write the string data
|
225
|
+
append_data.aux_buffer.resize(current_offset);
|
226
|
+
WriteData(append_data.aux_buffer.data() + last_offset, data[i]);
|
227
|
+
|
228
|
+
last_offset = current_offset;
|
229
|
+
}
|
230
|
+
append_data.row_count += size;
|
231
|
+
}
|
188
232
|
static void Initialize(ArrowAppendData &result, const LogicalType &type, idx_t capacity) {
|
189
233
|
result.main_buffer.reserve(capacity * sizeof(TGT));
|
190
234
|
// construct the enum child data
|
191
235
|
auto enum_data = InitializeArrowChild(LogicalType::VARCHAR, EnumType::GetSize(type));
|
192
|
-
|
236
|
+
EnumAppendVector(*enum_data, EnumType::GetValuesInsertOrder(type), EnumType::GetSize(type));
|
193
237
|
result.child_data.push_back(std::move(enum_data));
|
194
238
|
}
|
195
239
|
|
@@ -629,7 +673,7 @@ static void InitializeFunctionPointers(ArrowAppendData &append_data, const Logic
|
|
629
673
|
}
|
630
674
|
break;
|
631
675
|
case LogicalTypeId::INTERVAL:
|
632
|
-
InitializeFunctionPointers<ArrowScalarData<
|
676
|
+
InitializeFunctionPointers<ArrowScalarData<ArrowInterval, interval_t, ArrowIntervalConverter>>(append_data);
|
633
677
|
break;
|
634
678
|
case LogicalTypeId::STRUCT:
|
635
679
|
InitializeFunctionPointers<ArrowStructData>(append_data);
|
@@ -150,7 +150,7 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co
|
|
150
150
|
child.format = "tsm:";
|
151
151
|
break;
|
152
152
|
case LogicalTypeId::INTERVAL:
|
153
|
-
child.format = "
|
153
|
+
child.format = "tin";
|
154
154
|
break;
|
155
155
|
case LogicalTypeId::DECIMAL: {
|
156
156
|
uint8_t width, scale;
|
@@ -8,6 +8,7 @@ namespace duckdb {
|
|
8
8
|
FieldWriter::FieldWriter(Serializer &serializer_p)
|
9
9
|
: serializer(serializer_p), buffer(make_unique<BufferedSerializer>()), field_count(0), finalized(false) {
|
10
10
|
buffer->SetVersion(serializer.GetVersion());
|
11
|
+
buffer->is_query_plan = serializer.is_query_plan;
|
11
12
|
}
|
12
13
|
|
13
14
|
FieldWriter::~FieldWriter() {
|
@@ -7,8 +7,10 @@
|
|
7
7
|
|
8
8
|
namespace duckdb {
|
9
9
|
|
10
|
-
BufferedFileReader::BufferedFileReader(FileSystem &fs, const char *path, FileLockType lock_type,
|
11
|
-
|
10
|
+
BufferedFileReader::BufferedFileReader(FileSystem &fs, const char *path, ClientContext *context, FileLockType lock_type,
|
11
|
+
FileOpener *opener)
|
12
|
+
: fs(fs), data(unique_ptr<data_t[]>(new data_t[FILE_BUFFER_SIZE])), offset(0), read_data(0), context(context),
|
13
|
+
total_read(0) {
|
12
14
|
handle = fs.OpenFile(path, FileFlags::FILE_FLAGS_READ, lock_type, FileSystem::DEFAULT_COMPRESSION, opener);
|
13
15
|
file_size = fs.GetFileSize(*handle);
|
14
16
|
}
|
@@ -54,4 +56,15 @@ uint64_t BufferedFileReader::CurrentOffset() {
|
|
54
56
|
return total_read + offset;
|
55
57
|
}
|
56
58
|
|
59
|
+
ClientContext &BufferedFileReader::GetContext() {
|
60
|
+
if (!context) {
|
61
|
+
throw InternalException("Trying to acquire a client context that does not exist");
|
62
|
+
}
|
63
|
+
return *context;
|
64
|
+
}
|
65
|
+
|
66
|
+
Catalog *BufferedFileReader::GetCatalog() {
|
67
|
+
return catalog;
|
68
|
+
}
|
69
|
+
|
57
70
|
} // namespace duckdb
|
@@ -20,7 +20,7 @@ const int Blob::HEX_MAP[256] = {
|
|
20
20
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
|
21
21
|
|
22
22
|
bool IsRegularCharacter(data_t c) {
|
23
|
-
return c >= 32 && c <=
|
23
|
+
return c >= 32 && c <= 126 && c != '\\' && c != '\'' && c != '"';
|
24
24
|
}
|
25
25
|
|
26
26
|
idx_t Blob::GetStringSize(string_t blob) {
|
@@ -143,7 +143,7 @@ void ChunkCollection::Fuse(ChunkCollection &other) {
|
|
143
143
|
auto &rhs = other.GetChunk(chunk_idx);
|
144
144
|
lhs->data.reserve(rhs.data.size());
|
145
145
|
for (auto &v : rhs.data) {
|
146
|
-
lhs->data.emplace_back(
|
146
|
+
lhs->data.emplace_back(v);
|
147
147
|
}
|
148
148
|
lhs->SetCardinality(rhs.size());
|
149
149
|
chunks.push_back(std::move(lhs));
|
@@ -156,7 +156,7 @@ void ChunkCollection::Fuse(ChunkCollection &other) {
|
|
156
156
|
auto &rhs = other.GetChunk(chunk_idx);
|
157
157
|
D_ASSERT(lhs.size() == rhs.size());
|
158
158
|
for (auto &v : rhs.data) {
|
159
|
-
lhs.data.emplace_back(
|
159
|
+
lhs.data.emplace_back(v);
|
160
160
|
}
|
161
161
|
}
|
162
162
|
}
|
@@ -62,7 +62,7 @@ void DataChunk::InitializeEmpty(vector<LogicalType>::const_iterator begin, vecto
|
|
62
62
|
D_ASSERT(data.empty()); // can only be initialized once
|
63
63
|
D_ASSERT(std::distance(begin, end) != 0); // empty chunk not allowed
|
64
64
|
for (; begin != end; begin++) {
|
65
|
-
data.emplace_back(
|
65
|
+
data.emplace_back(*begin, nullptr);
|
66
66
|
}
|
67
67
|
}
|
68
68
|
|
@@ -604,22 +604,22 @@ Value Value::STRUCT(child_list_t<Value> values) {
|
|
604
604
|
struct_values.push_back(std::move(child.second));
|
605
605
|
}
|
606
606
|
result.value_info_ = make_shared<NestedValueInfo>(std::move(struct_values));
|
607
|
-
result.type_ = LogicalType::STRUCT(
|
607
|
+
result.type_ = LogicalType::STRUCT(child_types);
|
608
608
|
result.is_null = false;
|
609
609
|
return result;
|
610
610
|
}
|
611
611
|
|
612
|
-
Value Value::MAP(LogicalType child_type, vector<Value> values) {
|
612
|
+
Value Value::MAP(const LogicalType &child_type, vector<Value> values) {
|
613
613
|
Value result;
|
614
614
|
|
615
|
-
result.type_ = LogicalType::MAP(
|
615
|
+
result.type_ = LogicalType::MAP(child_type);
|
616
616
|
result.is_null = false;
|
617
617
|
result.value_info_ = make_shared<NestedValueInfo>(std::move(values));
|
618
618
|
return result;
|
619
619
|
}
|
620
620
|
|
621
621
|
Value Value::UNION(child_list_t<LogicalType> members, uint8_t tag, Value value) {
|
622
|
-
D_ASSERT(members.
|
622
|
+
D_ASSERT(!members.empty());
|
623
623
|
D_ASSERT(members.size() <= UnionType::MAX_UNION_MEMBERS);
|
624
624
|
D_ASSERT(members.size() > tag);
|
625
625
|
|
@@ -660,9 +660,9 @@ Value Value::LIST(vector<Value> values) {
|
|
660
660
|
return result;
|
661
661
|
}
|
662
662
|
|
663
|
-
Value Value::LIST(LogicalType child_type, vector<Value> values) {
|
663
|
+
Value Value::LIST(const LogicalType &child_type, vector<Value> values) {
|
664
664
|
if (values.empty()) {
|
665
|
-
return Value::EMPTYLIST(
|
665
|
+
return Value::EMPTYLIST(child_type);
|
666
666
|
}
|
667
667
|
for (auto &val : values) {
|
668
668
|
val = val.DefaultCastAs(child_type);
|
@@ -670,9 +670,9 @@ Value Value::LIST(LogicalType child_type, vector<Value> values) {
|
|
670
670
|
return Value::LIST(std::move(values));
|
671
671
|
}
|
672
672
|
|
673
|
-
Value Value::EMPTYLIST(LogicalType child_type) {
|
673
|
+
Value Value::EMPTYLIST(const LogicalType &child_type) {
|
674
674
|
Value result;
|
675
|
-
result.type_ = LogicalType::LIST(
|
675
|
+
result.type_ = LogicalType::LIST(child_type);
|
676
676
|
result.value_info_ = make_shared<NestedValueInfo>();
|
677
677
|
result.is_null = false;
|
678
678
|
return result;
|