duckdb 0.8.2-dev2208.0 → 0.8.2-dev2283.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/src/common/adbc/adbc.cpp +1 -1
- package/src/duckdb/src/function/table/arrow.cpp +1 -1
- package/src/duckdb/src/function/table/arrow_conversion.cpp +12 -10
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb.h +15 -0
- package/src/duckdb/src/main/capi/duckdb-c.cpp +16 -0
- package/src/duckdb/src/planner/binder/statement/bind_create.cpp +1 -0
- package/src/duckdb/src/storage/table/list_column_data.cpp +6 -3
package/package.json
CHANGED
@@ -450,7 +450,7 @@ AdbcStatusCode Ingest(duckdb_connection connection, const char *table_name, stru
|
|
450
450
|
|
451
451
|
auto arrow_scan = cconn->TableFunction("arrow_scan", {duckdb::Value::POINTER((uintptr_t)input),
|
452
452
|
duckdb::Value::POINTER((uintptr_t)stream_produce),
|
453
|
-
duckdb::Value::POINTER((uintptr_t)get_schema)});
|
453
|
+
duckdb::Value::POINTER((uintptr_t)input->get_schema)});
|
454
454
|
try {
|
455
455
|
if (ingestion_mode == IngestionMode::CREATE) {
|
456
456
|
// We create the table based on an Arrow Scanner
|
@@ -123,7 +123,7 @@ LogicalType ArrowTableFunction::GetArrowLogicalType(
|
|
123
123
|
child_list_t<LogicalType> child_types;
|
124
124
|
for (idx_t type_idx = 0; type_idx < (idx_t)schema.n_children; type_idx++) {
|
125
125
|
auto child_type = GetArrowLogicalType(*schema.children[type_idx], arrow_convert_data, col_idx);
|
126
|
-
child_types.
|
126
|
+
child_types.emplace_back(schema.children[type_idx]->name, child_type);
|
127
127
|
}
|
128
128
|
return LogicalType::STRUCT(child_types);
|
129
129
|
|
@@ -93,7 +93,7 @@ static void SetValidityMask(Vector &vector, ArrowArray &array, ArrowScanLocalSta
|
|
93
93
|
static void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanLocalState &scan_state, idx_t size,
|
94
94
|
std::unordered_map<idx_t, unique_ptr<ArrowConvertData>> &arrow_convert_data,
|
95
95
|
idx_t col_idx, ArrowConvertDataIndices &arrow_convert_idx, int64_t nested_offset = -1,
|
96
|
-
ValidityMask *parent_mask = nullptr);
|
96
|
+
ValidityMask *parent_mask = nullptr, uint64_t parent_offset = 0);
|
97
97
|
|
98
98
|
static void ArrowToDuckDBList(Vector &vector, ArrowArray &array, ArrowScanLocalState &scan_state, idx_t size,
|
99
99
|
std::unordered_map<idx_t, unique_ptr<ArrowConvertData>> &arrow_convert_data,
|
@@ -265,12 +265,13 @@ static void SetVectorString(Vector &vector, idx_t size, char *cdata, T *offsets)
|
|
265
265
|
}
|
266
266
|
}
|
267
267
|
|
268
|
-
static void DirectConversion(Vector &vector, ArrowArray &array, ArrowScanLocalState &scan_state,
|
269
|
-
|
268
|
+
static void DirectConversion(Vector &vector, ArrowArray &array, ArrowScanLocalState &scan_state, int64_t nested_offset,
|
269
|
+
uint64_t parent_offset) {
|
270
270
|
auto internal_type = GetTypeIdSize(vector.GetType().InternalType());
|
271
|
-
auto data_ptr =
|
271
|
+
auto data_ptr =
|
272
|
+
ArrowBufferData<data_t>(array, 1) + internal_type * (scan_state.chunk_offset + array.offset + parent_offset);
|
272
273
|
if (nested_offset != -1) {
|
273
|
-
data_ptr = ArrowBufferData<data_t>(array, 1) + internal_type * (array.offset + nested_offset);
|
274
|
+
data_ptr = ArrowBufferData<data_t>(array, 1) + internal_type * (array.offset + nested_offset + parent_offset);
|
274
275
|
}
|
275
276
|
FlatVector::SetData(vector, data_ptr);
|
276
277
|
}
|
@@ -359,7 +360,7 @@ static void IntervalConversionMonthDayNanos(Vector &vector, ArrowArray &array, A
|
|
359
360
|
static void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanLocalState &scan_state, idx_t size,
|
360
361
|
std::unordered_map<idx_t, unique_ptr<ArrowConvertData>> &arrow_convert_data,
|
361
362
|
idx_t col_idx, ArrowConvertDataIndices &arrow_convert_idx, int64_t nested_offset,
|
362
|
-
ValidityMask *parent_mask) {
|
363
|
+
ValidityMask *parent_mask, uint64_t parent_offset) {
|
363
364
|
switch (vector.GetType().id()) {
|
364
365
|
case LogicalTypeId::SQLNULL:
|
365
366
|
vector.Reference(Value());
|
@@ -407,7 +408,7 @@ static void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanLoca
|
|
407
408
|
case LogicalTypeId::TIMESTAMP_SEC:
|
408
409
|
case LogicalTypeId::TIMESTAMP_MS:
|
409
410
|
case LogicalTypeId::TIMESTAMP_NS: {
|
410
|
-
DirectConversion(vector, array, scan_state, nested_offset);
|
411
|
+
DirectConversion(vector, array, scan_state, nested_offset, parent_offset);
|
411
412
|
break;
|
412
413
|
}
|
413
414
|
case LogicalTypeId::VARCHAR: {
|
@@ -432,7 +433,7 @@ static void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanLoca
|
|
432
433
|
auto precision = arrow_convert_data[col_idx]->date_time_precision[arrow_convert_idx.datetime_precision_index++];
|
433
434
|
switch (precision) {
|
434
435
|
case ArrowDateTimeType::DAYS: {
|
435
|
-
DirectConversion(vector, array, scan_state, nested_offset);
|
436
|
+
DirectConversion(vector, array, scan_state, nested_offset, parent_offset);
|
436
437
|
break;
|
437
438
|
}
|
438
439
|
case ArrowDateTimeType::MILLISECONDS: {
|
@@ -495,7 +496,7 @@ static void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanLoca
|
|
495
496
|
break;
|
496
497
|
}
|
497
498
|
case ArrowDateTimeType::MICROSECONDS: {
|
498
|
-
DirectConversion(vector, array, scan_state, nested_offset);
|
499
|
+
DirectConversion(vector, array, scan_state, nested_offset, parent_offset);
|
499
500
|
break;
|
500
501
|
}
|
501
502
|
case ArrowDateTimeType::NANOSECONDS: {
|
@@ -640,7 +641,8 @@ static void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanLoca
|
|
640
641
|
}
|
641
642
|
}
|
642
643
|
ColumnArrowToDuckDB(*child_entries[type_idx], *array.children[type_idx], scan_state, size,
|
643
|
-
arrow_convert_data, col_idx, arrow_convert_idx, nested_offset, &struct_validity_mask
|
644
|
+
arrow_convert_data, col_idx, arrow_convert_idx, nested_offset, &struct_validity_mask,
|
645
|
+
array.offset);
|
644
646
|
}
|
645
647
|
break;
|
646
648
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
#ifndef DUCKDB_VERSION
|
2
|
-
#define DUCKDB_VERSION "0.8.2-
|
2
|
+
#define DUCKDB_VERSION "0.8.2-dev2283"
|
3
3
|
#endif
|
4
4
|
#ifndef DUCKDB_SOURCE_ID
|
5
|
-
#define DUCKDB_SOURCE_ID "
|
5
|
+
#define DUCKDB_SOURCE_ID "e89665e802"
|
6
6
|
#endif
|
7
7
|
#include "duckdb/function/table/system_functions.hpp"
|
8
8
|
#include "duckdb/main/database.hpp"
|
@@ -360,6 +360,21 @@ The instantiated connection should be closed using 'duckdb_disconnect'
|
|
360
360
|
*/
|
361
361
|
DUCKDB_API duckdb_state duckdb_connect(duckdb_database database, duckdb_connection *out_connection);
|
362
362
|
|
363
|
+
/*!
|
364
|
+
Interrupt running query
|
365
|
+
|
366
|
+
* connection: The connection to interruot
|
367
|
+
*/
|
368
|
+
DUCKDB_API void duckdb_interrupt(duckdb_connection connection);
|
369
|
+
|
370
|
+
/*!
|
371
|
+
Get progress of the running query
|
372
|
+
|
373
|
+
* connection: The working connection
|
374
|
+
* returns: -1 if no progress or a percentage of the progress
|
375
|
+
*/
|
376
|
+
DUCKDB_API double duckdb_query_progress(duckdb_connection connection);
|
377
|
+
|
363
378
|
/*!
|
364
379
|
Closes the specified connection and de-allocates all memory allocated for that connection.
|
365
380
|
|
@@ -54,6 +54,22 @@ duckdb_state duckdb_connect(duckdb_database database, duckdb_connection *out) {
|
|
54
54
|
return DuckDBSuccess;
|
55
55
|
}
|
56
56
|
|
57
|
+
void duckdb_interrupt(duckdb_connection connection) {
|
58
|
+
if (!connection) {
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
Connection *conn = reinterpret_cast<Connection *>(connection);
|
62
|
+
conn->Interrupt();
|
63
|
+
}
|
64
|
+
|
65
|
+
double duckdb_query_progress(duckdb_connection connection) {
|
66
|
+
if (!connection) {
|
67
|
+
return -1;
|
68
|
+
}
|
69
|
+
Connection *conn = reinterpret_cast<Connection *>(connection);
|
70
|
+
return conn->context->GetProgress();
|
71
|
+
}
|
72
|
+
|
57
73
|
void duckdb_disconnect(duckdb_connection *connection) {
|
58
74
|
if (connection && *connection) {
|
59
75
|
Connection *conn = reinterpret_cast<Connection *>(*connection);
|
@@ -89,16 +89,19 @@ idx_t ListColumnData::ScanCount(ColumnScanState &state, Vector &result, idx_t co
|
|
89
89
|
D_ASSERT(scan_count > 0);
|
90
90
|
validity.ScanCount(state.child_states[0], result, count);
|
91
91
|
|
92
|
-
|
93
|
-
|
92
|
+
UnifiedVectorFormat offsets;
|
93
|
+
offset_vector.ToUnifiedFormat(scan_count, offsets);
|
94
|
+
auto data = UnifiedVectorFormat::GetData<uint64_t>(offsets);
|
95
|
+
auto last_entry = data[offsets.sel->get_index(scan_count - 1)];
|
94
96
|
|
95
97
|
// shift all offsets so they are 0 at the first entry
|
96
98
|
auto result_data = FlatVector::GetData<list_entry_t>(result);
|
97
99
|
auto base_offset = state.last_offset;
|
98
100
|
idx_t current_offset = 0;
|
99
101
|
for (idx_t i = 0; i < scan_count; i++) {
|
102
|
+
auto offset_index = offsets.sel->get_index(i);
|
100
103
|
result_data[i].offset = current_offset;
|
101
|
-
result_data[i].length = data[
|
104
|
+
result_data[i].length = data[offset_index] - current_offset - base_offset;
|
102
105
|
current_offset += result_data[i].length;
|
103
106
|
}
|
104
107
|
|