duckdb 0.3.2-dev1292.0 → 0.3.2-dev1302.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 +66 -4
- package/src/duckdb.hpp +166 -152
- package/src/parquet-amalgamation.cpp +34919 -34919
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -4687,6 +4687,37 @@ data_ptr_t Allocator::ReallocateData(data_ptr_t pointer, idx_t size) {
|
|
|
4687
4687
|
|
|
4688
4688
|
|
|
4689
4689
|
|
|
4690
|
+
|
|
4691
|
+
//===----------------------------------------------------------------------===//
|
|
4692
|
+
// DuckDB
|
|
4693
|
+
//
|
|
4694
|
+
// duckdb/common/result_arrow_wrapper.hpp
|
|
4695
|
+
//
|
|
4696
|
+
//
|
|
4697
|
+
//===----------------------------------------------------------------------===//
|
|
4698
|
+
|
|
4699
|
+
|
|
4700
|
+
|
|
4701
|
+
|
|
4702
|
+
|
|
4703
|
+
|
|
4704
|
+
namespace duckdb {
|
|
4705
|
+
class ResultArrowArrayStreamWrapper {
|
|
4706
|
+
public:
|
|
4707
|
+
explicit ResultArrowArrayStreamWrapper(unique_ptr<QueryResult> result, idx_t approx_batch_size);
|
|
4708
|
+
ArrowArrayStream stream;
|
|
4709
|
+
unique_ptr<QueryResult> result;
|
|
4710
|
+
std::string last_error;
|
|
4711
|
+
idx_t vectors_per_chunk;
|
|
4712
|
+
|
|
4713
|
+
private:
|
|
4714
|
+
static int MyStreamGetSchema(struct ArrowArrayStream *stream, struct ArrowSchema *out);
|
|
4715
|
+
static int MyStreamGetNext(struct ArrowArrayStream *stream, struct ArrowArray *out);
|
|
4716
|
+
static void MyStreamRelease(struct ArrowArrayStream *stream);
|
|
4717
|
+
static const char *MyStreamGetLastError(struct ArrowArrayStream *stream);
|
|
4718
|
+
};
|
|
4719
|
+
} // namespace duckdb
|
|
4720
|
+
|
|
4690
4721
|
namespace duckdb {
|
|
4691
4722
|
|
|
4692
4723
|
ArrowSchemaWrapper::~ArrowSchemaWrapper() {
|
|
@@ -4737,8 +4768,8 @@ void ArrowArrayStreamWrapper::GetSchema(ArrowSchemaWrapper &schema) {
|
|
|
4737
4768
|
// LCOV_EXCL_STOP
|
|
4738
4769
|
}
|
|
4739
4770
|
|
|
4740
|
-
|
|
4741
|
-
auto current_chunk =
|
|
4771
|
+
shared_ptr<ArrowArrayWrapper> ArrowArrayStreamWrapper::GetNextChunk() {
|
|
4772
|
+
auto current_chunk = make_shared<ArrowArrayWrapper>();
|
|
4742
4773
|
if (arrow_array_stream.get_next(&arrow_array_stream, ¤t_chunk->arrow_array)) { // LCOV_EXCL_START
|
|
4743
4774
|
throw InvalidInputException("arrow_scan: get_next failed(): %s", string(GetError()));
|
|
4744
4775
|
} // LCOV_EXCL_STOP
|
|
@@ -30174,7 +30205,29 @@ struct SelCache {
|
|
|
30174
30205
|
|
|
30175
30206
|
|
|
30176
30207
|
|
|
30208
|
+
//===----------------------------------------------------------------------===//
|
|
30209
|
+
// DuckDB
|
|
30210
|
+
//
|
|
30211
|
+
// duckdb/common/types/arrow_aux_data.hpp
|
|
30212
|
+
//
|
|
30213
|
+
//
|
|
30214
|
+
//===----------------------------------------------------------------------===//
|
|
30215
|
+
|
|
30216
|
+
|
|
30217
|
+
|
|
30218
|
+
|
|
30219
|
+
|
|
30220
|
+
|
|
30221
|
+
namespace duckdb {
|
|
30222
|
+
struct ArrowAuxiliaryData : VectorAuxiliaryData {
|
|
30223
|
+
explicit ArrowAuxiliaryData(shared_ptr<ArrowArrayWrapper> arrow_array_p)
|
|
30224
|
+
: VectorAuxiliaryData(VectorAuxiliaryDataType::ARROW_AUXILIARY), arrow_array(std::move(arrow_array_p)) {
|
|
30177
30225
|
|
|
30226
|
+
};
|
|
30227
|
+
~ArrowAuxiliaryData() override {};
|
|
30228
|
+
shared_ptr<ArrowArrayWrapper> arrow_array;
|
|
30229
|
+
};
|
|
30230
|
+
} // namespace duckdb
|
|
30178
30231
|
|
|
30179
30232
|
|
|
30180
30233
|
namespace duckdb {
|
|
@@ -30443,6 +30496,7 @@ struct DuckDBArrowArrayHolder {
|
|
|
30443
30496
|
vector<DuckDBArrowArrayChildHolder> children = {};
|
|
30444
30497
|
vector<ArrowArray *> children_ptrs = {};
|
|
30445
30498
|
array<const void *, 1> buffers = {{nullptr}};
|
|
30499
|
+
vector<shared_ptr<ArrowArrayWrapper>> arrow_original_array;
|
|
30446
30500
|
};
|
|
30447
30501
|
|
|
30448
30502
|
static void ReleaseDuckDBArrowArray(ArrowArray *array) {
|
|
@@ -30869,7 +30923,12 @@ void DataChunk::ToArrowArray(ArrowArray *out_array) {
|
|
|
30869
30923
|
InitializeChild(child_holder, size());
|
|
30870
30924
|
auto &vector = child_holder.vector;
|
|
30871
30925
|
auto &child = child_holder.array;
|
|
30872
|
-
|
|
30926
|
+
auto vec_buffer = data[col_idx].GetBuffer();
|
|
30927
|
+
if (vec_buffer->GetAuxiliaryData() &&
|
|
30928
|
+
vec_buffer->GetAuxiliaryDataType() == VectorAuxiliaryDataType::ARROW_AUXILIARY) {
|
|
30929
|
+
auto arrow_aux_data = (ArrowAuxiliaryData *)vec_buffer->GetAuxiliaryData();
|
|
30930
|
+
root_holder->arrow_original_array.push_back(arrow_aux_data->arrow_array);
|
|
30931
|
+
}
|
|
30873
30932
|
//! We could, in theory, output other types of vectors here, currently only FLAT Vectors
|
|
30874
30933
|
SetArrowChild(child_holder, GetTypes()[col_idx], data[col_idx], size());
|
|
30875
30934
|
SetChildValidityMask(*vector, child);
|
|
@@ -90093,7 +90152,7 @@ struct ArrowScanState : public FunctionOperatorData {
|
|
|
90093
90152
|
explicit ArrowScanState(unique_ptr<ArrowArrayWrapper> current_chunk) : chunk(move(current_chunk)) {
|
|
90094
90153
|
}
|
|
90095
90154
|
unique_ptr<ArrowArrayStreamWrapper> stream;
|
|
90096
|
-
|
|
90155
|
+
shared_ptr<ArrowArrayWrapper> chunk;
|
|
90097
90156
|
idx_t chunk_offset = 0;
|
|
90098
90157
|
vector<column_t> column_ids;
|
|
90099
90158
|
//! Store child vectors for Arrow Dictionary Vectors (col-idx,vector)
|
|
@@ -90172,6 +90231,7 @@ private:
|
|
|
90172
90231
|
|
|
90173
90232
|
|
|
90174
90233
|
|
|
90234
|
+
|
|
90175
90235
|
#include <map>
|
|
90176
90236
|
|
|
90177
90237
|
namespace duckdb {
|
|
@@ -91146,6 +91206,8 @@ void ArrowTableFunction::ArrowToDuckDB(ArrowScanState &scan_state,
|
|
|
91146
91206
|
if (array.length != scan_state.chunk->arrow_array.length) {
|
|
91147
91207
|
throw InvalidInputException("arrow_scan: array length mismatch");
|
|
91148
91208
|
}
|
|
91209
|
+
output.data[idx].GetBuffer()->SetAuxiliaryData(make_unique<ArrowAuxiliaryData>(scan_state.chunk),
|
|
91210
|
+
VectorAuxiliaryDataType::ARROW_AUXILIARY);
|
|
91149
91211
|
if (array.dictionary) {
|
|
91150
91212
|
ColumnArrowToDuckDBDictionary(output.data[idx], array, scan_state, output.size(), arrow_convert_data,
|
|
91151
91213
|
col_idx, arrow_convert_idx);
|
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 "506b05a10"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.2-dev1302"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -3323,6 +3323,21 @@ enum class VectorBufferType : uint8_t {
|
|
|
3323
3323
|
OPAQUE_BUFFER // opaque buffer, can be created for example by the parquet reader
|
|
3324
3324
|
};
|
|
3325
3325
|
|
|
3326
|
+
enum class VectorAuxiliaryDataType : uint8_t {
|
|
3327
|
+
ARROW_AUXILIARY // Holds Arrow Chunks that this vector depends on
|
|
3328
|
+
};
|
|
3329
|
+
|
|
3330
|
+
struct VectorAuxiliaryData {
|
|
3331
|
+
explicit VectorAuxiliaryData(VectorAuxiliaryDataType type_p)
|
|
3332
|
+
: type(type_p) {
|
|
3333
|
+
|
|
3334
|
+
};
|
|
3335
|
+
VectorAuxiliaryDataType type;
|
|
3336
|
+
|
|
3337
|
+
virtual ~VectorAuxiliaryData() {
|
|
3338
|
+
}
|
|
3339
|
+
};
|
|
3340
|
+
|
|
3326
3341
|
//! The VectorBuffer is a class used by the vector to hold its data
|
|
3327
3342
|
class VectorBuffer {
|
|
3328
3343
|
public:
|
|
@@ -3345,10 +3360,19 @@ public:
|
|
|
3345
3360
|
data_ptr_t GetData() {
|
|
3346
3361
|
return data.get();
|
|
3347
3362
|
}
|
|
3363
|
+
|
|
3348
3364
|
void SetData(unique_ptr<data_t[]> new_data) {
|
|
3349
3365
|
data = move(new_data);
|
|
3350
3366
|
}
|
|
3351
3367
|
|
|
3368
|
+
VectorAuxiliaryData *GetAuxiliaryData() {
|
|
3369
|
+
return aux_data.get();
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
void SetAuxiliaryData(unique_ptr<VectorAuxiliaryData> aux_data_p, VectorAuxiliaryDataType aux_type_p) {
|
|
3373
|
+
aux_data = move(aux_data_p);
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3352
3376
|
static buffer_ptr<VectorBuffer> CreateStandardVector(PhysicalType type, idx_t capacity = STANDARD_VECTOR_SIZE);
|
|
3353
3377
|
static buffer_ptr<VectorBuffer> CreateConstantVector(PhysicalType type);
|
|
3354
3378
|
static buffer_ptr<VectorBuffer> CreateConstantVector(const LogicalType &logical_type);
|
|
@@ -3359,8 +3383,13 @@ public:
|
|
|
3359
3383
|
return buffer_type;
|
|
3360
3384
|
}
|
|
3361
3385
|
|
|
3386
|
+
inline VectorAuxiliaryDataType GetAuxiliaryDataType() const {
|
|
3387
|
+
return aux_data->type;
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3362
3390
|
protected:
|
|
3363
3391
|
VectorBufferType buffer_type;
|
|
3392
|
+
unique_ptr<VectorAuxiliaryData> aux_data;
|
|
3364
3393
|
unique_ptr<data_t[]> data;
|
|
3365
3394
|
};
|
|
3366
3395
|
|
|
@@ -3846,6 +3875,141 @@ struct SequenceVector {
|
|
|
3846
3875
|
|
|
3847
3876
|
|
|
3848
3877
|
|
|
3878
|
+
//===----------------------------------------------------------------------===//
|
|
3879
|
+
// DuckDB
|
|
3880
|
+
//
|
|
3881
|
+
// duckdb/common/arrow_wrapper.hpp
|
|
3882
|
+
//
|
|
3883
|
+
//
|
|
3884
|
+
//===----------------------------------------------------------------------===//
|
|
3885
|
+
|
|
3886
|
+
|
|
3887
|
+
//===----------------------------------------------------------------------===//
|
|
3888
|
+
// DuckDB
|
|
3889
|
+
//
|
|
3890
|
+
// duckdb/common/arrow.hpp
|
|
3891
|
+
//
|
|
3892
|
+
//
|
|
3893
|
+
//===----------------------------------------------------------------------===//
|
|
3894
|
+
|
|
3895
|
+
#ifndef ARROW_FLAG_DICTIONARY_ORDERED
|
|
3896
|
+
|
|
3897
|
+
#include <stdint.h>
|
|
3898
|
+
|
|
3899
|
+
#ifdef __cplusplus
|
|
3900
|
+
extern "C" {
|
|
3901
|
+
#endif
|
|
3902
|
+
|
|
3903
|
+
#define ARROW_FLAG_DICTIONARY_ORDERED 1
|
|
3904
|
+
#define ARROW_FLAG_NULLABLE 2
|
|
3905
|
+
#define ARROW_FLAG_MAP_KEYS_SORTED 4
|
|
3906
|
+
|
|
3907
|
+
struct ArrowSchema {
|
|
3908
|
+
// Array type description
|
|
3909
|
+
const char *format;
|
|
3910
|
+
const char *name;
|
|
3911
|
+
const char *metadata;
|
|
3912
|
+
int64_t flags;
|
|
3913
|
+
int64_t n_children;
|
|
3914
|
+
struct ArrowSchema **children;
|
|
3915
|
+
struct ArrowSchema *dictionary;
|
|
3916
|
+
|
|
3917
|
+
// Release callback
|
|
3918
|
+
void (*release)(struct ArrowSchema *);
|
|
3919
|
+
// Opaque producer-specific data
|
|
3920
|
+
void *private_data;
|
|
3921
|
+
};
|
|
3922
|
+
|
|
3923
|
+
struct ArrowArray {
|
|
3924
|
+
// Array data description
|
|
3925
|
+
int64_t length;
|
|
3926
|
+
int64_t null_count;
|
|
3927
|
+
int64_t offset;
|
|
3928
|
+
int64_t n_buffers;
|
|
3929
|
+
int64_t n_children;
|
|
3930
|
+
const void **buffers;
|
|
3931
|
+
struct ArrowArray **children;
|
|
3932
|
+
struct ArrowArray *dictionary;
|
|
3933
|
+
|
|
3934
|
+
// Release callback
|
|
3935
|
+
void (*release)(struct ArrowArray *);
|
|
3936
|
+
// Opaque producer-specific data
|
|
3937
|
+
void *private_data;
|
|
3938
|
+
};
|
|
3939
|
+
|
|
3940
|
+
// EXPERIMENTAL
|
|
3941
|
+
struct ArrowArrayStream {
|
|
3942
|
+
// Callback to get the stream type
|
|
3943
|
+
// (will be the same for all arrays in the stream).
|
|
3944
|
+
// Return value: 0 if successful, an `errno`-compatible error code otherwise.
|
|
3945
|
+
int (*get_schema)(struct ArrowArrayStream *, struct ArrowSchema *out);
|
|
3946
|
+
// Callback to get the next array
|
|
3947
|
+
// (if no error and the array is released, the stream has ended)
|
|
3948
|
+
// Return value: 0 if successful, an `errno`-compatible error code otherwise.
|
|
3949
|
+
int (*get_next)(struct ArrowArrayStream *, struct ArrowArray *out);
|
|
3950
|
+
|
|
3951
|
+
// Callback to get optional detailed error information.
|
|
3952
|
+
// This must only be called if the last stream operation failed
|
|
3953
|
+
// with a non-0 return code. The returned pointer is only valid until
|
|
3954
|
+
// the next operation on this stream (including release).
|
|
3955
|
+
// If unavailable, NULL is returned.
|
|
3956
|
+
const char *(*get_last_error)(struct ArrowArrayStream *);
|
|
3957
|
+
|
|
3958
|
+
// Release callback: release the stream's own resources.
|
|
3959
|
+
// Note that arrays returned by `get_next` must be individually released.
|
|
3960
|
+
void (*release)(struct ArrowArrayStream *);
|
|
3961
|
+
// Opaque producer-specific data
|
|
3962
|
+
void *private_data;
|
|
3963
|
+
};
|
|
3964
|
+
|
|
3965
|
+
#ifdef __cplusplus
|
|
3966
|
+
}
|
|
3967
|
+
#endif
|
|
3968
|
+
|
|
3969
|
+
#endif
|
|
3970
|
+
|
|
3971
|
+
|
|
3972
|
+
|
|
3973
|
+
//! Here we have the internal duckdb classes that interact with Arrow's Internal Header (i.e., duckdb/commons/arrow.hpp)
|
|
3974
|
+
namespace duckdb {
|
|
3975
|
+
class ArrowSchemaWrapper {
|
|
3976
|
+
public:
|
|
3977
|
+
ArrowSchema arrow_schema;
|
|
3978
|
+
|
|
3979
|
+
ArrowSchemaWrapper() {
|
|
3980
|
+
arrow_schema.release = nullptr;
|
|
3981
|
+
}
|
|
3982
|
+
|
|
3983
|
+
~ArrowSchemaWrapper();
|
|
3984
|
+
};
|
|
3985
|
+
class ArrowArrayWrapper {
|
|
3986
|
+
public:
|
|
3987
|
+
ArrowArray arrow_array;
|
|
3988
|
+
ArrowArrayWrapper() {
|
|
3989
|
+
arrow_array.length = 0;
|
|
3990
|
+
arrow_array.release = nullptr;
|
|
3991
|
+
}
|
|
3992
|
+
~ArrowArrayWrapper();
|
|
3993
|
+
};
|
|
3994
|
+
|
|
3995
|
+
class ArrowArrayStreamWrapper {
|
|
3996
|
+
public:
|
|
3997
|
+
ArrowArrayStream arrow_array_stream;
|
|
3998
|
+
int64_t number_of_rows;
|
|
3999
|
+
void GetSchema(ArrowSchemaWrapper &schema);
|
|
4000
|
+
|
|
4001
|
+
shared_ptr<ArrowArrayWrapper> GetNextChunk();
|
|
4002
|
+
|
|
4003
|
+
const char *GetError();
|
|
4004
|
+
|
|
4005
|
+
~ArrowArrayStreamWrapper();
|
|
4006
|
+
ArrowArrayStreamWrapper() {
|
|
4007
|
+
arrow_array_stream.release = nullptr;
|
|
4008
|
+
}
|
|
4009
|
+
};
|
|
4010
|
+
} // namespace duckdb
|
|
4011
|
+
|
|
4012
|
+
|
|
3849
4013
|
struct ArrowArray;
|
|
3850
4014
|
|
|
3851
4015
|
namespace duckdb {
|
|
@@ -12871,89 +13035,6 @@ private:
|
|
|
12871
13035
|
//===----------------------------------------------------------------------===//
|
|
12872
13036
|
// DuckDB
|
|
12873
13037
|
//
|
|
12874
|
-
// duckdb/common/arrow.hpp
|
|
12875
|
-
//
|
|
12876
|
-
//
|
|
12877
|
-
//===----------------------------------------------------------------------===//
|
|
12878
|
-
|
|
12879
|
-
#ifndef ARROW_FLAG_DICTIONARY_ORDERED
|
|
12880
|
-
|
|
12881
|
-
#include <stdint.h>
|
|
12882
|
-
|
|
12883
|
-
#ifdef __cplusplus
|
|
12884
|
-
extern "C" {
|
|
12885
|
-
#endif
|
|
12886
|
-
|
|
12887
|
-
#define ARROW_FLAG_DICTIONARY_ORDERED 1
|
|
12888
|
-
#define ARROW_FLAG_NULLABLE 2
|
|
12889
|
-
#define ARROW_FLAG_MAP_KEYS_SORTED 4
|
|
12890
|
-
|
|
12891
|
-
struct ArrowSchema {
|
|
12892
|
-
// Array type description
|
|
12893
|
-
const char *format;
|
|
12894
|
-
const char *name;
|
|
12895
|
-
const char *metadata;
|
|
12896
|
-
int64_t flags;
|
|
12897
|
-
int64_t n_children;
|
|
12898
|
-
struct ArrowSchema **children;
|
|
12899
|
-
struct ArrowSchema *dictionary;
|
|
12900
|
-
|
|
12901
|
-
// Release callback
|
|
12902
|
-
void (*release)(struct ArrowSchema *);
|
|
12903
|
-
// Opaque producer-specific data
|
|
12904
|
-
void *private_data;
|
|
12905
|
-
};
|
|
12906
|
-
|
|
12907
|
-
struct ArrowArray {
|
|
12908
|
-
// Array data description
|
|
12909
|
-
int64_t length;
|
|
12910
|
-
int64_t null_count;
|
|
12911
|
-
int64_t offset;
|
|
12912
|
-
int64_t n_buffers;
|
|
12913
|
-
int64_t n_children;
|
|
12914
|
-
const void **buffers;
|
|
12915
|
-
struct ArrowArray **children;
|
|
12916
|
-
struct ArrowArray *dictionary;
|
|
12917
|
-
|
|
12918
|
-
// Release callback
|
|
12919
|
-
void (*release)(struct ArrowArray *);
|
|
12920
|
-
// Opaque producer-specific data
|
|
12921
|
-
void *private_data;
|
|
12922
|
-
};
|
|
12923
|
-
|
|
12924
|
-
// EXPERIMENTAL
|
|
12925
|
-
struct ArrowArrayStream {
|
|
12926
|
-
// Callback to get the stream type
|
|
12927
|
-
// (will be the same for all arrays in the stream).
|
|
12928
|
-
// Return value: 0 if successful, an `errno`-compatible error code otherwise.
|
|
12929
|
-
int (*get_schema)(struct ArrowArrayStream *, struct ArrowSchema *out);
|
|
12930
|
-
// Callback to get the next array
|
|
12931
|
-
// (if no error and the array is released, the stream has ended)
|
|
12932
|
-
// Return value: 0 if successful, an `errno`-compatible error code otherwise.
|
|
12933
|
-
int (*get_next)(struct ArrowArrayStream *, struct ArrowArray *out);
|
|
12934
|
-
|
|
12935
|
-
// Callback to get optional detailed error information.
|
|
12936
|
-
// This must only be called if the last stream operation failed
|
|
12937
|
-
// with a non-0 return code. The returned pointer is only valid until
|
|
12938
|
-
// the next operation on this stream (including release).
|
|
12939
|
-
// If unavailable, NULL is returned.
|
|
12940
|
-
const char *(*get_last_error)(struct ArrowArrayStream *);
|
|
12941
|
-
|
|
12942
|
-
// Release callback: release the stream's own resources.
|
|
12943
|
-
// Note that arrays returned by `get_next` must be individually released.
|
|
12944
|
-
void (*release)(struct ArrowArrayStream *);
|
|
12945
|
-
// Opaque producer-specific data
|
|
12946
|
-
void *private_data;
|
|
12947
|
-
};
|
|
12948
|
-
|
|
12949
|
-
#ifdef __cplusplus
|
|
12950
|
-
}
|
|
12951
|
-
#endif
|
|
12952
|
-
|
|
12953
|
-
#endif
|
|
12954
|
-
//===----------------------------------------------------------------------===//
|
|
12955
|
-
// DuckDB
|
|
12956
|
-
//
|
|
12957
13038
|
// duckdb/common/types/blob.hpp
|
|
12958
13039
|
//
|
|
12959
13040
|
//
|
|
@@ -20855,73 +20936,6 @@ public:
|
|
|
20855
20936
|
string ToString(const string &column_name) override;
|
|
20856
20937
|
};
|
|
20857
20938
|
|
|
20858
|
-
} // namespace duckdb
|
|
20859
|
-
//===----------------------------------------------------------------------===//
|
|
20860
|
-
// DuckDB
|
|
20861
|
-
//
|
|
20862
|
-
// duckdb/common/arrow_wrapper.hpp
|
|
20863
|
-
//
|
|
20864
|
-
//
|
|
20865
|
-
//===----------------------------------------------------------------------===//
|
|
20866
|
-
|
|
20867
|
-
|
|
20868
|
-
|
|
20869
|
-
|
|
20870
|
-
|
|
20871
|
-
|
|
20872
|
-
//! Here we have the internal duckdb classes that interact with Arrow's Internal Header (i.e., duckdb/commons/arrow.hpp)
|
|
20873
|
-
namespace duckdb {
|
|
20874
|
-
class ArrowSchemaWrapper {
|
|
20875
|
-
public:
|
|
20876
|
-
ArrowSchema arrow_schema;
|
|
20877
|
-
|
|
20878
|
-
ArrowSchemaWrapper() {
|
|
20879
|
-
arrow_schema.release = nullptr;
|
|
20880
|
-
}
|
|
20881
|
-
|
|
20882
|
-
~ArrowSchemaWrapper();
|
|
20883
|
-
};
|
|
20884
|
-
class ArrowArrayWrapper {
|
|
20885
|
-
public:
|
|
20886
|
-
ArrowArray arrow_array;
|
|
20887
|
-
ArrowArrayWrapper() {
|
|
20888
|
-
arrow_array.length = 0;
|
|
20889
|
-
arrow_array.release = nullptr;
|
|
20890
|
-
}
|
|
20891
|
-
~ArrowArrayWrapper();
|
|
20892
|
-
};
|
|
20893
|
-
|
|
20894
|
-
class ArrowArrayStreamWrapper {
|
|
20895
|
-
public:
|
|
20896
|
-
ArrowArrayStream arrow_array_stream;
|
|
20897
|
-
int64_t number_of_rows;
|
|
20898
|
-
void GetSchema(ArrowSchemaWrapper &schema);
|
|
20899
|
-
|
|
20900
|
-
unique_ptr<ArrowArrayWrapper> GetNextChunk();
|
|
20901
|
-
|
|
20902
|
-
const char *GetError();
|
|
20903
|
-
|
|
20904
|
-
~ArrowArrayStreamWrapper();
|
|
20905
|
-
ArrowArrayStreamWrapper() {
|
|
20906
|
-
arrow_array_stream.release = nullptr;
|
|
20907
|
-
}
|
|
20908
|
-
};
|
|
20909
|
-
|
|
20910
|
-
class ResultArrowArrayStreamWrapper {
|
|
20911
|
-
public:
|
|
20912
|
-
explicit ResultArrowArrayStreamWrapper(unique_ptr<QueryResult> result, idx_t approx_batch_size);
|
|
20913
|
-
ArrowArrayStream stream;
|
|
20914
|
-
unique_ptr<QueryResult> result;
|
|
20915
|
-
std::string last_error;
|
|
20916
|
-
idx_t vectors_per_chunk;
|
|
20917
|
-
|
|
20918
|
-
private:
|
|
20919
|
-
static int MyStreamGetSchema(struct ArrowArrayStream *stream, struct ArrowSchema *out);
|
|
20920
|
-
static int MyStreamGetNext(struct ArrowArrayStream *stream, struct ArrowArray *out);
|
|
20921
|
-
static void MyStreamRelease(struct ArrowArrayStream *stream);
|
|
20922
|
-
static const char *MyStreamGetLastError(struct ArrowArrayStream *stream);
|
|
20923
|
-
};
|
|
20924
|
-
|
|
20925
20939
|
} // namespace duckdb
|
|
20926
20940
|
//===----------------------------------------------------------------------===//
|
|
20927
20941
|
// DuckDB
|