duckdb 0.7.1-dev2.0 → 0.7.1-dev43.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.7.1-dev2.0",
5
+ "version": "0.7.1-dev43.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -113,7 +113,7 @@ public:
113
113
  static constexpr char const *TYPE_STRING_OBJECT = "OBJECT";
114
114
 
115
115
  template <class YYJSON_VAL_T>
116
- static inline const char *const ValTypeToString(YYJSON_VAL_T *val) {
116
+ static inline const char *ValTypeToString(YYJSON_VAL_T *val) {
117
117
  switch (GetTag<YYJSON_VAL_T>(val)) {
118
118
  case YYJSON_TYPE_NULL | YYJSON_SUBTYPE_NONE:
119
119
  return JSONCommon::TYPE_STRING_NULL;
@@ -143,7 +143,7 @@ public:
143
143
  }
144
144
 
145
145
  template <class YYJSON_VAL_T>
146
- static inline const LogicalTypeId ValTypeToLogicalTypeId(YYJSON_VAL_T *val) {
146
+ static inline LogicalTypeId ValTypeToLogicalTypeId(YYJSON_VAL_T *val) {
147
147
  switch (GetTag<YYJSON_VAL_T>(val)) {
148
148
  case YYJSON_TYPE_NULL | YYJSON_SUBTYPE_NONE:
149
149
  return LogicalTypeId::SQLNULL;
@@ -253,6 +253,7 @@ bool JSONTransform::GetStringVector(yyjson_val *vals[], const idx_t count, const
253
253
  Vector &string_vector, JSONTransformOptions &options) {
254
254
  auto data = (string_t *)FlatVector::GetData(string_vector);
255
255
  auto &validity = FlatVector::Validity(string_vector);
256
+ validity.SetAllValid(count);
256
257
 
257
258
  for (idx_t i = 0; i < count; i++) {
258
259
  const auto &val = vals[i];
@@ -17,7 +17,7 @@ void JSONScan::AutoDetect(ClientContext &context, JSONScanData &bind_data, vecto
17
17
  {LogicalTypeId::DATE, {"%m-%d-%Y", "%m-%d-%y", "%d-%m-%Y", "%d-%m-%y", "%Y-%m-%d", "%y-%m-%d"}},
18
18
  {LogicalTypeId::TIMESTAMP,
19
19
  {"%Y-%m-%d %H:%M:%S.%f", "%m-%d-%Y %I:%M:%S %p", "%m-%d-%y %I:%M:%S %p", "%d-%m-%Y %H:%M:%S",
20
- "%d-%m-%y %H:%M:%S", "%Y-%m-%d %H:%M:%S", "%y-%m-%d %H:%M:%S"}},
20
+ "%d-%m-%y %H:%M:%S", "%Y-%m-%d %H:%M:%S", "%y-%m-%d %H:%M:%S", "%Y-%m-%dT%H:%M:%SZ"}},
21
21
  };
22
22
 
23
23
  // Populate possible date/timestamp formats, assume this is consistent across columns
@@ -946,13 +946,13 @@ static bool IntegerCastLoop(const char *buf, idx_t len, T &result, bool strict)
946
946
  ExponentData exponent {0, false};
947
947
  int negative = buf[pos] == '-';
948
948
  if (negative) {
949
- if (!IntegerCastLoop<ExponentData, true, false, IntegerCastOperation>(buf + pos, len - pos,
950
- exponent, strict)) {
949
+ if (!IntegerCastLoop<ExponentData, true, false, IntegerCastOperation, decimal_separator>(
950
+ buf + pos, len - pos, exponent, strict)) {
951
951
  return false;
952
952
  }
953
953
  } else {
954
- if (!IntegerCastLoop<ExponentData, false, false, IntegerCastOperation>(buf + pos, len - pos,
955
- exponent, strict)) {
954
+ if (!IntegerCastLoop<ExponentData, false, false, IntegerCastOperation, decimal_separator>(
955
+ buf + pos, len - pos, exponent, strict)) {
956
956
  return false;
957
957
  }
958
958
  }
@@ -65,7 +65,7 @@ idx_t Printer::TerminalWidth() {
65
65
  int columns, rows;
66
66
 
67
67
  GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
68
- rows = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
68
+ rows = csbi.srWindow.Right - csbi.srWindow.Left + 1;
69
69
  return rows;
70
70
  #else
71
71
  struct winsize w;
@@ -60,7 +60,7 @@ bool ParallelCSVReader::SetPosition(DataChunk &insert_chunk) {
60
60
  verification_positions.end_of_last_line = position_buffer;
61
61
  // First buffer doesn't need any setting
62
62
  // Unless we have a header
63
- if (options.header && options.auto_detect) {
63
+ if (options.header) {
64
64
  for (; position_buffer < end_buffer; position_buffer++) {
65
65
  if (StringUtil::CharacterIsNewline((*buffer)[position_buffer])) {
66
66
  bool carrier_return = (*buffer)[position_buffer] == '\r';
@@ -251,9 +251,6 @@ public:
251
251
  : file_handle(std::move(file_handle_p)), system_threads(system_threads_p), buffer_size(buffer_size_p),
252
252
  force_parallelism(force_parallelism_p) {
253
253
  current_file_path = files_path_p[0];
254
- for (idx_t i = 0; i < rows_to_skip; i++) {
255
- file_handle->ReadLine();
256
- }
257
254
  estimated_linenr = rows_to_skip;
258
255
  file_size = file_handle->FileSize();
259
256
  first_file_size = file_size;
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.7.1-dev2"
2
+ #define DUCKDB_VERSION "0.7.1-dev43"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "0f5e1ec507"
5
+ #define DUCKDB_SOURCE_ID "615a1b73e5"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -23,6 +23,8 @@ struct UpdateNode;
23
23
  class UpdateSegment {
24
24
  public:
25
25
  UpdateSegment(ColumnData &column_data);
26
+ // Construct a duplicate of 'other' with 'new_owner' as it's column data
27
+ UpdateSegment(UpdateSegment &other, ColumnData &new_owner);
26
28
  ~UpdateSegment();
27
29
 
28
30
  ColumnData &column_data;
@@ -128,6 +128,8 @@ unique_ptr<BoundTableRef> Binder::Bind(JoinRef &ref) {
128
128
  {
129
129
  LateralBinder binder(left_binder, context);
130
130
  result->right = right_binder.Bind(*ref.right);
131
+ result->correlated_columns = binder.ExtractCorrelatedColumns(right_binder);
132
+
131
133
  result->lateral = binder.HasCorrelatedColumns();
132
134
  if (result->lateral) {
133
135
  // lateral join: can only be an INNER or LEFT join
@@ -135,7 +137,6 @@ unique_ptr<BoundTableRef> Binder::Bind(JoinRef &ref) {
135
137
  throw BinderException("The combining JOIN type must be INNER or LEFT for a LATERAL reference");
136
138
  }
137
139
  }
138
- result->correlated_columns = binder.ExtractCorrelatedColumns(right_binder);
139
140
  }
140
141
 
141
142
  vector<unique_ptr<ParsedExpression>> extra_conditions;
@@ -39,14 +39,30 @@ BindResult LateralBinder::BindColumnRef(unique_ptr<ParsedExpression> *expr_ptr,
39
39
  }
40
40
 
41
41
  vector<CorrelatedColumnInfo> LateralBinder::ExtractCorrelatedColumns(Binder &binder) {
42
+
43
+ if (correlated_columns.empty()) {
44
+ return binder.correlated_columns;
45
+ }
46
+
47
+ // clear outer
48
+ correlated_columns.clear();
42
49
  auto all_correlated_columns = binder.correlated_columns;
43
- for (auto &correlated : correlated_columns) {
44
- auto entry = std::find(binder.correlated_columns.begin(), binder.correlated_columns.end(), correlated);
45
- if (entry == binder.correlated_columns.end()) {
46
- throw InternalException("Lateral Binder: could not find correlated column in binder");
50
+
51
+ // remove outer from inner
52
+ for (auto &corr_column : correlated_columns) {
53
+ auto entry = std::find(binder.correlated_columns.begin(), binder.correlated_columns.end(), corr_column);
54
+ if (entry != binder.correlated_columns.end()) {
55
+ binder.correlated_columns.erase(entry);
47
56
  }
48
- binder.correlated_columns.erase(entry);
49
57
  }
58
+
59
+ // add inner to outer
60
+ for (auto &corr_column : binder.correlated_columns) {
61
+ correlated_columns.push_back(corr_column);
62
+ }
63
+
64
+ // clear inner
65
+ binder.correlated_columns.clear();
50
66
  return all_correlated_columns;
51
67
  }
52
68
 
@@ -9,7 +9,8 @@ struct StorageVersionInfo {
9
9
  idx_t storage_version;
10
10
  };
11
11
 
12
- static StorageVersionInfo storage_version_info[] = {{"v0.6.0 or v0.6.1", 39},
12
+ static StorageVersionInfo storage_version_info[] = {{"v0.7.0", 43},
13
+ {"v0.6.0 or v0.6.1", 39},
13
14
  {"v0.5.0 or v0.5.1", 38},
14
15
  {"v0.3.3, v0.3.4 or v0.4.0", 33},
15
16
  {"v0.3.2", 31},
@@ -27,8 +27,10 @@ ColumnData::ColumnData(BlockManager &block_manager, DataTableInfo &info, idx_t c
27
27
 
28
28
  ColumnData::ColumnData(ColumnData &other, idx_t start, ColumnData *parent)
29
29
  : block_manager(other.block_manager), info(other.info), column_index(other.column_index), start(start),
30
- type(std::move(other.type)), parent(parent), updates(std::move(other.updates)),
31
- version(parent ? parent->version + 1 : 0) {
30
+ type(std::move(other.type)), parent(parent), version(parent ? parent->version + 1 : 0) {
31
+ if (other.updates) {
32
+ updates = make_unique<UpdateSegment>(*other.updates, *this);
33
+ }
32
34
  idx_t offset = 0;
33
35
  for (auto segment = other.data.GetRootSegment(); segment; segment = segment->Next()) {
34
36
  auto &other = (ColumnSegment &)*segment;
@@ -36,6 +36,21 @@ UpdateSegment::UpdateSegment(ColumnData &column_data)
36
36
  this->statistics_update_function = GetStatisticsUpdateFunction(physical_type);
37
37
  }
38
38
 
39
+ UpdateSegment::UpdateSegment(UpdateSegment &other, ColumnData &owner)
40
+ : column_data(owner), root(std::move(other.root)), stats(std::move(other.stats)), type_size(other.type_size) {
41
+
42
+ this->heap.Move(other.heap);
43
+
44
+ initialize_update_function = other.initialize_update_function;
45
+ merge_update_function = other.merge_update_function;
46
+ fetch_update_function = other.fetch_update_function;
47
+ fetch_committed_function = other.fetch_committed_function;
48
+ fetch_committed_range = other.fetch_committed_range;
49
+ fetch_row_function = other.fetch_row_function;
50
+ rollback_update_function = other.rollback_update_function;
51
+ statistics_update_function = other.statistics_update_function;
52
+ }
53
+
39
54
  UpdateSegment::~UpdateSegment() {
40
55
  }
41
56
 
@@ -41,6 +41,7 @@
41
41
  #include <vector>
42
42
  #include <exception>
43
43
  #include <typeinfo>
44
+ #include <cstddef>
44
45
 
45
46
  #include "thrift/TLogging.h"
46
47
  //#include <thrift/TOutput.h>
@@ -50,9 +51,14 @@
50
51
  namespace duckdb_apache {
51
52
  namespace thrift {
52
53
 
53
- class TEnumIterator
54
- : public std::iterator<std::forward_iterator_tag, std::pair<int, const char*> > {
54
+ class TEnumIterator {
55
55
  public:
56
+ using value_type = std::pair<int, const char*>;
57
+ using difference_type = std::ptrdiff_t;
58
+ using pointer = value_type*;
59
+ using reference = value_type&;
60
+ using iterator_category = std::forward_iterator_tag;
61
+
56
62
  TEnumIterator(int n, int* enums, const char** names)
57
63
  : ii_(0), n_(n), enums_(enums), names_(names) {}
58
64