duckdb 0.6.1-dev83.0 → 0.6.1
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/connection.cpp +100 -99
- package/src/duckdb.cpp +1515 -799
- package/src/duckdb.hpp +804 -747
- package/src/duckdb_node.hpp +0 -1
- package/src/parquet-amalgamation.cpp +37599 -37589
- package/src/parquet-amalgamation.hpp +0 -2
- package/test/arrow.test.js +36 -45
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.6.1
|
|
14
|
+
#define DUCKDB_SOURCE_ID "919cad22e8"
|
|
15
|
+
#define DUCKDB_VERSION "v0.6.1"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -4351,6 +4351,7 @@ void DestroyObject(T *ptr) {
|
|
|
4351
4351
|
//! As such this class should be used primarily for larger allocations.
|
|
4352
4352
|
struct BufferAllocator {
|
|
4353
4353
|
DUCKDB_API static Allocator &Get(ClientContext &context);
|
|
4354
|
+
DUCKDB_API static Allocator &Get(DatabaseInstance &db);
|
|
4354
4355
|
};
|
|
4355
4356
|
|
|
4356
4357
|
} // namespace duckdb
|
|
@@ -4404,7 +4405,7 @@ namespace duckdb {
|
|
|
4404
4405
|
//! returned pointer will remain valid until the StringHeap is destroyed
|
|
4405
4406
|
class StringHeap {
|
|
4406
4407
|
public:
|
|
4407
|
-
StringHeap();
|
|
4408
|
+
StringHeap(Allocator &allocator = Allocator::DefaultAllocator());
|
|
4408
4409
|
|
|
4409
4410
|
void Destroy();
|
|
4410
4411
|
void Move(StringHeap &other);
|
|
@@ -9171,6 +9172,7 @@ public:
|
|
|
9171
9172
|
|
|
9172
9173
|
public:
|
|
9173
9174
|
virtual unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo *info);
|
|
9175
|
+
virtual void UndoAlter(ClientContext &context, AlterInfo *info);
|
|
9174
9176
|
|
|
9175
9177
|
virtual unique_ptr<CatalogEntry> Copy(ClientContext &context);
|
|
9176
9178
|
|
|
@@ -11162,6 +11164,8 @@ public:
|
|
|
11162
11164
|
public:
|
|
11163
11165
|
bool HasGeneratedColumns() const;
|
|
11164
11166
|
unique_ptr<CatalogEntry> AlterEntry(ClientContext &context, AlterInfo *info) override;
|
|
11167
|
+
void UndoAlter(ClientContext &context, AlterInfo *info) override;
|
|
11168
|
+
|
|
11165
11169
|
//! Returns whether or not a column with the given name exists
|
|
11166
11170
|
DUCKDB_API bool ColumnExists(const string &name);
|
|
11167
11171
|
//! Returns a reference to the column of the specified name. Throws an
|
|
@@ -11340,6 +11344,9 @@ public:
|
|
|
11340
11344
|
return true;
|
|
11341
11345
|
}
|
|
11342
11346
|
|
|
11347
|
+
//! Returns the set of table indexes of this operator
|
|
11348
|
+
virtual vector<idx_t> GetTableIndex() const;
|
|
11349
|
+
|
|
11343
11350
|
protected:
|
|
11344
11351
|
//! Resolve types for this specific operator
|
|
11345
11352
|
virtual void ResolveTypes() = 0;
|
|
@@ -14190,6 +14197,9 @@ public:
|
|
|
14190
14197
|
void Reset();
|
|
14191
14198
|
void ResetSink();
|
|
14192
14199
|
void ResetSource(bool force);
|
|
14200
|
+
void ClearSource() {
|
|
14201
|
+
source_state.reset();
|
|
14202
|
+
}
|
|
14193
14203
|
void Schedule(shared_ptr<Event> &event);
|
|
14194
14204
|
|
|
14195
14205
|
//! Finalize this pipeline
|
|
@@ -15527,27 +15537,46 @@ namespace duckdb {
|
|
|
15527
15537
|
struct AlterInfo;
|
|
15528
15538
|
|
|
15529
15539
|
class ClientContext;
|
|
15540
|
+
struct MappingValue;
|
|
15541
|
+
struct EntryIndex;
|
|
15530
15542
|
|
|
15531
15543
|
typedef unordered_map<CatalogSet *, unique_lock<mutex>> set_lock_map_t;
|
|
15532
15544
|
|
|
15533
|
-
struct
|
|
15534
|
-
|
|
15545
|
+
struct EntryValue {
|
|
15546
|
+
EntryValue() {
|
|
15547
|
+
throw InternalException("EntryValue called without a catalog entry");
|
|
15535
15548
|
}
|
|
15536
15549
|
|
|
15537
|
-
|
|
15538
|
-
|
|
15539
|
-
|
|
15540
|
-
|
|
15541
|
-
|
|
15550
|
+
explicit EntryValue(unique_ptr<CatalogEntry> entry_p) : entry(move(entry_p)), reference_count(0) {
|
|
15551
|
+
}
|
|
15552
|
+
//! enable move constructors
|
|
15553
|
+
EntryValue(EntryValue &&other) noexcept {
|
|
15554
|
+
Swap(other);
|
|
15555
|
+
}
|
|
15556
|
+
EntryValue &operator=(EntryValue &&other) noexcept {
|
|
15557
|
+
Swap(other);
|
|
15558
|
+
return *this;
|
|
15559
|
+
}
|
|
15560
|
+
void Swap(EntryValue &other) {
|
|
15561
|
+
std::swap(entry, other.entry);
|
|
15562
|
+
idx_t count = reference_count;
|
|
15563
|
+
reference_count = other.reference_count.load();
|
|
15564
|
+
other.reference_count = count;
|
|
15565
|
+
}
|
|
15566
|
+
|
|
15567
|
+
unique_ptr<CatalogEntry> entry;
|
|
15568
|
+
atomic<idx_t> reference_count;
|
|
15542
15569
|
};
|
|
15543
15570
|
|
|
15544
15571
|
//! The Catalog Set stores (key, value) map of a set of CatalogEntries
|
|
15545
15572
|
class CatalogSet {
|
|
15546
15573
|
friend class DependencyManager;
|
|
15547
15574
|
friend class EntryDropper;
|
|
15575
|
+
friend struct EntryIndex;
|
|
15548
15576
|
|
|
15549
15577
|
public:
|
|
15550
15578
|
DUCKDB_API explicit CatalogSet(Catalog &catalog, unique_ptr<DefaultGenerator> defaults = nullptr);
|
|
15579
|
+
~CatalogSet();
|
|
15551
15580
|
|
|
15552
15581
|
//! Create an entry in the catalog set. Returns whether or not it was
|
|
15553
15582
|
//! successful.
|
|
@@ -15588,7 +15617,6 @@ public:
|
|
|
15588
15617
|
DUCKDB_API static bool HasConflict(ClientContext &context, transaction_t timestamp);
|
|
15589
15618
|
DUCKDB_API static bool UseTimestamp(ClientContext &context, transaction_t timestamp);
|
|
15590
15619
|
|
|
15591
|
-
CatalogEntry *GetEntryFromIndex(idx_t index);
|
|
15592
15620
|
void UpdateTimestamp(CatalogEntry *entry, transaction_t timestamp);
|
|
15593
15621
|
|
|
15594
15622
|
private:
|
|
@@ -15601,29 +15629,32 @@ private:
|
|
|
15601
15629
|
//! Given a root entry, gets the entry valid for this transaction
|
|
15602
15630
|
CatalogEntry *GetEntryForTransaction(ClientContext &context, CatalogEntry *current);
|
|
15603
15631
|
CatalogEntry *GetCommittedEntry(CatalogEntry *current);
|
|
15604
|
-
bool GetEntryInternal(ClientContext &context, const string &name,
|
|
15605
|
-
bool GetEntryInternal(ClientContext &context,
|
|
15632
|
+
bool GetEntryInternal(ClientContext &context, const string &name, EntryIndex *entry_index, CatalogEntry *&entry);
|
|
15633
|
+
bool GetEntryInternal(ClientContext &context, EntryIndex &entry_index, CatalogEntry *&entry);
|
|
15606
15634
|
//! Drops an entry from the catalog set; must hold the catalog_lock to safely call this
|
|
15607
|
-
void DropEntryInternal(ClientContext &context,
|
|
15635
|
+
void DropEntryInternal(ClientContext &context, EntryIndex entry_index, CatalogEntry &entry, bool cascade);
|
|
15608
15636
|
CatalogEntry *CreateEntryInternal(ClientContext &context, unique_ptr<CatalogEntry> entry);
|
|
15609
15637
|
MappingValue *GetMapping(ClientContext &context, const string &name, bool get_latest = false);
|
|
15610
|
-
void PutMapping(ClientContext &context, const string &name,
|
|
15638
|
+
void PutMapping(ClientContext &context, const string &name, EntryIndex entry_index);
|
|
15611
15639
|
void DeleteMapping(ClientContext &context, const string &name);
|
|
15612
|
-
void DropEntryDependencies(ClientContext &context,
|
|
15640
|
+
void DropEntryDependencies(ClientContext &context, EntryIndex &entry_index, CatalogEntry &entry, bool cascade);
|
|
15613
15641
|
|
|
15614
15642
|
//! Create all default entries
|
|
15615
15643
|
void CreateDefaultEntries(ClientContext &context, unique_lock<mutex> &lock);
|
|
15616
15644
|
//! Attempt to create a default entry with the specified name. Returns the entry if successful, nullptr otherwise.
|
|
15617
15645
|
CatalogEntry *CreateDefaultEntry(ClientContext &context, const string &name, unique_lock<mutex> &lock);
|
|
15618
15646
|
|
|
15647
|
+
EntryIndex PutEntry(idx_t entry_index, unique_ptr<CatalogEntry> entry);
|
|
15648
|
+
void PutEntry(EntryIndex index, unique_ptr<CatalogEntry> entry);
|
|
15649
|
+
|
|
15619
15650
|
private:
|
|
15620
15651
|
Catalog &catalog;
|
|
15621
15652
|
//! The catalog lock is used to make changes to the data
|
|
15622
15653
|
mutex catalog_lock;
|
|
15654
|
+
//! The set of catalog entries
|
|
15655
|
+
unordered_map<idx_t, EntryValue> entries;
|
|
15623
15656
|
//! Mapping of string to catalog entry
|
|
15624
15657
|
case_insensitive_map_t<unique_ptr<MappingValue>> mapping;
|
|
15625
|
-
//! The set of catalog entries
|
|
15626
|
-
unordered_map<idx_t, unique_ptr<CatalogEntry>> entries;
|
|
15627
15658
|
//! The current catalog entry index
|
|
15628
15659
|
idx_t current_entry = 0;
|
|
15629
15660
|
//! The generator used to generate default internal entries
|
|
@@ -18911,6 +18942,9 @@ struct OperatorExtensionInfo {
|
|
|
18911
18942
|
typedef BoundStatement (*bind_function_t)(ClientContext &context, Binder &binder, OperatorExtensionInfo *info,
|
|
18912
18943
|
SQLStatement &statement);
|
|
18913
18944
|
|
|
18945
|
+
// forward declaration to avoid circular reference
|
|
18946
|
+
struct LogicalExtensionOperator;
|
|
18947
|
+
|
|
18914
18948
|
class OperatorExtension {
|
|
18915
18949
|
public:
|
|
18916
18950
|
bind_function_t Bind;
|
|
@@ -18918,6 +18952,10 @@ public:
|
|
|
18918
18952
|
//! Additional info passed to the CreatePlan & Bind functions
|
|
18919
18953
|
shared_ptr<OperatorExtensionInfo> operator_info;
|
|
18920
18954
|
|
|
18955
|
+
virtual std::string GetName() = 0;
|
|
18956
|
+
virtual std::unique_ptr<LogicalExtensionOperator> Deserialize(LogicalDeserializationState &state,
|
|
18957
|
+
FieldReader &reader) = 0;
|
|
18958
|
+
|
|
18921
18959
|
DUCKDB_API virtual ~OperatorExtension() {
|
|
18922
18960
|
}
|
|
18923
18961
|
};
|
|
@@ -19063,7 +19101,7 @@ public:
|
|
|
19063
19101
|
//! A reference to the (shared) default allocator (Allocator::DefaultAllocator)
|
|
19064
19102
|
shared_ptr<Allocator> default_allocator;
|
|
19065
19103
|
//! Extensions made to binder
|
|
19066
|
-
vector<OperatorExtension
|
|
19104
|
+
vector<std::unique_ptr<OperatorExtension>> operator_extensions;
|
|
19067
19105
|
|
|
19068
19106
|
public:
|
|
19069
19107
|
DUCKDB_API static DBConfig &GetConfig(ClientContext &context);
|
|
@@ -25993,6 +26031,7 @@ struct SBIterator {
|
|
|
25993
26031
|
|
|
25994
26032
|
|
|
25995
26033
|
|
|
26034
|
+
|
|
25996
26035
|
//===----------------------------------------------------------------------===//
|
|
25997
26036
|
// DuckDB
|
|
25998
26037
|
//
|
|
@@ -26164,6 +26203,10 @@ public:
|
|
|
26164
26203
|
can_destroy = can_destroy_p;
|
|
26165
26204
|
}
|
|
26166
26205
|
|
|
26206
|
+
inline const idx_t &GetMemoryUsage() const {
|
|
26207
|
+
return memory_usage;
|
|
26208
|
+
}
|
|
26209
|
+
|
|
26167
26210
|
private:
|
|
26168
26211
|
static BufferHandle Load(shared_ptr<BlockHandle> &handle, unique_ptr<FileBuffer> buffer = nullptr);
|
|
26169
26212
|
unique_ptr<FileBuffer> UnloadAndTakeBlock();
|
|
@@ -26197,7 +26240,6 @@ private:
|
|
|
26197
26240
|
|
|
26198
26241
|
|
|
26199
26242
|
|
|
26200
|
-
|
|
26201
26243
|
namespace duckdb {
|
|
26202
26244
|
class BlockManager;
|
|
26203
26245
|
class DatabaseInstance;
|
|
@@ -26218,10 +26260,6 @@ public:
|
|
|
26218
26260
|
BufferManager(DatabaseInstance &db, string temp_directory, idx_t maximum_memory);
|
|
26219
26261
|
virtual ~BufferManager();
|
|
26220
26262
|
|
|
26221
|
-
//! Register an in-memory buffer of arbitrary size, as long as it is >= BLOCK_SIZE. can_destroy signifies whether or
|
|
26222
|
-
//! not the buffer can be destroyed when unpinned, or whether or not it needs to be written to a temporary file so
|
|
26223
|
-
//! it can be reloaded. The resulting buffer will already be allocated, but needs to be pinned in order to be used.
|
|
26224
|
-
shared_ptr<BlockHandle> RegisterMemory(idx_t block_size, bool can_destroy);
|
|
26225
26263
|
//! Registers an in-memory buffer that cannot be unloaded until it is destroyed
|
|
26226
26264
|
//! This buffer can be small (smaller than BLOCK_SIZE)
|
|
26227
26265
|
//! Unpin and pin are nops on this block of memory
|
|
@@ -26229,7 +26267,8 @@ public:
|
|
|
26229
26267
|
|
|
26230
26268
|
//! Allocate an in-memory buffer with a single pin.
|
|
26231
26269
|
//! The allocated memory is released when the buffer handle is destroyed.
|
|
26232
|
-
DUCKDB_API BufferHandle Allocate(idx_t block_size
|
|
26270
|
+
DUCKDB_API BufferHandle Allocate(idx_t block_size, bool can_destroy = true,
|
|
26271
|
+
shared_ptr<BlockHandle> *block = nullptr);
|
|
26233
26272
|
|
|
26234
26273
|
//! Reallocate an in-memory buffer that is pinned.
|
|
26235
26274
|
void ReAllocate(shared_ptr<BlockHandle> &handle, idx_t block_size);
|
|
@@ -26263,6 +26302,10 @@ public:
|
|
|
26263
26302
|
return db;
|
|
26264
26303
|
}
|
|
26265
26304
|
|
|
26305
|
+
static idx_t GetAllocSize(idx_t block_size) {
|
|
26306
|
+
return AlignValue<idx_t, Storage::SECTOR_SIZE>(block_size + Storage::BLOCK_HEADER_SIZE);
|
|
26307
|
+
}
|
|
26308
|
+
|
|
26266
26309
|
//! Construct a managed buffer.
|
|
26267
26310
|
//! The block_id is just used for internal tracking. It doesn't map to any actual
|
|
26268
26311
|
//! BlockManager.
|
|
@@ -26273,6 +26316,12 @@ public:
|
|
|
26273
26316
|
DUCKDB_API void FreeReservedMemory(idx_t size);
|
|
26274
26317
|
|
|
26275
26318
|
private:
|
|
26319
|
+
//! Register an in-memory buffer of arbitrary size, as long as it is >= BLOCK_SIZE. can_destroy signifies whether or
|
|
26320
|
+
//! not the buffer can be destroyed when unpinned, or whether or not it needs to be written to a temporary file so
|
|
26321
|
+
//! it can be reloaded. The resulting buffer will already be allocated, but needs to be pinned in order to be used.
|
|
26322
|
+
//! This needs to be private to prevent creating blocks without ever pinning them:
|
|
26323
|
+
//! blocks that are never pinned are never added to the eviction queue
|
|
26324
|
+
shared_ptr<BlockHandle> RegisterMemory(idx_t block_size, bool can_destroy);
|
|
26276
26325
|
//! Evict blocks until the currently used memory + extra_memory fit, returns false if this was not possible
|
|
26277
26326
|
//! (i.e. not enough blocks could be evicted)
|
|
26278
26327
|
//! If the "buffer" argument is specified AND the system can find a buffer to re-use for the given allocation size
|
|
@@ -26354,7 +26403,8 @@ public:
|
|
|
26354
26403
|
RowDataBlock(BufferManager &buffer_manager, idx_t capacity, idx_t entry_size)
|
|
26355
26404
|
: capacity(capacity), entry_size(entry_size), count(0), byte_offset(0) {
|
|
26356
26405
|
idx_t size = MaxValue<idx_t>(Storage::BLOCK_SIZE, capacity * entry_size);
|
|
26357
|
-
|
|
26406
|
+
buffer_manager.Allocate(size, false, &block);
|
|
26407
|
+
D_ASSERT(BufferManager::GetAllocSize(size) == block->GetMemoryUsage());
|
|
26358
26408
|
}
|
|
26359
26409
|
explicit RowDataBlock(idx_t entry_size) : entry_size(entry_size) {
|
|
26360
26410
|
}
|
|
@@ -26428,17 +26478,23 @@ public:
|
|
|
26428
26478
|
count = 0;
|
|
26429
26479
|
}
|
|
26430
26480
|
|
|
26431
|
-
//! The size (in bytes) of this RowDataCollection
|
|
26481
|
+
//! The size (in bytes) of this RowDataCollection
|
|
26432
26482
|
idx_t SizeInBytes() const {
|
|
26433
|
-
|
|
26434
|
-
|
|
26435
|
-
|
|
26436
|
-
|
|
26437
|
-
|
|
26438
|
-
|
|
26439
|
-
|
|
26483
|
+
VerifyBlockSizes();
|
|
26484
|
+
idx_t size = 0;
|
|
26485
|
+
for (auto &block : blocks) {
|
|
26486
|
+
size += block->block->GetMemoryUsage();
|
|
26487
|
+
}
|
|
26488
|
+
return size;
|
|
26489
|
+
}
|
|
26490
|
+
|
|
26491
|
+
//! Verifies that the block sizes are correct (Debug only)
|
|
26492
|
+
void VerifyBlockSizes() const {
|
|
26493
|
+
#ifdef DEBUG
|
|
26494
|
+
for (auto &block : blocks) {
|
|
26495
|
+
D_ASSERT(block->block->GetMemoryUsage() == BufferManager::GetAllocSize(block->capacity * entry_size));
|
|
26440
26496
|
}
|
|
26441
|
-
|
|
26497
|
+
#endif
|
|
26442
26498
|
}
|
|
26443
26499
|
|
|
26444
26500
|
static inline idx_t EntriesPerBlock(idx_t width) {
|
|
@@ -30777,6 +30833,7 @@ public:
|
|
|
30777
30833
|
|
|
30778
30834
|
void Serialize(FieldWriter &writer) const override;
|
|
30779
30835
|
static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
|
|
30836
|
+
vector<idx_t> GetTableIndex() const override;
|
|
30780
30837
|
|
|
30781
30838
|
protected:
|
|
30782
30839
|
void ResolveTypes() override;
|
|
@@ -30902,10 +30959,12 @@ public:
|
|
|
30902
30959
|
}
|
|
30903
30960
|
};
|
|
30904
30961
|
} // namespace duckdb
|
|
30962
|
+
|
|
30963
|
+
|
|
30905
30964
|
//===----------------------------------------------------------------------===//
|
|
30906
30965
|
// DuckDB
|
|
30907
30966
|
//
|
|
30908
|
-
// duckdb/parser/expression/
|
|
30967
|
+
// duckdb/parser/expression/case_expression.hpp
|
|
30909
30968
|
//
|
|
30910
30969
|
//
|
|
30911
30970
|
//===----------------------------------------------------------------------===//
|
|
@@ -30914,32 +30973,51 @@ public:
|
|
|
30914
30973
|
|
|
30915
30974
|
|
|
30916
30975
|
|
|
30976
|
+
|
|
30917
30977
|
namespace duckdb {
|
|
30918
|
-
class PositionalReferenceExpression : public ParsedExpression {
|
|
30919
|
-
public:
|
|
30920
|
-
DUCKDB_API PositionalReferenceExpression(idx_t index);
|
|
30921
30978
|
|
|
30922
|
-
|
|
30979
|
+
struct CaseCheck {
|
|
30980
|
+
unique_ptr<ParsedExpression> when_expr;
|
|
30981
|
+
unique_ptr<ParsedExpression> then_expr;
|
|
30982
|
+
};
|
|
30923
30983
|
|
|
30984
|
+
//! The CaseExpression represents a CASE expression in the query
|
|
30985
|
+
class CaseExpression : public ParsedExpression {
|
|
30924
30986
|
public:
|
|
30925
|
-
|
|
30926
|
-
|
|
30927
|
-
|
|
30987
|
+
DUCKDB_API CaseExpression();
|
|
30988
|
+
|
|
30989
|
+
vector<CaseCheck> case_checks;
|
|
30990
|
+
unique_ptr<ParsedExpression> else_expr;
|
|
30928
30991
|
|
|
30992
|
+
public:
|
|
30929
30993
|
string ToString() const override;
|
|
30930
30994
|
|
|
30931
|
-
static bool Equals(const
|
|
30995
|
+
static bool Equals(const CaseExpression *a, const CaseExpression *b);
|
|
30996
|
+
|
|
30932
30997
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
30933
|
-
hash_t Hash() const override;
|
|
30934
30998
|
|
|
30935
30999
|
void Serialize(FieldWriter &writer) const override;
|
|
30936
31000
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31001
|
+
|
|
31002
|
+
public:
|
|
31003
|
+
template <class T, class BASE>
|
|
31004
|
+
static string ToString(const T &entry) {
|
|
31005
|
+
string case_str = "CASE ";
|
|
31006
|
+
for (auto &check : entry.case_checks) {
|
|
31007
|
+
case_str += " WHEN (" + check.when_expr->ToString() + ")";
|
|
31008
|
+
case_str += " THEN (" + check.then_expr->ToString() + ")";
|
|
31009
|
+
}
|
|
31010
|
+
case_str += " ELSE " + entry.else_expr->ToString();
|
|
31011
|
+
case_str += " END";
|
|
31012
|
+
return case_str;
|
|
31013
|
+
}
|
|
30937
31014
|
};
|
|
30938
31015
|
} // namespace duckdb
|
|
31016
|
+
|
|
30939
31017
|
//===----------------------------------------------------------------------===//
|
|
30940
31018
|
// DuckDB
|
|
30941
31019
|
//
|
|
30942
|
-
// duckdb/parser/expression/
|
|
31020
|
+
// duckdb/parser/expression/cast_expression.hpp
|
|
30943
31021
|
//
|
|
30944
31022
|
//
|
|
30945
31023
|
//===----------------------------------------------------------------------===//
|
|
@@ -30951,23 +31029,22 @@ public:
|
|
|
30951
31029
|
|
|
30952
31030
|
namespace duckdb {
|
|
30953
31031
|
|
|
30954
|
-
|
|
30955
|
-
|
|
30956
|
-
unique_ptr<ParsedExpression> then_expr;
|
|
30957
|
-
};
|
|
30958
|
-
|
|
30959
|
-
//! The CaseExpression represents a CASE expression in the query
|
|
30960
|
-
class CaseExpression : public ParsedExpression {
|
|
31032
|
+
//! CastExpression represents a type cast from one SQL type to another SQL type
|
|
31033
|
+
class CastExpression : public ParsedExpression {
|
|
30961
31034
|
public:
|
|
30962
|
-
DUCKDB_API
|
|
31035
|
+
DUCKDB_API CastExpression(LogicalType target, unique_ptr<ParsedExpression> child, bool try_cast = false);
|
|
30963
31036
|
|
|
30964
|
-
|
|
30965
|
-
unique_ptr<ParsedExpression>
|
|
31037
|
+
//! The child of the cast expression
|
|
31038
|
+
unique_ptr<ParsedExpression> child;
|
|
31039
|
+
//! The type to cast to
|
|
31040
|
+
LogicalType cast_type;
|
|
31041
|
+
//! Whether or not this is a try_cast expression
|
|
31042
|
+
bool try_cast;
|
|
30966
31043
|
|
|
30967
31044
|
public:
|
|
30968
31045
|
string ToString() const override;
|
|
30969
31046
|
|
|
30970
|
-
static bool Equals(const
|
|
31047
|
+
static bool Equals(const CastExpression *a, const CastExpression *b);
|
|
30971
31048
|
|
|
30972
31049
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
30973
31050
|
|
|
@@ -30977,17 +31054,49 @@ public:
|
|
|
30977
31054
|
public:
|
|
30978
31055
|
template <class T, class BASE>
|
|
30979
31056
|
static string ToString(const T &entry) {
|
|
30980
|
-
|
|
30981
|
-
|
|
30982
|
-
case_str += " WHEN (" + check.when_expr->ToString() + ")";
|
|
30983
|
-
case_str += " THEN (" + check.then_expr->ToString() + ")";
|
|
30984
|
-
}
|
|
30985
|
-
case_str += " ELSE " + entry.else_expr->ToString();
|
|
30986
|
-
case_str += " END";
|
|
30987
|
-
return case_str;
|
|
31057
|
+
return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
|
|
31058
|
+
entry.cast_type.ToString() + ")";
|
|
30988
31059
|
}
|
|
30989
31060
|
};
|
|
30990
31061
|
} // namespace duckdb
|
|
31062
|
+
|
|
31063
|
+
//===----------------------------------------------------------------------===//
|
|
31064
|
+
// DuckDB
|
|
31065
|
+
//
|
|
31066
|
+
// duckdb/parser/expression/collate_expression.hpp
|
|
31067
|
+
//
|
|
31068
|
+
//
|
|
31069
|
+
//===----------------------------------------------------------------------===//
|
|
31070
|
+
|
|
31071
|
+
|
|
31072
|
+
|
|
31073
|
+
|
|
31074
|
+
|
|
31075
|
+
namespace duckdb {
|
|
31076
|
+
|
|
31077
|
+
//! CollateExpression represents a COLLATE statement
|
|
31078
|
+
class CollateExpression : public ParsedExpression {
|
|
31079
|
+
public:
|
|
31080
|
+
CollateExpression(string collation, unique_ptr<ParsedExpression> child);
|
|
31081
|
+
|
|
31082
|
+
//! The child of the cast expression
|
|
31083
|
+
unique_ptr<ParsedExpression> child;
|
|
31084
|
+
//! The collation clause
|
|
31085
|
+
string collation;
|
|
31086
|
+
|
|
31087
|
+
public:
|
|
31088
|
+
string ToString() const override;
|
|
31089
|
+
|
|
31090
|
+
static bool Equals(const CollateExpression *a, const CollateExpression *b);
|
|
31091
|
+
|
|
31092
|
+
unique_ptr<ParsedExpression> Copy() const override;
|
|
31093
|
+
|
|
31094
|
+
void Serialize(FieldWriter &writer) const override;
|
|
31095
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31096
|
+
};
|
|
31097
|
+
} // namespace duckdb
|
|
31098
|
+
|
|
31099
|
+
|
|
30991
31100
|
//===----------------------------------------------------------------------===//
|
|
30992
31101
|
// DuckDB
|
|
30993
31102
|
//
|
|
@@ -31029,10 +31138,11 @@ public:
|
|
|
31029
31138
|
}
|
|
31030
31139
|
};
|
|
31031
31140
|
} // namespace duckdb
|
|
31141
|
+
|
|
31032
31142
|
//===----------------------------------------------------------------------===//
|
|
31033
31143
|
// DuckDB
|
|
31034
31144
|
//
|
|
31035
|
-
// duckdb/parser/expression/
|
|
31145
|
+
// duckdb/parser/expression/conjunction_expression.hpp
|
|
31036
31146
|
//
|
|
31037
31147
|
//
|
|
31038
31148
|
//===----------------------------------------------------------------------===//
|
|
@@ -31044,31 +31154,44 @@ public:
|
|
|
31044
31154
|
|
|
31045
31155
|
namespace duckdb {
|
|
31046
31156
|
|
|
31047
|
-
//!
|
|
31048
|
-
class
|
|
31157
|
+
//! Represents a conjunction (AND/OR)
|
|
31158
|
+
class ConjunctionExpression : public ParsedExpression {
|
|
31049
31159
|
public:
|
|
31050
|
-
DUCKDB_API explicit
|
|
31160
|
+
DUCKDB_API explicit ConjunctionExpression(ExpressionType type);
|
|
31161
|
+
DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
31162
|
+
DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
|
|
31163
|
+
unique_ptr<ParsedExpression> right);
|
|
31051
31164
|
|
|
31052
|
-
|
|
31053
|
-
Value value;
|
|
31165
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
31054
31166
|
|
|
31055
31167
|
public:
|
|
31168
|
+
void AddExpression(unique_ptr<ParsedExpression> expr);
|
|
31169
|
+
|
|
31056
31170
|
string ToString() const override;
|
|
31057
31171
|
|
|
31058
|
-
static bool Equals(const
|
|
31059
|
-
hash_t Hash() const override;
|
|
31172
|
+
static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
|
|
31060
31173
|
|
|
31061
31174
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
31062
31175
|
|
|
31063
31176
|
void Serialize(FieldWriter &writer) const override;
|
|
31064
31177
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31065
|
-
};
|
|
31066
31178
|
|
|
31179
|
+
public:
|
|
31180
|
+
template <class T, class BASE>
|
|
31181
|
+
static string ToString(const T &entry) {
|
|
31182
|
+
string result = "(" + entry.children[0]->ToString();
|
|
31183
|
+
for (idx_t i = 1; i < entry.children.size(); i++) {
|
|
31184
|
+
result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
|
|
31185
|
+
}
|
|
31186
|
+
return result + ")";
|
|
31187
|
+
}
|
|
31188
|
+
};
|
|
31067
31189
|
} // namespace duckdb
|
|
31190
|
+
|
|
31068
31191
|
//===----------------------------------------------------------------------===//
|
|
31069
31192
|
// DuckDB
|
|
31070
31193
|
//
|
|
31071
|
-
// duckdb/parser/expression/
|
|
31194
|
+
// duckdb/parser/expression/constant_expression.hpp
|
|
31072
31195
|
//
|
|
31073
31196
|
//
|
|
31074
31197
|
//===----------------------------------------------------------------------===//
|
|
@@ -31080,33 +31203,28 @@ public:
|
|
|
31080
31203
|
|
|
31081
31204
|
namespace duckdb {
|
|
31082
31205
|
|
|
31083
|
-
//!
|
|
31084
|
-
class
|
|
31206
|
+
//! ConstantExpression represents a constant value in the query
|
|
31207
|
+
class ConstantExpression : public ParsedExpression {
|
|
31085
31208
|
public:
|
|
31086
|
-
|
|
31209
|
+
DUCKDB_API explicit ConstantExpression(Value val);
|
|
31087
31210
|
|
|
31088
|
-
//! The
|
|
31089
|
-
|
|
31090
|
-
//! List of columns to exclude from the STAR expression
|
|
31091
|
-
case_insensitive_set_t exclude_list;
|
|
31092
|
-
//! List of columns to replace with another expression
|
|
31093
|
-
case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
|
|
31094
|
-
//! Regular expression to select columns (if any)
|
|
31095
|
-
string regex;
|
|
31096
|
-
//! Whether or not this is a COLUMNS expression
|
|
31097
|
-
bool columns = false;
|
|
31211
|
+
//! The constant value referenced
|
|
31212
|
+
Value value;
|
|
31098
31213
|
|
|
31099
31214
|
public:
|
|
31100
31215
|
string ToString() const override;
|
|
31101
31216
|
|
|
31102
|
-
static bool Equals(const
|
|
31217
|
+
static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
|
|
31218
|
+
hash_t Hash() const override;
|
|
31103
31219
|
|
|
31104
31220
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
31105
31221
|
|
|
31106
31222
|
void Serialize(FieldWriter &writer) const override;
|
|
31107
31223
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31108
31224
|
};
|
|
31225
|
+
|
|
31109
31226
|
} // namespace duckdb
|
|
31227
|
+
|
|
31110
31228
|
//===----------------------------------------------------------------------===//
|
|
31111
31229
|
// DuckDB
|
|
31112
31230
|
//
|
|
@@ -31138,10 +31256,11 @@ public:
|
|
|
31138
31256
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31139
31257
|
};
|
|
31140
31258
|
} // namespace duckdb
|
|
31259
|
+
|
|
31141
31260
|
//===----------------------------------------------------------------------===//
|
|
31142
31261
|
// DuckDB
|
|
31143
31262
|
//
|
|
31144
|
-
// duckdb/parser/expression/
|
|
31263
|
+
// duckdb/parser/expression/function_expression.hpp
|
|
31145
31264
|
//
|
|
31146
31265
|
//
|
|
31147
31266
|
//===----------------------------------------------------------------------===//
|
|
@@ -31152,36 +31271,155 @@ public:
|
|
|
31152
31271
|
|
|
31153
31272
|
|
|
31154
31273
|
|
|
31155
|
-
|
|
31156
31274
|
namespace duckdb {
|
|
31157
|
-
//! Represents a
|
|
31158
|
-
class
|
|
31275
|
+
//! Represents a function call
|
|
31276
|
+
class FunctionExpression : public ParsedExpression {
|
|
31159
31277
|
public:
|
|
31160
|
-
DUCKDB_API
|
|
31161
|
-
|
|
31162
|
-
|
|
31278
|
+
DUCKDB_API FunctionExpression(string schema_name, const string &function_name,
|
|
31279
|
+
vector<unique_ptr<ParsedExpression>> children,
|
|
31280
|
+
unique_ptr<ParsedExpression> filter = nullptr,
|
|
31281
|
+
unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
|
|
31282
|
+
bool is_operator = false, bool export_state = false);
|
|
31283
|
+
DUCKDB_API FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
|
|
31284
|
+
unique_ptr<ParsedExpression> filter = nullptr,
|
|
31285
|
+
unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
|
|
31286
|
+
bool is_operator = false, bool export_state = false);
|
|
31163
31287
|
|
|
31288
|
+
//! Schema of the function
|
|
31289
|
+
string schema;
|
|
31290
|
+
//! Function name
|
|
31291
|
+
string function_name;
|
|
31292
|
+
//! Whether or not the function is an operator, only used for rendering
|
|
31293
|
+
bool is_operator;
|
|
31294
|
+
//! List of arguments to the function
|
|
31164
31295
|
vector<unique_ptr<ParsedExpression>> children;
|
|
31296
|
+
//! Whether or not the aggregate function is distinct, only used for aggregates
|
|
31297
|
+
bool distinct;
|
|
31298
|
+
//! Expression representing a filter, only used for aggregates
|
|
31299
|
+
unique_ptr<ParsedExpression> filter;
|
|
31300
|
+
//! Modifier representing an ORDER BY, only used for aggregates
|
|
31301
|
+
unique_ptr<OrderModifier> order_bys;
|
|
31302
|
+
//! whether this function should export its state or not
|
|
31303
|
+
bool export_state;
|
|
31165
31304
|
|
|
31166
31305
|
public:
|
|
31167
31306
|
string ToString() const override;
|
|
31168
31307
|
|
|
31169
|
-
static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
|
|
31170
|
-
|
|
31171
31308
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
31172
31309
|
|
|
31310
|
+
static bool Equals(const FunctionExpression *a, const FunctionExpression *b);
|
|
31311
|
+
hash_t Hash() const override;
|
|
31312
|
+
|
|
31173
31313
|
void Serialize(FieldWriter &writer) const override;
|
|
31174
31314
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31175
31315
|
|
|
31316
|
+
void Verify() const override;
|
|
31317
|
+
|
|
31176
31318
|
public:
|
|
31177
31319
|
template <class T, class BASE>
|
|
31178
|
-
static string ToString(const T &entry
|
|
31179
|
-
|
|
31180
|
-
|
|
31181
|
-
|
|
31182
|
-
|
|
31183
|
-
|
|
31184
|
-
|
|
31320
|
+
static string ToString(const T &entry, const string &schema, const string &function_name, bool is_operator = false,
|
|
31321
|
+
bool distinct = false, BASE *filter = nullptr, OrderModifier *order_bys = nullptr,
|
|
31322
|
+
bool export_state = false, bool add_alias = false) {
|
|
31323
|
+
if (is_operator) {
|
|
31324
|
+
// built-in operator
|
|
31325
|
+
D_ASSERT(!distinct);
|
|
31326
|
+
if (entry.children.size() == 1) {
|
|
31327
|
+
if (StringUtil::Contains(function_name, "__postfix")) {
|
|
31328
|
+
return "(" + entry.children[0]->ToString() + ")" +
|
|
31329
|
+
StringUtil::Replace(function_name, "__postfix", "");
|
|
31330
|
+
} else {
|
|
31331
|
+
return function_name + "(" + entry.children[0]->ToString() + ")";
|
|
31332
|
+
}
|
|
31333
|
+
} else if (entry.children.size() == 2) {
|
|
31334
|
+
return StringUtil::Format("(%s %s %s)", entry.children[0]->ToString(), function_name,
|
|
31335
|
+
entry.children[1]->ToString());
|
|
31336
|
+
}
|
|
31337
|
+
}
|
|
31338
|
+
// standard function call
|
|
31339
|
+
string result = schema.empty() ? function_name : schema + "." + function_name;
|
|
31340
|
+
result += "(";
|
|
31341
|
+
if (distinct) {
|
|
31342
|
+
result += "DISTINCT ";
|
|
31343
|
+
}
|
|
31344
|
+
result += StringUtil::Join(entry.children, entry.children.size(), ", ", [&](const unique_ptr<BASE> &child) {
|
|
31345
|
+
return child->alias.empty() || !add_alias
|
|
31346
|
+
? child->ToString()
|
|
31347
|
+
: KeywordHelper::WriteOptionallyQuoted(child->alias) + " := " + child->ToString();
|
|
31348
|
+
});
|
|
31349
|
+
// ordered aggregate
|
|
31350
|
+
if (order_bys && !order_bys->orders.empty()) {
|
|
31351
|
+
if (entry.children.empty()) {
|
|
31352
|
+
result += ") WITHIN GROUP (";
|
|
31353
|
+
}
|
|
31354
|
+
result += " ORDER BY ";
|
|
31355
|
+
for (idx_t i = 0; i < order_bys->orders.size(); i++) {
|
|
31356
|
+
if (i > 0) {
|
|
31357
|
+
result += ", ";
|
|
31358
|
+
}
|
|
31359
|
+
result += order_bys->orders[i].ToString();
|
|
31360
|
+
}
|
|
31361
|
+
}
|
|
31362
|
+
result += ")";
|
|
31363
|
+
|
|
31364
|
+
// filtered aggregate
|
|
31365
|
+
if (filter) {
|
|
31366
|
+
result += " FILTER (WHERE " + filter->ToString() + ")";
|
|
31367
|
+
}
|
|
31368
|
+
|
|
31369
|
+
if (export_state) {
|
|
31370
|
+
result += " EXPORT_STATE";
|
|
31371
|
+
}
|
|
31372
|
+
|
|
31373
|
+
return result;
|
|
31374
|
+
}
|
|
31375
|
+
};
|
|
31376
|
+
} // namespace duckdb
|
|
31377
|
+
|
|
31378
|
+
|
|
31379
|
+
//===----------------------------------------------------------------------===//
|
|
31380
|
+
// DuckDB
|
|
31381
|
+
//
|
|
31382
|
+
// duckdb/parser/expression/operator_expression.hpp
|
|
31383
|
+
//
|
|
31384
|
+
//
|
|
31385
|
+
//===----------------------------------------------------------------------===//
|
|
31386
|
+
|
|
31387
|
+
|
|
31388
|
+
|
|
31389
|
+
|
|
31390
|
+
|
|
31391
|
+
|
|
31392
|
+
|
|
31393
|
+
|
|
31394
|
+
namespace duckdb {
|
|
31395
|
+
//! Represents a built-in operator expression
|
|
31396
|
+
class OperatorExpression : public ParsedExpression {
|
|
31397
|
+
public:
|
|
31398
|
+
DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
|
|
31399
|
+
unique_ptr<ParsedExpression> right = nullptr);
|
|
31400
|
+
DUCKDB_API OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
31401
|
+
|
|
31402
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
31403
|
+
|
|
31404
|
+
public:
|
|
31405
|
+
string ToString() const override;
|
|
31406
|
+
|
|
31407
|
+
static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
|
|
31408
|
+
|
|
31409
|
+
unique_ptr<ParsedExpression> Copy() const override;
|
|
31410
|
+
|
|
31411
|
+
void Serialize(FieldWriter &writer) const override;
|
|
31412
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31413
|
+
|
|
31414
|
+
public:
|
|
31415
|
+
template <class T, class BASE>
|
|
31416
|
+
static string ToString(const T &entry) {
|
|
31417
|
+
auto op = ExpressionTypeToOperator(entry.type);
|
|
31418
|
+
if (!op.empty()) {
|
|
31419
|
+
// use the operator string to represent the operator
|
|
31420
|
+
D_ASSERT(entry.children.size() == 2);
|
|
31421
|
+
return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
|
|
31422
|
+
}
|
|
31185
31423
|
switch (entry.type) {
|
|
31186
31424
|
case ExpressionType::COMPARE_IN:
|
|
31187
31425
|
case ExpressionType::COMPARE_NOT_IN: {
|
|
@@ -31249,12 +31487,10 @@ public:
|
|
|
31249
31487
|
|
|
31250
31488
|
} // namespace duckdb
|
|
31251
31489
|
|
|
31252
|
-
|
|
31253
|
-
|
|
31254
31490
|
//===----------------------------------------------------------------------===//
|
|
31255
31491
|
// DuckDB
|
|
31256
31492
|
//
|
|
31257
|
-
// duckdb/parser/expression/
|
|
31493
|
+
// duckdb/parser/expression/parameter_expression.hpp
|
|
31258
31494
|
//
|
|
31259
31495
|
//
|
|
31260
31496
|
//===----------------------------------------------------------------------===//
|
|
@@ -31263,44 +31499,37 @@ public:
|
|
|
31263
31499
|
|
|
31264
31500
|
|
|
31265
31501
|
|
|
31266
|
-
|
|
31267
31502
|
namespace duckdb {
|
|
31268
|
-
|
|
31269
|
-
//! CastExpression represents a type cast from one SQL type to another SQL type
|
|
31270
|
-
class CastExpression : public ParsedExpression {
|
|
31503
|
+
class ParameterExpression : public ParsedExpression {
|
|
31271
31504
|
public:
|
|
31272
|
-
|
|
31505
|
+
ParameterExpression();
|
|
31273
31506
|
|
|
31274
|
-
|
|
31275
|
-
unique_ptr<ParsedExpression> child;
|
|
31276
|
-
//! The type to cast to
|
|
31277
|
-
LogicalType cast_type;
|
|
31278
|
-
//! Whether or not this is a try_cast expression
|
|
31279
|
-
bool try_cast;
|
|
31507
|
+
idx_t parameter_nr;
|
|
31280
31508
|
|
|
31281
31509
|
public:
|
|
31510
|
+
bool IsScalar() const override {
|
|
31511
|
+
return true;
|
|
31512
|
+
}
|
|
31513
|
+
bool HasParameter() const override {
|
|
31514
|
+
return true;
|
|
31515
|
+
}
|
|
31516
|
+
|
|
31282
31517
|
string ToString() const override;
|
|
31283
31518
|
|
|
31284
|
-
static bool Equals(const
|
|
31519
|
+
static bool Equals(const ParameterExpression *a, const ParameterExpression *b);
|
|
31285
31520
|
|
|
31286
31521
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
31522
|
+
hash_t Hash() const override;
|
|
31287
31523
|
|
|
31288
31524
|
void Serialize(FieldWriter &writer) const override;
|
|
31289
31525
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31290
|
-
|
|
31291
|
-
public:
|
|
31292
|
-
template <class T, class BASE>
|
|
31293
|
-
static string ToString(const T &entry) {
|
|
31294
|
-
return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " +
|
|
31295
|
-
entry.cast_type.ToString() + ")";
|
|
31296
|
-
}
|
|
31297
31526
|
};
|
|
31298
31527
|
} // namespace duckdb
|
|
31299
31528
|
|
|
31300
31529
|
//===----------------------------------------------------------------------===//
|
|
31301
31530
|
// DuckDB
|
|
31302
31531
|
//
|
|
31303
|
-
// duckdb/parser/expression/
|
|
31532
|
+
// duckdb/parser/expression/positional_reference_expression.hpp
|
|
31304
31533
|
//
|
|
31305
31534
|
//
|
|
31306
31535
|
//===----------------------------------------------------------------------===//
|
|
@@ -31310,35 +31539,32 @@ public:
|
|
|
31310
31539
|
|
|
31311
31540
|
|
|
31312
31541
|
namespace duckdb {
|
|
31313
|
-
|
|
31314
|
-
//! CollateExpression represents a COLLATE statement
|
|
31315
|
-
class CollateExpression : public ParsedExpression {
|
|
31542
|
+
class PositionalReferenceExpression : public ParsedExpression {
|
|
31316
31543
|
public:
|
|
31317
|
-
|
|
31544
|
+
DUCKDB_API PositionalReferenceExpression(idx_t index);
|
|
31318
31545
|
|
|
31319
|
-
|
|
31320
|
-
unique_ptr<ParsedExpression> child;
|
|
31321
|
-
//! The collation clause
|
|
31322
|
-
string collation;
|
|
31546
|
+
idx_t index;
|
|
31323
31547
|
|
|
31324
31548
|
public:
|
|
31325
|
-
|
|
31549
|
+
bool IsScalar() const override {
|
|
31550
|
+
return false;
|
|
31551
|
+
}
|
|
31326
31552
|
|
|
31327
|
-
|
|
31553
|
+
string ToString() const override;
|
|
31328
31554
|
|
|
31555
|
+
static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
|
|
31329
31556
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
31557
|
+
hash_t Hash() const override;
|
|
31330
31558
|
|
|
31331
31559
|
void Serialize(FieldWriter &writer) const override;
|
|
31332
31560
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31333
31561
|
};
|
|
31334
31562
|
} // namespace duckdb
|
|
31335
31563
|
|
|
31336
|
-
|
|
31337
|
-
|
|
31338
31564
|
//===----------------------------------------------------------------------===//
|
|
31339
31565
|
// DuckDB
|
|
31340
31566
|
//
|
|
31341
|
-
// duckdb/parser/expression/
|
|
31567
|
+
// duckdb/parser/expression/star_expression.hpp
|
|
31342
31568
|
//
|
|
31343
31569
|
//
|
|
31344
31570
|
//===----------------------------------------------------------------------===//
|
|
@@ -31350,46 +31576,38 @@ public:
|
|
|
31350
31576
|
|
|
31351
31577
|
namespace duckdb {
|
|
31352
31578
|
|
|
31353
|
-
//! Represents a
|
|
31354
|
-
class
|
|
31579
|
+
//! Represents a * expression in the SELECT clause
|
|
31580
|
+
class StarExpression : public ParsedExpression {
|
|
31355
31581
|
public:
|
|
31356
|
-
|
|
31357
|
-
DUCKDB_API ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
31358
|
-
DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left,
|
|
31359
|
-
unique_ptr<ParsedExpression> right);
|
|
31582
|
+
StarExpression(string relation_name = string());
|
|
31360
31583
|
|
|
31361
|
-
|
|
31584
|
+
//! The relation name in case of tbl.*, or empty if this is a normal *
|
|
31585
|
+
string relation_name;
|
|
31586
|
+
//! List of columns to exclude from the STAR expression
|
|
31587
|
+
case_insensitive_set_t exclude_list;
|
|
31588
|
+
//! List of columns to replace with another expression
|
|
31589
|
+
case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
|
|
31590
|
+
//! Regular expression to select columns (if any)
|
|
31591
|
+
string regex;
|
|
31592
|
+
//! Whether or not this is a COLUMNS expression
|
|
31593
|
+
bool columns = false;
|
|
31362
31594
|
|
|
31363
31595
|
public:
|
|
31364
|
-
void AddExpression(unique_ptr<ParsedExpression> expr);
|
|
31365
|
-
|
|
31366
31596
|
string ToString() const override;
|
|
31367
31597
|
|
|
31368
|
-
static bool Equals(const
|
|
31598
|
+
static bool Equals(const StarExpression *a, const StarExpression *b);
|
|
31369
31599
|
|
|
31370
31600
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
31371
31601
|
|
|
31372
31602
|
void Serialize(FieldWriter &writer) const override;
|
|
31373
31603
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31374
|
-
|
|
31375
|
-
public:
|
|
31376
|
-
template <class T, class BASE>
|
|
31377
|
-
static string ToString(const T &entry) {
|
|
31378
|
-
string result = "(" + entry.children[0]->ToString();
|
|
31379
|
-
for (idx_t i = 1; i < entry.children.size(); i++) {
|
|
31380
|
-
result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString();
|
|
31381
|
-
}
|
|
31382
|
-
return result + ")";
|
|
31383
|
-
}
|
|
31384
31604
|
};
|
|
31385
31605
|
} // namespace duckdb
|
|
31386
31606
|
|
|
31387
|
-
|
|
31388
|
-
|
|
31389
31607
|
//===----------------------------------------------------------------------===//
|
|
31390
31608
|
// DuckDB
|
|
31391
31609
|
//
|
|
31392
|
-
// duckdb/parser/expression/
|
|
31610
|
+
// duckdb/parser/expression/subquery_expression.hpp
|
|
31393
31611
|
//
|
|
31394
31612
|
//
|
|
31395
31613
|
//===----------------------------------------------------------------------===//
|
|
@@ -31401,115 +31619,46 @@ public:
|
|
|
31401
31619
|
|
|
31402
31620
|
|
|
31403
31621
|
namespace duckdb {
|
|
31404
|
-
|
|
31405
|
-
|
|
31622
|
+
|
|
31623
|
+
//! Represents a subquery
|
|
31624
|
+
class SubqueryExpression : public ParsedExpression {
|
|
31406
31625
|
public:
|
|
31407
|
-
|
|
31408
|
-
vector<unique_ptr<ParsedExpression>> children,
|
|
31409
|
-
unique_ptr<ParsedExpression> filter = nullptr,
|
|
31410
|
-
unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
|
|
31411
|
-
bool is_operator = false, bool export_state = false);
|
|
31412
|
-
DUCKDB_API FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
|
|
31413
|
-
unique_ptr<ParsedExpression> filter = nullptr,
|
|
31414
|
-
unique_ptr<OrderModifier> order_bys = nullptr, bool distinct = false,
|
|
31415
|
-
bool is_operator = false, bool export_state = false);
|
|
31626
|
+
SubqueryExpression();
|
|
31416
31627
|
|
|
31417
|
-
//!
|
|
31418
|
-
|
|
31419
|
-
//!
|
|
31420
|
-
|
|
31421
|
-
//!
|
|
31422
|
-
|
|
31423
|
-
|
|
31424
|
-
|
|
31425
|
-
|
|
31426
|
-
bool distinct;
|
|
31427
|
-
//! Expression representing a filter, only used for aggregates
|
|
31428
|
-
unique_ptr<ParsedExpression> filter;
|
|
31429
|
-
//! Modifier representing an ORDER BY, only used for aggregates
|
|
31430
|
-
unique_ptr<OrderModifier> order_bys;
|
|
31431
|
-
//! whether this function should export its state or not
|
|
31432
|
-
bool export_state;
|
|
31628
|
+
//! The actual subquery
|
|
31629
|
+
unique_ptr<SelectStatement> subquery;
|
|
31630
|
+
//! The subquery type
|
|
31631
|
+
SubqueryType subquery_type;
|
|
31632
|
+
//! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
|
|
31633
|
+
//! subquery)
|
|
31634
|
+
unique_ptr<ParsedExpression> child;
|
|
31635
|
+
//! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
|
|
31636
|
+
ExpressionType comparison_type;
|
|
31433
31637
|
|
|
31434
31638
|
public:
|
|
31639
|
+
bool HasSubquery() const override {
|
|
31640
|
+
return true;
|
|
31641
|
+
}
|
|
31642
|
+
bool IsScalar() const override {
|
|
31643
|
+
return false;
|
|
31644
|
+
}
|
|
31645
|
+
|
|
31435
31646
|
string ToString() const override;
|
|
31436
31647
|
|
|
31437
|
-
|
|
31648
|
+
static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
|
|
31438
31649
|
|
|
31439
|
-
|
|
31440
|
-
hash_t Hash() const override;
|
|
31650
|
+
unique_ptr<ParsedExpression> Copy() const override;
|
|
31441
31651
|
|
|
31442
31652
|
void Serialize(FieldWriter &writer) const override;
|
|
31443
31653
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
31444
|
-
|
|
31445
|
-
|
|
31446
|
-
|
|
31447
|
-
public:
|
|
31448
|
-
template <class T, class BASE>
|
|
31449
|
-
static string ToString(const T &entry, const string &schema, const string &function_name, bool is_operator = false,
|
|
31450
|
-
bool distinct = false, BASE *filter = nullptr, OrderModifier *order_bys = nullptr,
|
|
31451
|
-
bool export_state = false, bool add_alias = false) {
|
|
31452
|
-
if (is_operator) {
|
|
31453
|
-
// built-in operator
|
|
31454
|
-
D_ASSERT(!distinct);
|
|
31455
|
-
if (entry.children.size() == 1) {
|
|
31456
|
-
if (StringUtil::Contains(function_name, "__postfix")) {
|
|
31457
|
-
return "(" + entry.children[0]->ToString() + ")" +
|
|
31458
|
-
StringUtil::Replace(function_name, "__postfix", "");
|
|
31459
|
-
} else {
|
|
31460
|
-
return function_name + "(" + entry.children[0]->ToString() + ")";
|
|
31461
|
-
}
|
|
31462
|
-
} else if (entry.children.size() == 2) {
|
|
31463
|
-
return StringUtil::Format("(%s %s %s)", entry.children[0]->ToString(), function_name,
|
|
31464
|
-
entry.children[1]->ToString());
|
|
31465
|
-
}
|
|
31466
|
-
}
|
|
31467
|
-
// standard function call
|
|
31468
|
-
string result = schema.empty() ? function_name : schema + "." + function_name;
|
|
31469
|
-
result += "(";
|
|
31470
|
-
if (distinct) {
|
|
31471
|
-
result += "DISTINCT ";
|
|
31472
|
-
}
|
|
31473
|
-
result += StringUtil::Join(entry.children, entry.children.size(), ", ", [&](const unique_ptr<BASE> &child) {
|
|
31474
|
-
return child->alias.empty() || !add_alias
|
|
31475
|
-
? child->ToString()
|
|
31476
|
-
: KeywordHelper::WriteOptionallyQuoted(child->alias) + " := " + child->ToString();
|
|
31477
|
-
});
|
|
31478
|
-
// ordered aggregate
|
|
31479
|
-
if (order_bys && !order_bys->orders.empty()) {
|
|
31480
|
-
if (entry.children.empty()) {
|
|
31481
|
-
result += ") WITHIN GROUP (";
|
|
31482
|
-
}
|
|
31483
|
-
result += " ORDER BY ";
|
|
31484
|
-
for (idx_t i = 0; i < order_bys->orders.size(); i++) {
|
|
31485
|
-
if (i > 0) {
|
|
31486
|
-
result += ", ";
|
|
31487
|
-
}
|
|
31488
|
-
result += order_bys->orders[i].ToString();
|
|
31489
|
-
}
|
|
31490
|
-
}
|
|
31491
|
-
result += ")";
|
|
31492
|
-
|
|
31493
|
-
// filtered aggregate
|
|
31494
|
-
if (filter) {
|
|
31495
|
-
result += " FILTER (WHERE " + filter->ToString() + ")";
|
|
31496
|
-
}
|
|
31497
|
-
|
|
31498
|
-
if (export_state) {
|
|
31499
|
-
result += " EXPORT_STATE";
|
|
31500
|
-
}
|
|
31501
|
-
|
|
31502
|
-
return result;
|
|
31503
|
-
}
|
|
31504
|
-
};
|
|
31505
|
-
} // namespace duckdb
|
|
31506
|
-
|
|
31654
|
+
};
|
|
31655
|
+
} // namespace duckdb
|
|
31507
31656
|
|
|
31508
31657
|
|
|
31509
31658
|
//===----------------------------------------------------------------------===//
|
|
31510
31659
|
// DuckDB
|
|
31511
31660
|
//
|
|
31512
|
-
// duckdb/parser/
|
|
31661
|
+
// duckdb/parser/parsed_data/create_view_info.hpp
|
|
31513
31662
|
//
|
|
31514
31663
|
//
|
|
31515
31664
|
//===----------------------------------------------------------------------===//
|
|
@@ -31518,39 +31667,65 @@ public:
|
|
|
31518
31667
|
|
|
31519
31668
|
|
|
31520
31669
|
|
|
31521
|
-
namespace duckdb {
|
|
31522
|
-
class ParameterExpression : public ParsedExpression {
|
|
31523
|
-
public:
|
|
31524
|
-
ParameterExpression();
|
|
31525
31670
|
|
|
31526
|
-
|
|
31671
|
+
namespace duckdb {
|
|
31527
31672
|
|
|
31528
|
-
public
|
|
31529
|
-
|
|
31530
|
-
return true;
|
|
31673
|
+
struct CreateViewInfo : public CreateInfo {
|
|
31674
|
+
CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
|
|
31531
31675
|
}
|
|
31532
|
-
|
|
31533
|
-
|
|
31676
|
+
CreateViewInfo(string schema, string view_name)
|
|
31677
|
+
: CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
|
|
31534
31678
|
}
|
|
31535
31679
|
|
|
31536
|
-
|
|
31680
|
+
//! Table name to insert to
|
|
31681
|
+
string view_name;
|
|
31682
|
+
//! Aliases of the view
|
|
31683
|
+
vector<string> aliases;
|
|
31684
|
+
//! Return types
|
|
31685
|
+
vector<LogicalType> types;
|
|
31686
|
+
//! The SelectStatement of the view
|
|
31687
|
+
unique_ptr<SelectStatement> query;
|
|
31537
31688
|
|
|
31538
|
-
|
|
31689
|
+
public:
|
|
31690
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
31691
|
+
auto result = make_unique<CreateViewInfo>(schema, view_name);
|
|
31692
|
+
CopyProperties(*result);
|
|
31693
|
+
result->aliases = aliases;
|
|
31694
|
+
result->types = types;
|
|
31695
|
+
result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
|
|
31696
|
+
return move(result);
|
|
31697
|
+
}
|
|
31539
31698
|
|
|
31540
|
-
unique_ptr<
|
|
31541
|
-
|
|
31699
|
+
static unique_ptr<CreateViewInfo> Deserialize(Deserializer &deserializer) {
|
|
31700
|
+
auto result = make_unique<CreateViewInfo>();
|
|
31701
|
+
result->DeserializeBase(deserializer);
|
|
31542
31702
|
|
|
31543
|
-
|
|
31544
|
-
|
|
31545
|
-
|
|
31546
|
-
|
|
31703
|
+
FieldReader reader(deserializer);
|
|
31704
|
+
result->view_name = reader.ReadRequired<string>();
|
|
31705
|
+
result->aliases = reader.ReadRequiredList<string>();
|
|
31706
|
+
result->types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
|
|
31707
|
+
result->query = reader.ReadOptional<SelectStatement>(nullptr);
|
|
31708
|
+
reader.Finalize();
|
|
31547
31709
|
|
|
31710
|
+
return result;
|
|
31711
|
+
}
|
|
31548
31712
|
|
|
31713
|
+
protected:
|
|
31714
|
+
void SerializeInternal(Serializer &serializer) const override {
|
|
31715
|
+
FieldWriter writer(serializer);
|
|
31716
|
+
writer.WriteString(view_name);
|
|
31717
|
+
writer.WriteList<string>(aliases);
|
|
31718
|
+
writer.WriteRegularSerializableList(types);
|
|
31719
|
+
writer.WriteOptional(query);
|
|
31720
|
+
writer.Finalize();
|
|
31721
|
+
}
|
|
31722
|
+
};
|
|
31549
31723
|
|
|
31724
|
+
} // namespace duckdb
|
|
31550
31725
|
//===----------------------------------------------------------------------===//
|
|
31551
31726
|
// DuckDB
|
|
31552
31727
|
//
|
|
31553
|
-
// duckdb/parser/
|
|
31728
|
+
// duckdb/parser/parsed_data/alter_function_info.hpp
|
|
31554
31729
|
//
|
|
31555
31730
|
//
|
|
31556
31731
|
//===----------------------------------------------------------------------===//
|
|
@@ -31563,88 +31738,34 @@ public:
|
|
|
31563
31738
|
|
|
31564
31739
|
namespace duckdb {
|
|
31565
31740
|
|
|
31566
|
-
|
|
31567
|
-
|
|
31568
|
-
|
|
31569
|
-
|
|
31570
|
-
|
|
31571
|
-
//! The actual subquery
|
|
31572
|
-
unique_ptr<SelectStatement> subquery;
|
|
31573
|
-
//! The subquery type
|
|
31574
|
-
SubqueryType subquery_type;
|
|
31575
|
-
//! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
|
|
31576
|
-
//! subquery)
|
|
31577
|
-
unique_ptr<ParsedExpression> child;
|
|
31578
|
-
//! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
|
|
31579
|
-
ExpressionType comparison_type;
|
|
31580
|
-
|
|
31581
|
-
public:
|
|
31582
|
-
bool HasSubquery() const override {
|
|
31583
|
-
return true;
|
|
31584
|
-
}
|
|
31585
|
-
bool IsScalar() const override {
|
|
31586
|
-
return false;
|
|
31587
|
-
}
|
|
31588
|
-
|
|
31589
|
-
string ToString() const override;
|
|
31741
|
+
//===--------------------------------------------------------------------===//
|
|
31742
|
+
// Alter Table
|
|
31743
|
+
//===--------------------------------------------------------------------===//
|
|
31744
|
+
enum class AlterFunctionType : uint8_t { INVALID = 0, ADD_FUNCTION_OVERLOADS = 1 };
|
|
31590
31745
|
|
|
31591
|
-
|
|
31746
|
+
struct AlterFunctionInfo : public AlterInfo {
|
|
31747
|
+
AlterFunctionInfo(AlterFunctionType type, string schema, string name, bool if_exists);
|
|
31748
|
+
virtual ~AlterFunctionInfo() override;
|
|
31592
31749
|
|
|
31593
|
-
|
|
31750
|
+
AlterFunctionType alter_function_type;
|
|
31594
31751
|
|
|
31752
|
+
public:
|
|
31753
|
+
CatalogType GetCatalogType() const override;
|
|
31595
31754
|
void Serialize(FieldWriter &writer) const override;
|
|
31596
|
-
static unique_ptr<
|
|
31755
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
|
|
31597
31756
|
};
|
|
31598
|
-
} // namespace duckdb
|
|
31599
|
-
|
|
31600
|
-
|
|
31601
|
-
//===----------------------------------------------------------------------===//
|
|
31602
|
-
// DuckDB
|
|
31603
|
-
//
|
|
31604
|
-
// duckdb/parser/parsed_data/create_type_info.hpp
|
|
31605
|
-
//
|
|
31606
|
-
//
|
|
31607
|
-
//===----------------------------------------------------------------------===//
|
|
31608
|
-
|
|
31609
|
-
|
|
31610
|
-
|
|
31611
31757
|
|
|
31758
|
+
//===--------------------------------------------------------------------===//
|
|
31759
|
+
// AddFunctionOverloadInfo
|
|
31760
|
+
//===--------------------------------------------------------------------===//
|
|
31761
|
+
struct AddFunctionOverloadInfo : public AlterFunctionInfo {
|
|
31762
|
+
AddFunctionOverloadInfo(string schema, string name, bool if_exists, ScalarFunctionSet new_overloads);
|
|
31763
|
+
~AddFunctionOverloadInfo() override;
|
|
31612
31764
|
|
|
31613
|
-
|
|
31614
|
-
|
|
31615
|
-
|
|
31616
|
-
namespace duckdb {
|
|
31617
|
-
|
|
31618
|
-
struct CreateTypeInfo : public CreateInfo {
|
|
31619
|
-
CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
|
|
31620
|
-
}
|
|
31621
|
-
CreateTypeInfo(string name_p, LogicalType type_p)
|
|
31622
|
-
: CreateInfo(CatalogType::TYPE_ENTRY), name(move(name_p)), type(move(type_p)) {
|
|
31623
|
-
}
|
|
31624
|
-
|
|
31625
|
-
//! Name of the Type
|
|
31626
|
-
string name;
|
|
31627
|
-
//! Logical Type
|
|
31628
|
-
LogicalType type;
|
|
31629
|
-
//! Used by create enum from query
|
|
31630
|
-
unique_ptr<SQLStatement> query;
|
|
31765
|
+
ScalarFunctionSet new_overloads;
|
|
31631
31766
|
|
|
31632
31767
|
public:
|
|
31633
|
-
unique_ptr<
|
|
31634
|
-
auto result = make_unique<CreateTypeInfo>();
|
|
31635
|
-
CopyProperties(*result);
|
|
31636
|
-
result->name = name;
|
|
31637
|
-
result->type = type;
|
|
31638
|
-
if (query) {
|
|
31639
|
-
result->query = query->Copy();
|
|
31640
|
-
}
|
|
31641
|
-
return move(result);
|
|
31642
|
-
}
|
|
31643
|
-
|
|
31644
|
-
protected:
|
|
31645
|
-
void SerializeInternal(Serializer &) const override {
|
|
31646
|
-
throw NotImplementedException("Cannot serialize '%s'", CatalogTypeToString(CreateInfo::type));
|
|
31647
|
-
}
|
|
31768
|
+
unique_ptr<AlterInfo> Copy() const override;
|
|
31648
31769
|
};
|
|
31649
31770
|
|
|
31650
31771
|
} // namespace duckdb
|
|
@@ -31698,7 +31819,7 @@ public:
|
|
|
31698
31819
|
//===----------------------------------------------------------------------===//
|
|
31699
31820
|
// DuckDB
|
|
31700
31821
|
//
|
|
31701
|
-
// duckdb/parser/parsed_data/
|
|
31822
|
+
// duckdb/parser/parsed_data/show_select_info.hpp
|
|
31702
31823
|
//
|
|
31703
31824
|
//
|
|
31704
31825
|
//===----------------------------------------------------------------------===//
|
|
@@ -31710,28 +31831,23 @@ public:
|
|
|
31710
31831
|
|
|
31711
31832
|
namespace duckdb {
|
|
31712
31833
|
|
|
31713
|
-
struct
|
|
31714
|
-
|
|
31715
|
-
|
|
31716
|
-
|
|
31717
|
-
|
|
31718
|
-
|
|
31719
|
-
|
|
31720
|
-
|
|
31721
|
-
|
|
31722
|
-
name = functions.name;
|
|
31723
|
-
for (auto &func : functions.functions) {
|
|
31724
|
-
func.name = functions.name;
|
|
31725
|
-
}
|
|
31726
|
-
}
|
|
31727
|
-
|
|
31728
|
-
AggregateFunctionSet functions;
|
|
31834
|
+
struct ShowSelectInfo : public ParseInfo {
|
|
31835
|
+
//! Types of projected columns
|
|
31836
|
+
vector<LogicalType> types;
|
|
31837
|
+
//! The QueryNode of select query
|
|
31838
|
+
unique_ptr<QueryNode> query;
|
|
31839
|
+
//! Aliases of projected columns
|
|
31840
|
+
vector<string> aliases;
|
|
31841
|
+
//! Whether or not we are requesting a summary or a describe
|
|
31842
|
+
bool is_summary;
|
|
31729
31843
|
|
|
31730
|
-
|
|
31731
|
-
|
|
31732
|
-
|
|
31733
|
-
|
|
31734
|
-
|
|
31844
|
+
unique_ptr<ShowSelectInfo> Copy() {
|
|
31845
|
+
auto result = make_unique<ShowSelectInfo>();
|
|
31846
|
+
result->types = types;
|
|
31847
|
+
result->query = query->Copy();
|
|
31848
|
+
result->aliases = aliases;
|
|
31849
|
+
result->is_summary = is_summary;
|
|
31850
|
+
return result;
|
|
31735
31851
|
}
|
|
31736
31852
|
};
|
|
31737
31853
|
|
|
@@ -31739,7 +31855,7 @@ public:
|
|
|
31739
31855
|
//===----------------------------------------------------------------------===//
|
|
31740
31856
|
// DuckDB
|
|
31741
31857
|
//
|
|
31742
|
-
// duckdb/parser/parsed_data/
|
|
31858
|
+
// duckdb/parser/parsed_data/create_index_info.hpp
|
|
31743
31859
|
//
|
|
31744
31860
|
//
|
|
31745
31861
|
//===----------------------------------------------------------------------===//
|
|
@@ -31748,20 +31864,11 @@ public:
|
|
|
31748
31864
|
|
|
31749
31865
|
|
|
31750
31866
|
|
|
31751
|
-
//===----------------------------------------------------------------------===//
|
|
31752
|
-
// DuckDB
|
|
31753
|
-
//
|
|
31754
|
-
// duckdb/planner/tableref/bound_basetableref.hpp
|
|
31755
|
-
//
|
|
31756
|
-
//
|
|
31757
|
-
//===----------------------------------------------------------------------===//
|
|
31758
|
-
|
|
31759
|
-
|
|
31760
31867
|
|
|
31761
31868
|
//===----------------------------------------------------------------------===//
|
|
31762
31869
|
// DuckDB
|
|
31763
31870
|
//
|
|
31764
|
-
// duckdb/
|
|
31871
|
+
// duckdb/parser/tableref/basetableref.hpp
|
|
31765
31872
|
//
|
|
31766
31873
|
//
|
|
31767
31874
|
//===----------------------------------------------------------------------===//
|
|
@@ -31771,163 +31878,78 @@ public:
|
|
|
31771
31878
|
|
|
31772
31879
|
|
|
31773
31880
|
|
|
31774
|
-
|
|
31775
|
-
namespace duckdb {
|
|
31776
|
-
|
|
31777
|
-
class BoundTableRef {
|
|
31778
|
-
public:
|
|
31779
|
-
explicit BoundTableRef(TableReferenceType type) : type(type) {
|
|
31780
|
-
}
|
|
31781
|
-
virtual ~BoundTableRef() {
|
|
31782
|
-
}
|
|
31783
|
-
|
|
31784
|
-
//! The type of table reference
|
|
31785
|
-
TableReferenceType type;
|
|
31786
|
-
//! The sample options (if any)
|
|
31787
|
-
unique_ptr<SampleOptions> sample;
|
|
31788
|
-
};
|
|
31789
|
-
} // namespace duckdb
|
|
31790
|
-
|
|
31791
|
-
|
|
31792
|
-
|
|
31793
31881
|
namespace duckdb {
|
|
31794
|
-
class TableCatalogEntry;
|
|
31795
|
-
|
|
31796
31882
|
//! Represents a TableReference to a base table in the schema
|
|
31797
|
-
class
|
|
31883
|
+
class BaseTableRef : public TableRef {
|
|
31798
31884
|
public:
|
|
31799
|
-
|
|
31800
|
-
: BoundTableRef(TableReferenceType::BASE_TABLE), table(table), get(move(get)) {
|
|
31885
|
+
BaseTableRef() : TableRef(TableReferenceType::BASE_TABLE), schema_name(INVALID_SCHEMA) {
|
|
31801
31886
|
}
|
|
31802
31887
|
|
|
31803
|
-
|
|
31804
|
-
|
|
31805
|
-
|
|
31806
|
-
|
|
31807
|
-
|
|
31808
|
-
|
|
31809
|
-
|
|
31810
|
-
namespace duckdb {
|
|
31811
|
-
|
|
31812
|
-
struct VacuumOptions {
|
|
31813
|
-
bool vacuum;
|
|
31814
|
-
bool analyze;
|
|
31815
|
-
};
|
|
31888
|
+
//! Schema name
|
|
31889
|
+
string schema_name;
|
|
31890
|
+
//! Table name
|
|
31891
|
+
string table_name;
|
|
31892
|
+
//! Aliases for the column names
|
|
31893
|
+
vector<string> column_name_alias;
|
|
31816
31894
|
|
|
31817
|
-
struct VacuumInfo : public ParseInfo {
|
|
31818
31895
|
public:
|
|
31819
|
-
|
|
31820
|
-
|
|
31821
|
-
unique_ptr<VacuumInfo> Copy() {
|
|
31822
|
-
auto result = make_unique<VacuumInfo>(options);
|
|
31823
|
-
result->has_table = has_table;
|
|
31824
|
-
if (has_table) {
|
|
31825
|
-
result->ref = ref->Copy();
|
|
31826
|
-
}
|
|
31827
|
-
return result;
|
|
31828
|
-
}
|
|
31896
|
+
string ToString() const override;
|
|
31897
|
+
bool Equals(const TableRef *other_p) const override;
|
|
31829
31898
|
|
|
31830
|
-
|
|
31899
|
+
unique_ptr<TableRef> Copy() override;
|
|
31831
31900
|
|
|
31832
|
-
|
|
31833
|
-
|
|
31834
|
-
|
|
31835
|
-
|
|
31836
|
-
unordered_map<idx_t, idx_t> column_id_map;
|
|
31837
|
-
vector<string> columns;
|
|
31901
|
+
//! Serializes a blob into a BaseTableRef
|
|
31902
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
31903
|
+
//! Deserializes a blob back into a BaseTableRef
|
|
31904
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
31838
31905
|
};
|
|
31839
|
-
|
|
31840
31906
|
} // namespace duckdb
|
|
31841
|
-
//===----------------------------------------------------------------------===//
|
|
31842
|
-
// DuckDB
|
|
31843
|
-
//
|
|
31844
|
-
// duckdb/parser/parsed_data/drop_info.hpp
|
|
31845
|
-
//
|
|
31846
|
-
//
|
|
31847
|
-
//===----------------------------------------------------------------------===//
|
|
31848
|
-
|
|
31849
|
-
|
|
31850
31907
|
|
|
31851
31908
|
|
|
31852
31909
|
|
|
31853
31910
|
|
|
31854
31911
|
namespace duckdb {
|
|
31855
31912
|
|
|
31856
|
-
struct
|
|
31857
|
-
|
|
31858
|
-
}
|
|
31859
|
-
|
|
31860
|
-
//! The catalog type to drop
|
|
31861
|
-
CatalogType type;
|
|
31862
|
-
//! Schema name to drop from, if any
|
|
31863
|
-
string schema;
|
|
31864
|
-
//! Element name to drop
|
|
31865
|
-
string name;
|
|
31866
|
-
//! Ignore if the entry does not exist instead of failing
|
|
31867
|
-
bool if_exists = false;
|
|
31868
|
-
//! Cascade drop (drop all dependents instead of throwing an error if there
|
|
31869
|
-
//! are any)
|
|
31870
|
-
bool cascade = false;
|
|
31871
|
-
|
|
31872
|
-
public:
|
|
31873
|
-
unique_ptr<DropInfo> Copy() const {
|
|
31874
|
-
auto result = make_unique<DropInfo>();
|
|
31875
|
-
result->type = type;
|
|
31876
|
-
result->schema = schema;
|
|
31877
|
-
result->name = name;
|
|
31878
|
-
result->if_exists = if_exists;
|
|
31879
|
-
result->cascade = cascade;
|
|
31880
|
-
return result;
|
|
31913
|
+
struct CreateIndexInfo : public CreateInfo {
|
|
31914
|
+
CreateIndexInfo() : CreateInfo(CatalogType::INDEX_ENTRY) {
|
|
31881
31915
|
}
|
|
31882
|
-
};
|
|
31883
31916
|
|
|
31884
|
-
|
|
31885
|
-
|
|
31886
|
-
|
|
31887
|
-
|
|
31888
|
-
|
|
31889
|
-
|
|
31890
|
-
|
|
31891
|
-
|
|
31892
|
-
|
|
31893
|
-
|
|
31894
|
-
|
|
31895
|
-
|
|
31896
|
-
|
|
31897
|
-
|
|
31898
|
-
namespace duckdb {
|
|
31899
|
-
class TableCatalogEntry;
|
|
31900
|
-
|
|
31901
|
-
struct ExportedTableData {
|
|
31902
|
-
//! Name of the exported table
|
|
31903
|
-
string table_name;
|
|
31917
|
+
//! Index Type (e.g., B+-tree, Skip-List, ...)
|
|
31918
|
+
IndexType index_type;
|
|
31919
|
+
//! Name of the Index
|
|
31920
|
+
string index_name;
|
|
31921
|
+
//! Index Constraint Type
|
|
31922
|
+
IndexConstraintType constraint_type;
|
|
31923
|
+
//! The table to create the index on
|
|
31924
|
+
unique_ptr<BaseTableRef> table;
|
|
31925
|
+
//! Set of expressions to index by
|
|
31926
|
+
vector<unique_ptr<ParsedExpression>> expressions;
|
|
31927
|
+
vector<unique_ptr<ParsedExpression>> parsed_expressions;
|
|
31904
31928
|
|
|
31905
|
-
//!
|
|
31906
|
-
|
|
31929
|
+
//! Types used for the CREATE INDEX scan
|
|
31930
|
+
vector<LogicalType> scan_types;
|
|
31931
|
+
//! The names of the columns, used for the CREATE INDEX scan
|
|
31932
|
+
vector<string> names;
|
|
31933
|
+
//! Column IDs needed for index creation
|
|
31934
|
+
vector<column_t> column_ids;
|
|
31907
31935
|
|
|
31908
|
-
|
|
31909
|
-
|
|
31910
|
-
};
|
|
31936
|
+
protected:
|
|
31937
|
+
void SerializeInternal(Serializer &serializer) const override;
|
|
31911
31938
|
|
|
31912
|
-
|
|
31913
|
-
|
|
31914
|
-
ExportedTableData table_data;
|
|
31915
|
-
};
|
|
31939
|
+
public:
|
|
31940
|
+
unique_ptr<CreateInfo> Copy() const override;
|
|
31916
31941
|
|
|
31917
|
-
|
|
31918
|
-
std::vector<ExportedTableInfo> data;
|
|
31942
|
+
static unique_ptr<CreateIndexInfo> Deserialize(Deserializer &deserializer);
|
|
31919
31943
|
};
|
|
31920
31944
|
|
|
31921
31945
|
} // namespace duckdb
|
|
31922
31946
|
//===----------------------------------------------------------------------===//
|
|
31923
31947
|
// DuckDB
|
|
31924
31948
|
//
|
|
31925
|
-
// duckdb/parser/parsed_data/
|
|
31949
|
+
// duckdb/parser/parsed_data/transaction_info.hpp
|
|
31926
31950
|
//
|
|
31927
31951
|
//
|
|
31928
|
-
//===----------------------------------------------------------------------===//
|
|
31929
|
-
|
|
31930
|
-
|
|
31952
|
+
//===----------------------------------------------------------------------===//
|
|
31931
31953
|
|
|
31932
31954
|
|
|
31933
31955
|
|
|
@@ -31935,34 +31957,14 @@ struct BoundExportData : public ParseInfo {
|
|
|
31935
31957
|
|
|
31936
31958
|
namespace duckdb {
|
|
31937
31959
|
|
|
31938
|
-
|
|
31939
|
-
// Alter Table
|
|
31940
|
-
//===--------------------------------------------------------------------===//
|
|
31941
|
-
enum class AlterFunctionType : uint8_t { INVALID = 0, ADD_FUNCTION_OVERLOADS = 1 };
|
|
31942
|
-
|
|
31943
|
-
struct AlterFunctionInfo : public AlterInfo {
|
|
31944
|
-
AlterFunctionInfo(AlterFunctionType type, string schema, string name, bool if_exists);
|
|
31945
|
-
virtual ~AlterFunctionInfo() override;
|
|
31946
|
-
|
|
31947
|
-
AlterFunctionType alter_function_type;
|
|
31948
|
-
|
|
31949
|
-
public:
|
|
31950
|
-
CatalogType GetCatalogType() const override;
|
|
31951
|
-
void Serialize(FieldWriter &writer) const override;
|
|
31952
|
-
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
|
|
31953
|
-
};
|
|
31954
|
-
|
|
31955
|
-
//===--------------------------------------------------------------------===//
|
|
31956
|
-
// AddFunctionOverloadInfo
|
|
31957
|
-
//===--------------------------------------------------------------------===//
|
|
31958
|
-
struct AddFunctionOverloadInfo : public AlterFunctionInfo {
|
|
31959
|
-
AddFunctionOverloadInfo(string schema, string name, bool if_exists, ScalarFunctionSet new_overloads);
|
|
31960
|
-
~AddFunctionOverloadInfo() override;
|
|
31960
|
+
enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
|
|
31961
31961
|
|
|
31962
|
-
|
|
31962
|
+
struct TransactionInfo : public ParseInfo {
|
|
31963
|
+
explicit TransactionInfo(TransactionType type) : type(type) {
|
|
31964
|
+
}
|
|
31963
31965
|
|
|
31964
|
-
|
|
31965
|
-
|
|
31966
|
+
//! The type of transaction statement
|
|
31967
|
+
TransactionType type;
|
|
31966
31968
|
};
|
|
31967
31969
|
|
|
31968
31970
|
} // namespace duckdb
|
|
@@ -31999,7 +32001,7 @@ public:
|
|
|
31999
32001
|
//===----------------------------------------------------------------------===//
|
|
32000
32002
|
// DuckDB
|
|
32001
32003
|
//
|
|
32002
|
-
// duckdb/parser/parsed_data/
|
|
32004
|
+
// duckdb/parser/parsed_data/export_table_data.hpp
|
|
32003
32005
|
//
|
|
32004
32006
|
//
|
|
32005
32007
|
//===----------------------------------------------------------------------===//
|
|
@@ -32010,63 +32012,33 @@ public:
|
|
|
32010
32012
|
|
|
32011
32013
|
|
|
32012
32014
|
namespace duckdb {
|
|
32015
|
+
class TableCatalogEntry;
|
|
32013
32016
|
|
|
32014
|
-
struct
|
|
32015
|
-
|
|
32016
|
-
|
|
32017
|
-
CreateViewInfo(string schema, string view_name)
|
|
32018
|
-
: CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
|
|
32019
|
-
}
|
|
32020
|
-
|
|
32021
|
-
//! Table name to insert to
|
|
32022
|
-
string view_name;
|
|
32023
|
-
//! Aliases of the view
|
|
32024
|
-
vector<string> aliases;
|
|
32025
|
-
//! Return types
|
|
32026
|
-
vector<LogicalType> types;
|
|
32027
|
-
//! The SelectStatement of the view
|
|
32028
|
-
unique_ptr<SelectStatement> query;
|
|
32029
|
-
|
|
32030
|
-
public:
|
|
32031
|
-
unique_ptr<CreateInfo> Copy() const override {
|
|
32032
|
-
auto result = make_unique<CreateViewInfo>(schema, view_name);
|
|
32033
|
-
CopyProperties(*result);
|
|
32034
|
-
result->aliases = aliases;
|
|
32035
|
-
result->types = types;
|
|
32036
|
-
result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
|
|
32037
|
-
return move(result);
|
|
32038
|
-
}
|
|
32017
|
+
struct ExportedTableData {
|
|
32018
|
+
//! Name of the exported table
|
|
32019
|
+
string table_name;
|
|
32039
32020
|
|
|
32040
|
-
|
|
32041
|
-
|
|
32042
|
-
result->DeserializeBase(deserializer);
|
|
32021
|
+
//! Name of the schema
|
|
32022
|
+
string schema_name;
|
|
32043
32023
|
|
|
32044
|
-
|
|
32045
|
-
|
|
32046
|
-
|
|
32047
|
-
result->types = reader.ReadRequiredSerializableList<LogicalType, LogicalType>();
|
|
32048
|
-
result->query = reader.ReadOptional<SelectStatement>(nullptr);
|
|
32049
|
-
reader.Finalize();
|
|
32024
|
+
//! Path to be exported
|
|
32025
|
+
string file_path;
|
|
32026
|
+
};
|
|
32050
32027
|
|
|
32051
|
-
|
|
32052
|
-
|
|
32028
|
+
struct ExportedTableInfo {
|
|
32029
|
+
TableCatalogEntry *entry;
|
|
32030
|
+
ExportedTableData table_data;
|
|
32031
|
+
};
|
|
32053
32032
|
|
|
32054
|
-
|
|
32055
|
-
|
|
32056
|
-
FieldWriter writer(serializer);
|
|
32057
|
-
writer.WriteString(view_name);
|
|
32058
|
-
writer.WriteList<string>(aliases);
|
|
32059
|
-
writer.WriteRegularSerializableList(types);
|
|
32060
|
-
writer.WriteOptional(query);
|
|
32061
|
-
writer.Finalize();
|
|
32062
|
-
}
|
|
32033
|
+
struct BoundExportData : public ParseInfo {
|
|
32034
|
+
std::vector<ExportedTableInfo> data;
|
|
32063
32035
|
};
|
|
32064
32036
|
|
|
32065
32037
|
} // namespace duckdb
|
|
32066
32038
|
//===----------------------------------------------------------------------===//
|
|
32067
32039
|
// DuckDB
|
|
32068
32040
|
//
|
|
32069
|
-
// duckdb/parser/parsed_data/
|
|
32041
|
+
// duckdb/parser/parsed_data/create_aggregate_function_info.hpp
|
|
32070
32042
|
//
|
|
32071
32043
|
//
|
|
32072
32044
|
//===----------------------------------------------------------------------===//
|
|
@@ -32075,28 +32047,32 @@ protected:
|
|
|
32075
32047
|
|
|
32076
32048
|
|
|
32077
32049
|
|
|
32050
|
+
|
|
32078
32051
|
namespace duckdb {
|
|
32079
32052
|
|
|
32080
|
-
struct
|
|
32081
|
-
|
|
32053
|
+
struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
|
|
32054
|
+
explicit CreateAggregateFunctionInfo(AggregateFunction function)
|
|
32055
|
+
: CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
|
|
32056
|
+
name = function.name;
|
|
32057
|
+
functions.AddFunction(move(function));
|
|
32058
|
+
}
|
|
32059
|
+
|
|
32060
|
+
explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
|
|
32061
|
+
: CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
|
|
32062
|
+
name = functions.name;
|
|
32063
|
+
for (auto &func : functions.functions) {
|
|
32064
|
+
func.name = functions.name;
|
|
32065
|
+
}
|
|
32082
32066
|
}
|
|
32083
32067
|
|
|
32068
|
+
AggregateFunctionSet functions;
|
|
32069
|
+
|
|
32084
32070
|
public:
|
|
32085
32071
|
unique_ptr<CreateInfo> Copy() const override {
|
|
32086
|
-
auto result = make_unique<
|
|
32072
|
+
auto result = make_unique<CreateAggregateFunctionInfo>(functions);
|
|
32087
32073
|
CopyProperties(*result);
|
|
32088
32074
|
return move(result);
|
|
32089
32075
|
}
|
|
32090
|
-
|
|
32091
|
-
static unique_ptr<CreateSchemaInfo> Deserialize(Deserializer &deserializer) {
|
|
32092
|
-
auto result = make_unique<CreateSchemaInfo>();
|
|
32093
|
-
result->DeserializeBase(deserializer);
|
|
32094
|
-
return result;
|
|
32095
|
-
}
|
|
32096
|
-
|
|
32097
|
-
protected:
|
|
32098
|
-
void SerializeInternal(Serializer &) const override {
|
|
32099
|
-
}
|
|
32100
32076
|
};
|
|
32101
32077
|
|
|
32102
32078
|
} // namespace duckdb
|
|
@@ -32183,6 +32159,43 @@ public:
|
|
|
32183
32159
|
}
|
|
32184
32160
|
};
|
|
32185
32161
|
|
|
32162
|
+
} // namespace duckdb
|
|
32163
|
+
//===----------------------------------------------------------------------===//
|
|
32164
|
+
// DuckDB
|
|
32165
|
+
//
|
|
32166
|
+
// duckdb/parser/parsed_data/create_schema_info.hpp
|
|
32167
|
+
//
|
|
32168
|
+
//
|
|
32169
|
+
//===----------------------------------------------------------------------===//
|
|
32170
|
+
|
|
32171
|
+
|
|
32172
|
+
|
|
32173
|
+
|
|
32174
|
+
|
|
32175
|
+
namespace duckdb {
|
|
32176
|
+
|
|
32177
|
+
struct CreateSchemaInfo : public CreateInfo {
|
|
32178
|
+
CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
|
|
32179
|
+
}
|
|
32180
|
+
|
|
32181
|
+
public:
|
|
32182
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
32183
|
+
auto result = make_unique<CreateSchemaInfo>();
|
|
32184
|
+
CopyProperties(*result);
|
|
32185
|
+
return move(result);
|
|
32186
|
+
}
|
|
32187
|
+
|
|
32188
|
+
static unique_ptr<CreateSchemaInfo> Deserialize(Deserializer &deserializer) {
|
|
32189
|
+
auto result = make_unique<CreateSchemaInfo>();
|
|
32190
|
+
result->DeserializeBase(deserializer);
|
|
32191
|
+
return result;
|
|
32192
|
+
}
|
|
32193
|
+
|
|
32194
|
+
protected:
|
|
32195
|
+
void SerializeInternal(Serializer &) const override {
|
|
32196
|
+
}
|
|
32197
|
+
};
|
|
32198
|
+
|
|
32186
32199
|
} // namespace duckdb
|
|
32187
32200
|
//===----------------------------------------------------------------------===//
|
|
32188
32201
|
// DuckDB
|
|
@@ -32225,7 +32238,7 @@ public:
|
|
|
32225
32238
|
//===----------------------------------------------------------------------===//
|
|
32226
32239
|
// DuckDB
|
|
32227
32240
|
//
|
|
32228
|
-
// duckdb/parser/parsed_data/
|
|
32241
|
+
// duckdb/parser/parsed_data/vacuum_info.hpp
|
|
32229
32242
|
//
|
|
32230
32243
|
//
|
|
32231
32244
|
//===----------------------------------------------------------------------===//
|
|
@@ -32234,36 +32247,20 @@ public:
|
|
|
32234
32247
|
|
|
32235
32248
|
|
|
32236
32249
|
|
|
32237
|
-
namespace duckdb {
|
|
32238
|
-
|
|
32239
|
-
enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
|
|
32240
|
-
|
|
32241
|
-
struct TransactionInfo : public ParseInfo {
|
|
32242
|
-
explicit TransactionInfo(TransactionType type) : type(type) {
|
|
32243
|
-
}
|
|
32244
|
-
|
|
32245
|
-
//! The type of transaction statement
|
|
32246
|
-
TransactionType type;
|
|
32247
|
-
};
|
|
32248
|
-
|
|
32249
|
-
} // namespace duckdb
|
|
32250
32250
|
//===----------------------------------------------------------------------===//
|
|
32251
32251
|
// DuckDB
|
|
32252
32252
|
//
|
|
32253
|
-
// duckdb/
|
|
32253
|
+
// duckdb/planner/tableref/bound_basetableref.hpp
|
|
32254
32254
|
//
|
|
32255
32255
|
//
|
|
32256
32256
|
//===----------------------------------------------------------------------===//
|
|
32257
32257
|
|
|
32258
32258
|
|
|
32259
32259
|
|
|
32260
|
-
|
|
32261
|
-
|
|
32262
|
-
|
|
32263
32260
|
//===----------------------------------------------------------------------===//
|
|
32264
32261
|
// DuckDB
|
|
32265
32262
|
//
|
|
32266
|
-
// duckdb/
|
|
32263
|
+
// duckdb/planner/bound_tableref.hpp
|
|
32267
32264
|
//
|
|
32268
32265
|
//
|
|
32269
32266
|
//===----------------------------------------------------------------------===//
|
|
@@ -32273,75 +32270,77 @@ struct TransactionInfo : public ParseInfo {
|
|
|
32273
32270
|
|
|
32274
32271
|
|
|
32275
32272
|
|
|
32273
|
+
|
|
32276
32274
|
namespace duckdb {
|
|
32277
|
-
|
|
32278
|
-
class
|
|
32275
|
+
|
|
32276
|
+
class BoundTableRef {
|
|
32279
32277
|
public:
|
|
32280
|
-
|
|
32278
|
+
explicit BoundTableRef(TableReferenceType type) : type(type) {
|
|
32279
|
+
}
|
|
32280
|
+
virtual ~BoundTableRef() {
|
|
32281
32281
|
}
|
|
32282
32282
|
|
|
32283
|
-
//!
|
|
32284
|
-
|
|
32285
|
-
//!
|
|
32286
|
-
|
|
32287
|
-
|
|
32288
|
-
|
|
32283
|
+
//! The type of table reference
|
|
32284
|
+
TableReferenceType type;
|
|
32285
|
+
//! The sample options (if any)
|
|
32286
|
+
unique_ptr<SampleOptions> sample;
|
|
32287
|
+
};
|
|
32288
|
+
} // namespace duckdb
|
|
32289
32289
|
|
|
32290
|
-
public:
|
|
32291
|
-
string ToString() const override;
|
|
32292
|
-
bool Equals(const TableRef *other_p) const override;
|
|
32293
32290
|
|
|
32294
|
-
unique_ptr<TableRef> Copy() override;
|
|
32295
32291
|
|
|
32296
|
-
|
|
32297
|
-
|
|
32298
|
-
|
|
32299
|
-
|
|
32292
|
+
namespace duckdb {
|
|
32293
|
+
class TableCatalogEntry;
|
|
32294
|
+
|
|
32295
|
+
//! Represents a TableReference to a base table in the schema
|
|
32296
|
+
class BoundBaseTableRef : public BoundTableRef {
|
|
32297
|
+
public:
|
|
32298
|
+
BoundBaseTableRef(TableCatalogEntry *table, unique_ptr<LogicalOperator> get)
|
|
32299
|
+
: BoundTableRef(TableReferenceType::BASE_TABLE), table(table), get(move(get)) {
|
|
32300
|
+
}
|
|
32301
|
+
|
|
32302
|
+
TableCatalogEntry *table;
|
|
32303
|
+
unique_ptr<LogicalOperator> get;
|
|
32300
32304
|
};
|
|
32301
32305
|
} // namespace duckdb
|
|
32302
32306
|
|
|
32303
32307
|
|
|
32304
32308
|
|
|
32305
|
-
|
|
32306
32309
|
namespace duckdb {
|
|
32307
32310
|
|
|
32308
|
-
struct
|
|
32309
|
-
|
|
32310
|
-
|
|
32311
|
+
struct VacuumOptions {
|
|
32312
|
+
bool vacuum;
|
|
32313
|
+
bool analyze;
|
|
32314
|
+
};
|
|
32311
32315
|
|
|
32312
|
-
|
|
32313
|
-
|
|
32314
|
-
|
|
32315
|
-
string index_name;
|
|
32316
|
-
//! Index Constraint Type
|
|
32317
|
-
IndexConstraintType constraint_type;
|
|
32318
|
-
//! The table to create the index on
|
|
32319
|
-
unique_ptr<BaseTableRef> table;
|
|
32320
|
-
//! Set of expressions to index by
|
|
32321
|
-
vector<unique_ptr<ParsedExpression>> expressions;
|
|
32322
|
-
vector<unique_ptr<ParsedExpression>> parsed_expressions;
|
|
32316
|
+
struct VacuumInfo : public ParseInfo {
|
|
32317
|
+
public:
|
|
32318
|
+
explicit VacuumInfo(VacuumOptions options) : options(options), has_table(false), table(nullptr) {};
|
|
32323
32319
|
|
|
32324
|
-
|
|
32325
|
-
|
|
32326
|
-
|
|
32327
|
-
|
|
32328
|
-
|
|
32329
|
-
|
|
32320
|
+
unique_ptr<VacuumInfo> Copy() {
|
|
32321
|
+
auto result = make_unique<VacuumInfo>(options);
|
|
32322
|
+
result->has_table = has_table;
|
|
32323
|
+
if (has_table) {
|
|
32324
|
+
result->ref = ref->Copy();
|
|
32325
|
+
}
|
|
32326
|
+
return result;
|
|
32327
|
+
}
|
|
32330
32328
|
|
|
32331
|
-
|
|
32332
|
-
void SerializeInternal(Serializer &serializer) const override;
|
|
32329
|
+
const VacuumOptions options;
|
|
32333
32330
|
|
|
32334
32331
|
public:
|
|
32335
|
-
|
|
32336
|
-
|
|
32337
|
-
|
|
32332
|
+
bool has_table;
|
|
32333
|
+
unique_ptr<TableRef> ref;
|
|
32334
|
+
TableCatalogEntry *table;
|
|
32335
|
+
unordered_map<idx_t, idx_t> column_id_map;
|
|
32336
|
+
vector<string> columns;
|
|
32338
32337
|
};
|
|
32339
32338
|
|
|
32340
32339
|
} // namespace duckdb
|
|
32341
32340
|
//===----------------------------------------------------------------------===//
|
|
32342
32341
|
// DuckDB
|
|
32343
32342
|
//
|
|
32344
|
-
// duckdb/parser/parsed_data/
|
|
32343
|
+
// duckdb/parser/parsed_data/drop_info.hpp
|
|
32345
32344
|
//
|
|
32346
32345
|
//
|
|
32347
32346
|
//===----------------------------------------------------------------------===//
|
|
@@ -32353,22 +32352,30 @@ public:
|
|
|
32353
32352
|
|
|
32354
32353
|
namespace duckdb {
|
|
32355
32354
|
|
|
32356
|
-
struct
|
|
32357
|
-
|
|
32358
|
-
|
|
32359
|
-
//! The QueryNode of select query
|
|
32360
|
-
unique_ptr<QueryNode> query;
|
|
32361
|
-
//! Aliases of projected columns
|
|
32362
|
-
vector<string> aliases;
|
|
32363
|
-
//! Whether or not we are requesting a summary or a describe
|
|
32364
|
-
bool is_summary;
|
|
32355
|
+
struct DropInfo : public ParseInfo {
|
|
32356
|
+
DropInfo() : schema(INVALID_SCHEMA), if_exists(false), cascade(false) {
|
|
32357
|
+
}
|
|
32365
32358
|
|
|
32366
|
-
|
|
32367
|
-
|
|
32368
|
-
|
|
32369
|
-
|
|
32370
|
-
|
|
32371
|
-
|
|
32359
|
+
//! The catalog type to drop
|
|
32360
|
+
CatalogType type;
|
|
32361
|
+
//! Schema name to drop from, if any
|
|
32362
|
+
string schema;
|
|
32363
|
+
//! Element name to drop
|
|
32364
|
+
string name;
|
|
32365
|
+
//! Ignore if the entry does not exist instead of failing
|
|
32366
|
+
bool if_exists = false;
|
|
32367
|
+
//! Cascade drop (drop all dependents instead of throwing an error if there
|
|
32368
|
+
//! are any)
|
|
32369
|
+
bool cascade = false;
|
|
32370
|
+
|
|
32371
|
+
public:
|
|
32372
|
+
unique_ptr<DropInfo> Copy() const {
|
|
32373
|
+
auto result = make_unique<DropInfo>();
|
|
32374
|
+
result->type = type;
|
|
32375
|
+
result->schema = schema;
|
|
32376
|
+
result->name = name;
|
|
32377
|
+
result->if_exists = if_exists;
|
|
32378
|
+
result->cascade = cascade;
|
|
32372
32379
|
return result;
|
|
32373
32380
|
}
|
|
32374
32381
|
};
|
|
@@ -32377,7 +32384,7 @@ struct ShowSelectInfo : public ParseInfo {
|
|
|
32377
32384
|
//===----------------------------------------------------------------------===//
|
|
32378
32385
|
// DuckDB
|
|
32379
32386
|
//
|
|
32380
|
-
// duckdb/parser/
|
|
32387
|
+
// duckdb/parser/parsed_data/create_type_info.hpp
|
|
32381
32388
|
//
|
|
32382
32389
|
//
|
|
32383
32390
|
//===----------------------------------------------------------------------===//
|
|
@@ -32390,35 +32397,44 @@ struct ShowSelectInfo : public ParseInfo {
|
|
|
32390
32397
|
|
|
32391
32398
|
|
|
32392
32399
|
namespace duckdb {
|
|
32393
|
-
|
|
32394
|
-
|
|
32395
|
-
|
|
32396
|
-
|
|
32400
|
+
|
|
32401
|
+
struct CreateTypeInfo : public CreateInfo {
|
|
32402
|
+
CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
|
|
32403
|
+
}
|
|
32404
|
+
CreateTypeInfo(string name_p, LogicalType type_p)
|
|
32405
|
+
: CreateInfo(CatalogType::TYPE_ENTRY), name(move(name_p)), type(move(type_p)) {
|
|
32397
32406
|
}
|
|
32398
32407
|
|
|
32399
|
-
//!
|
|
32400
|
-
|
|
32401
|
-
//!
|
|
32402
|
-
|
|
32403
|
-
//!
|
|
32404
|
-
|
|
32408
|
+
//! Name of the Type
|
|
32409
|
+
string name;
|
|
32410
|
+
//! Logical Type
|
|
32411
|
+
LogicalType type;
|
|
32412
|
+
//! Used by create enum from query
|
|
32413
|
+
unique_ptr<SQLStatement> query;
|
|
32405
32414
|
|
|
32406
32415
|
public:
|
|
32407
|
-
|
|
32408
|
-
|
|
32409
|
-
|
|
32410
|
-
|
|
32416
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
32417
|
+
auto result = make_unique<CreateTypeInfo>();
|
|
32418
|
+
CopyProperties(*result);
|
|
32419
|
+
result->name = name;
|
|
32420
|
+
result->type = type;
|
|
32421
|
+
if (query) {
|
|
32422
|
+
result->query = query->Copy();
|
|
32423
|
+
}
|
|
32424
|
+
return move(result);
|
|
32425
|
+
}
|
|
32411
32426
|
|
|
32412
|
-
|
|
32413
|
-
void
|
|
32414
|
-
|
|
32415
|
-
|
|
32427
|
+
protected:
|
|
32428
|
+
void SerializeInternal(Serializer &) const override {
|
|
32429
|
+
throw NotImplementedException("Cannot serialize '%s'", CatalogTypeToString(CreateInfo::type));
|
|
32430
|
+
}
|
|
32416
32431
|
};
|
|
32432
|
+
|
|
32417
32433
|
} // namespace duckdb
|
|
32418
32434
|
//===----------------------------------------------------------------------===//
|
|
32419
32435
|
// DuckDB
|
|
32420
32436
|
//
|
|
32421
|
-
// duckdb/parser/tableref/
|
|
32437
|
+
// duckdb/parser/tableref/table_function_ref.hpp
|
|
32422
32438
|
//
|
|
32423
32439
|
//
|
|
32424
32440
|
//===----------------------------------------------------------------------===//
|
|
@@ -32432,41 +32448,38 @@ public:
|
|
|
32432
32448
|
|
|
32433
32449
|
|
|
32434
32450
|
namespace duckdb {
|
|
32435
|
-
//! Represents a
|
|
32436
|
-
class
|
|
32451
|
+
//! Represents a Table producing function
|
|
32452
|
+
class TableFunctionRef : public TableRef {
|
|
32437
32453
|
public:
|
|
32438
|
-
|
|
32439
|
-
}
|
|
32454
|
+
DUCKDB_API TableFunctionRef();
|
|
32440
32455
|
|
|
32441
|
-
|
|
32442
|
-
|
|
32443
|
-
|
|
32444
|
-
|
|
32445
|
-
|
|
32446
|
-
|
|
32447
|
-
|
|
32448
|
-
|
|
32449
|
-
//! Natural join
|
|
32450
|
-
bool is_natural;
|
|
32451
|
-
//! The set of USING columns (if any)
|
|
32452
|
-
vector<string> using_columns;
|
|
32456
|
+
unique_ptr<ParsedExpression> function;
|
|
32457
|
+
vector<string> column_name_alias;
|
|
32458
|
+
|
|
32459
|
+
// if the function takes a subquery as argument its in here
|
|
32460
|
+
unique_ptr<SelectStatement> subquery;
|
|
32461
|
+
|
|
32462
|
+
// External dependencies of this table funcion
|
|
32463
|
+
unique_ptr<ExternalDependency> external_dependency;
|
|
32453
32464
|
|
|
32454
32465
|
public:
|
|
32455
32466
|
string ToString() const override;
|
|
32467
|
+
|
|
32456
32468
|
bool Equals(const TableRef *other_p) const override;
|
|
32457
32469
|
|
|
32458
32470
|
unique_ptr<TableRef> Copy() override;
|
|
32459
32471
|
|
|
32460
|
-
//! Serializes a blob into a
|
|
32472
|
+
//! Serializes a blob into a BaseTableRef
|
|
32461
32473
|
void Serialize(FieldWriter &serializer) const override;
|
|
32462
|
-
//! Deserializes a blob back into a
|
|
32474
|
+
//! Deserializes a blob back into a BaseTableRef
|
|
32463
32475
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
32464
32476
|
};
|
|
32465
32477
|
} // namespace duckdb
|
|
32478
|
+
|
|
32466
32479
|
//===----------------------------------------------------------------------===//
|
|
32467
32480
|
// DuckDB
|
|
32468
32481
|
//
|
|
32469
|
-
// duckdb/parser/tableref/
|
|
32482
|
+
// duckdb/parser/tableref/crossproductref.hpp
|
|
32470
32483
|
//
|
|
32471
32484
|
//
|
|
32472
32485
|
//===----------------------------------------------------------------------===//
|
|
@@ -32475,17 +32488,17 @@ public:
|
|
|
32475
32488
|
|
|
32476
32489
|
|
|
32477
32490
|
|
|
32478
|
-
|
|
32479
32491
|
namespace duckdb {
|
|
32480
|
-
//! Represents a
|
|
32481
|
-
class
|
|
32492
|
+
//! Represents a cross product
|
|
32493
|
+
class CrossProductRef : public TableRef {
|
|
32482
32494
|
public:
|
|
32483
|
-
|
|
32495
|
+
CrossProductRef() : TableRef(TableReferenceType::CROSS_PRODUCT) {
|
|
32496
|
+
}
|
|
32484
32497
|
|
|
32485
|
-
//! The
|
|
32486
|
-
unique_ptr<
|
|
32487
|
-
//!
|
|
32488
|
-
|
|
32498
|
+
//! The left hand side of the cross product
|
|
32499
|
+
unique_ptr<TableRef> left;
|
|
32500
|
+
//! The right hand side of the cross product
|
|
32501
|
+
unique_ptr<TableRef> right;
|
|
32489
32502
|
|
|
32490
32503
|
public:
|
|
32491
32504
|
string ToString() const override;
|
|
@@ -32493,12 +32506,13 @@ public:
|
|
|
32493
32506
|
|
|
32494
32507
|
unique_ptr<TableRef> Copy() override;
|
|
32495
32508
|
|
|
32496
|
-
//! Serializes a blob into a
|
|
32509
|
+
//! Serializes a blob into a CrossProductRef
|
|
32497
32510
|
void Serialize(FieldWriter &serializer) const override;
|
|
32498
|
-
//! Deserializes a blob back into a
|
|
32511
|
+
//! Deserializes a blob back into a CrossProductRef
|
|
32499
32512
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
32500
32513
|
};
|
|
32501
32514
|
} // namespace duckdb
|
|
32515
|
+
|
|
32502
32516
|
//===----------------------------------------------------------------------===//
|
|
32503
32517
|
// DuckDB
|
|
32504
32518
|
//
|
|
@@ -32530,10 +32544,11 @@ public:
|
|
|
32530
32544
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
32531
32545
|
};
|
|
32532
32546
|
} // namespace duckdb
|
|
32547
|
+
|
|
32533
32548
|
//===----------------------------------------------------------------------===//
|
|
32534
32549
|
// DuckDB
|
|
32535
32550
|
//
|
|
32536
|
-
// duckdb/parser/tableref/
|
|
32551
|
+
// duckdb/parser/tableref/expressionlistref.hpp
|
|
32537
32552
|
//
|
|
32538
32553
|
//
|
|
32539
32554
|
//===----------------------------------------------------------------------===//
|
|
@@ -32542,17 +32557,22 @@ public:
|
|
|
32542
32557
|
|
|
32543
32558
|
|
|
32544
32559
|
|
|
32560
|
+
|
|
32561
|
+
|
|
32562
|
+
|
|
32545
32563
|
namespace duckdb {
|
|
32546
|
-
//! Represents a
|
|
32547
|
-
class
|
|
32564
|
+
//! Represents an expression list as generated by a VALUES statement
|
|
32565
|
+
class ExpressionListRef : public TableRef {
|
|
32548
32566
|
public:
|
|
32549
|
-
|
|
32567
|
+
ExpressionListRef() : TableRef(TableReferenceType::EXPRESSION_LIST) {
|
|
32550
32568
|
}
|
|
32551
32569
|
|
|
32552
|
-
//!
|
|
32553
|
-
unique_ptr<
|
|
32554
|
-
//!
|
|
32555
|
-
|
|
32570
|
+
//! Value list, only used for VALUES statement
|
|
32571
|
+
vector<vector<unique_ptr<ParsedExpression>>> values;
|
|
32572
|
+
//! Expected SQL types
|
|
32573
|
+
vector<LogicalType> expected_types;
|
|
32574
|
+
//! The set of expected names
|
|
32575
|
+
vector<string> expected_names;
|
|
32556
32576
|
|
|
32557
32577
|
public:
|
|
32558
32578
|
string ToString() const override;
|
|
@@ -32560,16 +32580,17 @@ public:
|
|
|
32560
32580
|
|
|
32561
32581
|
unique_ptr<TableRef> Copy() override;
|
|
32562
32582
|
|
|
32563
|
-
//! Serializes a blob into a
|
|
32583
|
+
//! Serializes a blob into a ExpressionListRef
|
|
32564
32584
|
void Serialize(FieldWriter &serializer) const override;
|
|
32565
|
-
//! Deserializes a blob back into a
|
|
32585
|
+
//! Deserializes a blob back into a ExpressionListRef
|
|
32566
32586
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
32567
32587
|
};
|
|
32568
32588
|
} // namespace duckdb
|
|
32589
|
+
|
|
32569
32590
|
//===----------------------------------------------------------------------===//
|
|
32570
32591
|
// DuckDB
|
|
32571
32592
|
//
|
|
32572
|
-
// duckdb/parser/tableref/
|
|
32593
|
+
// duckdb/parser/tableref/joinref.hpp
|
|
32573
32594
|
//
|
|
32574
32595
|
//
|
|
32575
32596
|
//===----------------------------------------------------------------------===//
|
|
@@ -32583,37 +32604,73 @@ public:
|
|
|
32583
32604
|
|
|
32584
32605
|
|
|
32585
32606
|
namespace duckdb {
|
|
32586
|
-
//! Represents a
|
|
32587
|
-
class
|
|
32607
|
+
//! Represents a JOIN between two expressions
|
|
32608
|
+
class JoinRef : public TableRef {
|
|
32588
32609
|
public:
|
|
32589
|
-
|
|
32590
|
-
|
|
32591
|
-
unique_ptr<ParsedExpression> function;
|
|
32592
|
-
vector<string> column_name_alias;
|
|
32593
|
-
|
|
32594
|
-
// if the function takes a subquery as argument its in here
|
|
32595
|
-
unique_ptr<SelectStatement> subquery;
|
|
32610
|
+
JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
|
|
32611
|
+
}
|
|
32596
32612
|
|
|
32597
|
-
|
|
32598
|
-
unique_ptr<
|
|
32613
|
+
//! The left hand side of the join
|
|
32614
|
+
unique_ptr<TableRef> left;
|
|
32615
|
+
//! The right hand side of the join
|
|
32616
|
+
unique_ptr<TableRef> right;
|
|
32617
|
+
//! The join condition
|
|
32618
|
+
unique_ptr<ParsedExpression> condition;
|
|
32619
|
+
//! The join type
|
|
32620
|
+
JoinType type;
|
|
32621
|
+
//! Natural join
|
|
32622
|
+
bool is_natural;
|
|
32623
|
+
//! The set of USING columns (if any)
|
|
32624
|
+
vector<string> using_columns;
|
|
32599
32625
|
|
|
32600
32626
|
public:
|
|
32601
32627
|
string ToString() const override;
|
|
32602
|
-
|
|
32603
32628
|
bool Equals(const TableRef *other_p) const override;
|
|
32604
32629
|
|
|
32605
32630
|
unique_ptr<TableRef> Copy() override;
|
|
32606
32631
|
|
|
32607
|
-
//! Serializes a blob into a
|
|
32632
|
+
//! Serializes a blob into a JoinRef
|
|
32608
32633
|
void Serialize(FieldWriter &serializer) const override;
|
|
32609
|
-
//! Deserializes a blob back into a
|
|
32634
|
+
//! Deserializes a blob back into a JoinRef
|
|
32610
32635
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
32611
32636
|
};
|
|
32612
32637
|
} // namespace duckdb
|
|
32613
32638
|
|
|
32639
|
+
//===----------------------------------------------------------------------===//
|
|
32640
|
+
// DuckDB
|
|
32641
|
+
//
|
|
32642
|
+
// duckdb/parser/tableref/subqueryref.hpp
|
|
32643
|
+
//
|
|
32644
|
+
//
|
|
32645
|
+
//===----------------------------------------------------------------------===//
|
|
32646
|
+
|
|
32647
|
+
|
|
32648
|
+
|
|
32649
|
+
|
|
32650
|
+
|
|
32651
|
+
|
|
32652
|
+
namespace duckdb {
|
|
32653
|
+
//! Represents a subquery
|
|
32654
|
+
class SubqueryRef : public TableRef {
|
|
32655
|
+
public:
|
|
32656
|
+
explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
|
|
32614
32657
|
|
|
32658
|
+
//! The subquery
|
|
32659
|
+
unique_ptr<SelectStatement> subquery;
|
|
32660
|
+
//! Aliases for the column names
|
|
32661
|
+
vector<string> column_name_alias;
|
|
32615
32662
|
|
|
32663
|
+
public:
|
|
32664
|
+
string ToString() const override;
|
|
32665
|
+
bool Equals(const TableRef *other_p) const override;
|
|
32616
32666
|
|
|
32667
|
+
unique_ptr<TableRef> Copy() override;
|
|
32617
32668
|
|
|
32669
|
+
//! Serializes a blob into a SubqueryRef
|
|
32670
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
32671
|
+
//! Deserializes a blob back into a SubqueryRef
|
|
32672
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
32673
|
+
};
|
|
32674
|
+
} // namespace duckdb
|
|
32618
32675
|
|
|
32619
32676
|
|