duckdb 0.5.2-dev2251.0 → 0.5.2-dev2256.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
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.5.2-dev2251.0",
5
+ "version": "0.5.2-dev2256.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -81718,6 +81718,16 @@ bool ParallelCSVReader::SetPosition(DataChunk &insert_chunk) {
81718
81718
  if (buffer->buffer->IsCSVFileFirstBuffer() && start_buffer == position_buffer &&
81719
81719
  start_buffer == buffer->buffer->GetStart()) {
81720
81720
  // First buffer doesn't need any setting
81721
+ // Unless we have a header
81722
+ if (options.header && options.auto_detect) {
81723
+ for (; position_buffer < end_buffer; position_buffer++) {
81724
+ if (StringUtil::CharacterIsNewline((*buffer)[position_buffer])) {
81725
+ position_buffer++;
81726
+ return true;
81727
+ }
81728
+ }
81729
+ return false;
81730
+ }
81721
81731
  return true;
81722
81732
  }
81723
81733
 
@@ -81841,8 +81851,9 @@ normal : {
81841
81851
  goto add_value;
81842
81852
  } else if (StringUtil::CharacterIsNewline(c)) {
81843
81853
  // newline: add row
81844
- D_ASSERT(try_add_line || column == insert_chunk.ColumnCount() - 1);
81845
- goto add_row;
81854
+ if (column > 0 || try_add_line) {
81855
+ goto add_row;
81856
+ }
81846
81857
  }
81847
81858
  }
81848
81859
  if (!BufferRemainder()) {
@@ -82016,9 +82027,8 @@ final_state : {
82016
82027
  }
82017
82028
  // If this is the last buffer, we have to read the last value
82018
82029
  if (buffer->buffer->IsCSVFileLastBuffer() || (buffer->next_buffer->IsCSVFileLastBuffer())) {
82019
- if (column > 0 || position_buffer > start_buffer) {
82030
+ if (column > 0 || try_add_line) {
82020
82031
  // remaining values to be added to the chunk
82021
- D_ASSERT(column == insert_chunk.ColumnCount() - 1);
82022
82032
  AddValue(buffer->GetValue(start_buffer, position_buffer, offset), column, escape_positions, has_quotes);
82023
82033
  if (try_add_line) {
82024
82034
  bool success = column == sql_types.size();
@@ -126407,13 +126417,10 @@ static unique_ptr<GlobalTableFunctionState> ParallelCSVInitGlobal(ClientContext
126407
126417
  return make_unique<ParallelCSVGlobalState>();
126408
126418
  }
126409
126419
  unique_ptr<CSVFileHandle> file_handle;
126410
- if (bind_data.initial_reader) {
126411
- file_handle = move(bind_data.initial_reader->file_handle);
126412
- bind_data.initial_reader.reset();
126413
- } else {
126414
- bind_data.options.file_path = bind_data.files[0];
126415
- file_handle = ReadCSV::OpenCSV(bind_data.options, context);
126416
- }
126420
+
126421
+ bind_data.options.file_path = bind_data.files[0];
126422
+ file_handle = ReadCSV::OpenCSV(bind_data.options, context);
126423
+
126417
126424
  idx_t rows_to_skip = bind_data.options.skip_rows + (bind_data.options.has_header ? 1 : 0);
126418
126425
  return make_unique<ParallelCSVGlobalState>(context, move(file_handle), bind_data.files,
126419
126426
  context.db->NumberOfThreads(), bind_data.options.buffer_size,
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 "2d34ffb455"
15
- #define DUCKDB_VERSION "v0.5.2-dev2251"
14
+ #define DUCKDB_SOURCE_ID "47bb125a91"
15
+ #define DUCKDB_VERSION "v0.5.2-dev2256"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //