Skip to content

Commit 1194fc2

Browse files
Update vendored DuckDB sources to e3509341f6
1 parent b24cfdf commit 1194fc2

6 files changed

Lines changed: 42 additions & 45 deletions

File tree

‎src/duckdb/src/function/table/version/pragma_version.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef DUCKDB_PATCH_VERSION
2-
#define DUCKDB_PATCH_VERSION "0-dev1450"
2+
#define DUCKDB_PATCH_VERSION "0-dev1462"
33
#endif
44
#ifndef DUCKDB_MINOR_VERSION
55
#define DUCKDB_MINOR_VERSION 6
@@ -8,10 +8,10 @@
88
#define DUCKDB_MAJOR_VERSION 1
99
#endif
1010
#ifndef DUCKDB_VERSION
11-
#define DUCKDB_VERSION "v1.6.0-dev1450"
11+
#define DUCKDB_VERSION "v1.6.0-dev1462"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "0bf859fca7"
14+
#define DUCKDB_SOURCE_ID "e3509341f6"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

‎src/duckdb/third_party/fsst/libfsst.cpp‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ std::ostream& operator<<(std::ostream& out, const Symbol& s) {
6060
return out;
6161
}
6262

63-
SymbolTable *buildSymbolTable(Counters& counters, vector<const u8*> line, const size_t len[], bool zeroTerminated=false) {
63+
SymbolTable *buildSymbolTable(Counters& counters, std::vector<const u8*> line, const size_t len[], bool zeroTerminated=false) {
6464
SymbolTable *st = new SymbolTable(), *bestTable = new SymbolTable();
6565
int bestGain = (int) -FSST_SAMPLEMAXSZ; // worst case (everything exception)
6666
size_t sampleFrac = 128;
@@ -161,13 +161,13 @@ SymbolTable *buildSymbolTable(Counters& counters, vector<const u8*> line, const
161161

162162
auto makeTable = [&](SymbolTable *st, Counters &counters) {
163163
// hashmap of c (needed because we can generate duplicate candidates)
164-
unordered_set<QSymbol> cands;
164+
std::unordered_set<QSymbol> cands;
165165

166166
// artificially make terminater the most frequent symbol so it gets included
167167
u16 terminator = st->nSymbols?FSST_CODE_BASE:st->terminator;
168168
counters.count1Set(terminator,65535);
169169

170-
auto addOrInc = [&](unordered_set<QSymbol> &cands, Symbol s, u64 count) {
170+
auto addOrInc = [&](std::unordered_set<QSymbol> &cands, Symbol s, u64 count) {
171171
if (count < (5*sampleFrac)/128) return; // improves both compression speed (less candidates), but also quality!!
172172
QSymbol q;
173173
q.symbol = s;
@@ -209,7 +209,7 @@ SymbolTable *buildSymbolTable(Counters& counters, vector<const u8*> line, const
209209

210210
// insert candidates into priority queue (by gain)
211211
auto cmpGn = [](const QSymbol& q1, const QSymbol& q2) { return (q1.gain < q2.gain) || (q1.gain == q2.gain && q1.symbol.load_num() > q2.symbol.load_num()); };
212-
priority_queue<QSymbol,vector<QSymbol>,decltype(cmpGn)> pq(cmpGn);
212+
std::priority_queue<QSymbol,std::vector<QSymbol>,decltype(cmpGn)> pq(cmpGn);
213213
for (auto& q : cands)
214214
pq.push(q);
215215

@@ -323,10 +323,10 @@ static inline size_t compressBulk(SymbolTable &symbolTable, size_t nlines, size_
323323
#define FSST_SAMPLELINE ((size_t) 512)
324324

325325
// quickly select a uniformly random set of lines such that we have between [FSST_SAMPLETARGET,FSST_SAMPLEMAXSZ) string bytes
326-
vector<const u8*> makeSample(u8* sampleBuf, u8* strIn[], size_t *lenIn, size_t nlines,
327-
duckdb::unique_ptr<vector<size_t>>& sample_len_out) {
326+
std::vector<const u8*> makeSample(u8* sampleBuf, u8* strIn[], size_t *lenIn, size_t nlines,
327+
duckdb::unique_ptr<std::vector<size_t>>& sample_len_out) {
328328
size_t totSize = 0;
329-
vector<const u8*> sample;
329+
std::vector<const u8*> sample;
330330

331331
for(size_t i=0; i<nlines; i++)
332332
totSize += lenIn[i];
@@ -338,7 +338,7 @@ vector<const u8*> makeSample(u8* sampleBuf, u8* strIn[], size_t *lenIn, size_t n
338338
size_t sampleRnd = FSST_HASH(4637947);
339339
const u8* sampleLim = sampleBuf + FSST_SAMPLETARGET;
340340

341-
sample_len_out = duckdb::unique_ptr<vector<size_t>>(new vector<size_t>());
341+
sample_len_out = duckdb::unique_ptr<std::vector<size_t>>(new std::vector<size_t>());
342342
sample_len_out->reserve(nlines + FSST_SAMPLEMAXSZ/FSST_SAMPLELINE);
343343

344344
// This fails if we have a lot of small strings and a few big ones?
@@ -355,7 +355,7 @@ vector<const u8*> makeSample(u8* sampleBuf, u8* strIn[], size_t *lenIn, size_t n
355355
size_t chunk = FSST_SAMPLELINE*(sampleRnd % chunks);
356356

357357
// add the chunk to the sample
358-
size_t len = min(lenIn[linenr]-chunk,FSST_SAMPLELINE);
358+
size_t len = std::min(lenIn[linenr]-chunk,FSST_SAMPLELINE);
359359
memcpy(sampleBuf, strIn[linenr]+chunk, len);
360360
sample.push_back(sampleBuf);
361361

@@ -368,11 +368,11 @@ vector<const u8*> makeSample(u8* sampleBuf, u8* strIn[], size_t *lenIn, size_t n
368368

369369
extern "C" duckdb_fsst_encoder_t* duckdb_fsst_create(size_t n, size_t lenIn[], u8 *strIn[], int zeroTerminated) {
370370
u8* sampleBuf = new u8[FSST_SAMPLEMAXSZ];
371-
duckdb::unique_ptr<vector<size_t>> sample_sizes;
372-
vector<const u8*> sample = makeSample(sampleBuf, strIn, lenIn, n?n:1, sample_sizes); // careful handling of input to get a right-size and representative sample
371+
duckdb::unique_ptr<std::vector<size_t>> sample_sizes;
372+
std::vector<const u8*> sample = makeSample(sampleBuf, strIn, lenIn, n?n:1, sample_sizes); // careful handling of input to get a right-size and representative sample
373373
Encoder *encoder = new Encoder();
374374
const size_t* sampleLen = sample_sizes ? sample_sizes->data() : &lenIn[0];
375-
encoder->symbolTable = shared_ptr<SymbolTable>(buildSymbolTable(encoder->counters, sample, sampleLen, zeroTerminated));
375+
encoder->symbolTable = std::shared_ptr<SymbolTable>(buildSymbolTable(encoder->counters, sample, sampleLen, zeroTerminated));
376376
delete[] sampleBuf;
377377
return (duckdb_fsst_encoder_t*) encoder;
378378
}
@@ -495,7 +495,7 @@ using namespace libfsst;
495495
// the main compression function (everything automatic)
496496
extern "C" size_t duckdb_fsst_compress(duckdb_fsst_encoder_t *encoder, size_t nlines, size_t lenIn[], u8 *strIn[], size_t size, u8 *output, size_t *lenOut, u8 *strOut[]) {
497497
// to be faster than scalar, simd needs 64 lines or more of length >=12; or fewer lines, but big ones (totLen > 32KB)
498-
size_t totLen = accumulate(lenIn, lenIn+nlines, 0);
498+
size_t totLen = std::accumulate(lenIn, lenIn+nlines, 0);
499499
int simd = totLen > nlines*12 && (nlines > 64 || totLen > (size_t) 1<<15);
500500
return _compressAuto((Encoder*) encoder, nlines, lenIn, strIn, size, output, lenOut, strOut, 3*simd);
501501
}

‎src/duckdb/third_party/fsst/libfsst.hpp‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include <fcntl.h>
3333
#include <stddef.h>
3434

35-
using namespace std;
3635

3736
#include "fsst.h" // the official FSST API -- also usable by C mortals
3837

@@ -448,7 +447,7 @@ struct Counters {
448447

449448
// an encoder is a symbolmap plus some bufferspace, needed during map construction as well as compression
450449
struct Encoder {
451-
shared_ptr<SymbolTable> symbolTable; // symbols, plus metadata and data structures for quick compression (shortCode,hashTab, etc)
450+
std::shared_ptr<SymbolTable> symbolTable; // symbols, plus metadata and data structures for quick compression (shortCode,hashTab, etc)
452451
union {
453452
Counters counters; // for counting symbol occurences during map construction
454453
u8 simdbuf[FSST_BUFSZ]; // for compression: SIMD string staging area 768KB = 256KB in + 512KB out (worst case for 256KB in)

‎src/duckdb/third_party/mbedtls/mbedtls_wrapper.cpp‎

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include <stdexcept>
1919

20-
using namespace std;
2120
using namespace duckdb_mbedtls;
2221
using CipherType = duckdb::EncryptionTypes::CipherType;
2322
using EncryptionVersion = duckdb::EncryptionTypes::EncryptionVersion;
@@ -45,13 +44,13 @@ void MbedTlsWrapper::ComputeSha256Hash(const char *in, size_t in_len, char *out)
4544
if (mbedtls_sha256_starts(&sha_context, false) ||
4645
mbedtls_sha256_update(&sha_context, reinterpret_cast<const unsigned char *>(in), in_len) ||
4746
mbedtls_sha256_finish(&sha_context, reinterpret_cast<unsigned char *>(out))) {
48-
throw runtime_error("SHA256 Error");
47+
throw std::runtime_error("SHA256 Error");
4948
}
5049
mbedtls_sha256_free(&sha_context);
5150
}
5251

53-
string MbedTlsWrapper::ComputeSha256Hash(const string &file_content) {
54-
string hash;
52+
std::string MbedTlsWrapper::ComputeSha256Hash(const std::string &file_content) {
53+
std::string hash;
5554
hash.resize(MbedTlsWrapper::SHA256_HASH_LENGTH_BYTES);
5655
ComputeSha256Hash(file_content.data(), file_content.size(), (char *)hash.data());
5756
return hash;
@@ -62,16 +61,16 @@ bool MbedTlsWrapper::IsValidSha256Signature(const std::string &pubkey, const std
6261

6362
if (signature.size() != 256 || sha256_hash.size() != 32) {
6463
throw std::runtime_error("Invalid input lengths, expected signature length 256, got " +
65-
to_string(signature.size()) + ", hash length 32, got " +
66-
to_string(sha256_hash.size()));
64+
std::to_string(signature.size()) + ", hash length 32, got " +
65+
std::to_string(sha256_hash.size()));
6766
}
6867

6968
mbedtls_pk_context pk_context;
7069
mbedtls_pk_init(&pk_context);
7170

7271
if (mbedtls_pk_parse_public_key(&pk_context, reinterpret_cast<const unsigned char *>(pubkey.c_str()),
7372
pubkey.size() + 1)) {
74-
throw runtime_error("RSA public key import error");
73+
throw std::runtime_error("RSA public key import error");
7574
}
7675

7776
// actually verify
@@ -88,14 +87,14 @@ void MbedTlsWrapper::Hmac256(const char *key, size_t key_len, const char *messag
8887
mbedtls_md_context_t hmac_ctx;
8988
const mbedtls_md_info_t *md_type = mbedtls_md_info_from_type(MBEDTLS_MD_SHA256);
9089
if (!md_type) {
91-
throw runtime_error("failed to init hmac");
90+
throw std::runtime_error("failed to init hmac");
9291
}
9392

9493
if (mbedtls_md_setup(&hmac_ctx, md_type, 1) ||
9594
mbedtls_md_hmac_starts(&hmac_ctx, reinterpret_cast<const unsigned char *>(key), key_len) ||
9695
mbedtls_md_hmac_update(&hmac_ctx, reinterpret_cast<const unsigned char *>(message), message_len) ||
9796
mbedtls_md_hmac_finish(&hmac_ctx, reinterpret_cast<unsigned char *>(out))) {
98-
throw runtime_error("HMAC256 Error");
97+
throw std::runtime_error("HMAC256 Error");
9998
}
10099
mbedtls_md_free(&hmac_ctx);
101100
}
@@ -163,7 +162,7 @@ void MbedTlsWrapper::SHA256State::FinalizeDerivedKey(duckdb::data_ptr_t hash) {
163162
std::string MbedTlsWrapper::SHA256State::Finalize() {
164163
auto context = reinterpret_cast<mbedtls_sha256_context *>(sha_context);
165164

166-
string hash;
165+
std::string hash;
167166
hash.resize(MbedTlsWrapper::SHA256_HASH_LENGTH_BYTES);
168167

169168
if (mbedtls_sha256_finish(context, (unsigned char *)hash.data())) {
@@ -176,7 +175,7 @@ std::string MbedTlsWrapper::SHA256State::Finalize() {
176175
void MbedTlsWrapper::SHA256State::FinishHex(char *out) {
177176
auto context = reinterpret_cast<mbedtls_sha256_context *>(sha_context);
178177

179-
string hash;
178+
std::string hash;
180179
hash.resize(MbedTlsWrapper::SHA256_HASH_LENGTH_BYTES);
181180

182181
if (mbedtls_sha256_finish(context, (unsigned char *)hash.data())) {
@@ -212,7 +211,7 @@ void MbedTlsWrapper::SHA1State::AddString(const std::string &str) {
212211
std::string MbedTlsWrapper::SHA1State::Finalize() {
213212
auto context = reinterpret_cast<mbedtls_sha1_context *>(sha_context);
214213

215-
string hash;
214+
std::string hash;
216215
hash.resize(MbedTlsWrapper::SHA1_HASH_LENGTH_BYTES);
217216

218217
if (mbedtls_sha1_finish(context, (unsigned char *)hash.data())) {
@@ -225,7 +224,7 @@ std::string MbedTlsWrapper::SHA1State::Finalize() {
225224
void MbedTlsWrapper::SHA1State::FinishHex(char *out) {
226225
auto context = reinterpret_cast<mbedtls_sha1_context *>(sha_context);
227226

228-
string hash;
227+
std::string hash;
229228
hash.resize(MbedTlsWrapper::SHA1_HASH_LENGTH_BYTES);
230229

231230
if (mbedtls_sha1_finish(context, (unsigned char *)hash.data())) {
@@ -246,7 +245,7 @@ const mbedtls_cipher_info_t *MbedTlsWrapper::AESStateMBEDTLS::GetCipher(){
246245
case 32:
247246
return mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_256_GCM);
248247
default:
249-
throw runtime_error("Invalid AES key length for GCM");
248+
throw std::runtime_error("Invalid AES key length for GCM");
250249
}
251250
case CipherType::CTR:
252251
switch (metadata->GetKeyLen()) {
@@ -257,7 +256,7 @@ const mbedtls_cipher_info_t *MbedTlsWrapper::AESStateMBEDTLS::GetCipher(){
257256
case 32:
258257
return mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_256_CTR);
259258
default:
260-
throw runtime_error("Invalid AES key length for CTR");
259+
throw std::runtime_error("Invalid AES key length for CTR");
261260
}
262261
case CipherType::CBC:
263262
switch (metadata->GetKeyLen()) {
@@ -268,7 +267,7 @@ const mbedtls_cipher_info_t *MbedTlsWrapper::AESStateMBEDTLS::GetCipher(){
268267
case 32:
269268
return mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_256_CBC);
270269
default:
271-
throw runtime_error("Invalid AES key length for CBC");
270+
throw std::runtime_error("Invalid AES key length for CBC");
272271
}
273272
default:
274273
throw duckdb::InternalException("Invalid Encryption/Decryption Cipher: %s", duckdb::EncryptionTypes::CipherToString(metadata->GetCipher()));
@@ -285,15 +284,15 @@ MbedTlsWrapper::AESStateMBEDTLS::AESStateMBEDTLS(duckdb::unique_ptr<duckdb::Encr
285284
auto cipher_info = GetCipher();
286285

287286
if (!cipher_info) {
288-
throw runtime_error("Failed to get Cipher");
287+
throw std::runtime_error("Failed to get Cipher");
289288
}
290289

291290
if (mbedtls_cipher_setup(context.get(), cipher_info)) {
292-
throw runtime_error("Failed to initialize cipher context");
291+
throw std::runtime_error("Failed to initialize cipher context");
293292
}
294293

295294
if (metadata->GetCipher() == duckdb::EncryptionTypes::CBC && mbedtls_cipher_set_padding_mode(context.get(), MBEDTLS_PADDING_PKCS7)) {
296-
throw runtime_error("Failed to set CBC padding");
295+
throw std::runtime_error("Failed to set CBC padding");
297296

298297
}
299298
}
@@ -330,7 +329,7 @@ void MbedTlsWrapper::AESStateMBEDTLS::GenerateRandomData(duckdb::data_ptr_t data
330329

331330
void MbedTlsWrapper::AESStateMBEDTLS::InitializeInternal(duckdb::EncryptionNonce &nonce, duckdb::const_data_ptr_t aad, duckdb::idx_t aad_len){
332331
if (mbedtls_cipher_set_iv(context.get(), nonce.data(), nonce.total_size())) {
333-
throw runtime_error("Failed to set IV for encryption");
332+
throw std::runtime_error("Failed to set IV for encryption");
334333
}
335334

336335
if (aad_len > 0) {
@@ -344,7 +343,7 @@ void MbedTlsWrapper::AESStateMBEDTLS::InitializeEncryption(duckdb::EncryptionNon
344343
mode = duckdb::EncryptionTypes::ENCRYPT;
345344

346345
if (mbedtls_cipher_setkey(context.get(), key, metadata->GetKeyLen() * 8, MBEDTLS_ENCRYPT) != 0) {
347-
runtime_error("Failed to set AES key for encryption");
346+
throw std::runtime_error("Failed to set AES key for encryption");
348347
}
349348

350349
InitializeInternal(nonce, aad, aad_len);
@@ -354,7 +353,7 @@ void MbedTlsWrapper::AESStateMBEDTLS::InitializeDecryption(duckdb::EncryptionNon
354353
mode = duckdb::EncryptionTypes::DECRYPT;
355354

356355
if (mbedtls_cipher_setkey(context.get(), key, metadata->GetKeyLen() * 8, MBEDTLS_DECRYPT)) {
357-
throw runtime_error("Failed to set AES key for encryption");
356+
throw std::runtime_error("Failed to set AES key for encryption");
358357
}
359358

360359
InitializeInternal(nonce, aad, aad_len);
@@ -376,7 +375,7 @@ size_t MbedTlsWrapper::AESStateMBEDTLS::Process(duckdb::const_data_ptr_t in, duc
376375
size_t out_len_res = duckdb::NumericCast<size_t>(out_len);
377376
if (mbedtls_cipher_update(context.get(), reinterpret_cast<const unsigned char *>(in), in_len, out_ptr,
378377
&out_len_res)) {
379-
throw runtime_error("Encryption or Decryption failed at Process");
378+
throw std::runtime_error("Encryption or Decryption failed at Process");
380379
};
381380

382381
if (use_out_copy) {
@@ -391,7 +390,7 @@ void MbedTlsWrapper::AESStateMBEDTLS::FinalizeGCM(duckdb::data_ptr_t tag, duckdb
391390

392391
case duckdb::EncryptionTypes::ENCRYPT: {
393392
if (mbedtls_cipher_write_tag(context.get(), tag, tag_len)) {
394-
throw runtime_error("Writing tag failed");
393+
throw std::runtime_error("Writing tag failed");
395394
}
396395
break;
397396
}
@@ -413,7 +412,7 @@ size_t MbedTlsWrapper::AESStateMBEDTLS::Finalize(duckdb::data_ptr_t out, duckdb:
413412
duckdb::idx_t tag_len) {
414413
size_t result = out_len;
415414
if (mbedtls_cipher_finish(context.get(), out, &result)) {
416-
throw runtime_error("Encryption or Decryption failed at Finalize");
415+
throw std::runtime_error("Encryption or Decryption failed at Finalize");
417416
}
418417
if (metadata->GetCipher() == duckdb::EncryptionTypes::GCM) {
419418
FinalizeGCM(tag, tag_len);

‎src/duckdb/third_party/re2/re2/regexp.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ class Regexp {
518518
void AllocSub(int n) {
519519
DCHECK(n >= 0 && static_cast<uint16_t>(n) == n);
520520
if (n > 1)
521-
submany_ = new Regexp*[n];
521+
submany_ = new Regexp*[static_cast<size_t>(n)];
522522
nsub_ = static_cast<uint16_t>(n);
523523
}
524524

‎src/duckdb/third_party/utf8proc/utf8proc_wrapper.cpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "duckdb/common/exception.hpp"
55
#include "duckdb/common/helper.hpp"
66

7-
using namespace std;
87

98
namespace duckdb {
109

0 commit comments

Comments
 (0)