duckdb 0.3.2-dev1288.0 → 0.3.2-dev1306.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 +140 -27
- package/src/duckdb.hpp +169 -154
- package/src/parquet-amalgamation.cpp +36532 -36532
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 "8835c86b4"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.2-dev1306"
|
|
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
|
//
|
|
@@ -20654,6 +20735,9 @@ struct BufferedCSVReaderOptions {
|
|
|
20654
20735
|
idx_t buffer_size = STANDARD_VECTOR_SIZE * 100;
|
|
20655
20736
|
//! Consider all columns to be of type varchar
|
|
20656
20737
|
bool all_varchar = false;
|
|
20738
|
+
//! Maximum CSV line size: specified because if we reach this amount, we likely have wrong delimiters (default: 2MB)
|
|
20739
|
+
idx_t maximum_line_size = 2097152;
|
|
20740
|
+
|
|
20657
20741
|
//! The date format to use (if any is specified)
|
|
20658
20742
|
std::map<LogicalTypeId, StrpTimeFormat> date_format = {{LogicalTypeId::DATE, {}}, {LogicalTypeId::TIMESTAMP, {}}};
|
|
20659
20743
|
//! Whether or not a type format is specified
|
|
@@ -20670,8 +20754,6 @@ enum class ParserMode : uint8_t { PARSING = 0, SNIFFING_DIALECT = 1, SNIFFING_DA
|
|
|
20670
20754
|
class BufferedCSVReader {
|
|
20671
20755
|
//! Initial buffer read size; can be extended for long lines
|
|
20672
20756
|
static constexpr idx_t INITIAL_BUFFER_SIZE = 16384;
|
|
20673
|
-
//! Maximum CSV line size: specified because if we reach this amount, we likely have the wrong delimiters
|
|
20674
|
-
static constexpr idx_t MAXIMUM_CSV_LINE_SIZE = 1048576;
|
|
20675
20757
|
ParserMode mode;
|
|
20676
20758
|
|
|
20677
20759
|
public:
|
|
@@ -20854,73 +20936,6 @@ public:
|
|
|
20854
20936
|
string ToString(const string &column_name) override;
|
|
20855
20937
|
};
|
|
20856
20938
|
|
|
20857
|
-
} // namespace duckdb
|
|
20858
|
-
//===----------------------------------------------------------------------===//
|
|
20859
|
-
// DuckDB
|
|
20860
|
-
//
|
|
20861
|
-
// duckdb/common/arrow_wrapper.hpp
|
|
20862
|
-
//
|
|
20863
|
-
//
|
|
20864
|
-
//===----------------------------------------------------------------------===//
|
|
20865
|
-
|
|
20866
|
-
|
|
20867
|
-
|
|
20868
|
-
|
|
20869
|
-
|
|
20870
|
-
|
|
20871
|
-
//! Here we have the internal duckdb classes that interact with Arrow's Internal Header (i.e., duckdb/commons/arrow.hpp)
|
|
20872
|
-
namespace duckdb {
|
|
20873
|
-
class ArrowSchemaWrapper {
|
|
20874
|
-
public:
|
|
20875
|
-
ArrowSchema arrow_schema;
|
|
20876
|
-
|
|
20877
|
-
ArrowSchemaWrapper() {
|
|
20878
|
-
arrow_schema.release = nullptr;
|
|
20879
|
-
}
|
|
20880
|
-
|
|
20881
|
-
~ArrowSchemaWrapper();
|
|
20882
|
-
};
|
|
20883
|
-
class ArrowArrayWrapper {
|
|
20884
|
-
public:
|
|
20885
|
-
ArrowArray arrow_array;
|
|
20886
|
-
ArrowArrayWrapper() {
|
|
20887
|
-
arrow_array.length = 0;
|
|
20888
|
-
arrow_array.release = nullptr;
|
|
20889
|
-
}
|
|
20890
|
-
~ArrowArrayWrapper();
|
|
20891
|
-
};
|
|
20892
|
-
|
|
20893
|
-
class ArrowArrayStreamWrapper {
|
|
20894
|
-
public:
|
|
20895
|
-
ArrowArrayStream arrow_array_stream;
|
|
20896
|
-
int64_t number_of_rows;
|
|
20897
|
-
void GetSchema(ArrowSchemaWrapper &schema);
|
|
20898
|
-
|
|
20899
|
-
unique_ptr<ArrowArrayWrapper> GetNextChunk();
|
|
20900
|
-
|
|
20901
|
-
const char *GetError();
|
|
20902
|
-
|
|
20903
|
-
~ArrowArrayStreamWrapper();
|
|
20904
|
-
ArrowArrayStreamWrapper() {
|
|
20905
|
-
arrow_array_stream.release = nullptr;
|
|
20906
|
-
}
|
|
20907
|
-
};
|
|
20908
|
-
|
|
20909
|
-
class ResultArrowArrayStreamWrapper {
|
|
20910
|
-
public:
|
|
20911
|
-
explicit ResultArrowArrayStreamWrapper(unique_ptr<QueryResult> result, idx_t approx_batch_size);
|
|
20912
|
-
ArrowArrayStream stream;
|
|
20913
|
-
unique_ptr<QueryResult> result;
|
|
20914
|
-
std::string last_error;
|
|
20915
|
-
idx_t vectors_per_chunk;
|
|
20916
|
-
|
|
20917
|
-
private:
|
|
20918
|
-
static int MyStreamGetSchema(struct ArrowArrayStream *stream, struct ArrowSchema *out);
|
|
20919
|
-
static int MyStreamGetNext(struct ArrowArrayStream *stream, struct ArrowArray *out);
|
|
20920
|
-
static void MyStreamRelease(struct ArrowArrayStream *stream);
|
|
20921
|
-
static const char *MyStreamGetLastError(struct ArrowArrayStream *stream);
|
|
20922
|
-
};
|
|
20923
|
-
|
|
20924
20939
|
} // namespace duckdb
|
|
20925
20940
|
//===----------------------------------------------------------------------===//
|
|
20926
20941
|
// DuckDB
|