duckdb 0.3.2-dev1286.0 → 0.3.2-dev1304.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.3.2-dev1286.0",
4
+ "version": "0.3.2-dev1304.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
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
- unique_ptr<ArrowArrayWrapper> ArrowArrayStreamWrapper::GetNextChunk() {
4741
- auto current_chunk = make_unique<ArrowArrayWrapper>();
4771
+ shared_ptr<ArrowArrayWrapper> ArrowArrayStreamWrapper::GetNextChunk() {
4772
+ auto current_chunk = make_shared<ArrowArrayWrapper>();
4742
4773
  if (arrow_array_stream.get_next(&arrow_array_stream, &current_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);
@@ -58342,8 +58401,8 @@ bool BufferedCSVReader::ReadBuffer(idx_t &start) {
58342
58401
  while (remaining > buffer_read_size) {
58343
58402
  buffer_read_size *= 2;
58344
58403
  }
58345
- if (remaining + buffer_read_size > MAXIMUM_CSV_LINE_SIZE) {
58346
- throw InvalidInputException("Maximum line size of %llu bytes exceeded!", MAXIMUM_CSV_LINE_SIZE);
58404
+ if (remaining + buffer_read_size > options.maximum_line_size) {
58405
+ throw InvalidInputException("Maximum line size of %llu bytes exceeded!", options.maximum_line_size);
58347
58406
  }
58348
58407
  buffer = unique_ptr<char[]>(new char[buffer_read_size + remaining + 1]);
58349
58408
  buffer_size = remaining + buffer_read_size;
@@ -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
- unique_ptr<ArrowArrayWrapper> chunk;
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);
@@ -91497,6 +91559,8 @@ static bool ParseBaseOption(BufferedCSVReaderOptions &options, string &loption,
91497
91559
  options.compression = FileCompressionTypeFromString(ParseString(set));
91498
91560
  } else if (loption == "skip") {
91499
91561
  options.skip_rows = ParseInteger(set);
91562
+ } else if (loption == "max_line_size" || loption == "maximum_line_size") {
91563
+ options.maximum_line_size = ParseInteger(set);
91500
91564
  } else {
91501
91565
  // unrecognized option in base CSV
91502
91566
  return false;
@@ -92801,6 +92865,8 @@ static unique_ptr<FunctionData> ReadCSVBind(ClientContext &context, vector<Value
92801
92865
  result->include_file_name = BooleanValue::Get(kv.second);
92802
92866
  } else if (loption == "skip") {
92803
92867
  options.skip_rows = kv.second.GetValue<int64_t>();
92868
+ } else if (loption == "max_line_size" || loption == "maximum_line_size") {
92869
+ options.maximum_line_size = kv.second.GetValue<int64_t>();
92804
92870
  } else {
92805
92871
  throw InternalException("Unrecognized parameter %s", kv.first);
92806
92872
  }
@@ -92907,6 +92973,8 @@ static void ReadCSVAddNamedParameters(TableFunction &table_function) {
92907
92973
  table_function.named_parameters["compression"] = LogicalType::VARCHAR;
92908
92974
  table_function.named_parameters["filename"] = LogicalType::BOOLEAN;
92909
92975
  table_function.named_parameters["skip"] = LogicalType::BIGINT;
92976
+ table_function.named_parameters["max_line_size"] = LogicalType::VARCHAR;
92977
+ table_function.named_parameters["maximum_line_size"] = LogicalType::VARCHAR;
92910
92978
  }
92911
92979
 
92912
92980
  double CSVReaderProgress(ClientContext &context, const FunctionData *bind_data_p) {
@@ -222743,12 +222811,17 @@ static void allocate_new(parser_state *state, size_t n) {
222743
222811
 
222744
222812
  void *palloc(size_t n) {
222745
222813
  // we need to align our pointers for the sanitizer
222746
- auto aligned_n = ((n + 7) / 8) * 8;
222814
+ auto allocate_n = n + sizeof(size_t);
222815
+ auto aligned_n = ((allocate_n + 7) / 8) * 8;
222747
222816
  if (pg_parser_state.malloc_pos + aligned_n > PG_MALLOC_SIZE) {
222748
222817
  allocate_new(&pg_parser_state, aligned_n);
222749
222818
  }
222750
222819
 
222751
- void *ptr = pg_parser_state.malloc_ptrs[pg_parser_state.malloc_ptr_idx - 1] + pg_parser_state.malloc_pos;
222820
+ // store the length of the allocation
222821
+ char *base_ptr = pg_parser_state.malloc_ptrs[pg_parser_state.malloc_ptr_idx - 1] + pg_parser_state.malloc_pos;
222822
+ memcpy(base_ptr, &n, sizeof(size_t));
222823
+ // store the actual pointer
222824
+ char *ptr = (char*) base_ptr + sizeof(size_t);
222752
222825
  memset(ptr, 0, n);
222753
222826
  pg_parser_state.malloc_pos += aligned_n;
222754
222827
  return ptr;
@@ -222861,7 +222934,14 @@ void *palloc0fast(size_t n) { // very fast
222861
222934
  return palloc(n);
222862
222935
  }
222863
222936
  void *repalloc(void *ptr, size_t n) {
222864
- return palloc(n);
222937
+ // get the length of the allocation
222938
+ size_t old_len;
222939
+ char *old_len_ptr = (char *) ptr - sizeof(size_t);
222940
+ memcpy((void *) &old_len, old_len_ptr, sizeof(size_t));
222941
+ // re-allocate and copy the data
222942
+ void *new_buf = palloc(n);
222943
+ memcpy(new_buf, ptr, old_len);
222944
+ return new_buf;
222865
222945
  }
222866
222946
  char *NameListToString(PGList *names) {
222867
222947
  throw std::runtime_error("NameListToString NOT IMPLEMENTED");
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 "1b5ee6dd7"
15
- #define DUCKDB_VERSION "v0.3.2-dev1286"
14
+ #define DUCKDB_SOURCE_ID "180367f93"
15
+ #define DUCKDB_VERSION "v0.3.2-dev1304"
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