duckdb 0.3.2-dev1031.0 → 0.3.2-dev1046.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 +235 -167
- package/src/duckdb.hpp +222 -188
- package/src/parquet-amalgamation.cpp +35400 -35400
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 "0.3.2-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "59838eae3"
|
|
15
|
+
#define DUCKDB_VERSION "0.3.2-dev1046"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -5293,6 +5293,26 @@ private:
|
|
|
5293
5293
|
|
|
5294
5294
|
|
|
5295
5295
|
|
|
5296
|
+
//===----------------------------------------------------------------------===//
|
|
5297
|
+
// DuckDB
|
|
5298
|
+
//
|
|
5299
|
+
// duckdb/common/named_parameter_map.hpp
|
|
5300
|
+
//
|
|
5301
|
+
//
|
|
5302
|
+
//===----------------------------------------------------------------------===//
|
|
5303
|
+
|
|
5304
|
+
|
|
5305
|
+
|
|
5306
|
+
//===----------------------------------------------------------------------===//
|
|
5307
|
+
// DuckDB
|
|
5308
|
+
//
|
|
5309
|
+
// duckdb/common/case_insensitive_map.hpp
|
|
5310
|
+
//
|
|
5311
|
+
//
|
|
5312
|
+
//===----------------------------------------------------------------------===//
|
|
5313
|
+
|
|
5314
|
+
|
|
5315
|
+
|
|
5296
5316
|
|
|
5297
5317
|
//===----------------------------------------------------------------------===//
|
|
5298
5318
|
// DuckDB
|
|
@@ -5310,6 +5330,171 @@ namespace duckdb {
|
|
|
5310
5330
|
using std::unordered_set;
|
|
5311
5331
|
}
|
|
5312
5332
|
|
|
5333
|
+
|
|
5334
|
+
//===----------------------------------------------------------------------===//
|
|
5335
|
+
// DuckDB
|
|
5336
|
+
//
|
|
5337
|
+
// duckdb/common/string_util.hpp
|
|
5338
|
+
//
|
|
5339
|
+
//
|
|
5340
|
+
//===----------------------------------------------------------------------===//
|
|
5341
|
+
|
|
5342
|
+
|
|
5343
|
+
|
|
5344
|
+
|
|
5345
|
+
|
|
5346
|
+
|
|
5347
|
+
|
|
5348
|
+
namespace duckdb {
|
|
5349
|
+
/**
|
|
5350
|
+
* String Utility Functions
|
|
5351
|
+
* Note that these are not the most efficient implementations (i.e., they copy
|
|
5352
|
+
* memory) and therefore they should only be used for debug messages and other
|
|
5353
|
+
* such things.
|
|
5354
|
+
*/
|
|
5355
|
+
class StringUtil {
|
|
5356
|
+
public:
|
|
5357
|
+
DUCKDB_API static bool CharacterIsSpace(char c) {
|
|
5358
|
+
return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r';
|
|
5359
|
+
}
|
|
5360
|
+
DUCKDB_API static bool CharacterIsNewline(char c) {
|
|
5361
|
+
return c == '\n' || c == '\r';
|
|
5362
|
+
}
|
|
5363
|
+
DUCKDB_API static bool CharacterIsDigit(char c) {
|
|
5364
|
+
return c >= '0' && c <= '9';
|
|
5365
|
+
}
|
|
5366
|
+
DUCKDB_API static char CharacterToLower(char c) {
|
|
5367
|
+
if (c >= 'A' && c <= 'Z') {
|
|
5368
|
+
return c - ('A' - 'a');
|
|
5369
|
+
}
|
|
5370
|
+
return c;
|
|
5371
|
+
}
|
|
5372
|
+
|
|
5373
|
+
//! Returns true if the needle string exists in the haystack
|
|
5374
|
+
DUCKDB_API static bool Contains(const string &haystack, const string &needle);
|
|
5375
|
+
|
|
5376
|
+
//! Returns true if the target string starts with the given prefix
|
|
5377
|
+
DUCKDB_API static bool StartsWith(string str, string prefix);
|
|
5378
|
+
|
|
5379
|
+
//! Returns true if the target string <b>ends</b> with the given suffix.
|
|
5380
|
+
DUCKDB_API static bool EndsWith(const string &str, const string &suffix);
|
|
5381
|
+
|
|
5382
|
+
//! Repeat a string multiple times
|
|
5383
|
+
DUCKDB_API static string Repeat(const string &str, const idx_t n);
|
|
5384
|
+
|
|
5385
|
+
//! Split the input string based on newline char
|
|
5386
|
+
DUCKDB_API static vector<string> Split(const string &str, char delimiter);
|
|
5387
|
+
|
|
5388
|
+
//! Split the input string allong a quote. Note that any escaping is NOT supported.
|
|
5389
|
+
DUCKDB_API static vector<string> SplitWithQuote(const string &str, char delimiter = ',', char quote = '"');
|
|
5390
|
+
|
|
5391
|
+
//! Join multiple strings into one string. Components are concatenated by the given separator
|
|
5392
|
+
DUCKDB_API static string Join(const vector<string> &input, const string &separator);
|
|
5393
|
+
|
|
5394
|
+
//! Join multiple items of container with given size, transformed to string
|
|
5395
|
+
//! using function, into one string using the given separator
|
|
5396
|
+
template <typename C, typename S, typename Func>
|
|
5397
|
+
static string Join(const C &input, S count, const string &separator, Func f) {
|
|
5398
|
+
// The result
|
|
5399
|
+
std::string result;
|
|
5400
|
+
|
|
5401
|
+
// If the input isn't empty, append the first element. We do this so we
|
|
5402
|
+
// don't need to introduce an if into the loop.
|
|
5403
|
+
if (count > 0) {
|
|
5404
|
+
result += f(input[0]);
|
|
5405
|
+
}
|
|
5406
|
+
|
|
5407
|
+
// Append the remaining input components, after the first
|
|
5408
|
+
for (size_t i = 1; i < count; i++) {
|
|
5409
|
+
result += separator + f(input[i]);
|
|
5410
|
+
}
|
|
5411
|
+
|
|
5412
|
+
return result;
|
|
5413
|
+
}
|
|
5414
|
+
|
|
5415
|
+
//! Return a string that formats the give number of bytes
|
|
5416
|
+
DUCKDB_API static string BytesToHumanReadableString(idx_t bytes);
|
|
5417
|
+
|
|
5418
|
+
//! Convert a string to uppercase
|
|
5419
|
+
DUCKDB_API static string Upper(const string &str);
|
|
5420
|
+
|
|
5421
|
+
//! Convert a string to lowercase
|
|
5422
|
+
DUCKDB_API static string Lower(const string &str);
|
|
5423
|
+
|
|
5424
|
+
//! Format a string using printf semantics
|
|
5425
|
+
template <typename... Args>
|
|
5426
|
+
static string Format(const string fmt_str, Args... params) {
|
|
5427
|
+
return Exception::ConstructMessage(fmt_str, params...);
|
|
5428
|
+
}
|
|
5429
|
+
|
|
5430
|
+
//! Split the input string into a vector of strings based on the split string
|
|
5431
|
+
DUCKDB_API static vector<string> Split(const string &input, const string &split);
|
|
5432
|
+
|
|
5433
|
+
//! Remove the whitespace char in the left end of the string
|
|
5434
|
+
DUCKDB_API static void LTrim(string &str);
|
|
5435
|
+
//! Remove the whitespace char in the right end of the string
|
|
5436
|
+
DUCKDB_API static void RTrim(string &str);
|
|
5437
|
+
//! Remove the whitespace char in the left and right end of the string
|
|
5438
|
+
DUCKDB_API static void Trim(string &str);
|
|
5439
|
+
|
|
5440
|
+
DUCKDB_API static string Replace(string source, const string &from, const string &to);
|
|
5441
|
+
|
|
5442
|
+
//! Get the levenshtein distance from two strings
|
|
5443
|
+
DUCKDB_API static idx_t LevenshteinDistance(const string &s1, const string &s2);
|
|
5444
|
+
|
|
5445
|
+
//! Get the top-n strings (sorted by the given score distance) from a set of scores.
|
|
5446
|
+
//! At least one entry is returned (if there is one).
|
|
5447
|
+
//! Strings are only returned if they have a score less than the threshold.
|
|
5448
|
+
DUCKDB_API static vector<string> TopNStrings(vector<std::pair<string, idx_t>> scores, idx_t n = 5,
|
|
5449
|
+
idx_t threshold = 5);
|
|
5450
|
+
//! Computes the levenshtein distance of each string in strings, and compares it to target, then returns TopNStrings
|
|
5451
|
+
//! with the given params.
|
|
5452
|
+
DUCKDB_API static vector<string> TopNLevenshtein(const vector<string> &strings, const string &target, idx_t n = 5,
|
|
5453
|
+
idx_t threshold = 5);
|
|
5454
|
+
DUCKDB_API static string CandidatesMessage(const vector<string> &candidates,
|
|
5455
|
+
const string &candidate = "Candidate bindings");
|
|
5456
|
+
|
|
5457
|
+
//! Generate an error message in the form of "{message_prefix}: nearest_string, nearest_string2, ...
|
|
5458
|
+
//! Equivalent to calling TopNLevenshtein followed by CandidatesMessage
|
|
5459
|
+
DUCKDB_API static string CandidatesErrorMessage(const vector<string> &strings, const string &target,
|
|
5460
|
+
const string &message_prefix, idx_t n = 5);
|
|
5461
|
+
};
|
|
5462
|
+
|
|
5463
|
+
} // namespace duckdb
|
|
5464
|
+
|
|
5465
|
+
|
|
5466
|
+
namespace duckdb {
|
|
5467
|
+
|
|
5468
|
+
struct CaseInsensitiveStringHashFunction {
|
|
5469
|
+
uint64_t operator()(const string &str) const {
|
|
5470
|
+
std::hash<string> hasher;
|
|
5471
|
+
return hasher(StringUtil::Lower(str));
|
|
5472
|
+
}
|
|
5473
|
+
};
|
|
5474
|
+
|
|
5475
|
+
struct CaseInsensitiveStringEquality {
|
|
5476
|
+
bool operator()(const string &a, const string &b) const {
|
|
5477
|
+
return StringUtil::Lower(a) == StringUtil::Lower(b);
|
|
5478
|
+
}
|
|
5479
|
+
};
|
|
5480
|
+
|
|
5481
|
+
template <typename T>
|
|
5482
|
+
using case_insensitive_map_t =
|
|
5483
|
+
unordered_map<string, T, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality>;
|
|
5484
|
+
|
|
5485
|
+
using case_insensitive_set_t = unordered_set<string, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality>;
|
|
5486
|
+
|
|
5487
|
+
} // namespace duckdb
|
|
5488
|
+
|
|
5489
|
+
|
|
5490
|
+
namespace duckdb {
|
|
5491
|
+
|
|
5492
|
+
using named_parameter_type_map_t = case_insensitive_map_t<LogicalType>;
|
|
5493
|
+
using named_parameter_map_t = case_insensitive_map_t<Value>;
|
|
5494
|
+
|
|
5495
|
+
} // namespace duckdb
|
|
5496
|
+
|
|
5497
|
+
|
|
5313
5498
|
//===----------------------------------------------------------------------===//
|
|
5314
5499
|
// DuckDB
|
|
5315
5500
|
//
|
|
@@ -5777,7 +5962,7 @@ struct TableFunctionData : public FunctionData {
|
|
|
5777
5962
|
|
|
5778
5963
|
struct FunctionParameters {
|
|
5779
5964
|
vector<Value> values;
|
|
5780
|
-
|
|
5965
|
+
named_parameter_map_t named_parameters;
|
|
5781
5966
|
};
|
|
5782
5967
|
|
|
5783
5968
|
//! Function is the base class used for any type of function (scalar, aggregate or simple function)
|
|
@@ -5797,7 +5982,7 @@ public:
|
|
|
5797
5982
|
const LogicalType &return_type);
|
|
5798
5983
|
//! Returns the formatted string name(arg1, arg2.., np1=a, np2=b, ...)
|
|
5799
5984
|
DUCKDB_API static string CallToString(const string &name, const vector<LogicalType> &arguments,
|
|
5800
|
-
const
|
|
5985
|
+
const named_parameter_type_map_t &named_parameters);
|
|
5801
5986
|
|
|
5802
5987
|
//! Bind a scalar function from the set of functions and input arguments. Returns the index of the chosen function,
|
|
5803
5988
|
//! returns DConstants::INVALID_INDEX and sets error if none could be found
|
|
@@ -5847,14 +6032,14 @@ public:
|
|
|
5847
6032
|
DUCKDB_API ~SimpleNamedParameterFunction() override;
|
|
5848
6033
|
|
|
5849
6034
|
//! The named parameters of the function
|
|
5850
|
-
|
|
6035
|
+
named_parameter_type_map_t named_parameters;
|
|
5851
6036
|
|
|
5852
6037
|
public:
|
|
5853
6038
|
DUCKDB_API string ToString() override;
|
|
5854
6039
|
DUCKDB_API bool HasNamedParameters();
|
|
5855
6040
|
|
|
5856
6041
|
DUCKDB_API void EvaluateInputParameters(vector<LogicalType> &arguments, vector<Value> ¶meters,
|
|
5857
|
-
|
|
6042
|
+
named_parameter_map_t &named_parameters,
|
|
5858
6043
|
vector<unique_ptr<ParsedExpression>> &children);
|
|
5859
6044
|
};
|
|
5860
6045
|
|
|
@@ -9673,8 +9858,6 @@ public:
|
|
|
9673
9858
|
|
|
9674
9859
|
|
|
9675
9860
|
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
9861
|
#include <functional>
|
|
9679
9862
|
|
|
9680
9863
|
namespace duckdb {
|
|
@@ -9694,7 +9877,7 @@ struct TableFilterCollection {
|
|
|
9694
9877
|
};
|
|
9695
9878
|
|
|
9696
9879
|
typedef unique_ptr<FunctionData> (*table_function_bind_t)(ClientContext &context, vector<Value> &inputs,
|
|
9697
|
-
|
|
9880
|
+
named_parameter_map_t &named_parameters,
|
|
9698
9881
|
vector<LogicalType> &input_table_types,
|
|
9699
9882
|
vector<string> &input_table_names,
|
|
9700
9883
|
vector<LogicalType> &return_types, vector<string> &names);
|
|
@@ -10534,7 +10717,7 @@ public:
|
|
|
10534
10717
|
//! Create a relation from calling a table in/out function on the input relation
|
|
10535
10718
|
DUCKDB_API shared_ptr<Relation> TableFunction(const std::string &fname, const vector<Value> &values);
|
|
10536
10719
|
DUCKDB_API shared_ptr<Relation> TableFunction(const std::string &fname, const vector<Value> &values,
|
|
10537
|
-
const
|
|
10720
|
+
const named_parameter_map_t &named_parameters);
|
|
10538
10721
|
|
|
10539
10722
|
public:
|
|
10540
10723
|
//! Whether or not the relation inherits column bindings from its child or not, only relevant for binding
|
|
@@ -10791,7 +10974,7 @@ public:
|
|
|
10791
10974
|
//! Returns a relation that calls a specified table function
|
|
10792
10975
|
DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname);
|
|
10793
10976
|
DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname, const vector<Value> &values,
|
|
10794
|
-
const
|
|
10977
|
+
const named_parameter_map_t &named_parameters);
|
|
10795
10978
|
DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname, const vector<Value> &values);
|
|
10796
10979
|
//! Returns a relation that produces values
|
|
10797
10980
|
DUCKDB_API shared_ptr<Relation> Values(const vector<vector<Value>> &values);
|
|
@@ -11002,173 +11185,6 @@ private:
|
|
|
11002
11185
|
|
|
11003
11186
|
} // namespace duckdb
|
|
11004
11187
|
|
|
11005
|
-
//===----------------------------------------------------------------------===//
|
|
11006
|
-
// DuckDB
|
|
11007
|
-
//
|
|
11008
|
-
// duckdb/common/case_insensitive_map.hpp
|
|
11009
|
-
//
|
|
11010
|
-
//
|
|
11011
|
-
//===----------------------------------------------------------------------===//
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
//===----------------------------------------------------------------------===//
|
|
11019
|
-
// DuckDB
|
|
11020
|
-
//
|
|
11021
|
-
// duckdb/common/string_util.hpp
|
|
11022
|
-
//
|
|
11023
|
-
//
|
|
11024
|
-
//===----------------------------------------------------------------------===//
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
namespace duckdb {
|
|
11033
|
-
/**
|
|
11034
|
-
* String Utility Functions
|
|
11035
|
-
* Note that these are not the most efficient implementations (i.e., they copy
|
|
11036
|
-
* memory) and therefore they should only be used for debug messages and other
|
|
11037
|
-
* such things.
|
|
11038
|
-
*/
|
|
11039
|
-
class StringUtil {
|
|
11040
|
-
public:
|
|
11041
|
-
DUCKDB_API static bool CharacterIsSpace(char c) {
|
|
11042
|
-
return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r';
|
|
11043
|
-
}
|
|
11044
|
-
DUCKDB_API static bool CharacterIsNewline(char c) {
|
|
11045
|
-
return c == '\n' || c == '\r';
|
|
11046
|
-
}
|
|
11047
|
-
DUCKDB_API static bool CharacterIsDigit(char c) {
|
|
11048
|
-
return c >= '0' && c <= '9';
|
|
11049
|
-
}
|
|
11050
|
-
DUCKDB_API static char CharacterToLower(char c) {
|
|
11051
|
-
if (c >= 'A' && c <= 'Z') {
|
|
11052
|
-
return c - ('A' - 'a');
|
|
11053
|
-
}
|
|
11054
|
-
return c;
|
|
11055
|
-
}
|
|
11056
|
-
|
|
11057
|
-
//! Returns true if the needle string exists in the haystack
|
|
11058
|
-
DUCKDB_API static bool Contains(const string &haystack, const string &needle);
|
|
11059
|
-
|
|
11060
|
-
//! Returns true if the target string starts with the given prefix
|
|
11061
|
-
DUCKDB_API static bool StartsWith(string str, string prefix);
|
|
11062
|
-
|
|
11063
|
-
//! Returns true if the target string <b>ends</b> with the given suffix.
|
|
11064
|
-
DUCKDB_API static bool EndsWith(const string &str, const string &suffix);
|
|
11065
|
-
|
|
11066
|
-
//! Repeat a string multiple times
|
|
11067
|
-
DUCKDB_API static string Repeat(const string &str, const idx_t n);
|
|
11068
|
-
|
|
11069
|
-
//! Split the input string based on newline char
|
|
11070
|
-
DUCKDB_API static vector<string> Split(const string &str, char delimiter);
|
|
11071
|
-
|
|
11072
|
-
//! Split the input string allong a quote. Note that any escaping is NOT supported.
|
|
11073
|
-
DUCKDB_API static vector<string> SplitWithQuote(const string &str, char delimiter = ',', char quote = '"');
|
|
11074
|
-
|
|
11075
|
-
//! Join multiple strings into one string. Components are concatenated by the given separator
|
|
11076
|
-
DUCKDB_API static string Join(const vector<string> &input, const string &separator);
|
|
11077
|
-
|
|
11078
|
-
//! Join multiple items of container with given size, transformed to string
|
|
11079
|
-
//! using function, into one string using the given separator
|
|
11080
|
-
template <typename C, typename S, typename Func>
|
|
11081
|
-
static string Join(const C &input, S count, const string &separator, Func f) {
|
|
11082
|
-
// The result
|
|
11083
|
-
std::string result;
|
|
11084
|
-
|
|
11085
|
-
// If the input isn't empty, append the first element. We do this so we
|
|
11086
|
-
// don't need to introduce an if into the loop.
|
|
11087
|
-
if (count > 0) {
|
|
11088
|
-
result += f(input[0]);
|
|
11089
|
-
}
|
|
11090
|
-
|
|
11091
|
-
// Append the remaining input components, after the first
|
|
11092
|
-
for (size_t i = 1; i < count; i++) {
|
|
11093
|
-
result += separator + f(input[i]);
|
|
11094
|
-
}
|
|
11095
|
-
|
|
11096
|
-
return result;
|
|
11097
|
-
}
|
|
11098
|
-
|
|
11099
|
-
//! Return a string that formats the give number of bytes
|
|
11100
|
-
DUCKDB_API static string BytesToHumanReadableString(idx_t bytes);
|
|
11101
|
-
|
|
11102
|
-
//! Convert a string to uppercase
|
|
11103
|
-
DUCKDB_API static string Upper(const string &str);
|
|
11104
|
-
|
|
11105
|
-
//! Convert a string to lowercase
|
|
11106
|
-
DUCKDB_API static string Lower(const string &str);
|
|
11107
|
-
|
|
11108
|
-
//! Format a string using printf semantics
|
|
11109
|
-
template <typename... Args>
|
|
11110
|
-
static string Format(const string fmt_str, Args... params) {
|
|
11111
|
-
return Exception::ConstructMessage(fmt_str, params...);
|
|
11112
|
-
}
|
|
11113
|
-
|
|
11114
|
-
//! Split the input string into a vector of strings based on the split string
|
|
11115
|
-
DUCKDB_API static vector<string> Split(const string &input, const string &split);
|
|
11116
|
-
|
|
11117
|
-
//! Remove the whitespace char in the left end of the string
|
|
11118
|
-
DUCKDB_API static void LTrim(string &str);
|
|
11119
|
-
//! Remove the whitespace char in the right end of the string
|
|
11120
|
-
DUCKDB_API static void RTrim(string &str);
|
|
11121
|
-
//! Remove the whitespace char in the left and right end of the string
|
|
11122
|
-
DUCKDB_API static void Trim(string &str);
|
|
11123
|
-
|
|
11124
|
-
DUCKDB_API static string Replace(string source, const string &from, const string &to);
|
|
11125
|
-
|
|
11126
|
-
//! Get the levenshtein distance from two strings
|
|
11127
|
-
DUCKDB_API static idx_t LevenshteinDistance(const string &s1, const string &s2);
|
|
11128
|
-
|
|
11129
|
-
//! Get the top-n strings (sorted by the given score distance) from a set of scores.
|
|
11130
|
-
//! At least one entry is returned (if there is one).
|
|
11131
|
-
//! Strings are only returned if they have a score less than the threshold.
|
|
11132
|
-
DUCKDB_API static vector<string> TopNStrings(vector<std::pair<string, idx_t>> scores, idx_t n = 5,
|
|
11133
|
-
idx_t threshold = 5);
|
|
11134
|
-
//! Computes the levenshtein distance of each string in strings, and compares it to target, then returns TopNStrings
|
|
11135
|
-
//! with the given params.
|
|
11136
|
-
DUCKDB_API static vector<string> TopNLevenshtein(const vector<string> &strings, const string &target, idx_t n = 5,
|
|
11137
|
-
idx_t threshold = 5);
|
|
11138
|
-
DUCKDB_API static string CandidatesMessage(const vector<string> &candidates,
|
|
11139
|
-
const string &candidate = "Candidate bindings");
|
|
11140
|
-
|
|
11141
|
-
//! Generate an error message in the form of "{message_prefix}: nearest_string, nearest_string2, ...
|
|
11142
|
-
//! Equivalent to calling TopNLevenshtein followed by CandidatesMessage
|
|
11143
|
-
DUCKDB_API static string CandidatesErrorMessage(const vector<string> &strings, const string &target,
|
|
11144
|
-
const string &message_prefix, idx_t n = 5);
|
|
11145
|
-
};
|
|
11146
|
-
|
|
11147
|
-
} // namespace duckdb
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
namespace duckdb {
|
|
11151
|
-
|
|
11152
|
-
struct CaseInsensitiveStringHashFunction {
|
|
11153
|
-
uint64_t operator()(const string &str) const {
|
|
11154
|
-
std::hash<string> hasher;
|
|
11155
|
-
return hasher(StringUtil::Lower(str));
|
|
11156
|
-
}
|
|
11157
|
-
};
|
|
11158
|
-
|
|
11159
|
-
struct CaseInsensitiveStringEquality {
|
|
11160
|
-
bool operator()(const string &a, const string &b) const {
|
|
11161
|
-
return StringUtil::Lower(a) == StringUtil::Lower(b);
|
|
11162
|
-
}
|
|
11163
|
-
};
|
|
11164
|
-
|
|
11165
|
-
template <typename T>
|
|
11166
|
-
using case_insensitive_map_t =
|
|
11167
|
-
unordered_map<string, T, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality>;
|
|
11168
|
-
|
|
11169
|
-
using case_insensitive_set_t = unordered_set<string, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality>;
|
|
11170
|
-
|
|
11171
|
-
} // namespace duckdb
|
|
11172
11188
|
|
|
11173
11189
|
|
|
11174
11190
|
|
|
@@ -15817,7 +15833,7 @@ public:
|
|
|
15817
15833
|
SchemaCatalogEntry *BindCreateFunctionInfo(CreateInfo &info);
|
|
15818
15834
|
|
|
15819
15835
|
//! Check usage, and cast named parameters to their types
|
|
15820
|
-
static void BindNamedParameters(
|
|
15836
|
+
static void BindNamedParameters(named_parameter_type_map_t &types, named_parameter_map_t &values,
|
|
15821
15837
|
QueryErrorContext &error_context, string &func_name);
|
|
15822
15838
|
|
|
15823
15839
|
unique_ptr<BoundTableRef> Bind(TableRef &ref);
|
|
@@ -15944,7 +15960,7 @@ private:
|
|
|
15944
15960
|
unique_ptr<BoundTableRef> Bind(ExpressionListRef &ref);
|
|
15945
15961
|
|
|
15946
15962
|
bool BindFunctionParameters(vector<unique_ptr<ParsedExpression>> &expressions, vector<LogicalType> &arguments,
|
|
15947
|
-
vector<Value> ¶meters,
|
|
15963
|
+
vector<Value> ¶meters, named_parameter_map_t &named_parameters,
|
|
15948
15964
|
unique_ptr<BoundSubqueryRef> &subquery, string &error);
|
|
15949
15965
|
|
|
15950
15966
|
unique_ptr<LogicalOperator> CreatePlan(BoundBaseTableRef &ref);
|
|
@@ -17285,6 +17301,10 @@ struct ClientConfig {
|
|
|
17285
17301
|
//! The wait time before showing the progress bar
|
|
17286
17302
|
int wait_time = 2000;
|
|
17287
17303
|
|
|
17304
|
+
//! Preserve identifier case while parsing.
|
|
17305
|
+
//! If false, all unquoted identifiers are lower-cased (e.g. "MyTable" -> "mytable").
|
|
17306
|
+
bool preserve_identifier_case = true;
|
|
17307
|
+
|
|
17288
17308
|
// Whether or not aggressive query verification is enabled
|
|
17289
17309
|
bool query_verification_enabled = false;
|
|
17290
17310
|
//! Enable the running of optimizers
|
|
@@ -17329,6 +17349,7 @@ class ClientContextLock;
|
|
|
17329
17349
|
struct CreateScalarFunctionInfo;
|
|
17330
17350
|
class ScalarFunctionCatalogEntry;
|
|
17331
17351
|
struct ActiveQueryContext;
|
|
17352
|
+
struct ParserOptions;
|
|
17332
17353
|
|
|
17333
17354
|
//! The ClientContext holds information relevant to the current client session
|
|
17334
17355
|
//! during execution
|
|
@@ -17446,6 +17467,9 @@ public:
|
|
|
17446
17467
|
//! Equivalent to CURRENT_SETTING(key) SQL function.
|
|
17447
17468
|
DUCKDB_API bool TryGetCurrentSetting(const std::string &key, Value &result);
|
|
17448
17469
|
|
|
17470
|
+
//! Returns the parser options for this client context
|
|
17471
|
+
DUCKDB_API ParserOptions GetParserOptions();
|
|
17472
|
+
|
|
17449
17473
|
DUCKDB_API unique_ptr<DataChunk> Fetch(ClientContextLock &lock, StreamQueryResult &result);
|
|
17450
17474
|
|
|
17451
17475
|
//! Whether or not the given result object (streaming query result or pending query result) is active
|
|
@@ -19763,7 +19787,7 @@ struct PragmaInfo : public ParseInfo {
|
|
|
19763
19787
|
//! Parameter list (if any)
|
|
19764
19788
|
vector<Value> parameters;
|
|
19765
19789
|
//! Named parameter list (if any)
|
|
19766
|
-
|
|
19790
|
+
named_parameter_map_t named_parameters;
|
|
19767
19791
|
|
|
19768
19792
|
public:
|
|
19769
19793
|
unique_ptr<PragmaInfo> Copy() const {
|
|
@@ -19814,7 +19838,7 @@ public:
|
|
|
19814
19838
|
|
|
19815
19839
|
pragma_query_t query;
|
|
19816
19840
|
pragma_function_t function;
|
|
19817
|
-
|
|
19841
|
+
named_parameter_type_map_t named_parameters;
|
|
19818
19842
|
|
|
19819
19843
|
private:
|
|
19820
19844
|
PragmaFunction(string name, PragmaType pragma_type, pragma_query_t query, pragma_function_t function,
|
|
@@ -19883,12 +19907,16 @@ struct PGList;
|
|
|
19883
19907
|
|
|
19884
19908
|
namespace duckdb {
|
|
19885
19909
|
|
|
19910
|
+
struct ParserOptions {
|
|
19911
|
+
bool preserve_identifier_case = true;
|
|
19912
|
+
};
|
|
19913
|
+
|
|
19886
19914
|
//! The parser is responsible for parsing the query and converting it into a set
|
|
19887
19915
|
//! of parsed statements. The parsed statements can then be converted into a
|
|
19888
19916
|
//! plan and executed.
|
|
19889
19917
|
class Parser {
|
|
19890
19918
|
public:
|
|
19891
|
-
Parser();
|
|
19919
|
+
Parser(ParserOptions options = ParserOptions());
|
|
19892
19920
|
|
|
19893
19921
|
//! The parsed SQL statements from an invocation to ParseQuery.
|
|
19894
19922
|
vector<unique_ptr<SQLStatement>> statements;
|
|
@@ -19909,16 +19937,22 @@ public:
|
|
|
19909
19937
|
static vector<ParserKeyword> KeywordList();
|
|
19910
19938
|
|
|
19911
19939
|
//! Parses a list of expressions (i.e. the list found in a SELECT clause)
|
|
19912
|
-
static vector<unique_ptr<ParsedExpression>> ParseExpressionList(const string &select_list
|
|
19940
|
+
static vector<unique_ptr<ParsedExpression>> ParseExpressionList(const string &select_list,
|
|
19941
|
+
ParserOptions options = ParserOptions());
|
|
19913
19942
|
//! Parses a list as found in an ORDER BY expression (i.e. including optional ASCENDING/DESCENDING modifiers)
|
|
19914
|
-
static vector<OrderByNode> ParseOrderList(const string &select_list);
|
|
19943
|
+
static vector<OrderByNode> ParseOrderList(const string &select_list, ParserOptions options = ParserOptions());
|
|
19915
19944
|
//! Parses an update list (i.e. the list found in the SET clause of an UPDATE statement)
|
|
19916
19945
|
static void ParseUpdateList(const string &update_list, vector<string> &update_columns,
|
|
19917
|
-
vector<unique_ptr<ParsedExpression>> &expressions
|
|
19946
|
+
vector<unique_ptr<ParsedExpression>> &expressions,
|
|
19947
|
+
ParserOptions options = ParserOptions());
|
|
19918
19948
|
//! Parses a VALUES list (i.e. the list of expressions after a VALUES clause)
|
|
19919
|
-
static vector<vector<unique_ptr<ParsedExpression>>> ParseValuesList(const string &value_list
|
|
19949
|
+
static vector<vector<unique_ptr<ParsedExpression>>> ParseValuesList(const string &value_list,
|
|
19950
|
+
ParserOptions options = ParserOptions());
|
|
19920
19951
|
//! Parses a column list (i.e. as found in a CREATE TABLE statement)
|
|
19921
|
-
static vector<ColumnDefinition> ParseColumnList(const string &column_list);
|
|
19952
|
+
static vector<ColumnDefinition> ParseColumnList(const string &column_list, ParserOptions options = ParserOptions());
|
|
19953
|
+
|
|
19954
|
+
private:
|
|
19955
|
+
ParserOptions options;
|
|
19922
19956
|
};
|
|
19923
19957
|
} // namespace duckdb
|
|
19924
19958
|
//===----------------------------------------------------------------------===//
|