duckdb 0.3.5-dev987.0 → 0.4.1-dev102.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/database.cpp +9 -7
- package/src/duckdb.cpp +14556 -13116
- package/src/duckdb.hpp +650 -556
- package/src/parquet-amalgamation.cpp +37001 -36744
- package/src/parquet-amalgamation.hpp +186 -16
- package/test/pathnames.test.js +82 -0
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.
|
|
14
|
+
#define DUCKDB_SOURCE_ID "febeb562d"
|
|
15
|
+
#define DUCKDB_VERSION "v0.4.1-dev102"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -102,7 +102,7 @@ using std::string;
|
|
|
102
102
|
#define DUCKDB_EXTENSION_API
|
|
103
103
|
#endif
|
|
104
104
|
#else
|
|
105
|
-
#define DUCKDB_EXTENSION_API
|
|
105
|
+
#define DUCKDB_EXTENSION_API __attribute__((visibility("default")))
|
|
106
106
|
#endif
|
|
107
107
|
#endif
|
|
108
108
|
|
|
@@ -401,6 +401,7 @@ DUCKDB_API void DuckDBAssertInternal(bool condition, const char *condition_name,
|
|
|
401
401
|
|
|
402
402
|
#endif
|
|
403
403
|
|
|
404
|
+
|
|
404
405
|
//===----------------------------------------------------------------------===//
|
|
405
406
|
// DuckDB
|
|
406
407
|
//
|
|
@@ -982,7 +983,7 @@ enum class LogicalTypeId : uint8_t {
|
|
|
982
983
|
|
|
983
984
|
HUGEINT = 50,
|
|
984
985
|
POINTER = 51,
|
|
985
|
-
HASH = 52,
|
|
986
|
+
// HASH = 52, // deprecated, uses UBIGINT instead
|
|
986
987
|
VALIDITY = 53,
|
|
987
988
|
UUID = 54,
|
|
988
989
|
|
|
@@ -1047,8 +1048,12 @@ struct LogicalType {
|
|
|
1047
1048
|
DUCKDB_API bool IsIntegral() const;
|
|
1048
1049
|
DUCKDB_API bool IsNumeric() const;
|
|
1049
1050
|
DUCKDB_API hash_t Hash() const;
|
|
1051
|
+
DUCKDB_API void SetAlias(string &alias);
|
|
1052
|
+
DUCKDB_API string GetAlias() const;
|
|
1050
1053
|
|
|
1051
1054
|
DUCKDB_API static LogicalType MaxLogicalType(const LogicalType &left, const LogicalType &right);
|
|
1055
|
+
DUCKDB_API static void SetCatalog(LogicalType &type, TypeCatalogEntry* catalog_entry);
|
|
1056
|
+
DUCKDB_API static TypeCatalogEntry* GetCatalog(const LogicalType &type);
|
|
1052
1057
|
|
|
1053
1058
|
//! Gets the decimal properties of a numeric type. Fails if the type is not numeric.
|
|
1054
1059
|
DUCKDB_API bool GetDecimalProperties(uint8_t &width, uint8_t &scale) const;
|
|
@@ -1090,7 +1095,7 @@ public:
|
|
|
1090
1095
|
static constexpr const LogicalTypeId INTERVAL = LogicalTypeId::INTERVAL;
|
|
1091
1096
|
static constexpr const LogicalTypeId HUGEINT = LogicalTypeId::HUGEINT;
|
|
1092
1097
|
static constexpr const LogicalTypeId UUID = LogicalTypeId::UUID;
|
|
1093
|
-
static constexpr const LogicalTypeId HASH = LogicalTypeId::
|
|
1098
|
+
static constexpr const LogicalTypeId HASH = LogicalTypeId::UBIGINT;
|
|
1094
1099
|
static constexpr const LogicalTypeId POINTER = LogicalTypeId::POINTER;
|
|
1095
1100
|
static constexpr const LogicalTypeId TABLE = LogicalTypeId::TABLE;
|
|
1096
1101
|
static constexpr const LogicalTypeId INVALID = LogicalTypeId::INVALID;
|
|
@@ -1106,6 +1111,7 @@ public:
|
|
|
1106
1111
|
DUCKDB_API static LogicalType MAP( child_list_t<LogicalType> children); // NOLINT
|
|
1107
1112
|
DUCKDB_API static LogicalType MAP(LogicalType key, LogicalType value); // NOLINT
|
|
1108
1113
|
DUCKDB_API static LogicalType ENUM(const string &enum_name, Vector &ordered_data, idx_t size); // NOLINT
|
|
1114
|
+
DUCKDB_API static LogicalType DEDUP_POINTER_ENUM(); // NOLINT
|
|
1109
1115
|
DUCKDB_API static LogicalType USER(const string &user_type_name); // NOLINT
|
|
1110
1116
|
//! A list of all NUMERIC types (integral and floating point types)
|
|
1111
1117
|
DUCKDB_API static const vector<LogicalType> Numeric();
|
|
@@ -1118,6 +1124,7 @@ public:
|
|
|
1118
1124
|
struct DecimalType {
|
|
1119
1125
|
DUCKDB_API static uint8_t GetWidth(const LogicalType &type);
|
|
1120
1126
|
DUCKDB_API static uint8_t GetScale(const LogicalType &type);
|
|
1127
|
+
DUCKDB_API static uint8_t MaxWidth();
|
|
1121
1128
|
};
|
|
1122
1129
|
|
|
1123
1130
|
struct StringType {
|
|
@@ -1140,7 +1147,7 @@ struct EnumType{
|
|
|
1140
1147
|
DUCKDB_API static const string GetValue(const Value &val);
|
|
1141
1148
|
DUCKDB_API static void SetCatalog(LogicalType &type, TypeCatalogEntry* catalog_entry);
|
|
1142
1149
|
DUCKDB_API static TypeCatalogEntry* GetCatalog(const LogicalType &type);
|
|
1143
|
-
DUCKDB_API static PhysicalType GetPhysicalType(
|
|
1150
|
+
DUCKDB_API static PhysicalType GetPhysicalType(const LogicalType &type);
|
|
1144
1151
|
};
|
|
1145
1152
|
|
|
1146
1153
|
struct StructType {
|
|
@@ -1265,8 +1272,8 @@ struct ExceptionFormatValue {
|
|
|
1265
1272
|
|
|
1266
1273
|
ExceptionFormatValueType type;
|
|
1267
1274
|
|
|
1268
|
-
double dbl_val;
|
|
1269
|
-
int64_t int_val;
|
|
1275
|
+
double dbl_val = 0;
|
|
1276
|
+
int64_t int_val = 0;
|
|
1270
1277
|
string str_val;
|
|
1271
1278
|
|
|
1272
1279
|
public:
|
|
@@ -1977,7 +1984,7 @@ public:
|
|
|
1977
1984
|
DUCKDB_API static string GetWorkingDirectory();
|
|
1978
1985
|
//! Gets the users home directory
|
|
1979
1986
|
DUCKDB_API static string GetHomeDirectory();
|
|
1980
|
-
//! Returns the system-available memory in bytes
|
|
1987
|
+
//! Returns the system-available memory in bytes. Returns DConstants::INVALID_INDEX if the system function fails.
|
|
1981
1988
|
DUCKDB_API static idx_t GetAvailableMemory();
|
|
1982
1989
|
//! Path separator for the current file system
|
|
1983
1990
|
DUCKDB_API static string PathSeparator();
|
|
@@ -2189,9 +2196,8 @@ namespace duckdb {
|
|
|
2189
2196
|
class VectorBuffer;
|
|
2190
2197
|
|
|
2191
2198
|
struct SelectionData {
|
|
2192
|
-
explicit SelectionData(idx_t count)
|
|
2193
|
-
|
|
2194
|
-
}
|
|
2199
|
+
explicit SelectionData(idx_t count);
|
|
2200
|
+
|
|
2195
2201
|
unique_ptr<sel_t[]> owned_data;
|
|
2196
2202
|
};
|
|
2197
2203
|
|
|
@@ -3552,6 +3558,7 @@ class VectorStructBuffer : public VectorBuffer {
|
|
|
3552
3558
|
public:
|
|
3553
3559
|
VectorStructBuffer();
|
|
3554
3560
|
VectorStructBuffer(const LogicalType &struct_type, idx_t capacity = STANDARD_VECTOR_SIZE);
|
|
3561
|
+
VectorStructBuffer(Vector &other, const SelectionVector &sel, idx_t count);
|
|
3555
3562
|
~VectorStructBuffer() override;
|
|
3556
3563
|
|
|
3557
3564
|
public:
|
|
@@ -3713,7 +3720,9 @@ public:
|
|
|
3713
3720
|
//! Verify that the Vector is in a consistent, not corrupt state. DEBUG
|
|
3714
3721
|
//! FUNCTION ONLY!
|
|
3715
3722
|
DUCKDB_API void Verify(idx_t count);
|
|
3716
|
-
|
|
3723
|
+
//! Asserts that the CheckMapValidity returns MapInvalidReason::VALID
|
|
3724
|
+
DUCKDB_API static void VerifyMap(Vector &map, const SelectionVector &sel, idx_t count);
|
|
3725
|
+
DUCKDB_API static void Verify(Vector &vector, const SelectionVector &sel, idx_t count);
|
|
3717
3726
|
DUCKDB_API void UTFVerify(idx_t count);
|
|
3718
3727
|
DUCKDB_API void UTFVerify(const SelectionVector &sel, idx_t count);
|
|
3719
3728
|
|
|
@@ -3756,6 +3765,10 @@ public:
|
|
|
3756
3765
|
// Setters
|
|
3757
3766
|
DUCKDB_API void SetVectorType(VectorType vector_type);
|
|
3758
3767
|
|
|
3768
|
+
private:
|
|
3769
|
+
//! Returns the [index] element of the Vector as a Value.
|
|
3770
|
+
DUCKDB_API static Value GetValue(const Vector &v, idx_t index);
|
|
3771
|
+
|
|
3759
3772
|
protected:
|
|
3760
3773
|
//! The vector type specifies how the data of the vector is physically stored (i.e. if it is a single repeated
|
|
3761
3774
|
//! constant, if it is compressed)
|
|
@@ -5881,6 +5894,9 @@ enum class ExpressionClass : uint8_t {
|
|
|
5881
5894
|
DUCKDB_API string ExpressionTypeToString(ExpressionType type);
|
|
5882
5895
|
string ExpressionTypeToOperator(ExpressionType type);
|
|
5883
5896
|
|
|
5897
|
+
// Operator String to ExpressionType (e.g. + => OPERATOR_ADD)
|
|
5898
|
+
ExpressionType OperatorToExpressionType(const string &op);
|
|
5899
|
+
|
|
5884
5900
|
//! Negate a comparison expression, turning e.g. = into !=, or < into >=
|
|
5885
5901
|
ExpressionType NegateComparisionExpression(ExpressionType type);
|
|
5886
5902
|
//! Flip a comparison expression, turning e.g. < into >, or = into =
|
|
@@ -7352,6 +7368,18 @@ struct FunctionLocalState {
|
|
|
7352
7368
|
class BoundFunctionExpression;
|
|
7353
7369
|
class ScalarFunctionCatalogEntry;
|
|
7354
7370
|
|
|
7371
|
+
struct FunctionStatisticsInput {
|
|
7372
|
+
FunctionStatisticsInput(BoundFunctionExpression &expr_p, FunctionData *bind_data_p,
|
|
7373
|
+
vector<unique_ptr<BaseStatistics>> &child_stats_p, unique_ptr<Expression> *expr_ptr_p)
|
|
7374
|
+
: expr(expr_p), bind_data(bind_data_p), child_stats(child_stats_p), expr_ptr(expr_ptr_p) {
|
|
7375
|
+
}
|
|
7376
|
+
|
|
7377
|
+
BoundFunctionExpression &expr;
|
|
7378
|
+
FunctionData *bind_data;
|
|
7379
|
+
vector<unique_ptr<BaseStatistics>> &child_stats;
|
|
7380
|
+
unique_ptr<Expression> *expr_ptr;
|
|
7381
|
+
};
|
|
7382
|
+
|
|
7355
7383
|
//! The type used for scalar functions
|
|
7356
7384
|
typedef std::function<void(DataChunk &, ExpressionState &, Vector &)> scalar_function_t;
|
|
7357
7385
|
//! Binds the scalar function and creates the function data
|
|
@@ -7359,9 +7387,7 @@ typedef unique_ptr<FunctionData> (*bind_scalar_function_t)(ClientContext &contex
|
|
|
7359
7387
|
vector<unique_ptr<Expression>> &arguments);
|
|
7360
7388
|
typedef unique_ptr<FunctionLocalState> (*init_local_state_t)(const BoundFunctionExpression &expr,
|
|
7361
7389
|
FunctionData *bind_data);
|
|
7362
|
-
typedef unique_ptr<BaseStatistics> (*function_statistics_t)(ClientContext &context,
|
|
7363
|
-
FunctionData *bind_data,
|
|
7364
|
-
vector<unique_ptr<BaseStatistics>> &child_stats);
|
|
7390
|
+
typedef unique_ptr<BaseStatistics> (*function_statistics_t)(ClientContext &context, FunctionStatisticsInput &input);
|
|
7365
7391
|
//! Adds the dependencies of this BoundFunctionExpression to the set of dependencies
|
|
7366
7392
|
typedef void (*dependency_function_t)(BoundFunctionExpression &expr, unordered_set<CatalogEntry *> &dependencies);
|
|
7367
7393
|
|
|
@@ -9875,11 +9901,13 @@ enum class StatementReturnType : uint8_t {
|
|
|
9875
9901
|
NOTHING // the statement returns nothing
|
|
9876
9902
|
};
|
|
9877
9903
|
|
|
9904
|
+
string StatementReturnTypeToString(StatementReturnType type);
|
|
9905
|
+
|
|
9878
9906
|
//! A struct containing various properties of a SQL statement
|
|
9879
9907
|
struct StatementProperties {
|
|
9880
9908
|
StatementProperties()
|
|
9881
9909
|
: read_only(true), requires_valid_transaction(true), allow_stream_result(false), bound_all_parameters(true),
|
|
9882
|
-
return_type(StatementReturnType::QUERY_RESULT) {
|
|
9910
|
+
return_type(StatementReturnType::QUERY_RESULT), parameter_count(0) {
|
|
9883
9911
|
}
|
|
9884
9912
|
|
|
9885
9913
|
//! Whether or not the statement is a read-only statement, or whether it can result in changes to the database
|
|
@@ -9893,6 +9921,8 @@ struct StatementProperties {
|
|
|
9893
9921
|
bool bound_all_parameters;
|
|
9894
9922
|
//! What type of data the statement returns
|
|
9895
9923
|
StatementReturnType return_type;
|
|
9924
|
+
//! The number of prepared statement parameters
|
|
9925
|
+
idx_t parameter_count;
|
|
9896
9926
|
};
|
|
9897
9927
|
|
|
9898
9928
|
} // namespace duckdb
|
|
@@ -10058,6 +10088,7 @@ private:
|
|
|
10058
10088
|
|
|
10059
10089
|
} // namespace duckdb
|
|
10060
10090
|
|
|
10091
|
+
|
|
10061
10092
|
namespace duckdb {
|
|
10062
10093
|
|
|
10063
10094
|
class ClientContext;
|
|
@@ -10096,6 +10127,7 @@ public:
|
|
|
10096
10127
|
};
|
|
10097
10128
|
|
|
10098
10129
|
} // namespace duckdb
|
|
10130
|
+
|
|
10099
10131
|
//===----------------------------------------------------------------------===//
|
|
10100
10132
|
// DuckDB
|
|
10101
10133
|
//
|
|
@@ -11236,6 +11268,7 @@ private:
|
|
|
11236
11268
|
|
|
11237
11269
|
} // namespace duckdb
|
|
11238
11270
|
|
|
11271
|
+
|
|
11239
11272
|
//===----------------------------------------------------------------------===//
|
|
11240
11273
|
// DuckDB
|
|
11241
11274
|
//
|
|
@@ -13539,8 +13572,9 @@ class LogicalGet;
|
|
|
13539
13572
|
class TableCatalogEntry;
|
|
13540
13573
|
class TableFunctionCatalogEntry;
|
|
13541
13574
|
class BoundTableFunction;
|
|
13575
|
+
class StandardEntry;
|
|
13542
13576
|
|
|
13543
|
-
enum class BindingType { BASE, TABLE, MACRO };
|
|
13577
|
+
enum class BindingType { BASE, TABLE, MACRO, CATALOG_ENTRY };
|
|
13544
13578
|
|
|
13545
13579
|
//! A Binding represents a binding to a table, table-producing function or subquery with a specified table index.
|
|
13546
13580
|
struct Binding {
|
|
@@ -13566,7 +13600,17 @@ public:
|
|
|
13566
13600
|
bool HasMatchingBinding(const string &column_name);
|
|
13567
13601
|
virtual string ColumnNotFoundError(const string &column_name) const;
|
|
13568
13602
|
virtual BindResult Bind(ColumnRefExpression &colref, idx_t depth);
|
|
13569
|
-
virtual
|
|
13603
|
+
virtual StandardEntry *GetStandardEntry();
|
|
13604
|
+
};
|
|
13605
|
+
|
|
13606
|
+
struct EntryBinding : public Binding {
|
|
13607
|
+
public:
|
|
13608
|
+
EntryBinding(const string &alias, vector<LogicalType> types, vector<string> names, idx_t index,
|
|
13609
|
+
StandardEntry &entry);
|
|
13610
|
+
StandardEntry &entry;
|
|
13611
|
+
|
|
13612
|
+
public:
|
|
13613
|
+
StandardEntry *GetStandardEntry() override;
|
|
13570
13614
|
};
|
|
13571
13615
|
|
|
13572
13616
|
//! TableBinding is exactly like the Binding, except it keeps track of which columns were bound in the linked LogicalGet
|
|
@@ -13581,7 +13625,7 @@ struct TableBinding : public Binding {
|
|
|
13581
13625
|
public:
|
|
13582
13626
|
unique_ptr<ParsedExpression> ExpandGeneratedColumn(const string &column_name);
|
|
13583
13627
|
BindResult Bind(ColumnRefExpression &colref, idx_t depth) override;
|
|
13584
|
-
|
|
13628
|
+
StandardEntry *GetStandardEntry() override;
|
|
13585
13629
|
string ColumnNotFoundError(const string &column_name) const override;
|
|
13586
13630
|
};
|
|
13587
13631
|
|
|
@@ -13671,10 +13715,15 @@ public:
|
|
|
13671
13715
|
//! Adds a call to a table function with the given alias to the BindContext.
|
|
13672
13716
|
void AddTableFunction(idx_t index, const string &alias, const vector<string> &names,
|
|
13673
13717
|
const vector<LogicalType> &types, LogicalGet &get);
|
|
13718
|
+
//! Adds a table view with a given alias to the BindContext.
|
|
13719
|
+
void AddView(idx_t index, const string &alias, SubqueryRef &ref, BoundQueryNode &subquery, ViewCatalogEntry *view);
|
|
13674
13720
|
//! Adds a subquery with a given alias to the BindContext.
|
|
13675
13721
|
void AddSubquery(idx_t index, const string &alias, SubqueryRef &ref, BoundQueryNode &subquery);
|
|
13676
13722
|
//! Adds a subquery with a given alias to the BindContext.
|
|
13677
13723
|
void AddSubquery(idx_t index, const string &alias, TableFunctionRef &ref, BoundQueryNode &subquery);
|
|
13724
|
+
//! Adds a binding to a catalog entry with a given alias to the BindContext.
|
|
13725
|
+
void AddEntryBinding(idx_t index, const string &alias, const vector<string> &names,
|
|
13726
|
+
const vector<LogicalType> &types, StandardEntry *entry);
|
|
13678
13727
|
//! Adds a base table with the given alias to the BindContext.
|
|
13679
13728
|
void AddGenericBinding(idx_t index, const string &alias, const vector<string> &names,
|
|
13680
13729
|
const vector<LogicalType> &types);
|
|
@@ -14123,11 +14172,11 @@ public:
|
|
|
14123
14172
|
//! The statement type
|
|
14124
14173
|
StatementType type;
|
|
14125
14174
|
//! The statement location within the query string
|
|
14126
|
-
idx_t stmt_location;
|
|
14175
|
+
idx_t stmt_location = 0;
|
|
14127
14176
|
//! The statement length within the query string
|
|
14128
|
-
idx_t stmt_length;
|
|
14177
|
+
idx_t stmt_length = 0;
|
|
14129
14178
|
//! The number of prepared statement parameters (if any)
|
|
14130
|
-
idx_t n_param;
|
|
14179
|
+
idx_t n_param = 0;
|
|
14131
14180
|
//! The query text that corresponds to this SQL statement
|
|
14132
14181
|
string query;
|
|
14133
14182
|
|
|
@@ -15149,8 +15198,8 @@ private:
|
|
|
15149
15198
|
void AdjustTableDependencies(CatalogEntry *entry);
|
|
15150
15199
|
//! Adjust one dependency
|
|
15151
15200
|
void AdjustDependency(CatalogEntry *entry, TableCatalogEntry *table, ColumnDefinition &column, bool remove);
|
|
15152
|
-
//! Adjust
|
|
15153
|
-
void
|
|
15201
|
+
//! Adjust User dependency
|
|
15202
|
+
void AdjustUserDependency(CatalogEntry *entry, ColumnDefinition &column, bool remove);
|
|
15154
15203
|
//! Given a root entry, gets the entry valid for this transaction
|
|
15155
15204
|
CatalogEntry *GetEntryForTransaction(ClientContext &context, CatalogEntry *current);
|
|
15156
15205
|
CatalogEntry *GetCommittedEntry(CatalogEntry *current);
|
|
@@ -15314,6 +15363,7 @@ namespace duckdb {
|
|
|
15314
15363
|
using std::deque;
|
|
15315
15364
|
}
|
|
15316
15365
|
|
|
15366
|
+
|
|
15317
15367
|
//===----------------------------------------------------------------------===//
|
|
15318
15368
|
// DuckDB
|
|
15319
15369
|
//
|
|
@@ -15348,6 +15398,19 @@ using std::deque;
|
|
|
15348
15398
|
#endif
|
|
15349
15399
|
#endif
|
|
15350
15400
|
|
|
15401
|
+
// duplicate of duckdb/main/winapi.hpp
|
|
15402
|
+
#ifndef DUCKDB_EXTENSION_API
|
|
15403
|
+
#ifdef _WIN32
|
|
15404
|
+
#ifdef DUCKDB_BUILD_LOADABLE_EXTENSION
|
|
15405
|
+
#define DUCKDB_EXTENSION_API __declspec(dllexport)
|
|
15406
|
+
#else
|
|
15407
|
+
#define DUCKDB_EXTENSION_API
|
|
15408
|
+
#endif
|
|
15409
|
+
#else
|
|
15410
|
+
#define DUCKDB_EXTENSION_API __attribute__((visibility("default")))
|
|
15411
|
+
#endif
|
|
15412
|
+
#endif
|
|
15413
|
+
|
|
15351
15414
|
// duplicate of duckdb/common/constants.hpp
|
|
15352
15415
|
#ifndef DUCKDB_API_0_3_1
|
|
15353
15416
|
#define DUCKDB_API_0_3_1 1
|
|
@@ -17378,6 +17441,7 @@ private:
|
|
|
17378
17441
|
|
|
17379
17442
|
|
|
17380
17443
|
|
|
17444
|
+
|
|
17381
17445
|
//===----------------------------------------------------------------------===//
|
|
17382
17446
|
// DuckDB
|
|
17383
17447
|
//
|
|
@@ -17432,6 +17496,7 @@ private:
|
|
|
17432
17496
|
};
|
|
17433
17497
|
|
|
17434
17498
|
} // namespace duckdb
|
|
17499
|
+
|
|
17435
17500
|
//===----------------------------------------------------------------------===//
|
|
17436
17501
|
// DuckDB
|
|
17437
17502
|
//
|
|
@@ -17640,6 +17705,7 @@ public:
|
|
|
17640
17705
|
|
|
17641
17706
|
} // namespace duckdb
|
|
17642
17707
|
|
|
17708
|
+
|
|
17643
17709
|
namespace duckdb {
|
|
17644
17710
|
class Appender;
|
|
17645
17711
|
class Catalog;
|
|
@@ -18030,6 +18096,7 @@ protected:
|
|
|
18030
18096
|
|
|
18031
18097
|
|
|
18032
18098
|
|
|
18099
|
+
|
|
18033
18100
|
namespace duckdb {
|
|
18034
18101
|
|
|
18035
18102
|
class ChunkCollection;
|
|
@@ -18304,9 +18371,12 @@ private:
|
|
|
18304
18371
|
|
|
18305
18372
|
class Allocator {
|
|
18306
18373
|
public:
|
|
18307
|
-
Allocator();
|
|
18308
|
-
Allocator(allocate_function_ptr_t allocate_function_p, free_function_ptr_t free_function_p,
|
|
18309
|
-
|
|
18374
|
+
DUCKDB_API Allocator();
|
|
18375
|
+
DUCKDB_API Allocator(allocate_function_ptr_t allocate_function_p, free_function_ptr_t free_function_p,
|
|
18376
|
+
reallocate_function_ptr_t reallocate_function_p,
|
|
18377
|
+
unique_ptr<PrivateAllocatorData> private_data);
|
|
18378
|
+
|
|
18379
|
+
DUCKDB_API Allocator &operator=(Allocator &&allocator) noexcept = default;
|
|
18310
18380
|
|
|
18311
18381
|
data_ptr_t AllocateData(idx_t size);
|
|
18312
18382
|
void FreeData(data_ptr_t pointer, idx_t size);
|
|
@@ -18641,6 +18711,7 @@ public:
|
|
|
18641
18711
|
|
|
18642
18712
|
} // namespace duckdb
|
|
18643
18713
|
|
|
18714
|
+
|
|
18644
18715
|
namespace duckdb {
|
|
18645
18716
|
class StorageManager;
|
|
18646
18717
|
class Catalog;
|
|
@@ -18672,6 +18743,8 @@ public:
|
|
|
18672
18743
|
|
|
18673
18744
|
DUCKDB_API static DatabaseInstance &GetDatabase(ClientContext &context);
|
|
18674
18745
|
|
|
18746
|
+
DUCKDB_API const unordered_set<std::string> &LoadedExtensions();
|
|
18747
|
+
|
|
18675
18748
|
private:
|
|
18676
18749
|
void Initialize(const char *path, DBConfig *config);
|
|
18677
18750
|
|
|
@@ -18783,6 +18856,7 @@ ExternC const PfnDliHook __pfnDliFailureHook2 = duckdb_dllimport_delay_hook;
|
|
|
18783
18856
|
}
|
|
18784
18857
|
#endif
|
|
18785
18858
|
#endif
|
|
18859
|
+
|
|
18786
18860
|
//===----------------------------------------------------------------------===//
|
|
18787
18861
|
// DuckDB
|
|
18788
18862
|
//
|
|
@@ -18803,6 +18877,10 @@ namespace duckdb {
|
|
|
18803
18877
|
//! The Date class is a static class that holds helper functions for the Date type.
|
|
18804
18878
|
class Date {
|
|
18805
18879
|
public:
|
|
18880
|
+
static const char *PINF; // NOLINT
|
|
18881
|
+
static const char *NINF; // NOLINT
|
|
18882
|
+
static const char *EPOCH; // NOLINT
|
|
18883
|
+
|
|
18806
18884
|
static const string_t MONTH_NAMES[12];
|
|
18807
18885
|
static const string_t MONTH_NAMES_ABBREVIATED[12];
|
|
18808
18886
|
static const string_t DAY_NAMES[7];
|
|
@@ -19015,6 +19093,8 @@ public:
|
|
|
19015
19093
|
|
|
19016
19094
|
|
|
19017
19095
|
namespace duckdb {
|
|
19096
|
+
class ClientContext;
|
|
19097
|
+
struct RandomEngine;
|
|
19018
19098
|
|
|
19019
19099
|
//! The UUID class contains static operations for the UUID type
|
|
19020
19100
|
class UUID {
|
|
@@ -19029,6 +19109,10 @@ public:
|
|
|
19029
19109
|
//! Convert a hugeint object to a uuid style string
|
|
19030
19110
|
static void ToString(hugeint_t input, char *buf);
|
|
19031
19111
|
|
|
19112
|
+
//! Convert a hugeint object to a uuid style string
|
|
19113
|
+
static hugeint_t GenerateRandomUUID(RandomEngine &engine);
|
|
19114
|
+
static hugeint_t GenerateRandomUUID();
|
|
19115
|
+
|
|
19032
19116
|
//! Convert a hugeint object to a uuid style string
|
|
19033
19117
|
static string ToString(hugeint_t input) {
|
|
19034
19118
|
char buff[STRING_SIZE];
|
|
@@ -22393,7 +22477,7 @@ protected:
|
|
|
22393
22477
|
//! Format is literals[0], specifiers[0], literals[1], ..., specifiers[n - 1], literals[n]
|
|
22394
22478
|
vector<string> literals;
|
|
22395
22479
|
//! The constant size that appears in the format string
|
|
22396
|
-
idx_t constant_size;
|
|
22480
|
+
idx_t constant_size = 0;
|
|
22397
22481
|
//! The max numeric width of the specifier (if it is parsed as a number), or -1 if it is not a number
|
|
22398
22482
|
vector<int> numeric_width;
|
|
22399
22483
|
|
|
@@ -22410,6 +22494,9 @@ struct StrfTimeFormat : public StrTimeFormat {
|
|
|
22410
22494
|
|
|
22411
22495
|
DUCKDB_API static string Format(timestamp_t timestamp, const string &format);
|
|
22412
22496
|
|
|
22497
|
+
DUCKDB_API void ConvertDateVector(Vector &input, Vector &result, idx_t count);
|
|
22498
|
+
DUCKDB_API void ConvertTimestampVector(Vector &input, Vector &result, idx_t count);
|
|
22499
|
+
|
|
22413
22500
|
protected:
|
|
22414
22501
|
//! The variable-length specifiers. To determine total string size, these need to be checked.
|
|
22415
22502
|
vector<StrTimeSpecifier> var_length_specifiers;
|
|
@@ -22567,6 +22654,7 @@ struct BufferedCSVReaderOptions {
|
|
|
22567
22654
|
//! How many leading rows to skip
|
|
22568
22655
|
idx_t skip_rows = 0;
|
|
22569
22656
|
//! Maximum CSV line size: specified because if we reach this amount, we likely have wrong delimiters (default: 2MB)
|
|
22657
|
+
//! note that this is the guaranteed line length that will succeed, longer lines may be accepted if slightly above
|
|
22570
22658
|
idx_t maximum_line_size = 2097152;
|
|
22571
22659
|
//! Whether or not header names shall be normalized
|
|
22572
22660
|
bool normalize_names = false;
|
|
@@ -22596,6 +22684,9 @@ struct BufferedCSVReaderOptions {
|
|
|
22596
22684
|
|
|
22597
22685
|
//! The date format to use (if any is specified)
|
|
22598
22686
|
std::map<LogicalTypeId, StrpTimeFormat> date_format = {{LogicalTypeId::DATE, {}}, {LogicalTypeId::TIMESTAMP, {}}};
|
|
22687
|
+
//! The date format to use for writing (if any is specified)
|
|
22688
|
+
std::map<LogicalTypeId, StrfTimeFormat> write_date_format = {{LogicalTypeId::DATE, {}},
|
|
22689
|
+
{LogicalTypeId::TIMESTAMP, {}}};
|
|
22599
22690
|
//! Whether or not a type format is specified
|
|
22600
22691
|
std::map<LogicalTypeId, bool> has_format = {{LogicalTypeId::DATE, false}, {LogicalTypeId::TIMESTAMP, false}};
|
|
22601
22692
|
|
|
@@ -22610,6 +22701,7 @@ struct BufferedCSVReaderOptions {
|
|
|
22610
22701
|
void SetReadOption(const string &loption, const Value &value, vector<string> &expected_names);
|
|
22611
22702
|
|
|
22612
22703
|
void SetWriteOption(const string &loption, const Value &value);
|
|
22704
|
+
void SetDateFormat(LogicalTypeId type, const string &format, bool read_format);
|
|
22613
22705
|
|
|
22614
22706
|
std::string ToString() const;
|
|
22615
22707
|
};
|
|
@@ -22620,6 +22712,8 @@ enum class ParserMode : uint8_t { PARSING = 0, SNIFFING_DIALECT = 1, SNIFFING_DA
|
|
|
22620
22712
|
class BufferedCSVReader {
|
|
22621
22713
|
//! Initial buffer read size; can be extended for long lines
|
|
22622
22714
|
static constexpr idx_t INITIAL_BUFFER_SIZE = 16384;
|
|
22715
|
+
//! Larger buffer size for non disk files
|
|
22716
|
+
static constexpr idx_t INITIAL_BUFFER_SIZE_LARGE = 10000000; // 10MB
|
|
22623
22717
|
ParserMode mode;
|
|
22624
22718
|
|
|
22625
22719
|
public:
|
|
@@ -22889,7 +22983,7 @@ private:
|
|
|
22889
22983
|
//===----------------------------------------------------------------------===//
|
|
22890
22984
|
// DuckDB
|
|
22891
22985
|
//
|
|
22892
|
-
// duckdb/parser/expression/
|
|
22986
|
+
// duckdb/parser/expression/between_expression.hpp
|
|
22893
22987
|
//
|
|
22894
22988
|
//
|
|
22895
22989
|
//===----------------------------------------------------------------------===//
|
|
@@ -22899,20 +22993,20 @@ private:
|
|
|
22899
22993
|
|
|
22900
22994
|
|
|
22901
22995
|
namespace duckdb {
|
|
22902
|
-
|
|
22903
|
-
|
|
22904
|
-
class ComparisonExpression : public ParsedExpression {
|
|
22996
|
+
|
|
22997
|
+
class BetweenExpression : public ParsedExpression {
|
|
22905
22998
|
public:
|
|
22906
|
-
DUCKDB_API
|
|
22907
|
-
|
|
22999
|
+
DUCKDB_API BetweenExpression(unique_ptr<ParsedExpression> input, unique_ptr<ParsedExpression> lower,
|
|
23000
|
+
unique_ptr<ParsedExpression> upper);
|
|
22908
23001
|
|
|
22909
|
-
unique_ptr<ParsedExpression>
|
|
22910
|
-
unique_ptr<ParsedExpression>
|
|
23002
|
+
unique_ptr<ParsedExpression> input;
|
|
23003
|
+
unique_ptr<ParsedExpression> lower;
|
|
23004
|
+
unique_ptr<ParsedExpression> upper;
|
|
22911
23005
|
|
|
22912
23006
|
public:
|
|
22913
23007
|
string ToString() const override;
|
|
22914
23008
|
|
|
22915
|
-
static bool Equals(const
|
|
23009
|
+
static bool Equals(const BetweenExpression *a, const BetweenExpression *b);
|
|
22916
23010
|
|
|
22917
23011
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
22918
23012
|
|
|
@@ -22922,41 +23016,12 @@ public:
|
|
|
22922
23016
|
public:
|
|
22923
23017
|
template <class T, class BASE>
|
|
22924
23018
|
static string ToString(const T &entry) {
|
|
22925
|
-
return entry.
|
|
23019
|
+
return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
|
|
22926
23020
|
}
|
|
22927
23021
|
};
|
|
22928
23022
|
} // namespace duckdb
|
|
22929
|
-
//===----------------------------------------------------------------------===//
|
|
22930
|
-
// DuckDB
|
|
22931
|
-
//
|
|
22932
|
-
// duckdb/parser/expression/default_expression.hpp
|
|
22933
|
-
//
|
|
22934
|
-
//
|
|
22935
|
-
//===----------------------------------------------------------------------===//
|
|
22936
|
-
|
|
22937
|
-
|
|
22938
23023
|
|
|
22939
23024
|
|
|
22940
|
-
|
|
22941
|
-
namespace duckdb {
|
|
22942
|
-
//! Represents the default value of a column
|
|
22943
|
-
class DefaultExpression : public ParsedExpression {
|
|
22944
|
-
public:
|
|
22945
|
-
DefaultExpression();
|
|
22946
|
-
|
|
22947
|
-
public:
|
|
22948
|
-
bool IsScalar() const override {
|
|
22949
|
-
return false;
|
|
22950
|
-
}
|
|
22951
|
-
|
|
22952
|
-
string ToString() const override;
|
|
22953
|
-
|
|
22954
|
-
unique_ptr<ParsedExpression> Copy() const override;
|
|
22955
|
-
|
|
22956
|
-
void Serialize(FieldWriter &writer) const override;
|
|
22957
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
22958
|
-
};
|
|
22959
|
-
} // namespace duckdb
|
|
22960
23025
|
//===----------------------------------------------------------------------===//
|
|
22961
23026
|
// DuckDB
|
|
22962
23027
|
//
|
|
@@ -23009,10 +23074,11 @@ public:
|
|
|
23009
23074
|
}
|
|
23010
23075
|
};
|
|
23011
23076
|
} // namespace duckdb
|
|
23077
|
+
|
|
23012
23078
|
//===----------------------------------------------------------------------===//
|
|
23013
23079
|
// DuckDB
|
|
23014
23080
|
//
|
|
23015
|
-
// duckdb/parser/expression/
|
|
23081
|
+
// duckdb/parser/expression/cast_expression.hpp
|
|
23016
23082
|
//
|
|
23017
23083
|
//
|
|
23018
23084
|
//===----------------------------------------------------------------------===//
|
|
@@ -23021,32 +23087,44 @@ public:
|
|
|
23021
23087
|
|
|
23022
23088
|
|
|
23023
23089
|
|
|
23090
|
+
|
|
23024
23091
|
namespace duckdb {
|
|
23025
|
-
|
|
23092
|
+
|
|
23093
|
+
//! CastExpression represents a type cast from one SQL type to another SQL type
|
|
23094
|
+
class CastExpression : public ParsedExpression {
|
|
23026
23095
|
public:
|
|
23027
|
-
DUCKDB_API
|
|
23096
|
+
DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
|
|
23028
23097
|
|
|
23029
|
-
|
|
23098
|
+
//! The child of the cast expression
|
|
23099
|
+
unique_ptr<ParsedExpression> child;
|
|
23100
|
+
//! The type to cast to
|
|
23101
|
+
LogicalType cast_type;
|
|
23102
|
+
//! Whether or not this is a try_cast expression
|
|
23103
|
+
bool try_cast;
|
|
23030
23104
|
|
|
23031
23105
|
public:
|
|
23032
|
-
bool IsScalar() const override {
|
|
23033
|
-
return false;
|
|
23034
|
-
}
|
|
23035
|
-
|
|
23036
23106
|
string ToString() const override;
|
|
23037
23107
|
|
|
23038
|
-
static bool Equals(const
|
|
23108
|
+
static bool Equals(const CastExpression *a, const CastExpression *b);
|
|
23109
|
+
|
|
23039
23110
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
23040
|
-
hash_t Hash() const override;
|
|
23041
23111
|
|
|
23042
23112
|
void Serialize(FieldWriter &writer) const override;
|
|
23043
23113
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
23114
|
+
|
|
23115
|
+
public:
|
|
23116
|
+
template <class T, class BASE>
|
|
23117
|
+
static string ToString(const T &entry) {
|
|
23118
|
+
return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
|
|
23119
|
+
entry.cast_type.ToString() + ")";
|
|
23120
|
+
}
|
|
23044
23121
|
};
|
|
23045
23122
|
} // namespace duckdb
|
|
23123
|
+
|
|
23046
23124
|
//===----------------------------------------------------------------------===//
|
|
23047
23125
|
// DuckDB
|
|
23048
23126
|
//
|
|
23049
|
-
// duckdb/parser/expression/
|
|
23127
|
+
// duckdb/parser/expression/collate_expression.hpp
|
|
23050
23128
|
//
|
|
23051
23129
|
//
|
|
23052
23130
|
//===----------------------------------------------------------------------===//
|
|
@@ -23055,46 +23133,35 @@ public:
|
|
|
23055
23133
|
|
|
23056
23134
|
|
|
23057
23135
|
|
|
23058
|
-
|
|
23059
23136
|
namespace duckdb {
|
|
23060
23137
|
|
|
23061
|
-
//!
|
|
23062
|
-
class
|
|
23138
|
+
//! CollateExpression represents a COLLATE statement
|
|
23139
|
+
class CollateExpression : public ParsedExpression {
|
|
23063
23140
|
public:
|
|
23064
|
-
|
|
23065
|
-
DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
23066
|
-
DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
|
|
23067
|
-
unique_ptr<ParsedExpression> right);
|
|
23141
|
+
CollateExpression(string collation, unique_ptr<ParsedExpression> child);
|
|
23068
23142
|
|
|
23069
|
-
|
|
23143
|
+
//! The child of the cast expression
|
|
23144
|
+
unique_ptr<ParsedExpression> child;
|
|
23145
|
+
//! The collation clause
|
|
23146
|
+
string collation;
|
|
23070
23147
|
|
|
23071
23148
|
public:
|
|
23072
|
-
void AddExpression(unique_ptr<ParsedExpression> expr);
|
|
23073
|
-
|
|
23074
23149
|
string ToString() const override;
|
|
23075
23150
|
|
|
23076
|
-
static bool Equals(const
|
|
23151
|
+
static bool Equals(const CollateExpression *a, const CollateExpression *b);
|
|
23077
23152
|
|
|
23078
23153
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
23079
23154
|
|
|
23080
23155
|
void Serialize(FieldWriter &writer) const override;
|
|
23081
23156
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
23082
|
-
|
|
23083
|
-
public:
|
|
23084
|
-
template <class T, class BASE>
|
|
23085
|
-
static string ToString(const T &entry) {
|
|
23086
|
-
string result = "(" + entry.children[0]->ToString();
|
|
23087
|
-
for (idx_t i = 1; i < entry.children.size(); i++) {
|
|
23088
|
-
result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
|
|
23089
|
-
}
|
|
23090
|
-
return result + ")";
|
|
23091
|
-
}
|
|
23092
23157
|
};
|
|
23093
23158
|
} // namespace duckdb
|
|
23159
|
+
|
|
23160
|
+
|
|
23094
23161
|
//===----------------------------------------------------------------------===//
|
|
23095
23162
|
// DuckDB
|
|
23096
23163
|
//
|
|
23097
|
-
// duckdb/parser/expression/
|
|
23164
|
+
// duckdb/parser/expression/comparison_expression.hpp
|
|
23098
23165
|
//
|
|
23099
23166
|
//
|
|
23100
23167
|
//===----------------------------------------------------------------------===//
|
|
@@ -23103,47 +23170,39 @@ public:
|
|
|
23103
23170
|
|
|
23104
23171
|
|
|
23105
23172
|
|
|
23106
|
-
|
|
23107
|
-
|
|
23108
23173
|
namespace duckdb {
|
|
23109
|
-
|
|
23110
|
-
//!
|
|
23111
|
-
class
|
|
23174
|
+
//! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
|
|
23175
|
+
//! and has two children.
|
|
23176
|
+
class ComparisonExpression : public ParsedExpression {
|
|
23112
23177
|
public:
|
|
23113
|
-
|
|
23178
|
+
DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
|
|
23179
|
+
unique_ptr<ParsedExpression> right);
|
|
23114
23180
|
|
|
23115
|
-
|
|
23116
|
-
unique_ptr<
|
|
23117
|
-
//! The subquery type
|
|
23118
|
-
SubqueryType subquery_type;
|
|
23119
|
-
//! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
|
|
23120
|
-
//! subquery)
|
|
23121
|
-
unique_ptr<ParsedExpression> child;
|
|
23122
|
-
//! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
|
|
23123
|
-
ExpressionType comparison_type;
|
|
23181
|
+
unique_ptr<ParsedExpression> left;
|
|
23182
|
+
unique_ptr<ParsedExpression> right;
|
|
23124
23183
|
|
|
23125
23184
|
public:
|
|
23126
|
-
bool HasSubquery() const override {
|
|
23127
|
-
return true;
|
|
23128
|
-
}
|
|
23129
|
-
bool IsScalar() const override {
|
|
23130
|
-
return false;
|
|
23131
|
-
}
|
|
23132
|
-
|
|
23133
23185
|
string ToString() const override;
|
|
23134
23186
|
|
|
23135
|
-
static bool Equals(const
|
|
23187
|
+
static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
|
|
23136
23188
|
|
|
23137
23189
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
23138
23190
|
|
|
23139
23191
|
void Serialize(FieldWriter &writer) const override;
|
|
23140
23192
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
23193
|
+
|
|
23194
|
+
public:
|
|
23195
|
+
template <class T, class BASE>
|
|
23196
|
+
static string ToString(const T &entry) {
|
|
23197
|
+
return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString();
|
|
23198
|
+
}
|
|
23141
23199
|
};
|
|
23142
23200
|
} // namespace duckdb
|
|
23201
|
+
|
|
23143
23202
|
//===----------------------------------------------------------------------===//
|
|
23144
23203
|
// DuckDB
|
|
23145
23204
|
//
|
|
23146
|
-
// duckdb/parser/expression/
|
|
23205
|
+
// duckdb/parser/expression/conjunction_expression.hpp
|
|
23147
23206
|
//
|
|
23148
23207
|
//
|
|
23149
23208
|
//===----------------------------------------------------------------------===//
|
|
@@ -23155,22 +23214,22 @@ public:
|
|
|
23155
23214
|
|
|
23156
23215
|
namespace duckdb {
|
|
23157
23216
|
|
|
23158
|
-
//!
|
|
23159
|
-
class
|
|
23217
|
+
//! Represents a conjunction (AND/OR)
|
|
23218
|
+
class ConjunctionExpression : public ParsedExpression {
|
|
23160
23219
|
public:
|
|
23161
|
-
DUCKDB_API
|
|
23220
|
+
DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
|
|
23221
|
+
DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
23222
|
+
DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
|
|
23223
|
+
unique_ptr<ParsedExpression> right);
|
|
23162
23224
|
|
|
23163
|
-
|
|
23164
|
-
unique_ptr<ParsedExpression> child;
|
|
23165
|
-
//! The type to cast to
|
|
23166
|
-
LogicalType cast_type;
|
|
23167
|
-
//! Whether or not this is a try_cast expression
|
|
23168
|
-
bool try_cast;
|
|
23225
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
23169
23226
|
|
|
23170
23227
|
public:
|
|
23228
|
+
void AddExpression(unique_ptr<ParsedExpression> expr);
|
|
23229
|
+
|
|
23171
23230
|
string ToString() const override;
|
|
23172
23231
|
|
|
23173
|
-
static bool Equals(const
|
|
23232
|
+
static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
|
|
23174
23233
|
|
|
23175
23234
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
23176
23235
|
|
|
@@ -23180,15 +23239,19 @@ public:
|
|
|
23180
23239
|
public:
|
|
23181
23240
|
template <class T, class BASE>
|
|
23182
23241
|
static string ToString(const T &entry) {
|
|
23183
|
-
|
|
23184
|
-
|
|
23242
|
+
string result = "(" + entry.children[0]->ToString();
|
|
23243
|
+
for (idx_t i = 1; i < entry.children.size(); i++) {
|
|
23244
|
+
result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
|
|
23245
|
+
}
|
|
23246
|
+
return result + ")";
|
|
23185
23247
|
}
|
|
23186
23248
|
};
|
|
23187
23249
|
} // namespace duckdb
|
|
23250
|
+
|
|
23188
23251
|
//===----------------------------------------------------------------------===//
|
|
23189
23252
|
// DuckDB
|
|
23190
23253
|
//
|
|
23191
|
-
// duckdb/parser/expression/
|
|
23254
|
+
// duckdb/parser/expression/constant_expression.hpp
|
|
23192
23255
|
//
|
|
23193
23256
|
//
|
|
23194
23257
|
//===----------------------------------------------------------------------===//
|
|
@@ -23200,21 +23263,18 @@ public:
|
|
|
23200
23263
|
|
|
23201
23264
|
namespace duckdb {
|
|
23202
23265
|
|
|
23203
|
-
//!
|
|
23204
|
-
|
|
23205
|
-
//! 2. An OperatorExpression with the "->" operator
|
|
23206
|
-
//! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
|
|
23207
|
-
class LambdaExpression : public ParsedExpression {
|
|
23266
|
+
//! ConstantExpression represents a constant value in the query
|
|
23267
|
+
class ConstantExpression : public ParsedExpression {
|
|
23208
23268
|
public:
|
|
23209
|
-
|
|
23269
|
+
DUCKDB_API explicit ConstantExpression(Value val);
|
|
23210
23270
|
|
|
23211
|
-
|
|
23212
|
-
|
|
23271
|
+
//! The constant value referenced
|
|
23272
|
+
Value value;
|
|
23213
23273
|
|
|
23214
23274
|
public:
|
|
23215
23275
|
string ToString() const override;
|
|
23216
23276
|
|
|
23217
|
-
static bool Equals(const
|
|
23277
|
+
static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
|
|
23218
23278
|
hash_t Hash() const override;
|
|
23219
23279
|
|
|
23220
23280
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
@@ -23224,10 +23284,43 @@ public:
|
|
|
23224
23284
|
};
|
|
23225
23285
|
|
|
23226
23286
|
} // namespace duckdb
|
|
23287
|
+
|
|
23227
23288
|
//===----------------------------------------------------------------------===//
|
|
23228
23289
|
// DuckDB
|
|
23229
23290
|
//
|
|
23230
|
-
// duckdb/parser/expression/
|
|
23291
|
+
// duckdb/parser/expression/default_expression.hpp
|
|
23292
|
+
//
|
|
23293
|
+
//
|
|
23294
|
+
//===----------------------------------------------------------------------===//
|
|
23295
|
+
|
|
23296
|
+
|
|
23297
|
+
|
|
23298
|
+
|
|
23299
|
+
|
|
23300
|
+
namespace duckdb {
|
|
23301
|
+
//! Represents the default value of a column
|
|
23302
|
+
class DefaultExpression : public ParsedExpression {
|
|
23303
|
+
public:
|
|
23304
|
+
DefaultExpression();
|
|
23305
|
+
|
|
23306
|
+
public:
|
|
23307
|
+
bool IsScalar() const override {
|
|
23308
|
+
return false;
|
|
23309
|
+
}
|
|
23310
|
+
|
|
23311
|
+
string ToString() const override;
|
|
23312
|
+
|
|
23313
|
+
unique_ptr<ParsedExpression> Copy() const override;
|
|
23314
|
+
|
|
23315
|
+
void Serialize(FieldWriter &writer) const override;
|
|
23316
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
23317
|
+
};
|
|
23318
|
+
} // namespace duckdb
|
|
23319
|
+
|
|
23320
|
+
//===----------------------------------------------------------------------===//
|
|
23321
|
+
// DuckDB
|
|
23322
|
+
//
|
|
23323
|
+
// duckdb/parser/expression/function_expression.hpp
|
|
23231
23324
|
//
|
|
23232
23325
|
//
|
|
23233
23326
|
//===----------------------------------------------------------------------===//
|
|
@@ -23341,10 +23434,11 @@ public:
|
|
|
23341
23434
|
}
|
|
23342
23435
|
};
|
|
23343
23436
|
} // namespace duckdb
|
|
23437
|
+
|
|
23344
23438
|
//===----------------------------------------------------------------------===//
|
|
23345
23439
|
// DuckDB
|
|
23346
23440
|
//
|
|
23347
|
-
// duckdb/parser/expression/
|
|
23441
|
+
// duckdb/parser/expression/lambda_expression.hpp
|
|
23348
23442
|
//
|
|
23349
23443
|
//
|
|
23350
23444
|
//===----------------------------------------------------------------------===//
|
|
@@ -23356,29 +23450,132 @@ public:
|
|
|
23356
23450
|
|
|
23357
23451
|
namespace duckdb {
|
|
23358
23452
|
|
|
23359
|
-
//!
|
|
23360
|
-
|
|
23453
|
+
//! LambdaExpression represents either:
|
|
23454
|
+
//! 1. A lambda operator that can be used for e.g. mapping an expression to a list
|
|
23455
|
+
//! 2. An OperatorExpression with the "->" operator
|
|
23456
|
+
//! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
|
|
23457
|
+
class LambdaExpression : public ParsedExpression {
|
|
23361
23458
|
public:
|
|
23362
|
-
|
|
23459
|
+
LambdaExpression(unique_ptr<ParsedExpression> lhs, unique_ptr<ParsedExpression> rhs);
|
|
23363
23460
|
|
|
23364
|
-
|
|
23365
|
-
|
|
23366
|
-
//! List of columns to exclude from the STAR expression
|
|
23367
|
-
case_insensitive_set_t exclude_list;
|
|
23368
|
-
//! List of columns to replace with another expression
|
|
23369
|
-
case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
|
|
23461
|
+
unique_ptr<ParsedExpression> lhs;
|
|
23462
|
+
unique_ptr<ParsedExpression> rhs;
|
|
23370
23463
|
|
|
23371
23464
|
public:
|
|
23372
23465
|
string ToString() const override;
|
|
23373
23466
|
|
|
23374
|
-
static bool Equals(const
|
|
23467
|
+
static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
|
|
23468
|
+
hash_t Hash() const override;
|
|
23469
|
+
|
|
23470
|
+
unique_ptr<ParsedExpression> Copy() const override;
|
|
23471
|
+
|
|
23472
|
+
void Serialize(FieldWriter &writer) const override;
|
|
23473
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
23474
|
+
};
|
|
23475
|
+
|
|
23476
|
+
} // namespace duckdb
|
|
23477
|
+
|
|
23478
|
+
//===----------------------------------------------------------------------===//
|
|
23479
|
+
// DuckDB
|
|
23480
|
+
//
|
|
23481
|
+
// duckdb/parser/expression/operator_expression.hpp
|
|
23482
|
+
//
|
|
23483
|
+
//
|
|
23484
|
+
//===----------------------------------------------------------------------===//
|
|
23485
|
+
|
|
23486
|
+
|
|
23487
|
+
|
|
23488
|
+
|
|
23489
|
+
|
|
23490
|
+
|
|
23491
|
+
|
|
23492
|
+
|
|
23493
|
+
namespace duckdb {
|
|
23494
|
+
//! Represents a built-in operator expression
|
|
23495
|
+
class OperatorExpression : public ParsedExpression {
|
|
23496
|
+
public:
|
|
23497
|
+
DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
|
|
23498
|
+
unique_ptr<ParsedExpression> right = nullptr);
|
|
23499
|
+
DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
23500
|
+
|
|
23501
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
23502
|
+
|
|
23503
|
+
public:
|
|
23504
|
+
string ToString() const override;
|
|
23505
|
+
|
|
23506
|
+
static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
|
|
23375
23507
|
|
|
23376
23508
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
23377
23509
|
|
|
23378
23510
|
void Serialize(FieldWriter &writer) const override;
|
|
23379
23511
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
23512
|
+
|
|
23513
|
+
public:
|
|
23514
|
+
template <class T, class BASE>
|
|
23515
|
+
static string ToString(const T &entry) {
|
|
23516
|
+
auto op = ExpressionTypeToOperator(entry.type);
|
|
23517
|
+
if (!op.empty()) {
|
|
23518
|
+
// use the operator string to represent the operator
|
|
23519
|
+
D_ASSERT(entry.children.size() == 2);
|
|
23520
|
+
return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
|
|
23521
|
+
}
|
|
23522
|
+
switch (entry.type) {
|
|
23523
|
+
case ExpressionType::COMPARE_IN:
|
|
23524
|
+
case ExpressionType::COMPARE_NOT_IN: {
|
|
23525
|
+
string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
|
|
23526
|
+
string in_child = entry.children[0]->ToString();
|
|
23527
|
+
string child_list = "(";
|
|
23528
|
+
for (idx_t i = 1; i < entry.children.size(); i++) {
|
|
23529
|
+
if (i > 1) {
|
|
23530
|
+
child_list += ", ";
|
|
23531
|
+
}
|
|
23532
|
+
child_list += entry.children[i]->ToString();
|
|
23533
|
+
}
|
|
23534
|
+
child_list += ")";
|
|
23535
|
+
return "(" + in_child + op_type + child_list + ")";
|
|
23536
|
+
}
|
|
23537
|
+
case ExpressionType::OPERATOR_NOT:
|
|
23538
|
+
case ExpressionType::GROUPING_FUNCTION:
|
|
23539
|
+
case ExpressionType::OPERATOR_COALESCE: {
|
|
23540
|
+
string result = ExpressionTypeToString(entry.type);
|
|
23541
|
+
result += "(";
|
|
23542
|
+
result += StringUtil::Join(entry.children, entry.children.size(), ", ",
|
|
23543
|
+
[](const unique_ptr<BASE> &child) { return child->ToString(); });
|
|
23544
|
+
result += ")";
|
|
23545
|
+
return result;
|
|
23546
|
+
}
|
|
23547
|
+
case ExpressionType::OPERATOR_IS_NULL:
|
|
23548
|
+
return "(" + entry.children[0]->ToString() + " IS NULL)";
|
|
23549
|
+
case ExpressionType::OPERATOR_IS_NOT_NULL:
|
|
23550
|
+
return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
|
|
23551
|
+
case ExpressionType::ARRAY_EXTRACT:
|
|
23552
|
+
return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
|
|
23553
|
+
case ExpressionType::ARRAY_SLICE:
|
|
23554
|
+
return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
|
|
23555
|
+
entry.children[2]->ToString() + "]";
|
|
23556
|
+
case ExpressionType::STRUCT_EXTRACT: {
|
|
23557
|
+
D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT);
|
|
23558
|
+
auto child_string = entry.children[1]->ToString();
|
|
23559
|
+
D_ASSERT(child_string.size() >= 3);
|
|
23560
|
+
D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
|
|
23561
|
+
return "(" + entry.children[0]->ToString() + ")." +
|
|
23562
|
+
KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
|
|
23563
|
+
}
|
|
23564
|
+
case ExpressionType::ARRAY_CONSTRUCTOR: {
|
|
23565
|
+
string result = "(ARRAY[";
|
|
23566
|
+
result += StringUtil::Join(entry.children, entry.children.size(), ", ",
|
|
23567
|
+
[](const unique_ptr<BASE> &child) { return child->ToString(); });
|
|
23568
|
+
result += "])";
|
|
23569
|
+
return result;
|
|
23570
|
+
}
|
|
23571
|
+
default:
|
|
23572
|
+
throw InternalException("Unrecognized operator type");
|
|
23573
|
+
}
|
|
23574
|
+
}
|
|
23380
23575
|
};
|
|
23576
|
+
|
|
23381
23577
|
} // namespace duckdb
|
|
23578
|
+
|
|
23382
23579
|
//===----------------------------------------------------------------------===//
|
|
23383
23580
|
// DuckDB
|
|
23384
23581
|
//
|
|
@@ -23415,10 +23612,11 @@ public:
|
|
|
23415
23612
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
23416
23613
|
};
|
|
23417
23614
|
} // namespace duckdb
|
|
23615
|
+
|
|
23418
23616
|
//===----------------------------------------------------------------------===//
|
|
23419
23617
|
// DuckDB
|
|
23420
23618
|
//
|
|
23421
|
-
// duckdb/parser/expression/
|
|
23619
|
+
// duckdb/parser/expression/positional_reference_expression.hpp
|
|
23422
23620
|
//
|
|
23423
23621
|
//
|
|
23424
23622
|
//===----------------------------------------------------------------------===//
|
|
@@ -23428,41 +23626,32 @@ public:
|
|
|
23428
23626
|
|
|
23429
23627
|
|
|
23430
23628
|
namespace duckdb {
|
|
23431
|
-
|
|
23432
|
-
class BetweenExpression : public ParsedExpression {
|
|
23629
|
+
class PositionalReferenceExpression : public ParsedExpression {
|
|
23433
23630
|
public:
|
|
23434
|
-
DUCKDB_API
|
|
23435
|
-
unique_ptr<ParsedExpression> upper);
|
|
23631
|
+
DUCKDB_API PositionalReferenceExpression(idx_t index);
|
|
23436
23632
|
|
|
23437
|
-
|
|
23438
|
-
unique_ptr<ParsedExpression> lower;
|
|
23439
|
-
unique_ptr<ParsedExpression> upper;
|
|
23633
|
+
idx_t index;
|
|
23440
23634
|
|
|
23441
23635
|
public:
|
|
23442
|
-
|
|
23636
|
+
bool IsScalar() const override {
|
|
23637
|
+
return false;
|
|
23638
|
+
}
|
|
23443
23639
|
|
|
23444
|
-
|
|
23640
|
+
string ToString() const override;
|
|
23445
23641
|
|
|
23642
|
+
static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
|
|
23446
23643
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
23644
|
+
hash_t Hash() const override;
|
|
23447
23645
|
|
|
23448
23646
|
void Serialize(FieldWriter &writer) const override;
|
|
23449
23647
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
23450
|
-
|
|
23451
|
-
public:
|
|
23452
|
-
template <class T, class BASE>
|
|
23453
|
-
static string ToString(const T &entry) {
|
|
23454
|
-
return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString();
|
|
23455
|
-
}
|
|
23456
23648
|
};
|
|
23457
23649
|
} // namespace duckdb
|
|
23458
23650
|
|
|
23459
|
-
|
|
23460
|
-
|
|
23461
|
-
|
|
23462
23651
|
//===----------------------------------------------------------------------===//
|
|
23463
23652
|
// DuckDB
|
|
23464
23653
|
//
|
|
23465
|
-
// duckdb/parser/expression/
|
|
23654
|
+
// duckdb/parser/expression/star_expression.hpp
|
|
23466
23655
|
//
|
|
23467
23656
|
//
|
|
23468
23657
|
//===----------------------------------------------------------------------===//
|
|
@@ -23471,22 +23660,25 @@ public:
|
|
|
23471
23660
|
|
|
23472
23661
|
|
|
23473
23662
|
|
|
23663
|
+
|
|
23474
23664
|
namespace duckdb {
|
|
23475
23665
|
|
|
23476
|
-
//!
|
|
23477
|
-
class
|
|
23666
|
+
//! Represents a * expression in the SELECT clause
|
|
23667
|
+
class StarExpression : public ParsedExpression {
|
|
23478
23668
|
public:
|
|
23479
|
-
|
|
23669
|
+
StarExpression(string relation_name = string());
|
|
23480
23670
|
|
|
23481
|
-
//! The
|
|
23482
|
-
|
|
23483
|
-
//!
|
|
23484
|
-
|
|
23671
|
+
//! The relation name in case of tbl.*, or empty if this is a normal *
|
|
23672
|
+
string relation_name;
|
|
23673
|
+
//! List of columns to exclude from the STAR expression
|
|
23674
|
+
case_insensitive_set_t exclude_list;
|
|
23675
|
+
//! List of columns to replace with another expression
|
|
23676
|
+
case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
|
|
23485
23677
|
|
|
23486
23678
|
public:
|
|
23487
23679
|
string ToString() const override;
|
|
23488
23680
|
|
|
23489
|
-
static bool Equals(const
|
|
23681
|
+
static bool Equals(const StarExpression *a, const StarExpression *b);
|
|
23490
23682
|
|
|
23491
23683
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
23492
23684
|
|
|
@@ -23495,13 +23687,10 @@ public:
|
|
|
23495
23687
|
};
|
|
23496
23688
|
} // namespace duckdb
|
|
23497
23689
|
|
|
23498
|
-
|
|
23499
|
-
|
|
23500
|
-
|
|
23501
23690
|
//===----------------------------------------------------------------------===//
|
|
23502
23691
|
// DuckDB
|
|
23503
23692
|
//
|
|
23504
|
-
// duckdb/parser/expression/
|
|
23693
|
+
// duckdb/parser/expression/subquery_expression.hpp
|
|
23505
23694
|
//
|
|
23506
23695
|
//
|
|
23507
23696
|
//===----------------------------------------------------------------------===//
|
|
@@ -23511,37 +23700,48 @@ public:
|
|
|
23511
23700
|
|
|
23512
23701
|
|
|
23513
23702
|
|
|
23703
|
+
|
|
23514
23704
|
namespace duckdb {
|
|
23515
23705
|
|
|
23516
|
-
//!
|
|
23517
|
-
class
|
|
23706
|
+
//! Represents a subquery
|
|
23707
|
+
class SubqueryExpression : public ParsedExpression {
|
|
23518
23708
|
public:
|
|
23519
|
-
|
|
23709
|
+
SubqueryExpression();
|
|
23520
23710
|
|
|
23521
|
-
//! The
|
|
23522
|
-
|
|
23711
|
+
//! The actual subquery
|
|
23712
|
+
unique_ptr<SelectStatement> subquery;
|
|
23713
|
+
//! The subquery type
|
|
23714
|
+
SubqueryType subquery_type;
|
|
23715
|
+
//! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
|
|
23716
|
+
//! subquery)
|
|
23717
|
+
unique_ptr<ParsedExpression> child;
|
|
23718
|
+
//! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
|
|
23719
|
+
ExpressionType comparison_type;
|
|
23523
23720
|
|
|
23524
23721
|
public:
|
|
23722
|
+
bool HasSubquery() const override {
|
|
23723
|
+
return true;
|
|
23724
|
+
}
|
|
23725
|
+
bool IsScalar() const override {
|
|
23726
|
+
return false;
|
|
23727
|
+
}
|
|
23728
|
+
|
|
23525
23729
|
string ToString() const override;
|
|
23526
23730
|
|
|
23527
|
-
static bool Equals(const
|
|
23528
|
-
hash_t Hash() const override;
|
|
23731
|
+
static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
|
|
23529
23732
|
|
|
23530
23733
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
23531
23734
|
|
|
23532
23735
|
void Serialize(FieldWriter &writer) const override;
|
|
23533
23736
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
23534
23737
|
};
|
|
23535
|
-
|
|
23536
23738
|
} // namespace duckdb
|
|
23537
23739
|
|
|
23538
23740
|
|
|
23539
|
-
|
|
23540
|
-
|
|
23541
23741
|
//===----------------------------------------------------------------------===//
|
|
23542
23742
|
// DuckDB
|
|
23543
23743
|
//
|
|
23544
|
-
// duckdb/parser/
|
|
23744
|
+
// duckdb/parser/parsed_data/vacuum_info.hpp
|
|
23545
23745
|
//
|
|
23546
23746
|
//
|
|
23547
23747
|
//===----------------------------------------------------------------------===//
|
|
@@ -23550,94 +23750,69 @@ public:
|
|
|
23550
23750
|
|
|
23551
23751
|
|
|
23552
23752
|
|
|
23753
|
+
namespace duckdb {
|
|
23553
23754
|
|
|
23755
|
+
enum class LoadType { LOAD, INSTALL, FORCE_INSTALL };
|
|
23554
23756
|
|
|
23757
|
+
struct LoadInfo : public ParseInfo {
|
|
23758
|
+
std::string filename;
|
|
23759
|
+
LoadType load_type;
|
|
23555
23760
|
|
|
23556
|
-
namespace duckdb {
|
|
23557
|
-
//! Represents a built-in operator expression
|
|
23558
|
-
class OperatorExpression : public ParsedExpression {
|
|
23559
23761
|
public:
|
|
23560
|
-
|
|
23561
|
-
|
|
23562
|
-
|
|
23762
|
+
unique_ptr<LoadInfo> Copy() const {
|
|
23763
|
+
auto result = make_unique<LoadInfo>();
|
|
23764
|
+
result->filename = filename;
|
|
23765
|
+
result->load_type = load_type;
|
|
23766
|
+
return result;
|
|
23767
|
+
}
|
|
23768
|
+
};
|
|
23769
|
+
|
|
23770
|
+
} // namespace duckdb
|
|
23771
|
+
//===----------------------------------------------------------------------===//
|
|
23772
|
+
// DuckDB
|
|
23773
|
+
//
|
|
23774
|
+
// duckdb/parser/parsed_data/create_type_info.hpp
|
|
23775
|
+
//
|
|
23776
|
+
//
|
|
23777
|
+
//===----------------------------------------------------------------------===//
|
|
23563
23778
|
|
|
23564
|
-
vector<unique_ptr<ParsedExpression>> children;
|
|
23565
23779
|
|
|
23566
|
-
public:
|
|
23567
|
-
string ToString() const override;
|
|
23568
23780
|
|
|
23569
|
-
static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
|
|
23570
23781
|
|
|
23571
|
-
unique_ptr<ParsedExpression> Copy() const override;
|
|
23572
23782
|
|
|
23573
|
-
|
|
23574
|
-
|
|
23783
|
+
|
|
23784
|
+
|
|
23785
|
+
|
|
23786
|
+
namespace duckdb {
|
|
23787
|
+
|
|
23788
|
+
struct CreateTypeInfo : public CreateInfo {
|
|
23789
|
+
|
|
23790
|
+
CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
|
|
23791
|
+
}
|
|
23792
|
+
|
|
23793
|
+
//! Name of the Type
|
|
23794
|
+
string name;
|
|
23795
|
+
//! Logical Type
|
|
23796
|
+
LogicalType type;
|
|
23575
23797
|
|
|
23576
23798
|
public:
|
|
23577
|
-
|
|
23578
|
-
|
|
23579
|
-
|
|
23580
|
-
|
|
23581
|
-
|
|
23582
|
-
|
|
23583
|
-
return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
|
|
23584
|
-
}
|
|
23585
|
-
switch (entry.type) {
|
|
23586
|
-
case ExpressionType::COMPARE_IN:
|
|
23587
|
-
case ExpressionType::COMPARE_NOT_IN: {
|
|
23588
|
-
string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
|
|
23589
|
-
string in_child = entry.children[0]->ToString();
|
|
23590
|
-
string child_list = "(";
|
|
23591
|
-
for (idx_t i = 1; i < entry.children.size(); i++) {
|
|
23592
|
-
if (i > 1) {
|
|
23593
|
-
child_list += ", ";
|
|
23594
|
-
}
|
|
23595
|
-
child_list += entry.children[i]->ToString();
|
|
23596
|
-
}
|
|
23597
|
-
child_list += ")";
|
|
23598
|
-
return "(" + in_child + op_type + child_list + ")";
|
|
23599
|
-
}
|
|
23600
|
-
case ExpressionType::OPERATOR_NOT:
|
|
23601
|
-
case ExpressionType::GROUPING_FUNCTION:
|
|
23602
|
-
case ExpressionType::OPERATOR_COALESCE: {
|
|
23603
|
-
string result = ExpressionTypeToString(entry.type);
|
|
23604
|
-
result += "(";
|
|
23605
|
-
result += StringUtil::Join(entry.children, entry.children.size(), ", ",
|
|
23606
|
-
[](const unique_ptr<BASE> &child) { return child->ToString(); });
|
|
23607
|
-
result += ")";
|
|
23608
|
-
return result;
|
|
23609
|
-
}
|
|
23610
|
-
case ExpressionType::OPERATOR_IS_NULL:
|
|
23611
|
-
return "(" + entry.children[0]->ToString() + " IS NULL)";
|
|
23612
|
-
case ExpressionType::OPERATOR_IS_NOT_NULL:
|
|
23613
|
-
return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
|
|
23614
|
-
case ExpressionType::ARRAY_EXTRACT:
|
|
23615
|
-
return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
|
|
23616
|
-
case ExpressionType::ARRAY_SLICE:
|
|
23617
|
-
return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" +
|
|
23618
|
-
entry.children[2]->ToString() + "]";
|
|
23619
|
-
case ExpressionType::STRUCT_EXTRACT: {
|
|
23620
|
-
D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT);
|
|
23621
|
-
auto child_string = entry.children[1]->ToString();
|
|
23622
|
-
D_ASSERT(child_string.size() >= 3);
|
|
23623
|
-
D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
|
|
23624
|
-
return "(" + entry.children[0]->ToString() + ")." +
|
|
23625
|
-
KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2));
|
|
23626
|
-
}
|
|
23627
|
-
case ExpressionType::ARRAY_CONSTRUCTOR: {
|
|
23628
|
-
string result = "(ARRAY[";
|
|
23629
|
-
result += StringUtil::Join(entry.children, entry.children.size(), ", ",
|
|
23630
|
-
[](const unique_ptr<BASE> &child) { return child->ToString(); });
|
|
23631
|
-
result += "])";
|
|
23632
|
-
return result;
|
|
23633
|
-
}
|
|
23634
|
-
default:
|
|
23635
|
-
throw InternalException("Unrecognized operator type");
|
|
23636
|
-
}
|
|
23799
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
23800
|
+
auto result = make_unique<CreateTypeInfo>();
|
|
23801
|
+
CopyProperties(*result);
|
|
23802
|
+
result->name = name;
|
|
23803
|
+
result->type = type;
|
|
23804
|
+
return move(result);
|
|
23637
23805
|
}
|
|
23638
23806
|
};
|
|
23639
23807
|
|
|
23640
23808
|
} // namespace duckdb
|
|
23809
|
+
//===----------------------------------------------------------------------===//
|
|
23810
|
+
// DuckDB
|
|
23811
|
+
//
|
|
23812
|
+
// duckdb/parser/parsed_data/create_index_info.hpp
|
|
23813
|
+
//
|
|
23814
|
+
//
|
|
23815
|
+
//===----------------------------------------------------------------------===//
|
|
23641
23816
|
|
|
23642
23817
|
|
|
23643
23818
|
|
|
@@ -23647,7 +23822,7 @@ public:
|
|
|
23647
23822
|
//===----------------------------------------------------------------------===//
|
|
23648
23823
|
// DuckDB
|
|
23649
23824
|
//
|
|
23650
|
-
// duckdb/parser/
|
|
23825
|
+
// duckdb/parser/tableref/basetableref.hpp
|
|
23651
23826
|
//
|
|
23652
23827
|
//
|
|
23653
23828
|
//===----------------------------------------------------------------------===//
|
|
@@ -23658,30 +23833,62 @@ public:
|
|
|
23658
23833
|
|
|
23659
23834
|
|
|
23660
23835
|
namespace duckdb {
|
|
23661
|
-
|
|
23662
|
-
|
|
23663
|
-
|
|
23836
|
+
//! Represents a TableReference to a base table in the schema
|
|
23837
|
+
class BaseTableRef : public TableRef {
|
|
23838
|
+
public:
|
|
23839
|
+
BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
|
|
23664
23840
|
}
|
|
23665
|
-
|
|
23666
|
-
|
|
23841
|
+
|
|
23842
|
+
//! Schema name
|
|
23843
|
+
string schema_name;
|
|
23844
|
+
//! Table name
|
|
23845
|
+
string table_name;
|
|
23846
|
+
//! Aliases for the column names
|
|
23847
|
+
vector<string> column_name_alias;
|
|
23848
|
+
|
|
23849
|
+
public:
|
|
23850
|
+
string ToString() const override;
|
|
23851
|
+
bool Equals(const TableRef *other_p) const override;
|
|
23852
|
+
|
|
23853
|
+
unique_ptr<TableRef> Copy() override;
|
|
23854
|
+
|
|
23855
|
+
//! Serializes a blob into a BaseTableRef
|
|
23856
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
23857
|
+
//! Deserializes a blob back into a BaseTableRef
|
|
23858
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
23859
|
+
};
|
|
23860
|
+
} // namespace duckdb
|
|
23861
|
+
|
|
23862
|
+
|
|
23863
|
+
|
|
23864
|
+
namespace duckdb {
|
|
23865
|
+
|
|
23866
|
+
struct CreateIndexInfo : public CreateInfo {
|
|
23867
|
+
CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
|
|
23667
23868
|
}
|
|
23668
23869
|
|
|
23669
|
-
//!
|
|
23670
|
-
|
|
23671
|
-
//!
|
|
23672
|
-
|
|
23673
|
-
//!
|
|
23674
|
-
|
|
23675
|
-
//! The
|
|
23676
|
-
unique_ptr<
|
|
23870
|
+
//! Index Type (e.g., B+-tree, Skip-List, ...)
|
|
23871
|
+
IndexType index_type;
|
|
23872
|
+
//! Name of the Index
|
|
23873
|
+
string index_name;
|
|
23874
|
+
//! If it is an unique index
|
|
23875
|
+
bool unique = false;
|
|
23876
|
+
//! The table to create the index on
|
|
23877
|
+
unique_ptr<BaseTableRef> table;
|
|
23878
|
+
//! Set of expressions to index by
|
|
23879
|
+
vector<unique_ptr<ParsedExpression>> expressions;
|
|
23677
23880
|
|
|
23678
23881
|
public:
|
|
23679
23882
|
unique_ptr<CreateInfo> Copy() const override {
|
|
23680
|
-
auto result = make_unique<
|
|
23883
|
+
auto result = make_unique<CreateIndexInfo>();
|
|
23681
23884
|
CopyProperties(*result);
|
|
23682
|
-
result->
|
|
23683
|
-
result->
|
|
23684
|
-
result->
|
|
23885
|
+
result->index_type = index_type;
|
|
23886
|
+
result->index_name = index_name;
|
|
23887
|
+
result->unique = unique;
|
|
23888
|
+
result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
|
|
23889
|
+
for (auto &expr : expressions) {
|
|
23890
|
+
result->expressions.push_back(expr->Copy());
|
|
23891
|
+
}
|
|
23685
23892
|
return move(result);
|
|
23686
23893
|
}
|
|
23687
23894
|
};
|
|
@@ -23755,7 +23962,7 @@ public:
|
|
|
23755
23962
|
//===----------------------------------------------------------------------===//
|
|
23756
23963
|
// DuckDB
|
|
23757
23964
|
//
|
|
23758
|
-
// duckdb/parser/parsed_data/
|
|
23965
|
+
// duckdb/parser/parsed_data/vacuum_info.hpp
|
|
23759
23966
|
//
|
|
23760
23967
|
//
|
|
23761
23968
|
//===----------------------------------------------------------------------===//
|
|
@@ -23766,99 +23973,51 @@ public:
|
|
|
23766
23973
|
|
|
23767
23974
|
namespace duckdb {
|
|
23768
23975
|
|
|
23769
|
-
struct
|
|
23770
|
-
|
|
23771
|
-
}
|
|
23772
|
-
|
|
23773
|
-
public:
|
|
23774
|
-
unique_ptr<CreateInfo> Copy() const override {
|
|
23775
|
-
auto result = make_unique<CreateSchemaInfo>();
|
|
23776
|
-
CopyProperties(*result);
|
|
23777
|
-
return move(result);
|
|
23778
|
-
}
|
|
23976
|
+
struct VacuumInfo : public ParseInfo {
|
|
23977
|
+
// nothing for now
|
|
23779
23978
|
};
|
|
23780
23979
|
|
|
23781
23980
|
} // namespace duckdb
|
|
23782
23981
|
//===----------------------------------------------------------------------===//
|
|
23783
23982
|
// DuckDB
|
|
23784
23983
|
//
|
|
23785
|
-
// duckdb/parser/parsed_data/
|
|
23786
|
-
//
|
|
23787
|
-
//
|
|
23788
|
-
//===----------------------------------------------------------------------===//
|
|
23789
|
-
|
|
23790
|
-
|
|
23791
|
-
|
|
23792
|
-
|
|
23793
|
-
//===----------------------------------------------------------------------===//
|
|
23794
|
-
// DuckDB
|
|
23795
|
-
//
|
|
23796
|
-
// duckdb/function/macro_function.hpp
|
|
23984
|
+
// duckdb/parser/parsed_data/drop_info.hpp
|
|
23797
23985
|
//
|
|
23798
23986
|
//
|
|
23799
23987
|
//===----------------------------------------------------------------------===//
|
|
23800
23988
|
|
|
23801
23989
|
|
|
23802
|
-
//! The SelectStatement of the view
|
|
23803
|
-
|
|
23804
|
-
|
|
23805
|
-
|
|
23806
23990
|
|
|
23807
23991
|
|
|
23808
23992
|
|
|
23809
23993
|
|
|
23810
23994
|
namespace duckdb {
|
|
23811
23995
|
|
|
23812
|
-
|
|
23813
|
-
|
|
23814
|
-
class MacroFunction {
|
|
23815
|
-
public:
|
|
23816
|
-
// explicit MacroFunction(unique_ptr<ParsedExpression> expression);
|
|
23817
|
-
MacroFunction(MacroType type);
|
|
23818
|
-
|
|
23819
|
-
// MacroFunction(void);
|
|
23820
|
-
// The type
|
|
23821
|
-
MacroType type;
|
|
23822
|
-
//! The positional parameters
|
|
23823
|
-
vector<unique_ptr<ParsedExpression>> parameters;
|
|
23824
|
-
//! The default parameters and their associated values
|
|
23825
|
-
unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
|
|
23826
|
-
|
|
23827
|
-
public:
|
|
23828
|
-
virtual ~MacroFunction() {
|
|
23829
|
-
}
|
|
23830
|
-
|
|
23831
|
-
void CopyProperties(MacroFunction &other);
|
|
23832
|
-
|
|
23833
|
-
virtual unique_ptr<MacroFunction> Copy() = 0;
|
|
23834
|
-
|
|
23835
|
-
static string ValidateArguments(MacroFunction ¯o_function, const string &name,
|
|
23836
|
-
FunctionExpression &function_expr,
|
|
23837
|
-
vector<unique_ptr<ParsedExpression>> &positionals,
|
|
23838
|
-
unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
|
|
23839
|
-
};
|
|
23840
|
-
|
|
23841
|
-
} // namespace duckdb
|
|
23842
|
-
|
|
23843
|
-
|
|
23844
|
-
namespace duckdb {
|
|
23845
|
-
|
|
23846
|
-
struct CreateMacroInfo : public CreateFunctionInfo {
|
|
23847
|
-
CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
|
|
23848
|
-
}
|
|
23849
|
-
|
|
23850
|
-
CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
|
|
23996
|
+
struct DropInfo : public ParseInfo {
|
|
23997
|
+
DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
|
|
23851
23998
|
}
|
|
23852
23999
|
|
|
23853
|
-
|
|
24000
|
+
//! The catalog type to drop
|
|
24001
|
+
CatalogType type;
|
|
24002
|
+
//! Schema name to drop from, if any
|
|
24003
|
+
string schema;
|
|
24004
|
+
//! Element name to drop
|
|
24005
|
+
string name;
|
|
24006
|
+
//! Ignore if the entry does not exist instead of failing
|
|
24007
|
+
bool if_exists = false;
|
|
24008
|
+
//! Cascade drop (drop all dependents instead of throwing an error if there
|
|
24009
|
+
//! are any)
|
|
24010
|
+
bool cascade = false;
|
|
23854
24011
|
|
|
23855
24012
|
public:
|
|
23856
|
-
unique_ptr<
|
|
23857
|
-
auto result = make_unique<
|
|
23858
|
-
result->
|
|
24013
|
+
unique_ptr<DropInfo> Copy() const {
|
|
24014
|
+
auto result = make_unique<DropInfo>();
|
|
24015
|
+
result->type = type;
|
|
24016
|
+
result->schema = schema;
|
|
23859
24017
|
result->name = name;
|
|
23860
|
-
|
|
23861
|
-
|
|
24018
|
+
result->if_exists = if_exists;
|
|
24019
|
+
result->cascade = cascade;
|
|
24020
|
+
return result;
|
|
23862
24021
|
}
|
|
23863
24022
|
};
|
|
23864
24023
|
|
|
@@ -23979,7 +24138,7 @@ struct BoundExportData : public ParseInfo {
|
|
|
23979
24138
|
//===----------------------------------------------------------------------===//
|
|
23980
24139
|
// DuckDB
|
|
23981
24140
|
//
|
|
23982
|
-
// duckdb/parser/parsed_data/
|
|
24141
|
+
// duckdb/parser/parsed_data/create_macro_info.hpp
|
|
23983
24142
|
//
|
|
23984
24143
|
//
|
|
23985
24144
|
//===----------------------------------------------------------------------===//
|
|
@@ -23987,122 +24146,74 @@ struct BoundExportData : public ParseInfo {
|
|
|
23987
24146
|
|
|
23988
24147
|
|
|
23989
24148
|
|
|
23990
|
-
|
|
23991
|
-
|
|
23992
|
-
namespace duckdb {
|
|
23993
|
-
|
|
23994
|
-
struct DropInfo : public ParseInfo {
|
|
23995
|
-
DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
|
|
23996
|
-
}
|
|
23997
|
-
|
|
23998
|
-
//! The catalog type to drop
|
|
23999
|
-
CatalogType type;
|
|
24000
|
-
//! Schema name to drop from, if any
|
|
24001
|
-
string schema;
|
|
24002
|
-
//! Element name to drop
|
|
24003
|
-
string name;
|
|
24004
|
-
//! Ignore if the entry does not exist instead of failing
|
|
24005
|
-
bool if_exists = false;
|
|
24006
|
-
//! Cascade drop (drop all dependents instead of throwing an error if there
|
|
24007
|
-
//! are any)
|
|
24008
|
-
bool cascade = false;
|
|
24009
|
-
|
|
24010
|
-
public:
|
|
24011
|
-
unique_ptr<DropInfo> Copy() const {
|
|
24012
|
-
auto result = make_unique<DropInfo>();
|
|
24013
|
-
result->type = type;
|
|
24014
|
-
result->schema = schema;
|
|
24015
|
-
result->name = name;
|
|
24016
|
-
result->if_exists = if_exists;
|
|
24017
|
-
result->cascade = cascade;
|
|
24018
|
-
return result;
|
|
24019
|
-
}
|
|
24020
|
-
};
|
|
24021
|
-
|
|
24022
|
-
} // namespace duckdb
|
|
24023
24149
|
//===----------------------------------------------------------------------===//
|
|
24024
24150
|
// DuckDB
|
|
24025
24151
|
//
|
|
24026
|
-
// duckdb/
|
|
24152
|
+
// duckdb/function/macro_function.hpp
|
|
24027
24153
|
//
|
|
24028
24154
|
//
|
|
24029
24155
|
//===----------------------------------------------------------------------===//
|
|
24030
24156
|
|
|
24031
24157
|
|
|
24158
|
+
//! The SelectStatement of the view
|
|
24032
24159
|
|
|
24033
24160
|
|
|
24034
24161
|
|
|
24035
24162
|
|
|
24036
|
-
//===----------------------------------------------------------------------===//
|
|
24037
|
-
// DuckDB
|
|
24038
|
-
//
|
|
24039
|
-
// duckdb/parser/tableref/basetableref.hpp
|
|
24040
|
-
//
|
|
24041
|
-
//
|
|
24042
|
-
//===----------------------------------------------------------------------===//
|
|
24043
24163
|
|
|
24044
24164
|
|
|
24045
24165
|
|
|
24166
|
+
namespace duckdb {
|
|
24046
24167
|
|
|
24168
|
+
enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO = 2 };
|
|
24047
24169
|
|
|
24170
|
+
class MacroFunction {
|
|
24171
|
+
public:
|
|
24172
|
+
// explicit MacroFunction(unique_ptr<ParsedExpression> expression);
|
|
24173
|
+
MacroFunction(MacroType type);
|
|
24174
|
+
|
|
24175
|
+
// MacroFunction(void);
|
|
24176
|
+
// The type
|
|
24177
|
+
MacroType type;
|
|
24178
|
+
//! The positional parameters
|
|
24179
|
+
vector<unique_ptr<ParsedExpression>> parameters;
|
|
24180
|
+
//! The default parameters and their associated values
|
|
24181
|
+
unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
|
|
24048
24182
|
|
|
24049
|
-
namespace duckdb {
|
|
24050
|
-
//! Represents a TableReference to a base table in the schema
|
|
24051
|
-
class BaseTableRef : public TableRef {
|
|
24052
24183
|
public:
|
|
24053
|
-
|
|
24184
|
+
virtual ~MacroFunction() {
|
|
24054
24185
|
}
|
|
24055
24186
|
|
|
24056
|
-
|
|
24057
|
-
string schema_name;
|
|
24058
|
-
//! Table name
|
|
24059
|
-
string table_name;
|
|
24060
|
-
//! Aliases for the column names
|
|
24061
|
-
vector<string> column_name_alias;
|
|
24062
|
-
|
|
24063
|
-
public:
|
|
24064
|
-
string ToString() const override;
|
|
24065
|
-
bool Equals(const TableRef *other_p) const override;
|
|
24187
|
+
void CopyProperties(MacroFunction &other);
|
|
24066
24188
|
|
|
24067
|
-
unique_ptr<
|
|
24189
|
+
virtual unique_ptr<MacroFunction> Copy() = 0;
|
|
24068
24190
|
|
|
24069
|
-
|
|
24070
|
-
|
|
24071
|
-
|
|
24072
|
-
|
|
24191
|
+
static string ValidateArguments(MacroFunction ¯o_function, const string &name,
|
|
24192
|
+
FunctionExpression &function_expr,
|
|
24193
|
+
vector<unique_ptr<ParsedExpression>> &positionals,
|
|
24194
|
+
unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
|
|
24073
24195
|
};
|
|
24074
|
-
} // namespace duckdb
|
|
24075
24196
|
|
|
24197
|
+
} // namespace duckdb
|
|
24076
24198
|
|
|
24077
24199
|
|
|
24078
24200
|
namespace duckdb {
|
|
24079
24201
|
|
|
24080
|
-
struct
|
|
24081
|
-
|
|
24202
|
+
struct CreateMacroInfo : public CreateFunctionInfo {
|
|
24203
|
+
CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
|
|
24082
24204
|
}
|
|
24083
24205
|
|
|
24084
|
-
|
|
24085
|
-
|
|
24086
|
-
|
|
24087
|
-
|
|
24088
|
-
//! If it is an unique index
|
|
24089
|
-
bool unique = false;
|
|
24090
|
-
//! The table to create the index on
|
|
24091
|
-
unique_ptr<BaseTableRef> table;
|
|
24092
|
-
//! Set of expressions to index by
|
|
24093
|
-
vector<unique_ptr<ParsedExpression>> expressions;
|
|
24206
|
+
CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) {
|
|
24207
|
+
}
|
|
24208
|
+
|
|
24209
|
+
unique_ptr<MacroFunction> function;
|
|
24094
24210
|
|
|
24095
24211
|
public:
|
|
24096
24212
|
unique_ptr<CreateInfo> Copy() const override {
|
|
24097
|
-
auto result = make_unique<
|
|
24213
|
+
auto result = make_unique<CreateMacroInfo>();
|
|
24214
|
+
result->function = function->Copy();
|
|
24215
|
+
result->name = name;
|
|
24098
24216
|
CopyProperties(*result);
|
|
24099
|
-
result->index_type = index_type;
|
|
24100
|
-
result->index_name = index_name;
|
|
24101
|
-
result->unique = unique;
|
|
24102
|
-
result->table = unique_ptr_cast<TableRef, BaseTableRef>(table->Copy());
|
|
24103
|
-
for (auto &expr : expressions) {
|
|
24104
|
-
result->expressions.push_back(expr->Copy());
|
|
24105
|
-
}
|
|
24106
24217
|
return move(result);
|
|
24107
24218
|
}
|
|
24108
24219
|
};
|
|
@@ -24111,7 +24222,7 @@ public:
|
|
|
24111
24222
|
//===----------------------------------------------------------------------===//
|
|
24112
24223
|
// DuckDB
|
|
24113
24224
|
//
|
|
24114
|
-
// duckdb/parser/parsed_data/
|
|
24225
|
+
// duckdb/parser/parsed_data/create_view_info.hpp
|
|
24115
24226
|
//
|
|
24116
24227
|
//
|
|
24117
24228
|
//===----------------------------------------------------------------------===//
|
|
@@ -24120,10 +24231,34 @@ public:
|
|
|
24120
24231
|
|
|
24121
24232
|
|
|
24122
24233
|
|
|
24234
|
+
|
|
24123
24235
|
namespace duckdb {
|
|
24124
24236
|
|
|
24125
|
-
struct
|
|
24126
|
-
|
|
24237
|
+
struct CreateViewInfo : public CreateInfo {
|
|
24238
|
+
CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
|
|
24239
|
+
}
|
|
24240
|
+
CreateViewInfo(string schema, string view_name)
|
|
24241
|
+
: CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
|
|
24242
|
+
}
|
|
24243
|
+
|
|
24244
|
+
//! Table name to insert to
|
|
24245
|
+
string view_name;
|
|
24246
|
+
//! Aliases of the view
|
|
24247
|
+
vector<string> aliases;
|
|
24248
|
+
//! Return types
|
|
24249
|
+
vector<LogicalType> types;
|
|
24250
|
+
//! The SelectStatement of the view
|
|
24251
|
+
unique_ptr<SelectStatement> query;
|
|
24252
|
+
|
|
24253
|
+
public:
|
|
24254
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
24255
|
+
auto result = make_unique<CreateViewInfo>(schema, view_name);
|
|
24256
|
+
CopyProperties(*result);
|
|
24257
|
+
result->aliases = aliases;
|
|
24258
|
+
result->types = types;
|
|
24259
|
+
result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
|
|
24260
|
+
return move(result);
|
|
24261
|
+
}
|
|
24127
24262
|
};
|
|
24128
24263
|
|
|
24129
24264
|
} // namespace duckdb
|
|
@@ -24172,7 +24307,7 @@ public:
|
|
|
24172
24307
|
//===----------------------------------------------------------------------===//
|
|
24173
24308
|
// DuckDB
|
|
24174
24309
|
//
|
|
24175
|
-
// duckdb/parser/parsed_data/
|
|
24310
|
+
// duckdb/parser/parsed_data/create_schema_info.hpp
|
|
24176
24311
|
//
|
|
24177
24312
|
//
|
|
24178
24313
|
//===----------------------------------------------------------------------===//
|
|
@@ -24183,26 +24318,24 @@ public:
|
|
|
24183
24318
|
|
|
24184
24319
|
namespace duckdb {
|
|
24185
24320
|
|
|
24186
|
-
|
|
24187
|
-
|
|
24188
|
-
|
|
24189
|
-
std::string filename;
|
|
24190
|
-
LoadType load_type;
|
|
24321
|
+
struct CreateSchemaInfo : public CreateInfo {
|
|
24322
|
+
CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
|
|
24323
|
+
}
|
|
24191
24324
|
|
|
24192
24325
|
public:
|
|
24193
|
-
unique_ptr<
|
|
24194
|
-
auto result = make_unique<
|
|
24195
|
-
result
|
|
24196
|
-
result
|
|
24197
|
-
return result;
|
|
24326
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
24327
|
+
auto result = make_unique<CreateSchemaInfo>();
|
|
24328
|
+
CopyProperties(*result);
|
|
24329
|
+
return move(result);
|
|
24198
24330
|
}
|
|
24199
24331
|
};
|
|
24200
24332
|
|
|
24201
24333
|
} // namespace duckdb
|
|
24334
|
+
|
|
24202
24335
|
//===----------------------------------------------------------------------===//
|
|
24203
24336
|
// DuckDB
|
|
24204
24337
|
//
|
|
24205
|
-
// duckdb/parser/
|
|
24338
|
+
// duckdb/parser/tableref/crossproductref.hpp
|
|
24206
24339
|
//
|
|
24207
24340
|
//
|
|
24208
24341
|
//===----------------------------------------------------------------------===//
|
|
@@ -24211,36 +24344,35 @@ public:
|
|
|
24211
24344
|
|
|
24212
24345
|
|
|
24213
24346
|
|
|
24214
|
-
|
|
24215
|
-
|
|
24216
|
-
|
|
24217
24347
|
namespace duckdb {
|
|
24218
|
-
|
|
24219
|
-
|
|
24220
|
-
|
|
24221
|
-
|
|
24348
|
+
//! Represents a cross product
|
|
24349
|
+
class CrossProductRef : public TableRef {
|
|
24350
|
+
public:
|
|
24351
|
+
CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
|
|
24222
24352
|
}
|
|
24223
24353
|
|
|
24224
|
-
//!
|
|
24225
|
-
|
|
24226
|
-
//!
|
|
24227
|
-
|
|
24354
|
+
//! The left hand side of the cross product
|
|
24355
|
+
unique_ptr<TableRef> left;
|
|
24356
|
+
//! The right hand side of the cross product
|
|
24357
|
+
unique_ptr<TableRef> right;
|
|
24228
24358
|
|
|
24229
24359
|
public:
|
|
24230
|
-
|
|
24231
|
-
|
|
24232
|
-
CopyProperties(*result);
|
|
24233
|
-
result->name = name;
|
|
24234
|
-
result->type = type;
|
|
24235
|
-
return move(result);
|
|
24236
|
-
}
|
|
24237
|
-
};
|
|
24360
|
+
string ToString() const override;
|
|
24361
|
+
bool Equals(const TableRef *other_p) const override;
|
|
24238
24362
|
|
|
24363
|
+
unique_ptr<TableRef> Copy() override;
|
|
24364
|
+
|
|
24365
|
+
//! Serializes a blob into a CrossProductRef
|
|
24366
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
24367
|
+
//! Deserializes a blob back into a CrossProductRef
|
|
24368
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
24369
|
+
};
|
|
24239
24370
|
} // namespace duckdb
|
|
24371
|
+
|
|
24240
24372
|
//===----------------------------------------------------------------------===//
|
|
24241
24373
|
// DuckDB
|
|
24242
24374
|
//
|
|
24243
|
-
// duckdb/parser/tableref/
|
|
24375
|
+
// duckdb/parser/tableref/emptytableref.hpp
|
|
24244
24376
|
//
|
|
24245
24377
|
//
|
|
24246
24378
|
//===----------------------------------------------------------------------===//
|
|
@@ -24249,17 +24381,12 @@ public:
|
|
|
24249
24381
|
|
|
24250
24382
|
|
|
24251
24383
|
|
|
24252
|
-
|
|
24253
24384
|
namespace duckdb {
|
|
24254
|
-
//! Represents a
|
|
24255
|
-
class
|
|
24385
|
+
//! Represents a cross product
|
|
24386
|
+
class EmptyTableRef : public TableRef {
|
|
24256
24387
|
public:
|
|
24257
|
-
|
|
24258
|
-
|
|
24259
|
-
//! The subquery
|
|
24260
|
-
unique_ptr<SelectStatement> subquery;
|
|
24261
|
-
//! Aliases for the column names
|
|
24262
|
-
vector<string> column_name_alias;
|
|
24388
|
+
EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
|
|
24389
|
+
}
|
|
24263
24390
|
|
|
24264
24391
|
public:
|
|
24265
24392
|
string ToString() const override;
|
|
@@ -24267,12 +24394,13 @@ public:
|
|
|
24267
24394
|
|
|
24268
24395
|
unique_ptr<TableRef> Copy() override;
|
|
24269
24396
|
|
|
24270
|
-
//! Serializes a blob into a
|
|
24397
|
+
//! Serializes a blob into a DummyTableRef
|
|
24271
24398
|
void Serialize(FieldWriter &serializer) const override;
|
|
24272
|
-
//! Deserializes a blob back into a
|
|
24399
|
+
//! Deserializes a blob back into a DummyTableRef
|
|
24273
24400
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
24274
24401
|
};
|
|
24275
24402
|
} // namespace duckdb
|
|
24403
|
+
|
|
24276
24404
|
//===----------------------------------------------------------------------===//
|
|
24277
24405
|
// DuckDB
|
|
24278
24406
|
//
|
|
@@ -24318,7 +24446,7 @@ public:
|
|
|
24318
24446
|
//===----------------------------------------------------------------------===//
|
|
24319
24447
|
// DuckDB
|
|
24320
24448
|
//
|
|
24321
|
-
// duckdb/parser/tableref/
|
|
24449
|
+
// duckdb/parser/tableref/joinref.hpp
|
|
24322
24450
|
//
|
|
24323
24451
|
//
|
|
24324
24452
|
//===----------------------------------------------------------------------===//
|
|
@@ -24327,68 +24455,47 @@ public:
|
|
|
24327
24455
|
|
|
24328
24456
|
|
|
24329
24457
|
|
|
24330
|
-
namespace duckdb {
|
|
24331
|
-
//! Represents a cross product
|
|
24332
|
-
class CrossProductRef : public TableRef {
|
|
24333
|
-
public:
|
|
24334
|
-
CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
|
|
24335
|
-
}
|
|
24336
|
-
|
|
24337
|
-
//! The left hand side of the cross product
|
|
24338
|
-
unique_ptr<TableRef> left;
|
|
24339
|
-
//! The right hand side of the cross product
|
|
24340
|
-
unique_ptr<TableRef> right;
|
|
24341
|
-
|
|
24342
|
-
public:
|
|
24343
|
-
string ToString() const override;
|
|
24344
|
-
bool Equals(const TableRef *other_p) const override;
|
|
24345
|
-
|
|
24346
|
-
unique_ptr<TableRef> Copy() override;
|
|
24347
|
-
|
|
24348
|
-
//! Serializes a blob into a CrossProductRef
|
|
24349
|
-
void Serialize(FieldWriter &serializer) const override;
|
|
24350
|
-
//! Deserializes a blob back into a CrossProductRef
|
|
24351
|
-
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
24352
|
-
};
|
|
24353
|
-
} // namespace duckdb
|
|
24354
|
-
|
|
24355
|
-
//===----------------------------------------------------------------------===//
|
|
24356
|
-
// DuckDB
|
|
24357
|
-
//
|
|
24358
|
-
// duckdb/parser/tableref/emptytableref.hpp
|
|
24359
|
-
//
|
|
24360
|
-
//
|
|
24361
|
-
//===----------------------------------------------------------------------===//
|
|
24362
|
-
|
|
24363
24458
|
|
|
24364
24459
|
|
|
24365
24460
|
|
|
24366
24461
|
|
|
24367
24462
|
namespace duckdb {
|
|
24368
|
-
//! Represents a
|
|
24369
|
-
class
|
|
24463
|
+
//! Represents a JOIN between two expressions
|
|
24464
|
+
class JoinRef : public TableRef {
|
|
24370
24465
|
public:
|
|
24371
|
-
|
|
24466
|
+
JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
|
|
24372
24467
|
}
|
|
24373
24468
|
|
|
24469
|
+
//! The left hand side of the join
|
|
24470
|
+
unique_ptr<TableRef> left;
|
|
24471
|
+
//! The right hand side of the join
|
|
24472
|
+
unique_ptr<TableRef> right;
|
|
24473
|
+
//! The join condition
|
|
24474
|
+
unique_ptr<ParsedExpression> condition;
|
|
24475
|
+
//! The join type
|
|
24476
|
+
JoinType type;
|
|
24477
|
+
//! Natural join
|
|
24478
|
+
bool is_natural;
|
|
24479
|
+
//! The set of USING columns (if any)
|
|
24480
|
+
vector<string> using_columns;
|
|
24481
|
+
|
|
24374
24482
|
public:
|
|
24375
24483
|
string ToString() const override;
|
|
24376
24484
|
bool Equals(const TableRef *other_p) const override;
|
|
24377
24485
|
|
|
24378
24486
|
unique_ptr<TableRef> Copy() override;
|
|
24379
24487
|
|
|
24380
|
-
//! Serializes a blob into a
|
|
24488
|
+
//! Serializes a blob into a JoinRef
|
|
24381
24489
|
void Serialize(FieldWriter &serializer) const override;
|
|
24382
|
-
//! Deserializes a blob back into a
|
|
24490
|
+
//! Deserializes a blob back into a JoinRef
|
|
24383
24491
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
24384
24492
|
};
|
|
24385
24493
|
} // namespace duckdb
|
|
24386
24494
|
|
|
24387
|
-
|
|
24388
24495
|
//===----------------------------------------------------------------------===//
|
|
24389
24496
|
// DuckDB
|
|
24390
24497
|
//
|
|
24391
|
-
// duckdb/parser/tableref/
|
|
24498
|
+
// duckdb/parser/tableref/subqueryref.hpp
|
|
24392
24499
|
//
|
|
24393
24500
|
//
|
|
24394
24501
|
//===----------------------------------------------------------------------===//
|
|
@@ -24398,28 +24505,16 @@ public:
|
|
|
24398
24505
|
|
|
24399
24506
|
|
|
24400
24507
|
|
|
24401
|
-
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
24508
|
namespace duckdb {
|
|
24405
|
-
//! Represents a
|
|
24406
|
-
class
|
|
24509
|
+
//! Represents a subquery
|
|
24510
|
+
class SubqueryRef : public TableRef {
|
|
24407
24511
|
public:
|
|
24408
|
-
|
|
24409
|
-
}
|
|
24512
|
+
explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
|
|
24410
24513
|
|
|
24411
|
-
//! The
|
|
24412
|
-
unique_ptr<
|
|
24413
|
-
//!
|
|
24414
|
-
|
|
24415
|
-
//! The join condition
|
|
24416
|
-
unique_ptr<ParsedExpression> condition;
|
|
24417
|
-
//! The join type
|
|
24418
|
-
JoinType type;
|
|
24419
|
-
//! Natural join
|
|
24420
|
-
bool is_natural;
|
|
24421
|
-
//! The set of USING columns (if any)
|
|
24422
|
-
vector<string> using_columns;
|
|
24514
|
+
//! The subquery
|
|
24515
|
+
unique_ptr<SelectStatement> subquery;
|
|
24516
|
+
//! Aliases for the column names
|
|
24517
|
+
vector<string> column_name_alias;
|
|
24423
24518
|
|
|
24424
24519
|
public:
|
|
24425
24520
|
string ToString() const override;
|
|
@@ -24427,14 +24522,13 @@ public:
|
|
|
24427
24522
|
|
|
24428
24523
|
unique_ptr<TableRef> Copy() override;
|
|
24429
24524
|
|
|
24430
|
-
//! Serializes a blob into a
|
|
24525
|
+
//! Serializes a blob into a SubqueryRef
|
|
24431
24526
|
void Serialize(FieldWriter &serializer) const override;
|
|
24432
|
-
//! Deserializes a blob back into a
|
|
24527
|
+
//! Deserializes a blob back into a SubqueryRef
|
|
24433
24528
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
24434
24529
|
};
|
|
24435
24530
|
} // namespace duckdb
|
|
24436
24531
|
|
|
24437
|
-
|
|
24438
24532
|
//===----------------------------------------------------------------------===//
|
|
24439
24533
|
// DuckDB
|
|
24440
24534
|
//
|