duckdb 0.3.2-dev26.0 → 0.3.2-dev29.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-dev26.0",
4
+ "version": "0.3.2-dev29.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -61228,15 +61228,9 @@ struct BufferedCSVReaderOptions {
61228
61228
  //! Whether or not a type format is specified
61229
61229
  std::map<LogicalTypeId, bool> has_format = {{LogicalTypeId::DATE, false}, {LogicalTypeId::TIMESTAMP, false}};
61230
61230
 
61231
- std::string toString() const {
61232
- return "DELIMITER='" + delimiter + (has_delimiter ? "'" : (auto_detect ? "' (auto detected)" : "' (default)")) +
61233
- ", QUOTE='" + quote + (has_quote ? "'" : (auto_detect ? "' (auto detected)" : "' (default)")) +
61234
- ", ESCAPE='" + escape + (has_escape ? "'" : (auto_detect ? "' (auto detected)" : "' (default)")) +
61235
- ", HEADER=" + std::to_string(header) +
61236
- (has_header ? "" : (auto_detect ? " (auto detected)" : "' (default)")) +
61237
- ", SAMPLE_SIZE=" + std::to_string(sample_chunk_size * sample_chunks) +
61238
- ", ALL_VARCHAR=" + std::to_string(all_varchar);
61239
- }
61231
+ void SetDelimiter(const string &delimiter);
61232
+
61233
+ std::string ToString() const;
61240
61234
  };
61241
61235
 
61242
61236
  enum class ParserMode : uint8_t { PARSING = 0, SNIFFING_DIALECT = 1, SNIFFING_DATATYPES = 2, PARSING_HEADER = 3 };
@@ -61389,6 +61383,24 @@ private:
61389
61383
 
61390
61384
  namespace duckdb {
61391
61385
 
61386
+ void BufferedCSVReaderOptions::SetDelimiter(const string &input) {
61387
+ this->delimiter = StringUtil::Replace(input, "\\t", "\t");
61388
+ this->has_delimiter = true;
61389
+ if (input.empty()) {
61390
+ throw BinderException("DELIM or SEP must not be empty");
61391
+ }
61392
+ }
61393
+
61394
+ std::string BufferedCSVReaderOptions::ToString() const {
61395
+ return "DELIMITER='" + delimiter + (has_delimiter ? "'" : (auto_detect ? "' (auto detected)" : "' (default)")) +
61396
+ ", QUOTE='" + quote + (has_quote ? "'" : (auto_detect ? "' (auto detected)" : "' (default)")) +
61397
+ ", ESCAPE='" + escape + (has_escape ? "'" : (auto_detect ? "' (auto detected)" : "' (default)")) +
61398
+ ", HEADER=" + std::to_string(header) +
61399
+ (has_header ? "" : (auto_detect ? " (auto detected)" : "' (default)")) +
61400
+ ", SAMPLE_SIZE=" + std::to_string(sample_chunk_size * sample_chunks) +
61401
+ ", ALL_VARCHAR=" + std::to_string(all_varchar);
61402
+ }
61403
+
61392
61404
  static string GetLineNumberStr(idx_t linenr, bool linenr_estimated) {
61393
61405
  string estimated = (linenr_estimated ? string(" (estimated)") : string(""));
61394
61406
  return to_string(linenr + 1) + estimated;
@@ -62202,7 +62214,7 @@ vector<LogicalType> BufferedCSVReader::RefineTypeDetection(const vector<LogicalT
62202
62214
  if (requested_types.size() != options.num_cols) {
62203
62215
  throw InvalidInputException(
62204
62216
  "Error while determining column types: found %lld columns but expected %d. (%s)", options.num_cols,
62205
- requested_types.size(), options.toString());
62217
+ requested_types.size(), options.ToString());
62206
62218
  } else {
62207
62219
  detected_types = requested_types;
62208
62220
  }
@@ -62460,7 +62472,7 @@ in_quotes:
62460
62472
  } while (ReadBuffer(start));
62461
62473
  // still in quoted state at the end of the file, error:
62462
62474
  error_message = StringUtil::Format("Error in file \"%s\" on line %s: unterminated quotes. (%s)", options.file_path,
62463
- GetLineNumberStr(linenr, linenr_estimated).c_str(), options.toString());
62475
+ GetLineNumberStr(linenr, linenr_estimated).c_str(), options.ToString());
62464
62476
  return false;
62465
62477
  unquote:
62466
62478
  /* state: unquote */
@@ -62490,7 +62502,7 @@ unquote:
62490
62502
  error_message = StringUtil::Format(
62491
62503
  "Error in file \"%s\" on line %s: quote should be followed by end of value, end "
62492
62504
  "of row or another quote. (%s)",
62493
- options.file_path, GetLineNumberStr(linenr, linenr_estimated).c_str(), options.toString());
62505
+ options.file_path, GetLineNumberStr(linenr, linenr_estimated).c_str(), options.ToString());
62494
62506
  return false;
62495
62507
  }
62496
62508
  if (delimiter_pos == options.delimiter.size()) {
@@ -62507,7 +62519,7 @@ unquote:
62507
62519
  } while (ReadBuffer(start));
62508
62520
  error_message = StringUtil::Format(
62509
62521
  "Error in file \"%s\" on line %s: quote should be followed by end of value, end of row or another quote. (%s)",
62510
- options.file_path, GetLineNumberStr(linenr, linenr_estimated).c_str(), options.toString());
62522
+ options.file_path, GetLineNumberStr(linenr, linenr_estimated).c_str(), options.ToString());
62511
62523
  return false;
62512
62524
  handle_escape:
62513
62525
  escape_pos = 0;
@@ -62522,7 +62534,7 @@ handle_escape:
62522
62534
  if (count > escape_pos && count > quote_pos) {
62523
62535
  error_message = StringUtil::Format(
62524
62536
  "Error in file \"%s\" on line %s: neither QUOTE nor ESCAPE is proceeded by ESCAPE. (%s)",
62525
- options.file_path, GetLineNumberStr(linenr, linenr_estimated).c_str(), options.toString());
62537
+ options.file_path, GetLineNumberStr(linenr, linenr_estimated).c_str(), options.ToString());
62526
62538
  return false;
62527
62539
  }
62528
62540
  if (quote_pos == options.quote.size() || escape_pos == options.escape.size()) {
@@ -62533,7 +62545,7 @@ handle_escape:
62533
62545
  } while (ReadBuffer(start));
62534
62546
  error_message =
62535
62547
  StringUtil::Format("Error in file \"%s\" on line %s: neither QUOTE nor ESCAPE is proceeded by ESCAPE. (%s)",
62536
- options.file_path, GetLineNumberStr(linenr, linenr_estimated).c_str(), options.toString());
62548
+ options.file_path, GetLineNumberStr(linenr, linenr_estimated).c_str(), options.ToString());
62537
62549
  return false;
62538
62550
  carriage_return:
62539
62551
  /* state: carriage_return */
@@ -62665,7 +62677,7 @@ in_quotes:
62665
62677
  } while (ReadBuffer(start));
62666
62678
  // still in quoted state at the end of the file, error:
62667
62679
  throw InvalidInputException("Error in file \"%s\" on line %s: unterminated quotes. (%s)", options.file_path,
62668
- GetLineNumberStr(linenr, linenr_estimated).c_str(), options.toString());
62680
+ GetLineNumberStr(linenr, linenr_estimated).c_str(), options.ToString());
62669
62681
  unquote:
62670
62682
  /* state: unquote */
62671
62683
  // this state handles the state directly after we unquote
@@ -62692,7 +62704,7 @@ unquote:
62692
62704
  error_message = StringUtil::Format(
62693
62705
  "Error in file \"%s\" on line %s: quote should be followed by end of value, end of "
62694
62706
  "row or another quote. (%s)",
62695
- options.file_path, GetLineNumberStr(linenr, linenr_estimated).c_str(), options.toString());
62707
+ options.file_path, GetLineNumberStr(linenr, linenr_estimated).c_str(), options.ToString());
62696
62708
  return false;
62697
62709
  }
62698
62710
  handle_escape:
@@ -62702,13 +62714,13 @@ handle_escape:
62702
62714
  if (position >= buffer_size && !ReadBuffer(start)) {
62703
62715
  error_message = StringUtil::Format(
62704
62716
  "Error in file \"%s\" on line %s: neither QUOTE nor ESCAPE is proceeded by ESCAPE. (%s)", options.file_path,
62705
- GetLineNumberStr(linenr, linenr_estimated).c_str(), options.toString());
62717
+ GetLineNumberStr(linenr, linenr_estimated).c_str(), options.ToString());
62706
62718
  return false;
62707
62719
  }
62708
62720
  if (buffer[position] != options.quote[0] && buffer[position] != options.escape[0]) {
62709
62721
  error_message = StringUtil::Format(
62710
62722
  "Error in file \"%s\" on line %s: neither QUOTE nor ESCAPE is proceeded by ESCAPE. (%s)", options.file_path,
62711
- GetLineNumberStr(linenr, linenr_estimated).c_str(), options.toString());
62723
+ GetLineNumberStr(linenr, linenr_estimated).c_str(), options.ToString());
62712
62724
  return false;
62713
62725
  }
62714
62726
  // escape was followed by quote or escape, go back to quoted state
@@ -62848,7 +62860,7 @@ void BufferedCSVReader::AddValue(char *str_val, idx_t length, idx_t &column, vec
62848
62860
  if (column >= sql_types.size()) {
62849
62861
  throw InvalidInputException("Error on line %s: expected %lld values per row, but got more. (%s)",
62850
62862
  GetLineNumberStr(linenr, linenr_estimated).c_str(), sql_types.size(),
62851
- options.toString());
62863
+ options.ToString());
62852
62864
  }
62853
62865
 
62854
62866
  // insert the line number into the chunk
@@ -62903,7 +62915,7 @@ bool BufferedCSVReader::AddRow(DataChunk &insert_chunk, idx_t &column) {
62903
62915
  if (column < sql_types.size() && mode != ParserMode::SNIFFING_DIALECT) {
62904
62916
  throw InvalidInputException("Error on line %s: expected %lld values per row, but got %d. (%s)",
62905
62917
  GetLineNumberStr(linenr, linenr_estimated).c_str(), sql_types.size(), column,
62906
- options.toString());
62918
+ options.ToString());
62907
62919
  }
62908
62920
 
62909
62921
  if (mode == ParserMode::SNIFFING_DIALECT) {
@@ -62956,7 +62968,7 @@ void BufferedCSVReader::Flush(DataChunk &insert_chunk) {
62956
62968
  throw InvalidInputException("Error in file \"%s\" between line %llu and %llu in column \"%s\": "
62957
62969
  "file is not valid UTF8. Parser options: %s",
62958
62970
  options.file_path, linenr - parse_chunk.size(), linenr, col_name,
62959
- options.toString());
62971
+ options.ToString());
62960
62972
  }
62961
62973
  }
62962
62974
  }
@@ -62990,11 +63002,11 @@ void BufferedCSVReader::Flush(DataChunk &insert_chunk) {
62990
63002
  "(SAMPLE_SIZE=X [X rows] or SAMPLE_SIZE=-1 [all rows]), "
62991
63003
  "or skipping column conversion (ALL_VARCHAR=1)",
62992
63004
  error_message, col_name, linenr - parse_chunk.size() + 1, linenr,
62993
- options.toString());
63005
+ options.ToString());
62994
63006
  } else {
62995
63007
  throw InvalidInputException("%s between line %llu and %llu in column %s. Parser options: %s ",
62996
63008
  error_message, linenr - parse_chunk.size(), linenr, col_name,
62997
- options.toString());
63009
+ options.ToString());
62998
63010
  }
62999
63011
  }
63000
63012
  }
@@ -94500,11 +94512,7 @@ static int64_t ParseInteger(vector<Value> &set) {
94500
94512
  //===--------------------------------------------------------------------===//
94501
94513
  static bool ParseBaseOption(BufferedCSVReaderOptions &options, string &loption, vector<Value> &set) {
94502
94514
  if (StringUtil::StartsWith(loption, "delim") || StringUtil::StartsWith(loption, "sep")) {
94503
- options.delimiter = ParseString(set);
94504
- options.has_delimiter = true;
94505
- if (options.delimiter.length() == 0) {
94506
- throw BinderException("DELIM or SEP must not be empty");
94507
- }
94515
+ options.SetDelimiter(ParseString(set));
94508
94516
  } else if (loption == "quote") {
94509
94517
  options.quote = ParseString(set);
94510
94518
  options.has_quote = true;
@@ -95789,8 +95797,7 @@ static unique_ptr<FunctionData> ReadCSVBind(ClientContext &context, vector<Value
95789
95797
  if (kv.first == "auto_detect") {
95790
95798
  options.auto_detect = kv.second.value_.boolean;
95791
95799
  } else if (kv.first == "sep" || kv.first == "delim") {
95792
- options.delimiter = kv.second.str_value;
95793
- options.has_delimiter = true;
95800
+ options.SetDelimiter(kv.second.str_value);
95794
95801
  } else if (kv.first == "header") {
95795
95802
  options.header = kv.second.value_.boolean;
95796
95803
  options.has_header = true;
package/src/duckdb.hpp CHANGED
@@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
10
10
 
11
11
  #pragma once
12
12
  #define DUCKDB_AMALGAMATION 1
13
- #define DUCKDB_SOURCE_ID "7c70a1d4d"
14
- #define DUCKDB_VERSION "0.3.2-dev26"
13
+ #define DUCKDB_SOURCE_ID "408ad6407"
14
+ #define DUCKDB_VERSION "0.3.2-dev29"
15
15
  //===----------------------------------------------------------------------===//
16
16
  // DuckDB
17
17
  //