duckdb 0.5.2-dev671.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 +1 -1
- package/src/duckdb.cpp +61 -16
- package/src/duckdb.hpp +12 -8
- package/src/parquet-amalgamation.cpp +37452 -37452
package/package.json
CHANGED
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,
|
|
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
|
-
|
|
35285
|
-
|
|
35286
|
-
|
|
35287
|
-
|
|
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
|
|
@@ -139886,8 +139907,12 @@ inline std::string GetDLError(void) {
|
|
|
139886
139907
|
namespace duckdb_mbedtls {
|
|
139887
139908
|
class MbedTlsWrapper {
|
|
139888
139909
|
public:
|
|
139910
|
+
static void ComputeSha256Hash(const char* in, size_t in_len, char* out);
|
|
139889
139911
|
static std::string ComputeSha256Hash(const std::string& file_content);
|
|
139890
139912
|
static bool IsValidSha256Signature(const std::string& pubkey, const std::string& signature, const std::string& sha256_hash);
|
|
139913
|
+
static void Hmac256(const char* key, size_t key_len, const char* message, size_t message_len, char* out);
|
|
139914
|
+
|
|
139915
|
+
static constexpr size_t SHA256_HASH_BYTES = 32;
|
|
139891
139916
|
};
|
|
139892
139917
|
}
|
|
139893
139918
|
|
|
@@ -328632,16 +328657,20 @@ openssl pkeyutl -sign -in hash -inkey private.pem -pkeyopt digest:sha256 -out du
|
|
|
328632
328657
|
*/
|
|
328633
328658
|
|
|
328634
328659
|
|
|
328635
|
-
|
|
328636
|
-
string hash;
|
|
328637
|
-
hash.resize(32);
|
|
328660
|
+
void MbedTlsWrapper::ComputeSha256Hash(const char* in, size_t in_len, char* out) {
|
|
328638
328661
|
|
|
328639
328662
|
mbedtls_sha256_context sha_context;
|
|
328640
328663
|
mbedtls_sha256_init(&sha_context);
|
|
328641
|
-
if(mbedtls_sha256_starts(&sha_context, false) || mbedtls_sha256_update(&sha_context, (const unsigned char*)
|
|
328664
|
+
if(mbedtls_sha256_starts(&sha_context, false) || mbedtls_sha256_update(&sha_context, (const unsigned char*) in, in_len) || mbedtls_sha256_finish(&sha_context, (unsigned char*)out)) {
|
|
328642
328665
|
throw runtime_error("SHA256 Error");
|
|
328643
328666
|
}
|
|
328644
328667
|
mbedtls_sha256_free(&sha_context);
|
|
328668
|
+
}
|
|
328669
|
+
|
|
328670
|
+
string MbedTlsWrapper::ComputeSha256Hash(const string& file_content) {
|
|
328671
|
+
string hash;
|
|
328672
|
+
hash.resize(MbedTlsWrapper::SHA256_HASH_BYTES);
|
|
328673
|
+
ComputeSha256Hash(file_content.data(), file_content.size(), (char*)hash.data());
|
|
328645
328674
|
return hash;
|
|
328646
328675
|
}
|
|
328647
328676
|
|
|
@@ -328668,6 +328697,22 @@ bool MbedTlsWrapper::IsValidSha256Signature(const std::string &pubkey, const std
|
|
|
328668
328697
|
return valid;
|
|
328669
328698
|
}
|
|
328670
328699
|
|
|
328700
|
+
// used in s3fs
|
|
328701
|
+
void MbedTlsWrapper::Hmac256(const char* key, size_t key_len, const char* message, size_t message_len, char* out) {
|
|
328702
|
+
mbedtls_md_context_t hmac_ctx;
|
|
328703
|
+
const mbedtls_md_info_t *md_type = mbedtls_md_info_from_type(MBEDTLS_MD_SHA256);
|
|
328704
|
+
if (!md_type) {
|
|
328705
|
+
throw runtime_error("failed to init hmac");
|
|
328706
|
+
}
|
|
328707
|
+
|
|
328708
|
+
if (mbedtls_md_setup(&hmac_ctx, md_type, 1) ||
|
|
328709
|
+
mbedtls_md_hmac_starts(&hmac_ctx, (const unsigned char *) key, key_len) ||
|
|
328710
|
+
mbedtls_md_hmac_update(&hmac_ctx, (const unsigned char *)message, message_len) ||
|
|
328711
|
+
mbedtls_md_hmac_finish(&hmac_ctx, (unsigned char *) out)) {
|
|
328712
|
+
throw runtime_error("HMAC256 Error");
|
|
328713
|
+
}
|
|
328714
|
+
mbedtls_md_free(&hmac_ctx);
|
|
328715
|
+
}
|
|
328671
328716
|
|
|
328672
328717
|
// LICENSE_CHANGE_END
|
|
328673
328718
|
|
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 "
|
|
15
|
-
#define DUCKDB_VERSION "v0.5.2-
|
|
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");
|