duckdb 0.5.2-dev674.0 → 0.5.2-dev678.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.5.2-dev674.0",
4
+ "version": "0.5.2-dev678.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -29017,7 +29017,7 @@ struct RowOperations {
29017
29017
  namespace duckdb {
29018
29018
 
29019
29019
  template <class OP, class RETURN_TYPE, typename... ARGS>
29020
- RETURN_TYPE RadixBitsSwitch(idx_t radix_bits, ARGS &&...args) {
29020
+ RETURN_TYPE RadixBitsSwitch(idx_t radix_bits, ARGS &&... args) {
29021
29021
  D_ASSERT(radix_bits <= sizeof(hash_t) * 8);
29022
29022
  switch (radix_bits) {
29023
29023
  case 1:
@@ -29046,7 +29046,7 @@ RETURN_TYPE RadixBitsSwitch(idx_t radix_bits, ARGS &&...args) {
29046
29046
  }
29047
29047
 
29048
29048
  template <class OP, class RETURN_TYPE, idx_t radix_bits_1, typename... ARGS>
29049
- RETURN_TYPE DoubleRadixBitsSwitch2(idx_t radix_bits_2, ARGS &&...args) {
29049
+ RETURN_TYPE DoubleRadixBitsSwitch2(idx_t radix_bits_2, ARGS &&... args) {
29050
29050
  D_ASSERT(radix_bits_2 <= sizeof(hash_t) * 8);
29051
29051
  switch (radix_bits_2) {
29052
29052
  case 1:
@@ -29075,7 +29075,7 @@ RETURN_TYPE DoubleRadixBitsSwitch2(idx_t radix_bits_2, ARGS &&...args) {
29075
29075
  }
29076
29076
 
29077
29077
  template <class OP, class RETURN_TYPE, typename... ARGS>
29078
- RETURN_TYPE DoubleRadixBitsSwitch1(idx_t radix_bits_1, idx_t radix_bits_2, ARGS &&...args) {
29078
+ RETURN_TYPE DoubleRadixBitsSwitch1(idx_t radix_bits_1, idx_t radix_bits_2, ARGS &&... args) {
29079
29079
  D_ASSERT(radix_bits_1 <= sizeof(hash_t) * 8);
29080
29080
  switch (radix_bits_1) {
29081
29081
  case 1:
@@ -35158,7 +35158,8 @@ namespace duckdb {
35158
35158
 
35159
35159
  class BufferedFileReader : public Deserializer {
35160
35160
  public:
35161
- BufferedFileReader(FileSystem &fs, const char *path, FileOpener *opener = nullptr);
35161
+ BufferedFileReader(FileSystem &fs, const char *path, FileLockType lock_type = FileLockType::READ_LOCK,
35162
+ FileOpener *opener = nullptr);
35162
35163
 
35163
35164
  FileSystem &fs;
35164
35165
  unique_ptr<data_t[]> data;
@@ -35175,6 +35176,9 @@ public:
35175
35176
  return file_size;
35176
35177
  }
35177
35178
 
35179
+ void Seek(uint64_t location);
35180
+ uint64_t CurrentOffset();
35181
+
35178
35182
  private:
35179
35183
  idx_t file_size;
35180
35184
  idx_t total_read;
@@ -35190,10 +35194,9 @@ private:
35190
35194
 
35191
35195
  namespace duckdb {
35192
35196
 
35193
- BufferedFileReader::BufferedFileReader(FileSystem &fs, const char *path, FileOpener *opener)
35197
+ BufferedFileReader::BufferedFileReader(FileSystem &fs, const char *path, FileLockType lock_type, FileOpener *opener)
35194
35198
  : fs(fs), data(unique_ptr<data_t[]>(new data_t[FILE_BUFFER_SIZE])), offset(0), read_data(0), total_read(0) {
35195
- handle =
35196
- fs.OpenFile(path, FileFlags::FILE_FLAGS_READ, FileLockType::READ_LOCK, FileSystem::DEFAULT_COMPRESSION, opener);
35199
+ handle = fs.OpenFile(path, FileFlags::FILE_FLAGS_READ, lock_type, FileSystem::DEFAULT_COMPRESSION, opener);
35197
35200
  file_size = fs.GetFileSize(*handle);
35198
35201
  }
35199
35202
 
@@ -35227,6 +35230,17 @@ bool BufferedFileReader::Finished() {
35227
35230
  return total_read + offset == file_size;
35228
35231
  }
35229
35232
 
35233
+ void BufferedFileReader::Seek(uint64_t location) {
35234
+ D_ASSERT(location <= file_size);
35235
+ handle->Seek(location);
35236
+ total_read = location;
35237
+ read_data = offset = 0;
35238
+ }
35239
+
35240
+ uint64_t BufferedFileReader::CurrentOffset() {
35241
+ return total_read + offset;
35242
+ }
35243
+
35230
35244
  } // namespace duckdb
35231
35245
 
35232
35246
 
@@ -35244,7 +35258,7 @@ BufferedFileWriter::BufferedFileWriter(FileSystem &fs, const string &path_p, uin
35244
35258
  }
35245
35259
 
35246
35260
  int64_t BufferedFileWriter::GetFileSize() {
35247
- return fs.GetFileSize(*handle);
35261
+ return fs.GetFileSize(*handle) + offset;
35248
35262
  }
35249
35263
 
35250
35264
  idx_t BufferedFileWriter::GetTotalWritten() {
@@ -35281,10 +35295,17 @@ void BufferedFileWriter::Sync() {
35281
35295
  }
35282
35296
 
35283
35297
  void BufferedFileWriter::Truncate(int64_t size) {
35284
- // truncate the physical file on disk
35285
- handle->Truncate(size);
35286
- // reset anything written in the buffer
35287
- offset = 0;
35298
+ uint64_t persistent = fs.GetFileSize(*handle);
35299
+ D_ASSERT((uint64_t)size <= persistent + offset);
35300
+ if (persistent <= (uint64_t)size) {
35301
+ // truncating into the pending write buffer.
35302
+ offset = size - persistent;
35303
+ } else {
35304
+ // truncate the physical file on disk
35305
+ handle->Truncate(size);
35306
+ // reset anything written in the buffer
35307
+ offset = 0;
35308
+ }
35288
35309
  }
35289
35310
 
35290
35311
  } // namespace duckdb
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 "0543dbc6f"
15
- #define DUCKDB_VERSION "v0.5.2-dev674"
14
+ #define DUCKDB_SOURCE_ID "23b94dd87"
15
+ #define DUCKDB_VERSION "v0.5.2-dev678"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -1875,7 +1875,7 @@ public:
1875
1875
  }
1876
1876
 
1877
1877
  template <class T, typename... ARGS>
1878
- void ReadList(vector<unique_ptr<T>> &list, ARGS &&...args) {
1878
+ void ReadList(vector<unique_ptr<T>> &list, ARGS &&... args) {
1879
1879
  auto select_count = Read<uint32_t>();
1880
1880
  for (uint32_t i = 0; i < select_count; i++) {
1881
1881
  auto child = T::Deserialize(*this, std::forward<ARGS>(args)...);
@@ -1884,7 +1884,7 @@ public:
1884
1884
  }
1885
1885
 
1886
1886
  template <class T, class RETURN_TYPE = T, typename... ARGS>
1887
- unique_ptr<RETURN_TYPE> ReadOptional(ARGS &&...args) {
1887
+ unique_ptr<RETURN_TYPE> ReadOptional(ARGS &&... args) {
1888
1888
  auto has_entry = Read<bool>();
1889
1889
  if (has_entry) {
1890
1890
  return T::Deserialize(*this, std::forward<ARGS>(args)...);
@@ -2087,6 +2087,10 @@ public:
2087
2087
  //! Closes the file handle.
2088
2088
  DUCKDB_API virtual void Close() = 0;
2089
2089
 
2090
+ string GetPath() const {
2091
+ return path;
2092
+ }
2093
+
2090
2094
  public:
2091
2095
  FileSystem &file_system;
2092
2096
  string path;
@@ -13773,7 +13777,7 @@ public:
13773
13777
  }
13774
13778
 
13775
13779
  template <class T, typename... ARGS>
13776
- unique_ptr<T> ReadOptional(unique_ptr<T> default_value, ARGS &&...args) {
13780
+ unique_ptr<T> ReadOptional(unique_ptr<T> default_value, ARGS &&... args) {
13777
13781
  if (field_count >= max_field_count) {
13778
13782
  // field is not there, read the default value
13779
13783
  return default_value;
@@ -13795,7 +13799,7 @@ public:
13795
13799
  }
13796
13800
 
13797
13801
  template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
13798
- RETURN_TYPE ReadSerializable(RETURN_TYPE default_value, ARGS &&...args) {
13802
+ RETURN_TYPE ReadSerializable(RETURN_TYPE default_value, ARGS &&... args) {
13799
13803
  if (field_count >= max_field_count) {
13800
13804
  // field is not there, read the default value
13801
13805
  return default_value;
@@ -13817,7 +13821,7 @@ public:
13817
13821
  }
13818
13822
 
13819
13823
  template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
13820
- RETURN_TYPE ReadRequiredSerializable(ARGS &&...args) {
13824
+ RETURN_TYPE ReadRequiredSerializable(ARGS &&... args) {
13821
13825
  if (field_count >= max_field_count) {
13822
13826
  // field is not there, throw an exception
13823
13827
  throw SerializationException("Attempting to read mandatory field, but field is missing");
@@ -13828,7 +13832,7 @@ public:
13828
13832
  }
13829
13833
 
13830
13834
  template <class T, class RETURN_TYPE = unique_ptr<T>, typename... ARGS>
13831
- vector<RETURN_TYPE> ReadRequiredSerializableList(ARGS &&...args) {
13835
+ vector<RETURN_TYPE> ReadRequiredSerializableList(ARGS &&... args) {
13832
13836
  if (field_count >= max_field_count) {
13833
13837
  // field is not there, throw an exception
13834
13838
  throw SerializationException("Attempting to read mandatory field, but field is missing");