duckdb 0.3.2-dev992.0 → 0.3.3-dev6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/duckdb.cpp +2850 -1857
- package/src/duckdb.hpp +1257 -1161
- package/src/parquet-amalgamation.cpp +30122 -30012
- package/src/parquet-amalgamation.hpp +165 -37
package/src/duckdb.hpp
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2018 DuckDB
|
|
2
|
+
Copyright 2018-2022 Stichting DuckDB Foundation
|
|
3
3
|
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
5
5
|
|
|
@@ -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 "
|
|
14
|
+
#define DUCKDB_SOURCE_ID "c66fa5ef9"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.3-dev6"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -371,13 +371,15 @@ void AssignSharedPointer(shared_ptr<T> &target, const shared_ptr<T> &source) {
|
|
|
371
371
|
|
|
372
372
|
|
|
373
373
|
|
|
374
|
+
|
|
375
|
+
|
|
374
376
|
#if (defined(DUCKDB_USE_STANDARD_ASSERT) || !defined(DEBUG)) && !defined(DUCKDB_FORCE_ASSERT)
|
|
375
377
|
|
|
376
378
|
#include <assert.h>
|
|
377
379
|
#define D_ASSERT assert
|
|
378
380
|
#else
|
|
379
381
|
namespace duckdb {
|
|
380
|
-
void DuckDBAssertInternal(bool condition, const char *condition_name, const char *file, int linenr);
|
|
382
|
+
DUCKDB_API void DuckDBAssertInternal(bool condition, const char *condition_name, const char *file, int linenr);
|
|
381
383
|
}
|
|
382
384
|
|
|
383
385
|
#define D_ASSERT(condition) duckdb::DuckDBAssertInternal(bool(condition), #condition, __FILE__, __LINE__)
|
|
@@ -1548,6 +1550,7 @@ public:
|
|
|
1548
1550
|
} // namespace duckdb
|
|
1549
1551
|
|
|
1550
1552
|
|
|
1553
|
+
#include <type_traits>
|
|
1551
1554
|
|
|
1552
1555
|
namespace duckdb {
|
|
1553
1556
|
|
|
@@ -1561,19 +1564,18 @@ public:
|
|
|
1561
1564
|
|
|
1562
1565
|
template <class T>
|
|
1563
1566
|
void Write(T element) {
|
|
1567
|
+
static_assert(std::is_trivially_destructible<T>(), "Write element must be trivially destructible");
|
|
1568
|
+
|
|
1564
1569
|
WriteData((const_data_ptr_t)&element, sizeof(T));
|
|
1565
1570
|
}
|
|
1566
1571
|
|
|
1567
|
-
//! Write data from a string buffer directly (
|
|
1572
|
+
//! Write data from a string buffer directly (without length prefix)
|
|
1568
1573
|
void WriteBufferData(const string &str) {
|
|
1569
1574
|
WriteData((const_data_ptr_t)str.c_str(), str.size());
|
|
1570
1575
|
}
|
|
1571
1576
|
//! Write a string with a length prefix
|
|
1572
1577
|
void WriteString(const string &val) {
|
|
1573
|
-
|
|
1574
|
-
if (!val.empty()) {
|
|
1575
|
-
WriteData((const_data_ptr_t)val.c_str(), val.size());
|
|
1576
|
-
}
|
|
1578
|
+
WriteStringLen((const_data_ptr_t)val.c_str(), val.size());
|
|
1577
1579
|
}
|
|
1578
1580
|
void WriteStringLen(const_data_ptr_t val, idx_t len) {
|
|
1579
1581
|
Write<uint32_t>((uint32_t)len);
|
|
@@ -1583,7 +1585,7 @@ public:
|
|
|
1583
1585
|
}
|
|
1584
1586
|
|
|
1585
1587
|
template <class T>
|
|
1586
|
-
void WriteList(vector<unique_ptr<T>> &list) {
|
|
1588
|
+
void WriteList(const vector<unique_ptr<T>> &list) {
|
|
1587
1589
|
Write<uint32_t>((uint32_t)list.size());
|
|
1588
1590
|
for (auto &child : list) {
|
|
1589
1591
|
child->Serialize(*this);
|
|
@@ -1812,30 +1814,28 @@ enum class FileType {
|
|
|
1812
1814
|
|
|
1813
1815
|
struct FileHandle {
|
|
1814
1816
|
public:
|
|
1815
|
-
FileHandle(FileSystem &file_system, string path)
|
|
1816
|
-
}
|
|
1817
|
+
DUCKDB_API FileHandle(FileSystem &file_system, string path);
|
|
1817
1818
|
FileHandle(const FileHandle &) = delete;
|
|
1818
|
-
virtual ~FileHandle()
|
|
1819
|
-
}
|
|
1819
|
+
DUCKDB_API virtual ~FileHandle();
|
|
1820
1820
|
|
|
1821
|
-
int64_t Read(void *buffer, idx_t nr_bytes);
|
|
1822
|
-
int64_t Write(void *buffer, idx_t nr_bytes);
|
|
1823
|
-
void Read(void *buffer, idx_t nr_bytes, idx_t location);
|
|
1824
|
-
void Write(void *buffer, idx_t nr_bytes, idx_t location);
|
|
1825
|
-
void Seek(idx_t location);
|
|
1826
|
-
void Reset();
|
|
1827
|
-
idx_t SeekPosition();
|
|
1828
|
-
void Sync();
|
|
1829
|
-
void Truncate(int64_t new_size);
|
|
1830
|
-
string ReadLine();
|
|
1821
|
+
DUCKDB_API int64_t Read(void *buffer, idx_t nr_bytes);
|
|
1822
|
+
DUCKDB_API int64_t Write(void *buffer, idx_t nr_bytes);
|
|
1823
|
+
DUCKDB_API void Read(void *buffer, idx_t nr_bytes, idx_t location);
|
|
1824
|
+
DUCKDB_API void Write(void *buffer, idx_t nr_bytes, idx_t location);
|
|
1825
|
+
DUCKDB_API void Seek(idx_t location);
|
|
1826
|
+
DUCKDB_API void Reset();
|
|
1827
|
+
DUCKDB_API idx_t SeekPosition();
|
|
1828
|
+
DUCKDB_API void Sync();
|
|
1829
|
+
DUCKDB_API void Truncate(int64_t new_size);
|
|
1830
|
+
DUCKDB_API string ReadLine();
|
|
1831
1831
|
|
|
1832
|
-
bool CanSeek();
|
|
1833
|
-
bool OnDiskFile();
|
|
1834
|
-
idx_t GetFileSize();
|
|
1835
|
-
FileType GetType();
|
|
1832
|
+
DUCKDB_API bool CanSeek();
|
|
1833
|
+
DUCKDB_API bool OnDiskFile();
|
|
1834
|
+
DUCKDB_API idx_t GetFileSize();
|
|
1835
|
+
DUCKDB_API FileType GetType();
|
|
1836
1836
|
|
|
1837
1837
|
//! Closes the file handle.
|
|
1838
|
-
virtual void Close() = 0;
|
|
1838
|
+
DUCKDB_API virtual void Close() = 0;
|
|
1839
1839
|
|
|
1840
1840
|
public:
|
|
1841
1841
|
FileSystem &file_system;
|
|
@@ -1862,107 +1862,107 @@ public:
|
|
|
1862
1862
|
|
|
1863
1863
|
class FileSystem {
|
|
1864
1864
|
public:
|
|
1865
|
-
virtual ~FileSystem()
|
|
1866
|
-
}
|
|
1865
|
+
DUCKDB_API virtual ~FileSystem();
|
|
1867
1866
|
|
|
1868
1867
|
public:
|
|
1869
|
-
static constexpr FileLockType DEFAULT_LOCK = FileLockType::NO_LOCK;
|
|
1870
|
-
static constexpr FileCompressionType DEFAULT_COMPRESSION = FileCompressionType::UNCOMPRESSED;
|
|
1871
|
-
static FileSystem &GetFileSystem(ClientContext &context);
|
|
1872
|
-
static FileSystem &GetFileSystem(DatabaseInstance &db);
|
|
1873
|
-
static FileOpener *GetFileOpener(ClientContext &context);
|
|
1868
|
+
DUCKDB_API static constexpr FileLockType DEFAULT_LOCK = FileLockType::NO_LOCK;
|
|
1869
|
+
DUCKDB_API static constexpr FileCompressionType DEFAULT_COMPRESSION = FileCompressionType::UNCOMPRESSED;
|
|
1870
|
+
DUCKDB_API static FileSystem &GetFileSystem(ClientContext &context);
|
|
1871
|
+
DUCKDB_API static FileSystem &GetFileSystem(DatabaseInstance &db);
|
|
1872
|
+
DUCKDB_API static FileOpener *GetFileOpener(ClientContext &context);
|
|
1874
1873
|
|
|
1875
|
-
virtual unique_ptr<FileHandle> OpenFile(const string &path, uint8_t flags,
|
|
1876
|
-
|
|
1877
|
-
|
|
1874
|
+
DUCKDB_API virtual unique_ptr<FileHandle> OpenFile(const string &path, uint8_t flags,
|
|
1875
|
+
FileLockType lock = DEFAULT_LOCK,
|
|
1876
|
+
FileCompressionType compression = DEFAULT_COMPRESSION,
|
|
1877
|
+
FileOpener *opener = nullptr);
|
|
1878
1878
|
|
|
1879
1879
|
//! Read exactly nr_bytes from the specified location in the file. Fails if nr_bytes could not be read. This is
|
|
1880
1880
|
//! equivalent to calling SetFilePointer(location) followed by calling Read().
|
|
1881
|
-
virtual void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location);
|
|
1881
|
+
DUCKDB_API virtual void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location);
|
|
1882
1882
|
//! Write exactly nr_bytes to the specified location in the file. Fails if nr_bytes could not be read. This is
|
|
1883
1883
|
//! equivalent to calling SetFilePointer(location) followed by calling Write().
|
|
1884
|
-
virtual void Write(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location);
|
|
1884
|
+
DUCKDB_API virtual void Write(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location);
|
|
1885
1885
|
//! Read nr_bytes from the specified file into the buffer, moving the file pointer forward by nr_bytes. Returns the
|
|
1886
1886
|
//! amount of bytes read.
|
|
1887
|
-
virtual int64_t Read(FileHandle &handle, void *buffer, int64_t nr_bytes);
|
|
1887
|
+
DUCKDB_API virtual int64_t Read(FileHandle &handle, void *buffer, int64_t nr_bytes);
|
|
1888
1888
|
//! Write nr_bytes from the buffer into the file, moving the file pointer forward by nr_bytes.
|
|
1889
|
-
virtual int64_t Write(FileHandle &handle, void *buffer, int64_t nr_bytes);
|
|
1889
|
+
DUCKDB_API virtual int64_t Write(FileHandle &handle, void *buffer, int64_t nr_bytes);
|
|
1890
1890
|
|
|
1891
1891
|
//! Returns the file size of a file handle, returns -1 on error
|
|
1892
|
-
virtual int64_t GetFileSize(FileHandle &handle);
|
|
1892
|
+
DUCKDB_API virtual int64_t GetFileSize(FileHandle &handle);
|
|
1893
1893
|
//! Returns the file last modified time of a file handle, returns timespec with zero on all attributes on error
|
|
1894
|
-
virtual time_t GetLastModifiedTime(FileHandle &handle);
|
|
1894
|
+
DUCKDB_API virtual time_t GetLastModifiedTime(FileHandle &handle);
|
|
1895
1895
|
//! Returns the file last modified time of a file handle, returns timespec with zero on all attributes on error
|
|
1896
|
-
virtual FileType GetFileType(FileHandle &handle);
|
|
1896
|
+
DUCKDB_API virtual FileType GetFileType(FileHandle &handle);
|
|
1897
1897
|
//! Truncate a file to a maximum size of new_size, new_size should be smaller than or equal to the current size of
|
|
1898
1898
|
//! the file
|
|
1899
|
-
virtual void Truncate(FileHandle &handle, int64_t new_size);
|
|
1899
|
+
DUCKDB_API virtual void Truncate(FileHandle &handle, int64_t new_size);
|
|
1900
1900
|
|
|
1901
1901
|
//! Check if a directory exists
|
|
1902
|
-
virtual bool DirectoryExists(const string &directory);
|
|
1902
|
+
DUCKDB_API virtual bool DirectoryExists(const string &directory);
|
|
1903
1903
|
//! Create a directory if it does not exist
|
|
1904
|
-
virtual void CreateDirectory(const string &directory);
|
|
1904
|
+
DUCKDB_API virtual void CreateDirectory(const string &directory);
|
|
1905
1905
|
//! Recursively remove a directory and all files in it
|
|
1906
|
-
virtual void RemoveDirectory(const string &directory);
|
|
1906
|
+
DUCKDB_API virtual void RemoveDirectory(const string &directory);
|
|
1907
1907
|
//! List files in a directory, invoking the callback method for each one with (filename, is_dir)
|
|
1908
|
-
virtual bool ListFiles(const string &directory, const std::function<void(string, bool)> &callback);
|
|
1908
|
+
DUCKDB_API virtual bool ListFiles(const string &directory, const std::function<void(string, bool)> &callback);
|
|
1909
1909
|
//! Move a file from source path to the target, StorageManager relies on this being an atomic action for ACID
|
|
1910
1910
|
//! properties
|
|
1911
|
-
virtual void MoveFile(const string &source, const string &target);
|
|
1911
|
+
DUCKDB_API virtual void MoveFile(const string &source, const string &target);
|
|
1912
1912
|
//! Check if a file exists
|
|
1913
|
-
virtual bool FileExists(const string &filename);
|
|
1913
|
+
DUCKDB_API virtual bool FileExists(const string &filename);
|
|
1914
1914
|
//! Remove a file from disk
|
|
1915
|
-
virtual void RemoveFile(const string &filename);
|
|
1915
|
+
DUCKDB_API virtual void RemoveFile(const string &filename);
|
|
1916
1916
|
//! Sync a file handle to disk
|
|
1917
|
-
virtual void FileSync(FileHandle &handle);
|
|
1917
|
+
DUCKDB_API virtual void FileSync(FileHandle &handle);
|
|
1918
1918
|
|
|
1919
1919
|
//! Sets the working directory
|
|
1920
|
-
static void SetWorkingDirectory(const string &path);
|
|
1920
|
+
DUCKDB_API static void SetWorkingDirectory(const string &path);
|
|
1921
1921
|
//! Gets the working directory
|
|
1922
|
-
static string GetWorkingDirectory();
|
|
1922
|
+
DUCKDB_API static string GetWorkingDirectory();
|
|
1923
1923
|
//! Gets the users home directory
|
|
1924
|
-
static string GetHomeDirectory();
|
|
1924
|
+
DUCKDB_API static string GetHomeDirectory();
|
|
1925
1925
|
//! Returns the system-available memory in bytes
|
|
1926
|
-
static idx_t GetAvailableMemory();
|
|
1926
|
+
DUCKDB_API static idx_t GetAvailableMemory();
|
|
1927
1927
|
//! Path separator for the current file system
|
|
1928
|
-
static string PathSeparator();
|
|
1928
|
+
DUCKDB_API static string PathSeparator();
|
|
1929
1929
|
//! Join two paths together
|
|
1930
|
-
static string JoinPath(const string &a, const string &path);
|
|
1930
|
+
DUCKDB_API static string JoinPath(const string &a, const string &path);
|
|
1931
1931
|
//! Convert separators in a path to the local separators (e.g. convert "/" into \\ on windows)
|
|
1932
|
-
static string ConvertSeparators(const string &path);
|
|
1932
|
+
DUCKDB_API static string ConvertSeparators(const string &path);
|
|
1933
1933
|
//! Extract the base name of a file (e.g. if the input is lib/example.dll the base name is example)
|
|
1934
|
-
static string ExtractBaseName(const string &path);
|
|
1934
|
+
DUCKDB_API static string ExtractBaseName(const string &path);
|
|
1935
1935
|
|
|
1936
1936
|
//! Runs a glob on the file system, returning a list of matching files
|
|
1937
|
-
virtual vector<string> Glob(const string &path);
|
|
1937
|
+
DUCKDB_API virtual vector<string> Glob(const string &path);
|
|
1938
1938
|
|
|
1939
1939
|
//! registers a sub-file system to handle certain file name prefixes, e.g. http:// etc.
|
|
1940
|
-
virtual void RegisterSubSystem(unique_ptr<FileSystem> sub_fs);
|
|
1941
|
-
virtual void RegisterSubSystem(FileCompressionType compression_type, unique_ptr<FileSystem> fs);
|
|
1940
|
+
DUCKDB_API virtual void RegisterSubSystem(unique_ptr<FileSystem> sub_fs);
|
|
1941
|
+
DUCKDB_API virtual void RegisterSubSystem(FileCompressionType compression_type, unique_ptr<FileSystem> fs);
|
|
1942
1942
|
|
|
1943
1943
|
//! Whether or not a sub-system can handle a specific file path
|
|
1944
|
-
virtual bool CanHandleFile(const string &fpath);
|
|
1944
|
+
DUCKDB_API virtual bool CanHandleFile(const string &fpath);
|
|
1945
1945
|
|
|
1946
1946
|
//! Set the file pointer of a file handle to a specified location. Reads and writes will happen from this location
|
|
1947
|
-
virtual void Seek(FileHandle &handle, idx_t location);
|
|
1947
|
+
DUCKDB_API virtual void Seek(FileHandle &handle, idx_t location);
|
|
1948
1948
|
//! Reset a file to the beginning (equivalent to Seek(handle, 0) for simple files)
|
|
1949
|
-
virtual void Reset(FileHandle &handle);
|
|
1950
|
-
virtual idx_t SeekPosition(FileHandle &handle);
|
|
1949
|
+
DUCKDB_API virtual void Reset(FileHandle &handle);
|
|
1950
|
+
DUCKDB_API virtual idx_t SeekPosition(FileHandle &handle);
|
|
1951
1951
|
|
|
1952
1952
|
//! Whether or not we can seek into the file
|
|
1953
|
-
virtual bool CanSeek();
|
|
1953
|
+
DUCKDB_API virtual bool CanSeek();
|
|
1954
1954
|
//! Whether or not the FS handles plain files on disk. This is relevant for certain optimizations, as random reads
|
|
1955
1955
|
//! in a file on-disk are much cheaper than e.g. random reads in a file over the network
|
|
1956
|
-
virtual bool OnDiskFile(FileHandle &handle);
|
|
1956
|
+
DUCKDB_API virtual bool OnDiskFile(FileHandle &handle);
|
|
1957
1957
|
|
|
1958
|
-
virtual unique_ptr<FileHandle> OpenCompressedFile(unique_ptr<FileHandle> handle, bool write);
|
|
1958
|
+
DUCKDB_API virtual unique_ptr<FileHandle> OpenCompressedFile(unique_ptr<FileHandle> handle, bool write);
|
|
1959
1959
|
|
|
1960
1960
|
//! Create a LocalFileSystem.
|
|
1961
|
-
static unique_ptr<FileSystem> CreateLocal();
|
|
1961
|
+
DUCKDB_API static unique_ptr<FileSystem> CreateLocal();
|
|
1962
1962
|
|
|
1963
1963
|
protected:
|
|
1964
1964
|
//! Return the name of the filesytem. Used for forming diagnosis messages.
|
|
1965
|
-
virtual std::string GetName() const = 0;
|
|
1965
|
+
DUCKDB_API virtual std::string GetName() const = 0;
|
|
1966
1966
|
};
|
|
1967
1967
|
|
|
1968
1968
|
} // namespace duckdb
|
|
@@ -2368,6 +2368,41 @@ public:
|
|
|
2368
2368
|
return true;
|
|
2369
2369
|
}
|
|
2370
2370
|
|
|
2371
|
+
idx_t CountValid(const idx_t count) const {
|
|
2372
|
+
if (AllValid() || count == 0) {
|
|
2373
|
+
return count;
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
idx_t valid = 0;
|
|
2377
|
+
const auto entry_count = EntryCount(count);
|
|
2378
|
+
for (idx_t entry_idx = 0; entry_idx < entry_count;) {
|
|
2379
|
+
auto entry = GetValidityEntry(entry_idx++);
|
|
2380
|
+
// Handle ragged end
|
|
2381
|
+
if (entry_idx == entry_count) {
|
|
2382
|
+
idx_t idx_in_entry;
|
|
2383
|
+
GetEntryIndex(count, entry_idx, idx_in_entry);
|
|
2384
|
+
for (idx_t i = 0; i < idx_in_entry; ++i) {
|
|
2385
|
+
valid += idx_t(RowIsValid(entry, i));
|
|
2386
|
+
}
|
|
2387
|
+
break;
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
// Handle all set
|
|
2391
|
+
if (AllValid(entry)) {
|
|
2392
|
+
valid += BITS_PER_VALUE;
|
|
2393
|
+
continue;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
// Count partial entry (Kernighan's algorithm)
|
|
2397
|
+
while (entry) {
|
|
2398
|
+
entry &= (entry - 1);
|
|
2399
|
+
++valid;
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
return valid;
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2371
2406
|
inline V *GetData() const {
|
|
2372
2407
|
return validity_mask;
|
|
2373
2408
|
}
|
|
@@ -2742,7 +2777,7 @@ public:
|
|
|
2742
2777
|
DUCKDB_API bool TryCastAs(const LogicalType &target_type, bool strict = false);
|
|
2743
2778
|
|
|
2744
2779
|
//! Serializes a Value to a stand-alone binary blob
|
|
2745
|
-
DUCKDB_API void Serialize(Serializer &serializer);
|
|
2780
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
2746
2781
|
//! Deserializes a Value from a blob
|
|
2747
2782
|
DUCKDB_API static Value Deserialize(Deserializer &source);
|
|
2748
2783
|
|
|
@@ -3288,6 +3323,21 @@ enum class VectorBufferType : uint8_t {
|
|
|
3288
3323
|
OPAQUE_BUFFER // opaque buffer, can be created for example by the parquet reader
|
|
3289
3324
|
};
|
|
3290
3325
|
|
|
3326
|
+
enum class VectorAuxiliaryDataType : uint8_t {
|
|
3327
|
+
ARROW_AUXILIARY // Holds Arrow Chunks that this vector depends on
|
|
3328
|
+
};
|
|
3329
|
+
|
|
3330
|
+
struct VectorAuxiliaryData {
|
|
3331
|
+
explicit VectorAuxiliaryData(VectorAuxiliaryDataType type_p)
|
|
3332
|
+
: type(type_p) {
|
|
3333
|
+
|
|
3334
|
+
};
|
|
3335
|
+
VectorAuxiliaryDataType type;
|
|
3336
|
+
|
|
3337
|
+
virtual ~VectorAuxiliaryData() {
|
|
3338
|
+
}
|
|
3339
|
+
};
|
|
3340
|
+
|
|
3291
3341
|
//! The VectorBuffer is a class used by the vector to hold its data
|
|
3292
3342
|
class VectorBuffer {
|
|
3293
3343
|
public:
|
|
@@ -3310,10 +3360,19 @@ public:
|
|
|
3310
3360
|
data_ptr_t GetData() {
|
|
3311
3361
|
return data.get();
|
|
3312
3362
|
}
|
|
3363
|
+
|
|
3313
3364
|
void SetData(unique_ptr<data_t[]> new_data) {
|
|
3314
3365
|
data = move(new_data);
|
|
3315
3366
|
}
|
|
3316
3367
|
|
|
3368
|
+
VectorAuxiliaryData *GetAuxiliaryData() {
|
|
3369
|
+
return aux_data.get();
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
void SetAuxiliaryData(unique_ptr<VectorAuxiliaryData> aux_data_p, VectorAuxiliaryDataType aux_type_p) {
|
|
3373
|
+
aux_data = move(aux_data_p);
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3317
3376
|
static buffer_ptr<VectorBuffer> CreateStandardVector(PhysicalType type, idx_t capacity = STANDARD_VECTOR_SIZE);
|
|
3318
3377
|
static buffer_ptr<VectorBuffer> CreateConstantVector(PhysicalType type);
|
|
3319
3378
|
static buffer_ptr<VectorBuffer> CreateConstantVector(const LogicalType &logical_type);
|
|
@@ -3324,8 +3383,13 @@ public:
|
|
|
3324
3383
|
return buffer_type;
|
|
3325
3384
|
}
|
|
3326
3385
|
|
|
3386
|
+
inline VectorAuxiliaryDataType GetAuxiliaryDataType() const {
|
|
3387
|
+
return aux_data->type;
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3327
3390
|
protected:
|
|
3328
3391
|
VectorBufferType buffer_type;
|
|
3392
|
+
unique_ptr<VectorAuxiliaryData> aux_data;
|
|
3329
3393
|
unique_ptr<data_t[]> data;
|
|
3330
3394
|
};
|
|
3331
3395
|
|
|
@@ -3811,6 +3875,141 @@ struct SequenceVector {
|
|
|
3811
3875
|
|
|
3812
3876
|
|
|
3813
3877
|
|
|
3878
|
+
//===----------------------------------------------------------------------===//
|
|
3879
|
+
// DuckDB
|
|
3880
|
+
//
|
|
3881
|
+
// duckdb/common/arrow_wrapper.hpp
|
|
3882
|
+
//
|
|
3883
|
+
//
|
|
3884
|
+
//===----------------------------------------------------------------------===//
|
|
3885
|
+
|
|
3886
|
+
|
|
3887
|
+
//===----------------------------------------------------------------------===//
|
|
3888
|
+
// DuckDB
|
|
3889
|
+
//
|
|
3890
|
+
// duckdb/common/arrow.hpp
|
|
3891
|
+
//
|
|
3892
|
+
//
|
|
3893
|
+
//===----------------------------------------------------------------------===//
|
|
3894
|
+
|
|
3895
|
+
#ifndef ARROW_FLAG_DICTIONARY_ORDERED
|
|
3896
|
+
|
|
3897
|
+
#include <stdint.h>
|
|
3898
|
+
|
|
3899
|
+
#ifdef __cplusplus
|
|
3900
|
+
extern "C" {
|
|
3901
|
+
#endif
|
|
3902
|
+
|
|
3903
|
+
#define ARROW_FLAG_DICTIONARY_ORDERED 1
|
|
3904
|
+
#define ARROW_FLAG_NULLABLE 2
|
|
3905
|
+
#define ARROW_FLAG_MAP_KEYS_SORTED 4
|
|
3906
|
+
|
|
3907
|
+
struct ArrowSchema {
|
|
3908
|
+
// Array type description
|
|
3909
|
+
const char *format;
|
|
3910
|
+
const char *name;
|
|
3911
|
+
const char *metadata;
|
|
3912
|
+
int64_t flags;
|
|
3913
|
+
int64_t n_children;
|
|
3914
|
+
struct ArrowSchema **children;
|
|
3915
|
+
struct ArrowSchema *dictionary;
|
|
3916
|
+
|
|
3917
|
+
// Release callback
|
|
3918
|
+
void (*release)(struct ArrowSchema *);
|
|
3919
|
+
// Opaque producer-specific data
|
|
3920
|
+
void *private_data;
|
|
3921
|
+
};
|
|
3922
|
+
|
|
3923
|
+
struct ArrowArray {
|
|
3924
|
+
// Array data description
|
|
3925
|
+
int64_t length;
|
|
3926
|
+
int64_t null_count;
|
|
3927
|
+
int64_t offset;
|
|
3928
|
+
int64_t n_buffers;
|
|
3929
|
+
int64_t n_children;
|
|
3930
|
+
const void **buffers;
|
|
3931
|
+
struct ArrowArray **children;
|
|
3932
|
+
struct ArrowArray *dictionary;
|
|
3933
|
+
|
|
3934
|
+
// Release callback
|
|
3935
|
+
void (*release)(struct ArrowArray *);
|
|
3936
|
+
// Opaque producer-specific data
|
|
3937
|
+
void *private_data;
|
|
3938
|
+
};
|
|
3939
|
+
|
|
3940
|
+
// EXPERIMENTAL
|
|
3941
|
+
struct ArrowArrayStream {
|
|
3942
|
+
// Callback to get the stream type
|
|
3943
|
+
// (will be the same for all arrays in the stream).
|
|
3944
|
+
// Return value: 0 if successful, an `errno`-compatible error code otherwise.
|
|
3945
|
+
int (*get_schema)(struct ArrowArrayStream *, struct ArrowSchema *out);
|
|
3946
|
+
// Callback to get the next array
|
|
3947
|
+
// (if no error and the array is released, the stream has ended)
|
|
3948
|
+
// Return value: 0 if successful, an `errno`-compatible error code otherwise.
|
|
3949
|
+
int (*get_next)(struct ArrowArrayStream *, struct ArrowArray *out);
|
|
3950
|
+
|
|
3951
|
+
// Callback to get optional detailed error information.
|
|
3952
|
+
// This must only be called if the last stream operation failed
|
|
3953
|
+
// with a non-0 return code. The returned pointer is only valid until
|
|
3954
|
+
// the next operation on this stream (including release).
|
|
3955
|
+
// If unavailable, NULL is returned.
|
|
3956
|
+
const char *(*get_last_error)(struct ArrowArrayStream *);
|
|
3957
|
+
|
|
3958
|
+
// Release callback: release the stream's own resources.
|
|
3959
|
+
// Note that arrays returned by `get_next` must be individually released.
|
|
3960
|
+
void (*release)(struct ArrowArrayStream *);
|
|
3961
|
+
// Opaque producer-specific data
|
|
3962
|
+
void *private_data;
|
|
3963
|
+
};
|
|
3964
|
+
|
|
3965
|
+
#ifdef __cplusplus
|
|
3966
|
+
}
|
|
3967
|
+
#endif
|
|
3968
|
+
|
|
3969
|
+
#endif
|
|
3970
|
+
|
|
3971
|
+
|
|
3972
|
+
|
|
3973
|
+
//! Here we have the internal duckdb classes that interact with Arrow's Internal Header (i.e., duckdb/commons/arrow.hpp)
|
|
3974
|
+
namespace duckdb {
|
|
3975
|
+
class ArrowSchemaWrapper {
|
|
3976
|
+
public:
|
|
3977
|
+
ArrowSchema arrow_schema;
|
|
3978
|
+
|
|
3979
|
+
ArrowSchemaWrapper() {
|
|
3980
|
+
arrow_schema.release = nullptr;
|
|
3981
|
+
}
|
|
3982
|
+
|
|
3983
|
+
~ArrowSchemaWrapper();
|
|
3984
|
+
};
|
|
3985
|
+
class ArrowArrayWrapper {
|
|
3986
|
+
public:
|
|
3987
|
+
ArrowArray arrow_array;
|
|
3988
|
+
ArrowArrayWrapper() {
|
|
3989
|
+
arrow_array.length = 0;
|
|
3990
|
+
arrow_array.release = nullptr;
|
|
3991
|
+
}
|
|
3992
|
+
~ArrowArrayWrapper();
|
|
3993
|
+
};
|
|
3994
|
+
|
|
3995
|
+
class ArrowArrayStreamWrapper {
|
|
3996
|
+
public:
|
|
3997
|
+
ArrowArrayStream arrow_array_stream;
|
|
3998
|
+
int64_t number_of_rows;
|
|
3999
|
+
void GetSchema(ArrowSchemaWrapper &schema);
|
|
4000
|
+
|
|
4001
|
+
shared_ptr<ArrowArrayWrapper> GetNextChunk();
|
|
4002
|
+
|
|
4003
|
+
const char *GetError();
|
|
4004
|
+
|
|
4005
|
+
~ArrowArrayStreamWrapper();
|
|
4006
|
+
ArrowArrayStreamWrapper() {
|
|
4007
|
+
arrow_array_stream.release = nullptr;
|
|
4008
|
+
}
|
|
4009
|
+
};
|
|
4010
|
+
} // namespace duckdb
|
|
4011
|
+
|
|
4012
|
+
|
|
3814
4013
|
struct ArrowArray;
|
|
3815
4014
|
|
|
3816
4015
|
namespace duckdb {
|
|
@@ -5258,27 +5457,20 @@ private:
|
|
|
5258
5457
|
|
|
5259
5458
|
|
|
5260
5459
|
|
|
5261
|
-
|
|
5262
5460
|
//===----------------------------------------------------------------------===//
|
|
5263
5461
|
// DuckDB
|
|
5264
5462
|
//
|
|
5265
|
-
// duckdb/common/
|
|
5463
|
+
// duckdb/common/named_parameter_map.hpp
|
|
5266
5464
|
//
|
|
5267
5465
|
//
|
|
5268
5466
|
//===----------------------------------------------------------------------===//
|
|
5269
5467
|
|
|
5270
5468
|
|
|
5271
5469
|
|
|
5272
|
-
#include <unordered_set>
|
|
5273
|
-
|
|
5274
|
-
namespace duckdb {
|
|
5275
|
-
using std::unordered_set;
|
|
5276
|
-
}
|
|
5277
|
-
|
|
5278
5470
|
//===----------------------------------------------------------------------===//
|
|
5279
5471
|
// DuckDB
|
|
5280
5472
|
//
|
|
5281
|
-
// duckdb/
|
|
5473
|
+
// duckdb/common/case_insensitive_map.hpp
|
|
5282
5474
|
//
|
|
5283
5475
|
//
|
|
5284
5476
|
//===----------------------------------------------------------------------===//
|
|
@@ -5286,32 +5478,27 @@ using std::unordered_set;
|
|
|
5286
5478
|
|
|
5287
5479
|
|
|
5288
5480
|
|
|
5289
|
-
|
|
5290
5481
|
//===----------------------------------------------------------------------===//
|
|
5291
5482
|
// DuckDB
|
|
5292
5483
|
//
|
|
5293
|
-
// duckdb/
|
|
5484
|
+
// duckdb/common/unordered_set.hpp
|
|
5294
5485
|
//
|
|
5295
5486
|
//
|
|
5296
5487
|
//===----------------------------------------------------------------------===//
|
|
5297
5488
|
|
|
5298
5489
|
|
|
5299
5490
|
|
|
5300
|
-
|
|
5301
|
-
// DuckDB
|
|
5302
|
-
//
|
|
5303
|
-
// duckdb/parser/base_expression.hpp
|
|
5304
|
-
//
|
|
5305
|
-
//
|
|
5306
|
-
//===----------------------------------------------------------------------===//
|
|
5307
|
-
|
|
5491
|
+
#include <unordered_set>
|
|
5308
5492
|
|
|
5493
|
+
namespace duckdb {
|
|
5494
|
+
using std::unordered_set;
|
|
5495
|
+
}
|
|
5309
5496
|
|
|
5310
5497
|
|
|
5311
5498
|
//===----------------------------------------------------------------------===//
|
|
5312
5499
|
// DuckDB
|
|
5313
5500
|
//
|
|
5314
|
-
// duckdb/common/
|
|
5501
|
+
// duckdb/common/string_util.hpp
|
|
5315
5502
|
//
|
|
5316
5503
|
//
|
|
5317
5504
|
//===----------------------------------------------------------------------===//
|
|
@@ -5320,33 +5507,230 @@ using std::unordered_set;
|
|
|
5320
5507
|
|
|
5321
5508
|
|
|
5322
5509
|
|
|
5510
|
+
|
|
5511
|
+
|
|
5323
5512
|
namespace duckdb {
|
|
5513
|
+
/**
|
|
5514
|
+
* String Utility Functions
|
|
5515
|
+
* Note that these are not the most efficient implementations (i.e., they copy
|
|
5516
|
+
* memory) and therefore they should only be used for debug messages and other
|
|
5517
|
+
* such things.
|
|
5518
|
+
*/
|
|
5519
|
+
class StringUtil {
|
|
5520
|
+
public:
|
|
5521
|
+
DUCKDB_API static bool CharacterIsSpace(char c) {
|
|
5522
|
+
return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r';
|
|
5523
|
+
}
|
|
5524
|
+
DUCKDB_API static bool CharacterIsNewline(char c) {
|
|
5525
|
+
return c == '\n' || c == '\r';
|
|
5526
|
+
}
|
|
5527
|
+
DUCKDB_API static bool CharacterIsDigit(char c) {
|
|
5528
|
+
return c >= '0' && c <= '9';
|
|
5529
|
+
}
|
|
5530
|
+
DUCKDB_API static char CharacterToLower(char c) {
|
|
5531
|
+
if (c >= 'A' && c <= 'Z') {
|
|
5532
|
+
return c - ('A' - 'a');
|
|
5533
|
+
}
|
|
5534
|
+
return c;
|
|
5535
|
+
}
|
|
5324
5536
|
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
//===--------------------------------------------------------------------===//
|
|
5328
|
-
enum class ExpressionType : uint8_t {
|
|
5329
|
-
INVALID = 0,
|
|
5537
|
+
//! Returns true if the needle string exists in the haystack
|
|
5538
|
+
DUCKDB_API static bool Contains(const string &haystack, const string &needle);
|
|
5330
5539
|
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
// logical not operator
|
|
5334
|
-
OPERATOR_NOT = 13,
|
|
5335
|
-
// is null operator
|
|
5336
|
-
OPERATOR_IS_NULL = 14,
|
|
5337
|
-
// is not null operator
|
|
5338
|
-
OPERATOR_IS_NOT_NULL = 15,
|
|
5540
|
+
//! Returns true if the target string starts with the given prefix
|
|
5541
|
+
DUCKDB_API static bool StartsWith(string str, string prefix);
|
|
5339
5542
|
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5543
|
+
//! Returns true if the target string <b>ends</b> with the given suffix.
|
|
5544
|
+
DUCKDB_API static bool EndsWith(const string &str, const string &suffix);
|
|
5545
|
+
|
|
5546
|
+
//! Repeat a string multiple times
|
|
5547
|
+
DUCKDB_API static string Repeat(const string &str, const idx_t n);
|
|
5548
|
+
|
|
5549
|
+
//! Split the input string based on newline char
|
|
5550
|
+
DUCKDB_API static vector<string> Split(const string &str, char delimiter);
|
|
5551
|
+
|
|
5552
|
+
//! Split the input string allong a quote. Note that any escaping is NOT supported.
|
|
5553
|
+
DUCKDB_API static vector<string> SplitWithQuote(const string &str, char delimiter = ',', char quote = '"');
|
|
5554
|
+
|
|
5555
|
+
//! Join multiple strings into one string. Components are concatenated by the given separator
|
|
5556
|
+
DUCKDB_API static string Join(const vector<string> &input, const string &separator);
|
|
5557
|
+
|
|
5558
|
+
//! Join multiple items of container with given size, transformed to string
|
|
5559
|
+
//! using function, into one string using the given separator
|
|
5560
|
+
template <typename C, typename S, typename Func>
|
|
5561
|
+
static string Join(const C &input, S count, const string &separator, Func f) {
|
|
5562
|
+
// The result
|
|
5563
|
+
std::string result;
|
|
5564
|
+
|
|
5565
|
+
// If the input isn't empty, append the first element. We do this so we
|
|
5566
|
+
// don't need to introduce an if into the loop.
|
|
5567
|
+
if (count > 0) {
|
|
5568
|
+
result += f(input[0]);
|
|
5569
|
+
}
|
|
5570
|
+
|
|
5571
|
+
// Append the remaining input components, after the first
|
|
5572
|
+
for (size_t i = 1; i < count; i++) {
|
|
5573
|
+
result += separator + f(input[i]);
|
|
5574
|
+
}
|
|
5575
|
+
|
|
5576
|
+
return result;
|
|
5577
|
+
}
|
|
5578
|
+
|
|
5579
|
+
//! Return a string that formats the give number of bytes
|
|
5580
|
+
DUCKDB_API static string BytesToHumanReadableString(idx_t bytes);
|
|
5581
|
+
|
|
5582
|
+
//! Convert a string to uppercase
|
|
5583
|
+
DUCKDB_API static string Upper(const string &str);
|
|
5584
|
+
|
|
5585
|
+
//! Convert a string to lowercase
|
|
5586
|
+
DUCKDB_API static string Lower(const string &str);
|
|
5587
|
+
|
|
5588
|
+
//! Format a string using printf semantics
|
|
5589
|
+
template <typename... Args>
|
|
5590
|
+
static string Format(const string fmt_str, Args... params) {
|
|
5591
|
+
return Exception::ConstructMessage(fmt_str, params...);
|
|
5592
|
+
}
|
|
5593
|
+
|
|
5594
|
+
//! Split the input string into a vector of strings based on the split string
|
|
5595
|
+
DUCKDB_API static vector<string> Split(const string &input, const string &split);
|
|
5596
|
+
|
|
5597
|
+
//! Remove the whitespace char in the left end of the string
|
|
5598
|
+
DUCKDB_API static void LTrim(string &str);
|
|
5599
|
+
//! Remove the whitespace char in the right end of the string
|
|
5600
|
+
DUCKDB_API static void RTrim(string &str);
|
|
5601
|
+
//! Remove the whitespace char in the left and right end of the string
|
|
5602
|
+
DUCKDB_API static void Trim(string &str);
|
|
5603
|
+
|
|
5604
|
+
DUCKDB_API static string Replace(string source, const string &from, const string &to);
|
|
5605
|
+
|
|
5606
|
+
//! Get the levenshtein distance from two strings
|
|
5607
|
+
DUCKDB_API static idx_t LevenshteinDistance(const string &s1, const string &s2);
|
|
5608
|
+
|
|
5609
|
+
//! Get the top-n strings (sorted by the given score distance) from a set of scores.
|
|
5610
|
+
//! At least one entry is returned (if there is one).
|
|
5611
|
+
//! Strings are only returned if they have a score less than the threshold.
|
|
5612
|
+
DUCKDB_API static vector<string> TopNStrings(vector<std::pair<string, idx_t>> scores, idx_t n = 5,
|
|
5613
|
+
idx_t threshold = 5);
|
|
5614
|
+
//! Computes the levenshtein distance of each string in strings, and compares it to target, then returns TopNStrings
|
|
5615
|
+
//! with the given params.
|
|
5616
|
+
DUCKDB_API static vector<string> TopNLevenshtein(const vector<string> &strings, const string &target, idx_t n = 5,
|
|
5617
|
+
idx_t threshold = 5);
|
|
5618
|
+
DUCKDB_API static string CandidatesMessage(const vector<string> &candidates,
|
|
5619
|
+
const string &candidate = "Candidate bindings");
|
|
5620
|
+
|
|
5621
|
+
//! Generate an error message in the form of "{message_prefix}: nearest_string, nearest_string2, ...
|
|
5622
|
+
//! Equivalent to calling TopNLevenshtein followed by CandidatesMessage
|
|
5623
|
+
DUCKDB_API static string CandidatesErrorMessage(const vector<string> &strings, const string &target,
|
|
5624
|
+
const string &message_prefix, idx_t n = 5);
|
|
5625
|
+
};
|
|
5626
|
+
|
|
5627
|
+
} // namespace duckdb
|
|
5628
|
+
|
|
5629
|
+
|
|
5630
|
+
namespace duckdb {
|
|
5631
|
+
|
|
5632
|
+
struct CaseInsensitiveStringHashFunction {
|
|
5633
|
+
uint64_t operator()(const string &str) const {
|
|
5634
|
+
std::hash<string> hasher;
|
|
5635
|
+
return hasher(StringUtil::Lower(str));
|
|
5636
|
+
}
|
|
5637
|
+
};
|
|
5638
|
+
|
|
5639
|
+
struct CaseInsensitiveStringEquality {
|
|
5640
|
+
bool operator()(const string &a, const string &b) const {
|
|
5641
|
+
return StringUtil::Lower(a) == StringUtil::Lower(b);
|
|
5642
|
+
}
|
|
5643
|
+
};
|
|
5644
|
+
|
|
5645
|
+
template <typename T>
|
|
5646
|
+
using case_insensitive_map_t =
|
|
5647
|
+
unordered_map<string, T, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality>;
|
|
5648
|
+
|
|
5649
|
+
using case_insensitive_set_t = unordered_set<string, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality>;
|
|
5650
|
+
|
|
5651
|
+
} // namespace duckdb
|
|
5652
|
+
|
|
5653
|
+
|
|
5654
|
+
namespace duckdb {
|
|
5655
|
+
|
|
5656
|
+
using named_parameter_type_map_t = case_insensitive_map_t<LogicalType>;
|
|
5657
|
+
using named_parameter_map_t = case_insensitive_map_t<Value>;
|
|
5658
|
+
|
|
5659
|
+
} // namespace duckdb
|
|
5660
|
+
|
|
5661
|
+
|
|
5662
|
+
//===----------------------------------------------------------------------===//
|
|
5663
|
+
// DuckDB
|
|
5664
|
+
//
|
|
5665
|
+
// duckdb/parser/column_definition.hpp
|
|
5666
|
+
//
|
|
5667
|
+
//
|
|
5668
|
+
//===----------------------------------------------------------------------===//
|
|
5669
|
+
|
|
5670
|
+
|
|
5671
|
+
|
|
5672
|
+
|
|
5673
|
+
|
|
5674
|
+
//===----------------------------------------------------------------------===//
|
|
5675
|
+
// DuckDB
|
|
5676
|
+
//
|
|
5677
|
+
// duckdb/parser/parsed_expression.hpp
|
|
5678
|
+
//
|
|
5679
|
+
//
|
|
5680
|
+
//===----------------------------------------------------------------------===//
|
|
5681
|
+
|
|
5682
|
+
|
|
5683
|
+
|
|
5684
|
+
//===----------------------------------------------------------------------===//
|
|
5685
|
+
// DuckDB
|
|
5686
|
+
//
|
|
5687
|
+
// duckdb/parser/base_expression.hpp
|
|
5688
|
+
//
|
|
5689
|
+
//
|
|
5690
|
+
//===----------------------------------------------------------------------===//
|
|
5691
|
+
|
|
5692
|
+
|
|
5693
|
+
|
|
5694
|
+
|
|
5695
|
+
//===----------------------------------------------------------------------===//
|
|
5696
|
+
// DuckDB
|
|
5697
|
+
//
|
|
5698
|
+
// duckdb/common/enums/expression_type.hpp
|
|
5699
|
+
//
|
|
5700
|
+
//
|
|
5701
|
+
//===----------------------------------------------------------------------===//
|
|
5702
|
+
|
|
5703
|
+
|
|
5704
|
+
|
|
5705
|
+
|
|
5706
|
+
|
|
5707
|
+
namespace duckdb {
|
|
5708
|
+
|
|
5709
|
+
//===--------------------------------------------------------------------===//
|
|
5710
|
+
// Predicate Expression Operation Types
|
|
5711
|
+
//===--------------------------------------------------------------------===//
|
|
5712
|
+
enum class ExpressionType : uint8_t {
|
|
5713
|
+
INVALID = 0,
|
|
5714
|
+
|
|
5715
|
+
// explicitly cast left as right (right is integer in ValueType enum)
|
|
5716
|
+
OPERATOR_CAST = 12,
|
|
5717
|
+
// logical not operator
|
|
5718
|
+
OPERATOR_NOT = 13,
|
|
5719
|
+
// is null operator
|
|
5720
|
+
OPERATOR_IS_NULL = 14,
|
|
5721
|
+
// is not null operator
|
|
5722
|
+
OPERATOR_IS_NOT_NULL = 15,
|
|
5723
|
+
|
|
5724
|
+
// -----------------------------
|
|
5725
|
+
// Comparison Operators
|
|
5726
|
+
// -----------------------------
|
|
5727
|
+
// equal operator between left and right
|
|
5728
|
+
COMPARE_EQUAL = 25,
|
|
5729
|
+
// compare initial boundary
|
|
5730
|
+
COMPARE_BOUNDARY_START = COMPARE_EQUAL,
|
|
5731
|
+
// inequal operator between left and right
|
|
5732
|
+
COMPARE_NOTEQUAL = 26,
|
|
5733
|
+
// less than operator between left and right
|
|
5350
5734
|
COMPARE_LESSTHAN = 27,
|
|
5351
5735
|
// greater than operator between left and right
|
|
5352
5736
|
COMPARE_GREATERTHAN = 28,
|
|
@@ -5598,6 +5982,8 @@ public:
|
|
|
5598
5982
|
namespace duckdb {
|
|
5599
5983
|
class Serializer;
|
|
5600
5984
|
class Deserializer;
|
|
5985
|
+
class FieldWriter;
|
|
5986
|
+
class FieldReader;
|
|
5601
5987
|
|
|
5602
5988
|
//! The ParsedExpression class is a base class that can represent any expression
|
|
5603
5989
|
//! part of a SQL statement.
|
|
@@ -5631,7 +6017,10 @@ public:
|
|
|
5631
6017
|
virtual unique_ptr<ParsedExpression> Copy() const = 0;
|
|
5632
6018
|
|
|
5633
6019
|
//! Serializes an Expression to a stand-alone binary blob
|
|
5634
|
-
|
|
6020
|
+
void Serialize(Serializer &serializer) const;
|
|
6021
|
+
//! Serializes an Expression to a stand-alone binary blob
|
|
6022
|
+
virtual void Serialize(FieldWriter &writer) const = 0;
|
|
6023
|
+
|
|
5635
6024
|
//! Deserializes a blob back into an Expression [CAN THROW:
|
|
5636
6025
|
//! SerializationException]
|
|
5637
6026
|
static unique_ptr<ParsedExpression> Deserialize(Deserializer &source);
|
|
@@ -5742,7 +6131,7 @@ struct TableFunctionData : public FunctionData {
|
|
|
5742
6131
|
|
|
5743
6132
|
struct FunctionParameters {
|
|
5744
6133
|
vector<Value> values;
|
|
5745
|
-
|
|
6134
|
+
named_parameter_map_t named_parameters;
|
|
5746
6135
|
};
|
|
5747
6136
|
|
|
5748
6137
|
//! Function is the base class used for any type of function (scalar, aggregate or simple function)
|
|
@@ -5762,7 +6151,7 @@ public:
|
|
|
5762
6151
|
const LogicalType &return_type);
|
|
5763
6152
|
//! Returns the formatted string name(arg1, arg2.., np1=a, np2=b, ...)
|
|
5764
6153
|
DUCKDB_API static string CallToString(const string &name, const vector<LogicalType> &arguments,
|
|
5765
|
-
const
|
|
6154
|
+
const named_parameter_type_map_t &named_parameters);
|
|
5766
6155
|
|
|
5767
6156
|
//! Bind a scalar function from the set of functions and input arguments. Returns the index of the chosen function,
|
|
5768
6157
|
//! returns DConstants::INVALID_INDEX and sets error if none could be found
|
|
@@ -5812,14 +6201,14 @@ public:
|
|
|
5812
6201
|
DUCKDB_API ~SimpleNamedParameterFunction() override;
|
|
5813
6202
|
|
|
5814
6203
|
//! The named parameters of the function
|
|
5815
|
-
|
|
6204
|
+
named_parameter_type_map_t named_parameters;
|
|
5816
6205
|
|
|
5817
6206
|
public:
|
|
5818
6207
|
DUCKDB_API string ToString() override;
|
|
5819
6208
|
DUCKDB_API bool HasNamedParameters();
|
|
5820
6209
|
|
|
5821
6210
|
DUCKDB_API void EvaluateInputParameters(vector<LogicalType> &arguments, vector<Value> ¶meters,
|
|
5822
|
-
|
|
6211
|
+
named_parameter_map_t &named_parameters,
|
|
5823
6212
|
vector<unique_ptr<ParsedExpression>> &children);
|
|
5824
6213
|
};
|
|
5825
6214
|
|
|
@@ -6511,6 +6900,8 @@ struct SelectionVector;
|
|
|
6511
6900
|
|
|
6512
6901
|
class Serializer;
|
|
6513
6902
|
class Deserializer;
|
|
6903
|
+
class FieldWriter;
|
|
6904
|
+
class FieldReader;
|
|
6514
6905
|
class Vector;
|
|
6515
6906
|
class ValidityStatistics;
|
|
6516
6907
|
|
|
@@ -6525,24 +6916,27 @@ public:
|
|
|
6525
6916
|
unique_ptr<BaseStatistics> validity_stats;
|
|
6526
6917
|
|
|
6527
6918
|
public:
|
|
6528
|
-
bool CanHaveNull();
|
|
6529
|
-
bool CanHaveNoNull();
|
|
6919
|
+
bool CanHaveNull() const;
|
|
6920
|
+
bool CanHaveNoNull() const;
|
|
6530
6921
|
|
|
6531
|
-
virtual bool IsConstant() {
|
|
6922
|
+
virtual bool IsConstant() const {
|
|
6532
6923
|
return false;
|
|
6533
6924
|
}
|
|
6534
6925
|
|
|
6535
6926
|
static unique_ptr<BaseStatistics> CreateEmpty(LogicalType type);
|
|
6536
6927
|
|
|
6537
6928
|
virtual void Merge(const BaseStatistics &other);
|
|
6538
|
-
|
|
6539
|
-
virtual
|
|
6929
|
+
|
|
6930
|
+
virtual unique_ptr<BaseStatistics> Copy() const;
|
|
6931
|
+
void Serialize(Serializer &serializer) const;
|
|
6932
|
+
virtual void Serialize(FieldWriter &writer) const;
|
|
6540
6933
|
static unique_ptr<BaseStatistics> Deserialize(Deserializer &source, LogicalType type);
|
|
6934
|
+
|
|
6541
6935
|
//! Verify that a vector does not violate the statistics
|
|
6542
|
-
virtual void Verify(Vector &vector, const SelectionVector &sel, idx_t count);
|
|
6543
|
-
void Verify(Vector &vector, idx_t count);
|
|
6936
|
+
virtual void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const;
|
|
6937
|
+
void Verify(Vector &vector, idx_t count) const;
|
|
6544
6938
|
|
|
6545
|
-
virtual string ToString();
|
|
6939
|
+
virtual string ToString() const;
|
|
6546
6940
|
};
|
|
6547
6941
|
|
|
6548
6942
|
} // namespace duckdb
|
|
@@ -7167,6 +7561,8 @@ enum class OrderByNullType : uint8_t { INVALID = 0, ORDER_DEFAULT = 1, NULLS_FIR
|
|
|
7167
7561
|
|
|
7168
7562
|
|
|
7169
7563
|
namespace duckdb {
|
|
7564
|
+
class FieldWriter;
|
|
7565
|
+
class FieldReader;
|
|
7170
7566
|
|
|
7171
7567
|
enum ResultModifierType : uint8_t {
|
|
7172
7568
|
LIMIT_MODIFIER = 1,
|
|
@@ -7190,9 +7586,11 @@ public:
|
|
|
7190
7586
|
virtual bool Equals(const ResultModifier *other) const;
|
|
7191
7587
|
|
|
7192
7588
|
//! Create a copy of this ResultModifier
|
|
7193
|
-
virtual unique_ptr<ResultModifier> Copy() = 0;
|
|
7589
|
+
virtual unique_ptr<ResultModifier> Copy() const = 0;
|
|
7194
7590
|
//! Serializes a ResultModifier to a stand-alone binary blob
|
|
7195
|
-
|
|
7591
|
+
void Serialize(Serializer &serializer) const;
|
|
7592
|
+
//! Serializes a ResultModifier to a stand-alone binary blob
|
|
7593
|
+
virtual void Serialize(FieldWriter &writer) const = 0;
|
|
7196
7594
|
//! Deserializes a blob back into a ResultModifier
|
|
7197
7595
|
static unique_ptr<ResultModifier> Deserialize(Deserializer &source);
|
|
7198
7596
|
};
|
|
@@ -7211,7 +7609,7 @@ struct OrderByNode {
|
|
|
7211
7609
|
unique_ptr<ParsedExpression> expression;
|
|
7212
7610
|
|
|
7213
7611
|
public:
|
|
7214
|
-
void Serialize(Serializer &serializer);
|
|
7612
|
+
void Serialize(Serializer &serializer) const;
|
|
7215
7613
|
string ToString() const;
|
|
7216
7614
|
static OrderByNode Deserialize(Deserializer &source);
|
|
7217
7615
|
};
|
|
@@ -7228,9 +7626,9 @@ public:
|
|
|
7228
7626
|
|
|
7229
7627
|
public:
|
|
7230
7628
|
bool Equals(const ResultModifier *other) const override;
|
|
7231
|
-
unique_ptr<ResultModifier> Copy() override;
|
|
7232
|
-
void Serialize(
|
|
7233
|
-
static unique_ptr<ResultModifier> Deserialize(
|
|
7629
|
+
unique_ptr<ResultModifier> Copy() const override;
|
|
7630
|
+
void Serialize(FieldWriter &writer) const override;
|
|
7631
|
+
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
|
7234
7632
|
};
|
|
7235
7633
|
|
|
7236
7634
|
class OrderModifier : public ResultModifier {
|
|
@@ -7243,9 +7641,9 @@ public:
|
|
|
7243
7641
|
|
|
7244
7642
|
public:
|
|
7245
7643
|
bool Equals(const ResultModifier *other) const override;
|
|
7246
|
-
unique_ptr<ResultModifier> Copy() override;
|
|
7247
|
-
void Serialize(
|
|
7248
|
-
static unique_ptr<ResultModifier> Deserialize(
|
|
7644
|
+
unique_ptr<ResultModifier> Copy() const override;
|
|
7645
|
+
void Serialize(FieldWriter &writer) const override;
|
|
7646
|
+
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
|
7249
7647
|
};
|
|
7250
7648
|
|
|
7251
7649
|
class DistinctModifier : public ResultModifier {
|
|
@@ -7258,9 +7656,9 @@ public:
|
|
|
7258
7656
|
|
|
7259
7657
|
public:
|
|
7260
7658
|
bool Equals(const ResultModifier *other) const override;
|
|
7261
|
-
unique_ptr<ResultModifier> Copy() override;
|
|
7262
|
-
void Serialize(
|
|
7263
|
-
static unique_ptr<ResultModifier> Deserialize(
|
|
7659
|
+
unique_ptr<ResultModifier> Copy() const override;
|
|
7660
|
+
void Serialize(FieldWriter &writer) const override;
|
|
7661
|
+
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
|
7264
7662
|
};
|
|
7265
7663
|
|
|
7266
7664
|
class LimitPercentModifier : public ResultModifier {
|
|
@@ -7275,9 +7673,9 @@ public:
|
|
|
7275
7673
|
|
|
7276
7674
|
public:
|
|
7277
7675
|
bool Equals(const ResultModifier *other) const override;
|
|
7278
|
-
unique_ptr<ResultModifier> Copy() override;
|
|
7279
|
-
void Serialize(
|
|
7280
|
-
static unique_ptr<ResultModifier> Deserialize(
|
|
7676
|
+
unique_ptr<ResultModifier> Copy() const override;
|
|
7677
|
+
void Serialize(FieldWriter &writer) const override;
|
|
7678
|
+
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
|
7281
7679
|
};
|
|
7282
7680
|
|
|
7283
7681
|
} // namespace duckdb
|
|
@@ -9638,8 +10036,6 @@ public:
|
|
|
9638
10036
|
|
|
9639
10037
|
|
|
9640
10038
|
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
10039
|
#include <functional>
|
|
9644
10040
|
|
|
9645
10041
|
namespace duckdb {
|
|
@@ -9659,7 +10055,7 @@ struct TableFilterCollection {
|
|
|
9659
10055
|
};
|
|
9660
10056
|
|
|
9661
10057
|
typedef unique_ptr<FunctionData> (*table_function_bind_t)(ClientContext &context, vector<Value> &inputs,
|
|
9662
|
-
|
|
10058
|
+
named_parameter_map_t &named_parameters,
|
|
9663
10059
|
vector<LogicalType> &input_table_types,
|
|
9664
10060
|
vector<string> &input_table_names,
|
|
9665
10061
|
vector<LogicalType> &return_types, vector<string> &names);
|
|
@@ -10462,6 +10858,9 @@ public:
|
|
|
10462
10858
|
DUCKDB_API shared_ptr<Relation> Join(const shared_ptr<Relation> &other, const string &condition,
|
|
10463
10859
|
JoinType type = JoinType::INNER);
|
|
10464
10860
|
|
|
10861
|
+
// CROSS PRODUCT operation
|
|
10862
|
+
DUCKDB_API shared_ptr<Relation> CrossProduct(const shared_ptr<Relation> &other);
|
|
10863
|
+
|
|
10465
10864
|
// SET operations
|
|
10466
10865
|
DUCKDB_API shared_ptr<Relation> Union(const shared_ptr<Relation> &other);
|
|
10467
10866
|
DUCKDB_API shared_ptr<Relation> Except(const shared_ptr<Relation> &other);
|
|
@@ -10499,7 +10898,7 @@ public:
|
|
|
10499
10898
|
//! Create a relation from calling a table in/out function on the input relation
|
|
10500
10899
|
DUCKDB_API shared_ptr<Relation> TableFunction(const std::string &fname, const vector<Value> &values);
|
|
10501
10900
|
DUCKDB_API shared_ptr<Relation> TableFunction(const std::string &fname, const vector<Value> &values,
|
|
10502
|
-
const
|
|
10901
|
+
const named_parameter_map_t &named_parameters);
|
|
10503
10902
|
|
|
10504
10903
|
public:
|
|
10505
10904
|
//! Whether or not the relation inherits column bindings from its child or not, only relevant for binding
|
|
@@ -10656,6 +11055,9 @@ public:
|
|
|
10656
11055
|
//! The query text that corresponds to this SQL statement
|
|
10657
11056
|
string query;
|
|
10658
11057
|
|
|
11058
|
+
protected:
|
|
11059
|
+
SQLStatement(const SQLStatement &other) = default;
|
|
11060
|
+
|
|
10659
11061
|
public:
|
|
10660
11062
|
//! Create a copy of this SelectStatement
|
|
10661
11063
|
virtual unique_ptr<SQLStatement> Copy() const = 0;
|
|
@@ -10670,6 +11072,7 @@ class ClientContext;
|
|
|
10670
11072
|
class DatabaseInstance;
|
|
10671
11073
|
class DuckDB;
|
|
10672
11074
|
class LogicalOperator;
|
|
11075
|
+
class SelectStatement;
|
|
10673
11076
|
|
|
10674
11077
|
typedef void (*warning_callback)(std::string);
|
|
10675
11078
|
|
|
@@ -10756,7 +11159,7 @@ public:
|
|
|
10756
11159
|
//! Returns a relation that calls a specified table function
|
|
10757
11160
|
DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname);
|
|
10758
11161
|
DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname, const vector<Value> &values,
|
|
10759
|
-
const
|
|
11162
|
+
const named_parameter_map_t &named_parameters);
|
|
10760
11163
|
DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname, const vector<Value> &values);
|
|
10761
11164
|
//! Returns a relation that produces values
|
|
10762
11165
|
DUCKDB_API shared_ptr<Relation> Values(const vector<vector<Value>> &values);
|
|
@@ -10769,7 +11172,10 @@ public:
|
|
|
10769
11172
|
DUCKDB_API shared_ptr<Relation> ReadCSV(const string &csv_file);
|
|
10770
11173
|
DUCKDB_API shared_ptr<Relation> ReadCSV(const string &csv_file, const vector<string> &columns);
|
|
10771
11174
|
//! Returns a relation from a query
|
|
10772
|
-
DUCKDB_API shared_ptr<Relation> RelationFromQuery(const string &query,
|
|
11175
|
+
DUCKDB_API shared_ptr<Relation> RelationFromQuery(const string &query, string alias = "queryrelation",
|
|
11176
|
+
const string &error = "Expected a single SELECT statement");
|
|
11177
|
+
DUCKDB_API shared_ptr<Relation> RelationFromQuery(unique_ptr<SelectStatement> select_stmt,
|
|
11178
|
+
string alias = "queryrelation");
|
|
10773
11179
|
|
|
10774
11180
|
DUCKDB_API void BeginTransaction();
|
|
10775
11181
|
DUCKDB_API void Commit();
|
|
@@ -10967,10 +11373,17 @@ private:
|
|
|
10967
11373
|
|
|
10968
11374
|
} // namespace duckdb
|
|
10969
11375
|
|
|
11376
|
+
|
|
11377
|
+
|
|
11378
|
+
|
|
11379
|
+
|
|
11380
|
+
|
|
11381
|
+
|
|
11382
|
+
|
|
10970
11383
|
//===----------------------------------------------------------------------===//
|
|
10971
11384
|
// DuckDB
|
|
10972
11385
|
//
|
|
10973
|
-
// duckdb/
|
|
11386
|
+
// duckdb/function/replacement_scan.hpp
|
|
10974
11387
|
//
|
|
10975
11388
|
//
|
|
10976
11389
|
//===----------------------------------------------------------------------===//
|
|
@@ -10979,222 +11392,48 @@ private:
|
|
|
10979
11392
|
|
|
10980
11393
|
|
|
10981
11394
|
|
|
11395
|
+
namespace duckdb {
|
|
11396
|
+
|
|
11397
|
+
class TableFunctionRef;
|
|
11398
|
+
|
|
11399
|
+
typedef unique_ptr<TableFunctionRef> (*replacement_scan_t)(const string &table_name, void *data);
|
|
11400
|
+
|
|
11401
|
+
//! Replacement table scans are automatically attempted when a table name cannot be found in the schema
|
|
11402
|
+
//! This allows you to do e.g. SELECT * FROM 'filename.csv', and automatically convert this into a CSV scan
|
|
11403
|
+
struct ReplacementScan {
|
|
11404
|
+
explicit ReplacementScan(replacement_scan_t function, void *data = nullptr) : function(function), data(data) {
|
|
11405
|
+
}
|
|
11406
|
+
|
|
11407
|
+
replacement_scan_t function;
|
|
11408
|
+
void *data;
|
|
11409
|
+
};
|
|
11410
|
+
|
|
11411
|
+
} // namespace duckdb
|
|
10982
11412
|
|
|
10983
11413
|
//===----------------------------------------------------------------------===//
|
|
10984
11414
|
// DuckDB
|
|
10985
11415
|
//
|
|
10986
|
-
// duckdb/common/
|
|
11416
|
+
// duckdb/common/set.hpp
|
|
10987
11417
|
//
|
|
10988
11418
|
//
|
|
10989
11419
|
//===----------------------------------------------------------------------===//
|
|
10990
11420
|
|
|
10991
11421
|
|
|
10992
|
-
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r';
|
|
11008
|
-
}
|
|
11009
|
-
DUCKDB_API static bool CharacterIsNewline(char c) {
|
|
11010
|
-
return c == '\n' || c == '\r';
|
|
11011
|
-
}
|
|
11012
|
-
DUCKDB_API static bool CharacterIsDigit(char c) {
|
|
11013
|
-
return c >= '0' && c <= '9';
|
|
11014
|
-
}
|
|
11015
|
-
DUCKDB_API static char CharacterToLower(char c) {
|
|
11016
|
-
if (c >= 'A' && c <= 'Z') {
|
|
11017
|
-
return c - ('A' - 'a');
|
|
11018
|
-
}
|
|
11019
|
-
return c;
|
|
11020
|
-
}
|
|
11021
|
-
|
|
11022
|
-
//! Returns true if the needle string exists in the haystack
|
|
11023
|
-
DUCKDB_API static bool Contains(const string &haystack, const string &needle);
|
|
11024
|
-
|
|
11025
|
-
//! Returns true if the target string starts with the given prefix
|
|
11026
|
-
DUCKDB_API static bool StartsWith(string str, string prefix);
|
|
11027
|
-
|
|
11028
|
-
//! Returns true if the target string <b>ends</b> with the given suffix.
|
|
11029
|
-
DUCKDB_API static bool EndsWith(const string &str, const string &suffix);
|
|
11030
|
-
|
|
11031
|
-
//! Repeat a string multiple times
|
|
11032
|
-
DUCKDB_API static string Repeat(const string &str, const idx_t n);
|
|
11033
|
-
|
|
11034
|
-
//! Split the input string based on newline char
|
|
11035
|
-
DUCKDB_API static vector<string> Split(const string &str, char delimiter);
|
|
11036
|
-
|
|
11037
|
-
//! Split the input string allong a quote. Note that any escaping is NOT supported.
|
|
11038
|
-
DUCKDB_API static vector<string> SplitWithQuote(const string &str, char delimiter = ',', char quote = '"');
|
|
11039
|
-
|
|
11040
|
-
//! Join multiple strings into one string. Components are concatenated by the given separator
|
|
11041
|
-
DUCKDB_API static string Join(const vector<string> &input, const string &separator);
|
|
11042
|
-
|
|
11043
|
-
//! Join multiple items of container with given size, transformed to string
|
|
11044
|
-
//! using function, into one string using the given separator
|
|
11045
|
-
template <typename C, typename S, typename Func>
|
|
11046
|
-
static string Join(const C &input, S count, const string &separator, Func f) {
|
|
11047
|
-
// The result
|
|
11048
|
-
std::string result;
|
|
11049
|
-
|
|
11050
|
-
// If the input isn't empty, append the first element. We do this so we
|
|
11051
|
-
// don't need to introduce an if into the loop.
|
|
11052
|
-
if (count > 0) {
|
|
11053
|
-
result += f(input[0]);
|
|
11054
|
-
}
|
|
11055
|
-
|
|
11056
|
-
// Append the remaining input components, after the first
|
|
11057
|
-
for (size_t i = 1; i < count; i++) {
|
|
11058
|
-
result += separator + f(input[i]);
|
|
11059
|
-
}
|
|
11060
|
-
|
|
11061
|
-
return result;
|
|
11062
|
-
}
|
|
11063
|
-
|
|
11064
|
-
//! Return a string that formats the give number of bytes
|
|
11065
|
-
DUCKDB_API static string BytesToHumanReadableString(idx_t bytes);
|
|
11066
|
-
|
|
11067
|
-
//! Convert a string to uppercase
|
|
11068
|
-
DUCKDB_API static string Upper(const string &str);
|
|
11069
|
-
|
|
11070
|
-
//! Convert a string to lowercase
|
|
11071
|
-
DUCKDB_API static string Lower(const string &str);
|
|
11072
|
-
|
|
11073
|
-
//! Format a string using printf semantics
|
|
11074
|
-
template <typename... Args>
|
|
11075
|
-
static string Format(const string fmt_str, Args... params) {
|
|
11076
|
-
return Exception::ConstructMessage(fmt_str, params...);
|
|
11077
|
-
}
|
|
11078
|
-
|
|
11079
|
-
//! Split the input string into a vector of strings based on the split string
|
|
11080
|
-
DUCKDB_API static vector<string> Split(const string &input, const string &split);
|
|
11081
|
-
|
|
11082
|
-
//! Remove the whitespace char in the left end of the string
|
|
11083
|
-
DUCKDB_API static void LTrim(string &str);
|
|
11084
|
-
//! Remove the whitespace char in the right end of the string
|
|
11085
|
-
DUCKDB_API static void RTrim(string &str);
|
|
11086
|
-
//! Remove the whitespace char in the left and right end of the string
|
|
11087
|
-
DUCKDB_API static void Trim(string &str);
|
|
11088
|
-
|
|
11089
|
-
DUCKDB_API static string Replace(string source, const string &from, const string &to);
|
|
11090
|
-
|
|
11091
|
-
//! Get the levenshtein distance from two strings
|
|
11092
|
-
DUCKDB_API static idx_t LevenshteinDistance(const string &s1, const string &s2);
|
|
11093
|
-
|
|
11094
|
-
//! Get the top-n strings (sorted by the given score distance) from a set of scores.
|
|
11095
|
-
//! At least one entry is returned (if there is one).
|
|
11096
|
-
//! Strings are only returned if they have a score less than the threshold.
|
|
11097
|
-
DUCKDB_API static vector<string> TopNStrings(vector<std::pair<string, idx_t>> scores, idx_t n = 5,
|
|
11098
|
-
idx_t threshold = 5);
|
|
11099
|
-
//! Computes the levenshtein distance of each string in strings, and compares it to target, then returns TopNStrings
|
|
11100
|
-
//! with the given params.
|
|
11101
|
-
DUCKDB_API static vector<string> TopNLevenshtein(const vector<string> &strings, const string &target, idx_t n = 5,
|
|
11102
|
-
idx_t threshold = 5);
|
|
11103
|
-
DUCKDB_API static string CandidatesMessage(const vector<string> &candidates,
|
|
11104
|
-
const string &candidate = "Candidate bindings");
|
|
11105
|
-
|
|
11106
|
-
//! Generate an error message in the form of "{message_prefix}: nearest_string, nearest_string2, ...
|
|
11107
|
-
//! Equivalent to calling TopNLevenshtein followed by CandidatesMessage
|
|
11108
|
-
DUCKDB_API static string CandidatesErrorMessage(const vector<string> &strings, const string &target,
|
|
11109
|
-
const string &message_prefix, idx_t n = 5);
|
|
11110
|
-
};
|
|
11111
|
-
|
|
11112
|
-
} // namespace duckdb
|
|
11113
|
-
|
|
11114
|
-
|
|
11115
|
-
namespace duckdb {
|
|
11116
|
-
|
|
11117
|
-
struct CaseInsensitiveStringHashFunction {
|
|
11118
|
-
uint64_t operator()(const string &str) const {
|
|
11119
|
-
std::hash<string> hasher;
|
|
11120
|
-
return hasher(StringUtil::Lower(str));
|
|
11121
|
-
}
|
|
11122
|
-
};
|
|
11123
|
-
|
|
11124
|
-
struct CaseInsensitiveStringEquality {
|
|
11125
|
-
bool operator()(const string &a, const string &b) const {
|
|
11126
|
-
return StringUtil::Lower(a) == StringUtil::Lower(b);
|
|
11127
|
-
}
|
|
11128
|
-
};
|
|
11129
|
-
|
|
11130
|
-
template <typename T>
|
|
11131
|
-
using case_insensitive_map_t =
|
|
11132
|
-
unordered_map<string, T, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality>;
|
|
11133
|
-
|
|
11134
|
-
using case_insensitive_set_t = unordered_set<string, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality>;
|
|
11135
|
-
|
|
11136
|
-
} // namespace duckdb
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
//===----------------------------------------------------------------------===//
|
|
11145
|
-
// DuckDB
|
|
11146
|
-
//
|
|
11147
|
-
// duckdb/function/replacement_scan.hpp
|
|
11148
|
-
//
|
|
11149
|
-
//
|
|
11150
|
-
//===----------------------------------------------------------------------===//
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
namespace duckdb {
|
|
11157
|
-
|
|
11158
|
-
class TableFunctionRef;
|
|
11159
|
-
|
|
11160
|
-
typedef unique_ptr<TableFunctionRef> (*replacement_scan_t)(const string &table_name, void *data);
|
|
11161
|
-
|
|
11162
|
-
//! Replacement table scans are automatically attempted when a table name cannot be found in the schema
|
|
11163
|
-
//! This allows you to do e.g. SELECT * FROM 'filename.csv', and automatically convert this into a CSV scan
|
|
11164
|
-
struct ReplacementScan {
|
|
11165
|
-
explicit ReplacementScan(replacement_scan_t function, void *data = nullptr) : function(function), data(data) {
|
|
11166
|
-
}
|
|
11167
|
-
|
|
11168
|
-
replacement_scan_t function;
|
|
11169
|
-
void *data;
|
|
11170
|
-
};
|
|
11171
|
-
|
|
11172
|
-
} // namespace duckdb
|
|
11173
|
-
|
|
11174
|
-
//===----------------------------------------------------------------------===//
|
|
11175
|
-
// DuckDB
|
|
11176
|
-
//
|
|
11177
|
-
// duckdb/common/set.hpp
|
|
11178
|
-
//
|
|
11179
|
-
//
|
|
11180
|
-
//===----------------------------------------------------------------------===//
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
#include <set>
|
|
11185
|
-
|
|
11186
|
-
namespace duckdb {
|
|
11187
|
-
using std::set;
|
|
11188
|
-
}
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
//===----------------------------------------------------------------------===//
|
|
11192
|
-
// DuckDB
|
|
11193
|
-
//
|
|
11194
|
-
// duckdb/common/enums/optimizer_type.hpp
|
|
11195
|
-
//
|
|
11196
|
-
//
|
|
11197
|
-
//===----------------------------------------------------------------------===//
|
|
11422
|
+
|
|
11423
|
+
#include <set>
|
|
11424
|
+
|
|
11425
|
+
namespace duckdb {
|
|
11426
|
+
using std::set;
|
|
11427
|
+
}
|
|
11428
|
+
|
|
11429
|
+
|
|
11430
|
+
//===----------------------------------------------------------------------===//
|
|
11431
|
+
// DuckDB
|
|
11432
|
+
//
|
|
11433
|
+
// duckdb/common/enums/optimizer_type.hpp
|
|
11434
|
+
//
|
|
11435
|
+
//
|
|
11436
|
+
//===----------------------------------------------------------------------===//
|
|
11198
11437
|
|
|
11199
11438
|
|
|
11200
11439
|
|
|
@@ -11455,17 +11694,17 @@ public:
|
|
|
11455
11694
|
DBConfig config;
|
|
11456
11695
|
|
|
11457
11696
|
public:
|
|
11458
|
-
StorageManager &GetStorageManager();
|
|
11459
|
-
Catalog &GetCatalog();
|
|
11460
|
-
FileSystem &GetFileSystem();
|
|
11461
|
-
TransactionManager &GetTransactionManager();
|
|
11462
|
-
TaskScheduler &GetScheduler();
|
|
11463
|
-
ObjectCache &GetObjectCache();
|
|
11464
|
-
ConnectionManager &GetConnectionManager();
|
|
11697
|
+
DUCKDB_API StorageManager &GetStorageManager();
|
|
11698
|
+
DUCKDB_API Catalog &GetCatalog();
|
|
11699
|
+
DUCKDB_API FileSystem &GetFileSystem();
|
|
11700
|
+
DUCKDB_API TransactionManager &GetTransactionManager();
|
|
11701
|
+
DUCKDB_API TaskScheduler &GetScheduler();
|
|
11702
|
+
DUCKDB_API ObjectCache &GetObjectCache();
|
|
11703
|
+
DUCKDB_API ConnectionManager &GetConnectionManager();
|
|
11465
11704
|
|
|
11466
11705
|
idx_t NumberOfThreads();
|
|
11467
11706
|
|
|
11468
|
-
static DatabaseInstance &GetDatabase(ClientContext &context);
|
|
11707
|
+
DUCKDB_API static DatabaseInstance &GetDatabase(ClientContext &context);
|
|
11469
11708
|
|
|
11470
11709
|
private:
|
|
11471
11710
|
void Initialize(const char *path, DBConfig *config);
|
|
@@ -12775,7 +13014,9 @@ public:
|
|
|
12775
13014
|
//! contains January 4 of that year.
|
|
12776
13015
|
//! In the ISO week-numbering system, it is possible for early-January dates
|
|
12777
13016
|
//! to be part of the 52nd or 53rd week of the previous year.
|
|
13017
|
+
DUCKDB_API static void ExtractISOYearWeek(date_t date, int32_t &year, int32_t &week);
|
|
12778
13018
|
DUCKDB_API static int32_t ExtractISOWeekNumber(date_t date);
|
|
13019
|
+
DUCKDB_API static int32_t ExtractISOYearNumber(date_t date);
|
|
12779
13020
|
//! Extract the week number as Python handles it.
|
|
12780
13021
|
//! Either Monday or Sunday is the first day of the week,
|
|
12781
13022
|
//! and any date before the first Monday/Sunday returns week 0
|
|
@@ -12797,112 +13038,29 @@ private:
|
|
|
12797
13038
|
//===----------------------------------------------------------------------===//
|
|
12798
13039
|
// DuckDB
|
|
12799
13040
|
//
|
|
12800
|
-
// duckdb/common/
|
|
13041
|
+
// duckdb/common/types/blob.hpp
|
|
12801
13042
|
//
|
|
12802
13043
|
//
|
|
12803
13044
|
//===----------------------------------------------------------------------===//
|
|
12804
13045
|
|
|
12805
|
-
#ifndef ARROW_FLAG_DICTIONARY_ORDERED
|
|
12806
|
-
|
|
12807
|
-
#include <stdint.h>
|
|
12808
13046
|
|
|
12809
|
-
#ifdef __cplusplus
|
|
12810
|
-
extern "C" {
|
|
12811
|
-
#endif
|
|
12812
13047
|
|
|
12813
|
-
#define ARROW_FLAG_DICTIONARY_ORDERED 1
|
|
12814
|
-
#define ARROW_FLAG_NULLABLE 2
|
|
12815
|
-
#define ARROW_FLAG_MAP_KEYS_SORTED 4
|
|
12816
13048
|
|
|
12817
|
-
struct ArrowSchema {
|
|
12818
|
-
// Array type description
|
|
12819
|
-
const char *format;
|
|
12820
|
-
const char *name;
|
|
12821
|
-
const char *metadata;
|
|
12822
|
-
int64_t flags;
|
|
12823
|
-
int64_t n_children;
|
|
12824
|
-
struct ArrowSchema **children;
|
|
12825
|
-
struct ArrowSchema *dictionary;
|
|
12826
13049
|
|
|
12827
|
-
// Release callback
|
|
12828
|
-
void (*release)(struct ArrowSchema *);
|
|
12829
|
-
// Opaque producer-specific data
|
|
12830
|
-
void *private_data;
|
|
12831
|
-
};
|
|
12832
13050
|
|
|
12833
|
-
|
|
12834
|
-
// Array data description
|
|
12835
|
-
int64_t length;
|
|
12836
|
-
int64_t null_count;
|
|
12837
|
-
int64_t offset;
|
|
12838
|
-
int64_t n_buffers;
|
|
12839
|
-
int64_t n_children;
|
|
12840
|
-
const void **buffers;
|
|
12841
|
-
struct ArrowArray **children;
|
|
12842
|
-
struct ArrowArray *dictionary;
|
|
13051
|
+
namespace duckdb {
|
|
12843
13052
|
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
|
|
12855
|
-
int (*get_schema)(struct ArrowArrayStream *, struct ArrowSchema *out);
|
|
12856
|
-
// Callback to get the next array
|
|
12857
|
-
// (if no error and the array is released, the stream has ended)
|
|
12858
|
-
// Return value: 0 if successful, an `errno`-compatible error code otherwise.
|
|
12859
|
-
int (*get_next)(struct ArrowArrayStream *, struct ArrowArray *out);
|
|
12860
|
-
|
|
12861
|
-
// Callback to get optional detailed error information.
|
|
12862
|
-
// This must only be called if the last stream operation failed
|
|
12863
|
-
// with a non-0 return code. The returned pointer is only valid until
|
|
12864
|
-
// the next operation on this stream (including release).
|
|
12865
|
-
// If unavailable, NULL is returned.
|
|
12866
|
-
const char *(*get_last_error)(struct ArrowArrayStream *);
|
|
12867
|
-
|
|
12868
|
-
// Release callback: release the stream's own resources.
|
|
12869
|
-
// Note that arrays returned by `get_next` must be individually released.
|
|
12870
|
-
void (*release)(struct ArrowArrayStream *);
|
|
12871
|
-
// Opaque producer-specific data
|
|
12872
|
-
void *private_data;
|
|
12873
|
-
};
|
|
12874
|
-
|
|
12875
|
-
#ifdef __cplusplus
|
|
12876
|
-
}
|
|
12877
|
-
#endif
|
|
12878
|
-
|
|
12879
|
-
#endif
|
|
12880
|
-
//===----------------------------------------------------------------------===//
|
|
12881
|
-
// DuckDB
|
|
12882
|
-
//
|
|
12883
|
-
// duckdb/common/types/blob.hpp
|
|
12884
|
-
//
|
|
12885
|
-
//
|
|
12886
|
-
//===----------------------------------------------------------------------===//
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
namespace duckdb {
|
|
12894
|
-
|
|
12895
|
-
//! The Blob class is a static class that holds helper functions for the Blob type.
|
|
12896
|
-
class Blob {
|
|
12897
|
-
public:
|
|
12898
|
-
// map of integer -> hex value
|
|
12899
|
-
static constexpr const char *HEX_TABLE = "0123456789ABCDEF";
|
|
12900
|
-
// reverse map of byte -> integer value, or -1 for invalid hex values
|
|
12901
|
-
static const int HEX_MAP[256];
|
|
12902
|
-
//! map of index -> base64 character
|
|
12903
|
-
static constexpr const char *BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
12904
|
-
//! padding character used in base64 encoding
|
|
12905
|
-
static constexpr const char BASE64_PADDING = '=';
|
|
13053
|
+
//! The Blob class is a static class that holds helper functions for the Blob type.
|
|
13054
|
+
class Blob {
|
|
13055
|
+
public:
|
|
13056
|
+
// map of integer -> hex value
|
|
13057
|
+
static constexpr const char *HEX_TABLE = "0123456789ABCDEF";
|
|
13058
|
+
// reverse map of byte -> integer value, or -1 for invalid hex values
|
|
13059
|
+
static const int HEX_MAP[256];
|
|
13060
|
+
//! map of index -> base64 character
|
|
13061
|
+
static constexpr const char *BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
13062
|
+
//! padding character used in base64 encoding
|
|
13063
|
+
static constexpr const char BASE64_PADDING = '=';
|
|
12906
13064
|
|
|
12907
13065
|
public:
|
|
12908
13066
|
//! Returns the string size of a blob -> string conversion
|
|
@@ -13480,6 +13638,8 @@ namespace duckdb {
|
|
|
13480
13638
|
|
|
13481
13639
|
class Serializer;
|
|
13482
13640
|
class Deserializer;
|
|
13641
|
+
class FieldWriter;
|
|
13642
|
+
class FieldReader;
|
|
13483
13643
|
|
|
13484
13644
|
//===--------------------------------------------------------------------===//
|
|
13485
13645
|
// Constraint Types
|
|
@@ -13502,13 +13662,14 @@ public:
|
|
|
13502
13662
|
|
|
13503
13663
|
public:
|
|
13504
13664
|
DUCKDB_API virtual string ToString() const = 0;
|
|
13505
|
-
DUCKDB_API void Print();
|
|
13665
|
+
DUCKDB_API void Print() const;
|
|
13506
13666
|
|
|
13507
|
-
DUCKDB_API virtual unique_ptr<Constraint> Copy() = 0;
|
|
13667
|
+
DUCKDB_API virtual unique_ptr<Constraint> Copy() const = 0;
|
|
13508
13668
|
//! Serializes a Constraint to a stand-alone binary blob
|
|
13509
|
-
DUCKDB_API
|
|
13510
|
-
//!
|
|
13511
|
-
|
|
13669
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
13670
|
+
//! Serializes a Constraint to a stand-alone binary blob
|
|
13671
|
+
DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
|
|
13672
|
+
//! Deserializes a blob back into a Constraint
|
|
13512
13673
|
DUCKDB_API static unique_ptr<Constraint> Deserialize(Deserializer &source);
|
|
13513
13674
|
};
|
|
13514
13675
|
} // namespace duckdb
|
|
@@ -13779,10 +13940,8 @@ enum class AlterType : uint8_t {
|
|
|
13779
13940
|
};
|
|
13780
13941
|
|
|
13781
13942
|
struct AlterInfo : public ParseInfo {
|
|
13782
|
-
AlterInfo(AlterType type, string schema, string name)
|
|
13783
|
-
|
|
13784
|
-
~AlterInfo() override {
|
|
13785
|
-
}
|
|
13943
|
+
AlterInfo(AlterType type, string schema, string name);
|
|
13944
|
+
~AlterInfo() override;
|
|
13786
13945
|
|
|
13787
13946
|
AlterType type;
|
|
13788
13947
|
//! Schema name to alter
|
|
@@ -13791,9 +13950,10 @@ struct AlterInfo : public ParseInfo {
|
|
|
13791
13950
|
string name;
|
|
13792
13951
|
|
|
13793
13952
|
public:
|
|
13794
|
-
virtual CatalogType GetCatalogType() = 0;
|
|
13953
|
+
virtual CatalogType GetCatalogType() const = 0;
|
|
13795
13954
|
virtual unique_ptr<AlterInfo> Copy() const = 0;
|
|
13796
|
-
|
|
13955
|
+
void Serialize(Serializer &serializer) const;
|
|
13956
|
+
virtual void Serialize(FieldWriter &writer) const = 0;
|
|
13797
13957
|
static unique_ptr<AlterInfo> Deserialize(Deserializer &source);
|
|
13798
13958
|
};
|
|
13799
13959
|
|
|
@@ -13802,10 +13962,7 @@ public:
|
|
|
13802
13962
|
//===--------------------------------------------------------------------===//
|
|
13803
13963
|
struct ChangeOwnershipInfo : public AlterInfo {
|
|
13804
13964
|
ChangeOwnershipInfo(CatalogType entry_catalog_type, string entry_schema, string entry_name, string owner_schema,
|
|
13805
|
-
string owner_name)
|
|
13806
|
-
: AlterInfo(AlterType::CHANGE_OWNERSHIP, entry_schema, entry_name), entry_catalog_type(entry_catalog_type),
|
|
13807
|
-
owner_schema(owner_schema), owner_name(owner_name) {
|
|
13808
|
-
}
|
|
13965
|
+
string owner_name);
|
|
13809
13966
|
|
|
13810
13967
|
// Catalog type refers to the entry type, since this struct is usually built from an
|
|
13811
13968
|
// ALTER <TYPE> <schema>.<name> OWNED BY <owner_schema>.<owner_name> statement
|
|
@@ -13816,8 +13973,9 @@ struct ChangeOwnershipInfo : public AlterInfo {
|
|
|
13816
13973
|
string owner_name;
|
|
13817
13974
|
|
|
13818
13975
|
public:
|
|
13819
|
-
CatalogType GetCatalogType() override;
|
|
13976
|
+
CatalogType GetCatalogType() const override;
|
|
13820
13977
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13978
|
+
void Serialize(FieldWriter &writer) const override;
|
|
13821
13979
|
};
|
|
13822
13980
|
|
|
13823
13981
|
//===--------------------------------------------------------------------===//
|
|
@@ -13834,32 +13992,24 @@ enum class AlterTableType : uint8_t {
|
|
|
13834
13992
|
};
|
|
13835
13993
|
|
|
13836
13994
|
struct AlterTableInfo : public AlterInfo {
|
|
13837
|
-
AlterTableInfo(AlterTableType type, string schema, string table)
|
|
13838
|
-
|
|
13839
|
-
}
|
|
13840
|
-
~AlterTableInfo() override {
|
|
13841
|
-
}
|
|
13995
|
+
AlterTableInfo(AlterTableType type, string schema, string table);
|
|
13996
|
+
~AlterTableInfo() override;
|
|
13842
13997
|
|
|
13843
13998
|
AlterTableType alter_table_type;
|
|
13844
13999
|
|
|
13845
14000
|
public:
|
|
13846
|
-
CatalogType GetCatalogType() override
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
static unique_ptr<AlterInfo> Deserialize(Deserializer &source);
|
|
14001
|
+
CatalogType GetCatalogType() const override;
|
|
14002
|
+
void Serialize(FieldWriter &writer) const override;
|
|
14003
|
+
virtual void SerializeAlterTable(FieldWriter &writer) const = 0;
|
|
14004
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
|
|
13851
14005
|
};
|
|
13852
14006
|
|
|
13853
14007
|
//===--------------------------------------------------------------------===//
|
|
13854
14008
|
// RenameColumnInfo
|
|
13855
14009
|
//===--------------------------------------------------------------------===//
|
|
13856
14010
|
struct RenameColumnInfo : public AlterTableInfo {
|
|
13857
|
-
RenameColumnInfo(string schema, string table, string old_name_p, string new_name_p)
|
|
13858
|
-
|
|
13859
|
-
new_name(move(new_name_p)) {
|
|
13860
|
-
}
|
|
13861
|
-
~RenameColumnInfo() override {
|
|
13862
|
-
}
|
|
14011
|
+
RenameColumnInfo(string schema, string table, string old_name_p, string new_name_p);
|
|
14012
|
+
~RenameColumnInfo() override;
|
|
13863
14013
|
|
|
13864
14014
|
//! Column old name
|
|
13865
14015
|
string old_name;
|
|
@@ -13868,58 +14018,48 @@ struct RenameColumnInfo : public AlterTableInfo {
|
|
|
13868
14018
|
|
|
13869
14019
|
public:
|
|
13870
14020
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13871
|
-
void
|
|
13872
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14021
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14022
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13873
14023
|
};
|
|
13874
14024
|
|
|
13875
14025
|
//===--------------------------------------------------------------------===//
|
|
13876
14026
|
// RenameTableInfo
|
|
13877
14027
|
//===--------------------------------------------------------------------===//
|
|
13878
14028
|
struct RenameTableInfo : public AlterTableInfo {
|
|
13879
|
-
RenameTableInfo(string schema, string table, string new_name)
|
|
13880
|
-
|
|
13881
|
-
}
|
|
13882
|
-
~RenameTableInfo() override {
|
|
13883
|
-
}
|
|
14029
|
+
RenameTableInfo(string schema, string table, string new_name);
|
|
14030
|
+
~RenameTableInfo() override;
|
|
13884
14031
|
|
|
13885
14032
|
//! Relation new name
|
|
13886
14033
|
string new_table_name;
|
|
13887
14034
|
|
|
13888
14035
|
public:
|
|
13889
14036
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13890
|
-
void
|
|
13891
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14037
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14038
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13892
14039
|
};
|
|
13893
14040
|
|
|
13894
14041
|
//===--------------------------------------------------------------------===//
|
|
13895
14042
|
// AddColumnInfo
|
|
13896
14043
|
//===--------------------------------------------------------------------===//
|
|
13897
14044
|
struct AddColumnInfo : public AlterTableInfo {
|
|
13898
|
-
AddColumnInfo(string schema, string table, ColumnDefinition new_column)
|
|
13899
|
-
|
|
13900
|
-
}
|
|
13901
|
-
~AddColumnInfo() override {
|
|
13902
|
-
}
|
|
14045
|
+
AddColumnInfo(string schema, string table, ColumnDefinition new_column);
|
|
14046
|
+
~AddColumnInfo() override;
|
|
13903
14047
|
|
|
13904
14048
|
//! New column
|
|
13905
14049
|
ColumnDefinition new_column;
|
|
13906
14050
|
|
|
13907
14051
|
public:
|
|
13908
14052
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13909
|
-
void
|
|
13910
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14053
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14054
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13911
14055
|
};
|
|
13912
14056
|
|
|
13913
14057
|
//===--------------------------------------------------------------------===//
|
|
13914
14058
|
// RemoveColumnInfo
|
|
13915
14059
|
//===--------------------------------------------------------------------===//
|
|
13916
14060
|
struct RemoveColumnInfo : public AlterTableInfo {
|
|
13917
|
-
RemoveColumnInfo(string schema, string table, string removed_column, bool if_exists)
|
|
13918
|
-
|
|
13919
|
-
if_exists(if_exists) {
|
|
13920
|
-
}
|
|
13921
|
-
~RemoveColumnInfo() override {
|
|
13922
|
-
}
|
|
14061
|
+
RemoveColumnInfo(string schema, string table, string removed_column, bool if_exists);
|
|
14062
|
+
~RemoveColumnInfo() override;
|
|
13923
14063
|
|
|
13924
14064
|
//! The column to remove
|
|
13925
14065
|
string removed_column;
|
|
@@ -13928,8 +14068,8 @@ struct RemoveColumnInfo : public AlterTableInfo {
|
|
|
13928
14068
|
|
|
13929
14069
|
public:
|
|
13930
14070
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13931
|
-
void
|
|
13932
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14071
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14072
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13933
14073
|
};
|
|
13934
14074
|
|
|
13935
14075
|
//===--------------------------------------------------------------------===//
|
|
@@ -13937,12 +14077,8 @@ public:
|
|
|
13937
14077
|
//===--------------------------------------------------------------------===//
|
|
13938
14078
|
struct ChangeColumnTypeInfo : public AlterTableInfo {
|
|
13939
14079
|
ChangeColumnTypeInfo(string schema, string table, string column_name, LogicalType target_type,
|
|
13940
|
-
unique_ptr<ParsedExpression> expression)
|
|
13941
|
-
|
|
13942
|
-
target_type(move(target_type)), expression(move(expression)) {
|
|
13943
|
-
}
|
|
13944
|
-
~ChangeColumnTypeInfo() override {
|
|
13945
|
-
}
|
|
14080
|
+
unique_ptr<ParsedExpression> expression);
|
|
14081
|
+
~ChangeColumnTypeInfo() override;
|
|
13946
14082
|
|
|
13947
14083
|
//! The column name to alter
|
|
13948
14084
|
string column_name;
|
|
@@ -13953,20 +14089,16 @@ struct ChangeColumnTypeInfo : public AlterTableInfo {
|
|
|
13953
14089
|
|
|
13954
14090
|
public:
|
|
13955
14091
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13956
|
-
void
|
|
13957
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14092
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14093
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13958
14094
|
};
|
|
13959
14095
|
|
|
13960
14096
|
//===--------------------------------------------------------------------===//
|
|
13961
14097
|
// SetDefaultInfo
|
|
13962
14098
|
//===--------------------------------------------------------------------===//
|
|
13963
14099
|
struct SetDefaultInfo : public AlterTableInfo {
|
|
13964
|
-
SetDefaultInfo(string schema, string table, string column_name, unique_ptr<ParsedExpression> new_default)
|
|
13965
|
-
|
|
13966
|
-
expression(move(new_default)) {
|
|
13967
|
-
}
|
|
13968
|
-
~SetDefaultInfo() override {
|
|
13969
|
-
}
|
|
14100
|
+
SetDefaultInfo(string schema, string table, string column_name, unique_ptr<ParsedExpression> new_default);
|
|
14101
|
+
~SetDefaultInfo() override;
|
|
13970
14102
|
|
|
13971
14103
|
//! The column name to alter
|
|
13972
14104
|
string column_name;
|
|
@@ -13975,8 +14107,8 @@ struct SetDefaultInfo : public AlterTableInfo {
|
|
|
13975
14107
|
|
|
13976
14108
|
public:
|
|
13977
14109
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13978
|
-
void
|
|
13979
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14110
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14111
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13980
14112
|
};
|
|
13981
14113
|
|
|
13982
14114
|
//===--------------------------------------------------------------------===//
|
|
@@ -13985,39 +14117,32 @@ public:
|
|
|
13985
14117
|
enum class AlterViewType : uint8_t { INVALID = 0, RENAME_VIEW = 1 };
|
|
13986
14118
|
|
|
13987
14119
|
struct AlterViewInfo : public AlterInfo {
|
|
13988
|
-
AlterViewInfo(AlterViewType type, string schema, string view)
|
|
13989
|
-
|
|
13990
|
-
}
|
|
13991
|
-
~AlterViewInfo() override {
|
|
13992
|
-
}
|
|
14120
|
+
AlterViewInfo(AlterViewType type, string schema, string view);
|
|
14121
|
+
~AlterViewInfo() override;
|
|
13993
14122
|
|
|
13994
14123
|
AlterViewType alter_view_type;
|
|
13995
14124
|
|
|
13996
14125
|
public:
|
|
13997
|
-
CatalogType GetCatalogType() override
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
static unique_ptr<AlterInfo> Deserialize(Deserializer &source);
|
|
14126
|
+
CatalogType GetCatalogType() const override;
|
|
14127
|
+
void Serialize(FieldWriter &writer) const override;
|
|
14128
|
+
virtual void SerializeAlterView(FieldWriter &writer) const = 0;
|
|
14129
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
|
|
14002
14130
|
};
|
|
14003
14131
|
|
|
14004
14132
|
//===--------------------------------------------------------------------===//
|
|
14005
14133
|
// RenameViewInfo
|
|
14006
14134
|
//===--------------------------------------------------------------------===//
|
|
14007
14135
|
struct RenameViewInfo : public AlterViewInfo {
|
|
14008
|
-
RenameViewInfo(string schema, string view, string new_name)
|
|
14009
|
-
|
|
14010
|
-
}
|
|
14011
|
-
~RenameViewInfo() override {
|
|
14012
|
-
}
|
|
14136
|
+
RenameViewInfo(string schema, string view, string new_name);
|
|
14137
|
+
~RenameViewInfo() override;
|
|
14013
14138
|
|
|
14014
14139
|
//! Relation new name
|
|
14015
14140
|
string new_view_name;
|
|
14016
14141
|
|
|
14017
14142
|
public:
|
|
14018
14143
|
unique_ptr<AlterInfo> Copy() const override;
|
|
14019
|
-
void
|
|
14020
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14144
|
+
void SerializeAlterView(FieldWriter &writer) const override;
|
|
14145
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
14021
14146
|
};
|
|
14022
14147
|
|
|
14023
14148
|
} // namespace duckdb
|
|
@@ -15103,8 +15228,8 @@ public:
|
|
|
15103
15228
|
|
|
15104
15229
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
15105
15230
|
|
|
15106
|
-
void Serialize(
|
|
15107
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
15231
|
+
void Serialize(FieldWriter &writer) const override;
|
|
15232
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
15108
15233
|
};
|
|
15109
15234
|
} // namespace duckdb
|
|
15110
15235
|
|
|
@@ -15338,6 +15463,10 @@ public:
|
|
|
15338
15463
|
unique_ptr<ParsedExpression> Copy() const override {
|
|
15339
15464
|
throw SerializationException("Cannot copy or serialize bound expression");
|
|
15340
15465
|
}
|
|
15466
|
+
|
|
15467
|
+
void Serialize(FieldWriter &writer) const override {
|
|
15468
|
+
throw SerializationException("Cannot copy or serialize bound expression");
|
|
15469
|
+
}
|
|
15341
15470
|
};
|
|
15342
15471
|
|
|
15343
15472
|
} // namespace duckdb
|
|
@@ -15782,7 +15911,7 @@ public:
|
|
|
15782
15911
|
SchemaCatalogEntry *BindCreateFunctionInfo(CreateInfo &info);
|
|
15783
15912
|
|
|
15784
15913
|
//! Check usage, and cast named parameters to their types
|
|
15785
|
-
static void BindNamedParameters(
|
|
15914
|
+
static void BindNamedParameters(named_parameter_type_map_t &types, named_parameter_map_t &values,
|
|
15786
15915
|
QueryErrorContext &error_context, string &func_name);
|
|
15787
15916
|
|
|
15788
15917
|
unique_ptr<BoundTableRef> Bind(TableRef &ref);
|
|
@@ -15798,6 +15927,9 @@ public:
|
|
|
15798
15927
|
|
|
15799
15928
|
bool CTEIsAlreadyBound(CommonTableExpressionInfo *cte);
|
|
15800
15929
|
|
|
15930
|
+
//! Add the view to the set of currently bound views - used for detecting recursive view definitions
|
|
15931
|
+
void AddBoundView(ViewCatalogEntry *view);
|
|
15932
|
+
|
|
15801
15933
|
void PushExpressionBinder(ExpressionBinder *binder);
|
|
15802
15934
|
void PopExpressionBinder();
|
|
15803
15935
|
void SetActiveBinder(ExpressionBinder *binder);
|
|
@@ -15859,6 +15991,8 @@ private:
|
|
|
15859
15991
|
BindingMode mode = BindingMode::STANDARD_BINDING;
|
|
15860
15992
|
//! Table names extracted for BindingMode::EXTRACT_NAMES
|
|
15861
15993
|
unordered_set<string> table_names;
|
|
15994
|
+
//! The set of bound views
|
|
15995
|
+
unordered_set<ViewCatalogEntry *> bound_views;
|
|
15862
15996
|
|
|
15863
15997
|
private:
|
|
15864
15998
|
//! Bind the default values of the columns of a table
|
|
@@ -15909,7 +16043,7 @@ private:
|
|
|
15909
16043
|
unique_ptr<BoundTableRef> Bind(ExpressionListRef &ref);
|
|
15910
16044
|
|
|
15911
16045
|
bool BindFunctionParameters(vector<unique_ptr<ParsedExpression>> &expressions, vector<LogicalType> &arguments,
|
|
15912
|
-
vector<Value> ¶meters,
|
|
16046
|
+
vector<Value> ¶meters, named_parameter_map_t &named_parameters,
|
|
15913
16047
|
unique_ptr<BoundSubqueryRef> &subquery, string &error);
|
|
15914
16048
|
|
|
15915
16049
|
unique_ptr<LogicalOperator> CreatePlan(BoundBaseTableRef &ref);
|
|
@@ -16117,9 +16251,11 @@ public:
|
|
|
16117
16251
|
virtual unique_ptr<TableRef> Copy() = 0;
|
|
16118
16252
|
|
|
16119
16253
|
//! Serializes a TableRef to a stand-alone binary blob
|
|
16120
|
-
|
|
16254
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
16255
|
+
//! Serializes a TableRef to a stand-alone binary blob
|
|
16256
|
+
DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
|
|
16121
16257
|
//! Deserializes a blob back into a TableRef
|
|
16122
|
-
static unique_ptr<TableRef> Deserialize(Deserializer &source);
|
|
16258
|
+
DUCKDB_API static unique_ptr<TableRef> Deserialize(Deserializer &source);
|
|
16123
16259
|
|
|
16124
16260
|
//! Copy the properties of this table ref to the target
|
|
16125
16261
|
void CopyProperties(TableRef &target) const;
|
|
@@ -16140,11 +16276,14 @@ public:
|
|
|
16140
16276
|
//! The main query node
|
|
16141
16277
|
unique_ptr<QueryNode> node;
|
|
16142
16278
|
|
|
16279
|
+
protected:
|
|
16280
|
+
SelectStatement(const SelectStatement &other);
|
|
16281
|
+
|
|
16143
16282
|
public:
|
|
16144
16283
|
//! Create a copy of this SelectStatement
|
|
16145
16284
|
unique_ptr<SQLStatement> Copy() const override;
|
|
16146
16285
|
//! Serializes a SelectStatement to a stand-alone binary blob
|
|
16147
|
-
void Serialize(Serializer &serializer);
|
|
16286
|
+
void Serialize(Serializer &serializer) const;
|
|
16148
16287
|
//! Deserializes a blob back into a SelectStatement, returns nullptr if
|
|
16149
16288
|
//! deserialization is not possible
|
|
16150
16289
|
static unique_ptr<SelectStatement> Deserialize(Deserializer &source);
|
|
@@ -16195,12 +16334,13 @@ public:
|
|
|
16195
16334
|
virtual bool Equals(const QueryNode *other) const;
|
|
16196
16335
|
|
|
16197
16336
|
//! Create a copy of this QueryNode
|
|
16198
|
-
virtual unique_ptr<QueryNode> Copy() = 0;
|
|
16337
|
+
virtual unique_ptr<QueryNode> Copy() const = 0;
|
|
16199
16338
|
//! Serializes a QueryNode to a stand-alone binary blob
|
|
16200
|
-
|
|
16201
|
-
//!
|
|
16202
|
-
|
|
16203
|
-
|
|
16339
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
16340
|
+
//! Serializes a QueryNode to a stand-alone binary blob
|
|
16341
|
+
DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
|
|
16342
|
+
//! Deserializes a blob back into a QueryNode
|
|
16343
|
+
DUCKDB_API static unique_ptr<QueryNode> Deserialize(Deserializer &source);
|
|
16204
16344
|
|
|
16205
16345
|
protected:
|
|
16206
16346
|
//! Copy base QueryNode properties from another expression to this one,
|
|
@@ -16395,8 +16535,8 @@ public:
|
|
|
16395
16535
|
|
|
16396
16536
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
16397
16537
|
|
|
16398
|
-
void Serialize(
|
|
16399
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
16538
|
+
void Serialize(FieldWriter &writer) const override;
|
|
16539
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
16400
16540
|
};
|
|
16401
16541
|
} // namespace duckdb
|
|
16402
16542
|
|
|
@@ -17250,6 +17390,10 @@ struct ClientConfig {
|
|
|
17250
17390
|
//! The wait time before showing the progress bar
|
|
17251
17391
|
int wait_time = 2000;
|
|
17252
17392
|
|
|
17393
|
+
//! Preserve identifier case while parsing.
|
|
17394
|
+
//! If false, all unquoted identifiers are lower-cased (e.g. "MyTable" -> "mytable").
|
|
17395
|
+
bool preserve_identifier_case = true;
|
|
17396
|
+
|
|
17253
17397
|
// Whether or not aggressive query verification is enabled
|
|
17254
17398
|
bool query_verification_enabled = false;
|
|
17255
17399
|
//! Enable the running of optimizers
|
|
@@ -17294,6 +17438,7 @@ class ClientContextLock;
|
|
|
17294
17438
|
struct CreateScalarFunctionInfo;
|
|
17295
17439
|
class ScalarFunctionCatalogEntry;
|
|
17296
17440
|
struct ActiveQueryContext;
|
|
17441
|
+
struct ParserOptions;
|
|
17297
17442
|
|
|
17298
17443
|
//! The ClientContext holds information relevant to the current client session
|
|
17299
17444
|
//! during execution
|
|
@@ -17411,6 +17556,9 @@ public:
|
|
|
17411
17556
|
//! Equivalent to CURRENT_SETTING(key) SQL function.
|
|
17412
17557
|
DUCKDB_API bool TryGetCurrentSetting(const std::string &key, Value &result);
|
|
17413
17558
|
|
|
17559
|
+
//! Returns the parser options for this client context
|
|
17560
|
+
DUCKDB_API ParserOptions GetParserOptions();
|
|
17561
|
+
|
|
17414
17562
|
DUCKDB_API unique_ptr<DataChunk> Fetch(ClientContextLock &lock, StreamQueryResult &result);
|
|
17415
17563
|
|
|
17416
17564
|
//! Whether or not the given result object (streaming query result or pending query result) is active
|
|
@@ -18544,12 +18692,12 @@ public:
|
|
|
18544
18692
|
public:
|
|
18545
18693
|
DUCKDB_API string ToString() const override;
|
|
18546
18694
|
|
|
18547
|
-
DUCKDB_API unique_ptr<Constraint> Copy() override;
|
|
18695
|
+
DUCKDB_API unique_ptr<Constraint> Copy() const override;
|
|
18548
18696
|
|
|
18549
18697
|
//! Serialize to a stand-alone binary blob
|
|
18550
|
-
DUCKDB_API void Serialize(
|
|
18698
|
+
DUCKDB_API void Serialize(FieldWriter &writer) const override;
|
|
18551
18699
|
//! Deserializes a NotNullConstraint
|
|
18552
|
-
DUCKDB_API static unique_ptr<Constraint> Deserialize(
|
|
18700
|
+
DUCKDB_API static unique_ptr<Constraint> Deserialize(FieldReader &source);
|
|
18553
18701
|
};
|
|
18554
18702
|
|
|
18555
18703
|
} // namespace duckdb
|
|
@@ -19728,7 +19876,7 @@ struct PragmaInfo : public ParseInfo {
|
|
|
19728
19876
|
//! Parameter list (if any)
|
|
19729
19877
|
vector<Value> parameters;
|
|
19730
19878
|
//! Named parameter list (if any)
|
|
19731
|
-
|
|
19879
|
+
named_parameter_map_t named_parameters;
|
|
19732
19880
|
|
|
19733
19881
|
public:
|
|
19734
19882
|
unique_ptr<PragmaInfo> Copy() const {
|
|
@@ -19779,7 +19927,7 @@ public:
|
|
|
19779
19927
|
|
|
19780
19928
|
pragma_query_t query;
|
|
19781
19929
|
pragma_function_t function;
|
|
19782
|
-
|
|
19930
|
+
named_parameter_type_map_t named_parameters;
|
|
19783
19931
|
|
|
19784
19932
|
private:
|
|
19785
19933
|
PragmaFunction(string name, PragmaType pragma_type, pragma_query_t query, pragma_function_t function,
|
|
@@ -19848,12 +19996,16 @@ struct PGList;
|
|
|
19848
19996
|
|
|
19849
19997
|
namespace duckdb {
|
|
19850
19998
|
|
|
19999
|
+
struct ParserOptions {
|
|
20000
|
+
bool preserve_identifier_case = true;
|
|
20001
|
+
};
|
|
20002
|
+
|
|
19851
20003
|
//! The parser is responsible for parsing the query and converting it into a set
|
|
19852
20004
|
//! of parsed statements. The parsed statements can then be converted into a
|
|
19853
20005
|
//! plan and executed.
|
|
19854
20006
|
class Parser {
|
|
19855
20007
|
public:
|
|
19856
|
-
Parser();
|
|
20008
|
+
Parser(ParserOptions options = ParserOptions());
|
|
19857
20009
|
|
|
19858
20010
|
//! The parsed SQL statements from an invocation to ParseQuery.
|
|
19859
20011
|
vector<unique_ptr<SQLStatement>> statements;
|
|
@@ -19874,16 +20026,22 @@ public:
|
|
|
19874
20026
|
static vector<ParserKeyword> KeywordList();
|
|
19875
20027
|
|
|
19876
20028
|
//! Parses a list of expressions (i.e. the list found in a SELECT clause)
|
|
19877
|
-
static vector<unique_ptr<ParsedExpression>> ParseExpressionList(const string &select_list
|
|
20029
|
+
static vector<unique_ptr<ParsedExpression>> ParseExpressionList(const string &select_list,
|
|
20030
|
+
ParserOptions options = ParserOptions());
|
|
19878
20031
|
//! Parses a list as found in an ORDER BY expression (i.e. including optional ASCENDING/DESCENDING modifiers)
|
|
19879
|
-
static vector<OrderByNode> ParseOrderList(const string &select_list);
|
|
20032
|
+
static vector<OrderByNode> ParseOrderList(const string &select_list, ParserOptions options = ParserOptions());
|
|
19880
20033
|
//! Parses an update list (i.e. the list found in the SET clause of an UPDATE statement)
|
|
19881
20034
|
static void ParseUpdateList(const string &update_list, vector<string> &update_columns,
|
|
19882
|
-
vector<unique_ptr<ParsedExpression>> &expressions
|
|
20035
|
+
vector<unique_ptr<ParsedExpression>> &expressions,
|
|
20036
|
+
ParserOptions options = ParserOptions());
|
|
19883
20037
|
//! Parses a VALUES list (i.e. the list of expressions after a VALUES clause)
|
|
19884
|
-
static vector<vector<unique_ptr<ParsedExpression>>> ParseValuesList(const string &value_list
|
|
20038
|
+
static vector<vector<unique_ptr<ParsedExpression>>> ParseValuesList(const string &value_list,
|
|
20039
|
+
ParserOptions options = ParserOptions());
|
|
19885
20040
|
//! Parses a column list (i.e. as found in a CREATE TABLE statement)
|
|
19886
|
-
static vector<ColumnDefinition> ParseColumnList(const string &column_list);
|
|
20041
|
+
static vector<ColumnDefinition> ParseColumnList(const string &column_list, ParserOptions options = ParserOptions());
|
|
20042
|
+
|
|
20043
|
+
private:
|
|
20044
|
+
ParserOptions options;
|
|
19887
20045
|
};
|
|
19888
20046
|
} // namespace duckdb
|
|
19889
20047
|
//===----------------------------------------------------------------------===//
|
|
@@ -20093,17 +20251,17 @@ public:
|
|
|
20093
20251
|
public:
|
|
20094
20252
|
void Merge(const BaseStatistics &other) override;
|
|
20095
20253
|
|
|
20096
|
-
bool IsConstant() override;
|
|
20254
|
+
bool IsConstant() const override;
|
|
20097
20255
|
|
|
20098
|
-
unique_ptr<BaseStatistics> Copy() override;
|
|
20099
|
-
void Serialize(
|
|
20100
|
-
static unique_ptr<BaseStatistics> Deserialize(
|
|
20101
|
-
void Verify(Vector &vector, const SelectionVector &sel, idx_t count) override;
|
|
20256
|
+
unique_ptr<BaseStatistics> Copy() const override;
|
|
20257
|
+
void Serialize(FieldWriter &writer) const override;
|
|
20258
|
+
static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader);
|
|
20259
|
+
void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
|
|
20102
20260
|
|
|
20103
20261
|
static unique_ptr<BaseStatistics> Combine(const unique_ptr<BaseStatistics> &lstats,
|
|
20104
20262
|
const unique_ptr<BaseStatistics> &rstats);
|
|
20105
20263
|
|
|
20106
|
-
string ToString() override;
|
|
20264
|
+
string ToString() const override;
|
|
20107
20265
|
};
|
|
20108
20266
|
|
|
20109
20267
|
} // namespace duckdb
|
|
@@ -20133,14 +20291,14 @@ public:
|
|
|
20133
20291
|
void Update(const string_t &value);
|
|
20134
20292
|
void Merge(const BaseStatistics &other) override;
|
|
20135
20293
|
|
|
20136
|
-
unique_ptr<BaseStatistics> Copy() override;
|
|
20137
|
-
void Serialize(
|
|
20138
|
-
static unique_ptr<BaseStatistics> Deserialize(
|
|
20139
|
-
void Verify(Vector &vector, const SelectionVector &sel, idx_t count) override;
|
|
20294
|
+
unique_ptr<BaseStatistics> Copy() const override;
|
|
20295
|
+
void Serialize(FieldWriter &writer) const override;
|
|
20296
|
+
static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader, LogicalType type);
|
|
20297
|
+
void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
|
|
20140
20298
|
|
|
20141
|
-
FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const string &value);
|
|
20299
|
+
FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const string &value) const;
|
|
20142
20300
|
|
|
20143
|
-
string ToString() override;
|
|
20301
|
+
string ToString() const override;
|
|
20144
20302
|
};
|
|
20145
20303
|
|
|
20146
20304
|
} // namespace duckdb
|
|
@@ -20221,20 +20379,20 @@ public:
|
|
|
20221
20379
|
public:
|
|
20222
20380
|
void Merge(const BaseStatistics &other) override;
|
|
20223
20381
|
|
|
20224
|
-
bool IsConstant() override;
|
|
20382
|
+
bool IsConstant() const override;
|
|
20225
20383
|
|
|
20226
|
-
FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant);
|
|
20384
|
+
FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant) const;
|
|
20227
20385
|
|
|
20228
|
-
unique_ptr<BaseStatistics> Copy() override;
|
|
20229
|
-
void Serialize(
|
|
20230
|
-
static unique_ptr<BaseStatistics> Deserialize(
|
|
20231
|
-
void Verify(Vector &vector, const SelectionVector &sel, idx_t count) override;
|
|
20386
|
+
unique_ptr<BaseStatistics> Copy() const override;
|
|
20387
|
+
void Serialize(FieldWriter &writer) const override;
|
|
20388
|
+
static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader, LogicalType type);
|
|
20389
|
+
void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
|
|
20232
20390
|
|
|
20233
|
-
string ToString() override;
|
|
20391
|
+
string ToString() const override;
|
|
20234
20392
|
|
|
20235
20393
|
private:
|
|
20236
20394
|
template <class T>
|
|
20237
|
-
void TemplatedVerify(Vector &vector, const SelectionVector &sel, idx_t count);
|
|
20395
|
+
void TemplatedVerify(Vector &vector, const SelectionVector &sel, idx_t count) const;
|
|
20238
20396
|
|
|
20239
20397
|
public:
|
|
20240
20398
|
template <class T>
|
|
@@ -20444,7 +20602,7 @@ struct StrfTimeFormat : public StrTimeFormat {
|
|
|
20444
20602
|
void FormatString(date_t date, int32_t data[7], char *target);
|
|
20445
20603
|
void FormatString(date_t date, dtime_t time, char *target);
|
|
20446
20604
|
|
|
20447
|
-
static string Format(timestamp_t timestamp, const string &format);
|
|
20605
|
+
DUCKDB_API static string Format(timestamp_t timestamp, const string &format);
|
|
20448
20606
|
|
|
20449
20607
|
protected:
|
|
20450
20608
|
//! The variable-length specifiers. To determine total string size, these need to be checked.
|
|
@@ -20478,9 +20636,14 @@ public:
|
|
|
20478
20636
|
timestamp_t ToTimestamp();
|
|
20479
20637
|
string FormatError(string_t input, const string &format_specifier);
|
|
20480
20638
|
};
|
|
20639
|
+
|
|
20640
|
+
public:
|
|
20481
20641
|
//! The full format specifier, for error messages
|
|
20482
20642
|
string format_specifier;
|
|
20483
20643
|
|
|
20644
|
+
public:
|
|
20645
|
+
DUCKDB_API static ParseResult Parse(const string &format, const string &text);
|
|
20646
|
+
|
|
20484
20647
|
bool Parse(string_t str, ParseResult &result);
|
|
20485
20648
|
|
|
20486
20649
|
bool TryParseDate(string_t str, date_t &result, string &error_message);
|
|
@@ -20583,6 +20746,9 @@ struct BufferedCSVReaderOptions {
|
|
|
20583
20746
|
idx_t buffer_size = STANDARD_VECTOR_SIZE * 100;
|
|
20584
20747
|
//! Consider all columns to be of type varchar
|
|
20585
20748
|
bool all_varchar = false;
|
|
20749
|
+
//! Maximum CSV line size: specified because if we reach this amount, we likely have wrong delimiters (default: 2MB)
|
|
20750
|
+
idx_t maximum_line_size = 2097152;
|
|
20751
|
+
|
|
20586
20752
|
//! The date format to use (if any is specified)
|
|
20587
20753
|
std::map<LogicalTypeId, StrpTimeFormat> date_format = {{LogicalTypeId::DATE, {}}, {LogicalTypeId::TIMESTAMP, {}}};
|
|
20588
20754
|
//! Whether or not a type format is specified
|
|
@@ -20599,8 +20765,6 @@ enum class ParserMode : uint8_t { PARSING = 0, SNIFFING_DIALECT = 1, SNIFFING_DA
|
|
|
20599
20765
|
class BufferedCSVReader {
|
|
20600
20766
|
//! Initial buffer read size; can be extended for long lines
|
|
20601
20767
|
static constexpr idx_t INITIAL_BUFFER_SIZE = 16384;
|
|
20602
|
-
//! Maximum CSV line size: specified because if we reach this amount, we likely have the wrong delimiters
|
|
20603
|
-
static constexpr idx_t MAXIMUM_CSV_LINE_SIZE = 1048576;
|
|
20604
20768
|
ParserMode mode;
|
|
20605
20769
|
|
|
20606
20770
|
public:
|
|
@@ -20783,73 +20947,6 @@ public:
|
|
|
20783
20947
|
string ToString(const string &column_name) override;
|
|
20784
20948
|
};
|
|
20785
20949
|
|
|
20786
|
-
} // namespace duckdb
|
|
20787
|
-
//===----------------------------------------------------------------------===//
|
|
20788
|
-
// DuckDB
|
|
20789
|
-
//
|
|
20790
|
-
// duckdb/common/arrow_wrapper.hpp
|
|
20791
|
-
//
|
|
20792
|
-
//
|
|
20793
|
-
//===----------------------------------------------------------------------===//
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
|
|
20799
|
-
|
|
20800
|
-
//! Here we have the internal duckdb classes that interact with Arrow's Internal Header (i.e., duckdb/commons/arrow.hpp)
|
|
20801
|
-
namespace duckdb {
|
|
20802
|
-
class ArrowSchemaWrapper {
|
|
20803
|
-
public:
|
|
20804
|
-
ArrowSchema arrow_schema;
|
|
20805
|
-
|
|
20806
|
-
ArrowSchemaWrapper() {
|
|
20807
|
-
arrow_schema.release = nullptr;
|
|
20808
|
-
}
|
|
20809
|
-
|
|
20810
|
-
~ArrowSchemaWrapper();
|
|
20811
|
-
};
|
|
20812
|
-
class ArrowArrayWrapper {
|
|
20813
|
-
public:
|
|
20814
|
-
ArrowArray arrow_array;
|
|
20815
|
-
ArrowArrayWrapper() {
|
|
20816
|
-
arrow_array.length = 0;
|
|
20817
|
-
arrow_array.release = nullptr;
|
|
20818
|
-
}
|
|
20819
|
-
~ArrowArrayWrapper();
|
|
20820
|
-
};
|
|
20821
|
-
|
|
20822
|
-
class ArrowArrayStreamWrapper {
|
|
20823
|
-
public:
|
|
20824
|
-
ArrowArrayStream arrow_array_stream;
|
|
20825
|
-
int64_t number_of_rows;
|
|
20826
|
-
void GetSchema(ArrowSchemaWrapper &schema);
|
|
20827
|
-
|
|
20828
|
-
unique_ptr<ArrowArrayWrapper> GetNextChunk();
|
|
20829
|
-
|
|
20830
|
-
const char *GetError();
|
|
20831
|
-
|
|
20832
|
-
~ArrowArrayStreamWrapper();
|
|
20833
|
-
ArrowArrayStreamWrapper() {
|
|
20834
|
-
arrow_array_stream.release = nullptr;
|
|
20835
|
-
}
|
|
20836
|
-
};
|
|
20837
|
-
|
|
20838
|
-
class ResultArrowArrayStreamWrapper {
|
|
20839
|
-
public:
|
|
20840
|
-
explicit ResultArrowArrayStreamWrapper(unique_ptr<QueryResult> result, idx_t approx_batch_size);
|
|
20841
|
-
ArrowArrayStream stream;
|
|
20842
|
-
unique_ptr<QueryResult> result;
|
|
20843
|
-
std::string last_error;
|
|
20844
|
-
idx_t vectors_per_chunk;
|
|
20845
|
-
|
|
20846
|
-
private:
|
|
20847
|
-
static int MyStreamGetSchema(struct ArrowArrayStream *stream, struct ArrowSchema *out);
|
|
20848
|
-
static int MyStreamGetNext(struct ArrowArrayStream *stream, struct ArrowArray *out);
|
|
20849
|
-
static void MyStreamRelease(struct ArrowArrayStream *stream);
|
|
20850
|
-
static const char *MyStreamGetLastError(struct ArrowArrayStream *stream);
|
|
20851
|
-
};
|
|
20852
|
-
|
|
20853
20950
|
} // namespace duckdb
|
|
20854
20951
|
//===----------------------------------------------------------------------===//
|
|
20855
20952
|
// DuckDB
|
|
@@ -20933,7 +21030,7 @@ private:
|
|
|
20933
21030
|
//===----------------------------------------------------------------------===//
|
|
20934
21031
|
// DuckDB
|
|
20935
21032
|
//
|
|
20936
|
-
// duckdb/parser/expression/
|
|
21033
|
+
// duckdb/parser/expression/lambda_expression.hpp
|
|
20937
21034
|
//
|
|
20938
21035
|
//
|
|
20939
21036
|
//===----------------------------------------------------------------------===//
|
|
@@ -20945,33 +21042,32 @@ private:
|
|
|
20945
21042
|
|
|
20946
21043
|
namespace duckdb {
|
|
20947
21044
|
|
|
20948
|
-
//!
|
|
20949
|
-
|
|
21045
|
+
//! LambdaExpression represents a lambda operator that can be used for e.g. mapping an expression to a list
|
|
21046
|
+
//! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
|
|
21047
|
+
class LambdaExpression : public ParsedExpression {
|
|
20950
21048
|
public:
|
|
20951
|
-
|
|
21049
|
+
LambdaExpression(vector<string> parameters, unique_ptr<ParsedExpression> expression);
|
|
20952
21050
|
|
|
20953
|
-
|
|
20954
|
-
|
|
20955
|
-
//! List of columns to exclude from the STAR expression
|
|
20956
|
-
case_insensitive_set_t exclude_list;
|
|
20957
|
-
//! List of columns to replace with another expression
|
|
20958
|
-
case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
|
|
21051
|
+
vector<string> parameters;
|
|
21052
|
+
unique_ptr<ParsedExpression> expression;
|
|
20959
21053
|
|
|
20960
21054
|
public:
|
|
20961
21055
|
string ToString() const override;
|
|
20962
21056
|
|
|
20963
|
-
static bool Equals(const
|
|
21057
|
+
static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
|
|
21058
|
+
hash_t Hash() const override;
|
|
20964
21059
|
|
|
20965
21060
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
20966
21061
|
|
|
20967
|
-
void Serialize(
|
|
20968
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21062
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21063
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
20969
21064
|
};
|
|
21065
|
+
|
|
20970
21066
|
} // namespace duckdb
|
|
20971
21067
|
//===----------------------------------------------------------------------===//
|
|
20972
21068
|
// DuckDB
|
|
20973
21069
|
//
|
|
20974
|
-
// duckdb/parser/expression/
|
|
21070
|
+
// duckdb/parser/expression/case_expression.hpp
|
|
20975
21071
|
//
|
|
20976
21072
|
//
|
|
20977
21073
|
//===----------------------------------------------------------------------===//
|
|
@@ -20983,32 +21079,34 @@ public:
|
|
|
20983
21079
|
|
|
20984
21080
|
namespace duckdb {
|
|
20985
21081
|
|
|
20986
|
-
|
|
20987
|
-
|
|
21082
|
+
struct CaseCheck {
|
|
21083
|
+
unique_ptr<ParsedExpression> when_expr;
|
|
21084
|
+
unique_ptr<ParsedExpression> then_expr;
|
|
21085
|
+
};
|
|
21086
|
+
|
|
21087
|
+
//! The CaseExpression represents a CASE expression in the query
|
|
21088
|
+
class CaseExpression : public ParsedExpression {
|
|
20988
21089
|
public:
|
|
20989
|
-
|
|
20990
|
-
ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
20991
|
-
ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
|
|
21090
|
+
CaseExpression();
|
|
20992
21091
|
|
|
20993
|
-
vector<
|
|
21092
|
+
vector<CaseCheck> case_checks;
|
|
21093
|
+
unique_ptr<ParsedExpression> else_expr;
|
|
20994
21094
|
|
|
20995
21095
|
public:
|
|
20996
|
-
void AddExpression(unique_ptr<ParsedExpression> expr);
|
|
20997
|
-
|
|
20998
21096
|
string ToString() const override;
|
|
20999
21097
|
|
|
21000
|
-
static bool Equals(const
|
|
21098
|
+
static bool Equals(const CaseExpression *a, const CaseExpression *b);
|
|
21001
21099
|
|
|
21002
21100
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21003
21101
|
|
|
21004
|
-
void Serialize(
|
|
21005
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21102
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21103
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21006
21104
|
};
|
|
21007
21105
|
} // namespace duckdb
|
|
21008
21106
|
//===----------------------------------------------------------------------===//
|
|
21009
21107
|
// DuckDB
|
|
21010
21108
|
//
|
|
21011
|
-
// duckdb/parser/expression/
|
|
21109
|
+
// duckdb/parser/expression/conjunction_expression.hpp
|
|
21012
21110
|
//
|
|
21013
21111
|
//
|
|
21014
21112
|
//===----------------------------------------------------------------------===//
|
|
@@ -21017,33 +21115,35 @@ public:
|
|
|
21017
21115
|
|
|
21018
21116
|
|
|
21019
21117
|
|
|
21118
|
+
|
|
21020
21119
|
namespace duckdb {
|
|
21021
21120
|
|
|
21022
|
-
//!
|
|
21023
|
-
class
|
|
21121
|
+
//! Represents a conjunction (AND/OR)
|
|
21122
|
+
class ConjunctionExpression : public ParsedExpression {
|
|
21024
21123
|
public:
|
|
21025
|
-
|
|
21124
|
+
explicit ConjunctionExpression(ExpressionType type);
|
|
21125
|
+
ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
21126
|
+
ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
|
|
21026
21127
|
|
|
21027
|
-
|
|
21028
|
-
unique_ptr<ParsedExpression> child;
|
|
21029
|
-
//! The collation clause
|
|
21030
|
-
string collation;
|
|
21128
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
21031
21129
|
|
|
21032
21130
|
public:
|
|
21131
|
+
void AddExpression(unique_ptr<ParsedExpression> expr);
|
|
21132
|
+
|
|
21033
21133
|
string ToString() const override;
|
|
21034
21134
|
|
|
21035
|
-
static bool Equals(const
|
|
21135
|
+
static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
|
|
21036
21136
|
|
|
21037
21137
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21038
21138
|
|
|
21039
|
-
void Serialize(
|
|
21040
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21139
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21140
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21041
21141
|
};
|
|
21042
21142
|
} // namespace duckdb
|
|
21043
21143
|
//===----------------------------------------------------------------------===//
|
|
21044
21144
|
// DuckDB
|
|
21045
21145
|
//
|
|
21046
|
-
// duckdb/parser/expression/
|
|
21146
|
+
// duckdb/parser/expression/function_expression.hpp
|
|
21047
21147
|
//
|
|
21048
21148
|
//
|
|
21049
21149
|
//===----------------------------------------------------------------------===//
|
|
@@ -21055,44 +21155,47 @@ public:
|
|
|
21055
21155
|
|
|
21056
21156
|
|
|
21057
21157
|
namespace duckdb {
|
|
21058
|
-
|
|
21059
|
-
|
|
21060
|
-
class SubqueryExpression : public ParsedExpression {
|
|
21158
|
+
//! Represents a function call
|
|
21159
|
+
class FunctionExpression : public ParsedExpression {
|
|
21061
21160
|
public:
|
|
21062
|
-
|
|
21161
|
+
FunctionExpression(string schema_name, const string &function_name, vector<unique_ptr<ParsedExpression>> children,
|
|
21162
|
+
unique_ptr<ParsedExpression> filter = nullptr, unique_ptr<OrderModifier> order_bys = nullptr,
|
|
21163
|
+
bool distinct = false, bool is_operator = false);
|
|
21164
|
+
FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
|
|
21165
|
+
unique_ptr<ParsedExpression> filter = nullptr, unique_ptr<OrderModifier> order_bys = nullptr,
|
|
21166
|
+
bool distinct = false, bool is_operator = false);
|
|
21063
21167
|
|
|
21064
|
-
//!
|
|
21065
|
-
|
|
21066
|
-
//!
|
|
21067
|
-
|
|
21068
|
-
//!
|
|
21069
|
-
|
|
21070
|
-
|
|
21071
|
-
|
|
21072
|
-
|
|
21168
|
+
//! Schema of the function
|
|
21169
|
+
string schema;
|
|
21170
|
+
//! Function name
|
|
21171
|
+
string function_name;
|
|
21172
|
+
//! Whether or not the function is an operator, only used for rendering
|
|
21173
|
+
bool is_operator;
|
|
21174
|
+
//! List of arguments to the function
|
|
21175
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
21176
|
+
//! Whether or not the aggregate function is distinct, only used for aggregates
|
|
21177
|
+
bool distinct;
|
|
21178
|
+
//! Expression representing a filter, only used for aggregates
|
|
21179
|
+
unique_ptr<ParsedExpression> filter;
|
|
21180
|
+
//! Modifier representing an ORDER BY, only used for aggregates
|
|
21181
|
+
unique_ptr<OrderModifier> order_bys;
|
|
21073
21182
|
|
|
21074
21183
|
public:
|
|
21075
|
-
bool HasSubquery() const override {
|
|
21076
|
-
return true;
|
|
21077
|
-
}
|
|
21078
|
-
bool IsScalar() const override {
|
|
21079
|
-
return false;
|
|
21080
|
-
}
|
|
21081
|
-
|
|
21082
21184
|
string ToString() const override;
|
|
21083
21185
|
|
|
21084
|
-
static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
|
|
21085
|
-
|
|
21086
21186
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21087
21187
|
|
|
21088
|
-
|
|
21089
|
-
|
|
21188
|
+
static bool Equals(const FunctionExpression *a, const FunctionExpression *b);
|
|
21189
|
+
hash_t Hash() const override;
|
|
21190
|
+
|
|
21191
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21192
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21090
21193
|
};
|
|
21091
21194
|
} // namespace duckdb
|
|
21092
21195
|
//===----------------------------------------------------------------------===//
|
|
21093
21196
|
// DuckDB
|
|
21094
21197
|
//
|
|
21095
|
-
// duckdb/parser/expression/
|
|
21198
|
+
// duckdb/parser/expression/default_expression.hpp
|
|
21096
21199
|
//
|
|
21097
21200
|
//
|
|
21098
21201
|
//===----------------------------------------------------------------------===//
|
|
@@ -21101,34 +21204,29 @@ public:
|
|
|
21101
21204
|
|
|
21102
21205
|
|
|
21103
21206
|
|
|
21104
|
-
|
|
21105
21207
|
namespace duckdb {
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
class ConstantExpression : public ParsedExpression {
|
|
21208
|
+
//! Represents the default value of a column
|
|
21209
|
+
class DefaultExpression : public ParsedExpression {
|
|
21109
21210
|
public:
|
|
21110
|
-
|
|
21111
|
-
|
|
21112
|
-
//! The constant value referenced
|
|
21113
|
-
Value value;
|
|
21211
|
+
DefaultExpression();
|
|
21114
21212
|
|
|
21115
21213
|
public:
|
|
21116
|
-
|
|
21214
|
+
bool IsScalar() const override {
|
|
21215
|
+
return false;
|
|
21216
|
+
}
|
|
21117
21217
|
|
|
21118
|
-
|
|
21119
|
-
hash_t Hash() const override;
|
|
21218
|
+
string ToString() const override;
|
|
21120
21219
|
|
|
21121
21220
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21122
21221
|
|
|
21123
|
-
void Serialize(
|
|
21124
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21222
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21223
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21125
21224
|
};
|
|
21126
|
-
|
|
21127
21225
|
} // namespace duckdb
|
|
21128
21226
|
//===----------------------------------------------------------------------===//
|
|
21129
21227
|
// DuckDB
|
|
21130
21228
|
//
|
|
21131
|
-
// duckdb/parser/expression/
|
|
21229
|
+
// duckdb/parser/expression/comparison_expression.hpp
|
|
21132
21230
|
//
|
|
21133
21231
|
//
|
|
21134
21232
|
//===----------------------------------------------------------------------===//
|
|
@@ -21137,35 +21235,31 @@ public:
|
|
|
21137
21235
|
|
|
21138
21236
|
|
|
21139
21237
|
|
|
21140
|
-
|
|
21141
21238
|
namespace duckdb {
|
|
21142
|
-
|
|
21143
|
-
//!
|
|
21144
|
-
|
|
21145
|
-
class LambdaExpression : public ParsedExpression {
|
|
21239
|
+
//! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
|
|
21240
|
+
//! and has two children.
|
|
21241
|
+
class ComparisonExpression : public ParsedExpression {
|
|
21146
21242
|
public:
|
|
21147
|
-
|
|
21243
|
+
ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
|
|
21148
21244
|
|
|
21149
|
-
|
|
21150
|
-
unique_ptr<ParsedExpression>
|
|
21245
|
+
unique_ptr<ParsedExpression> left;
|
|
21246
|
+
unique_ptr<ParsedExpression> right;
|
|
21151
21247
|
|
|
21152
21248
|
public:
|
|
21153
21249
|
string ToString() const override;
|
|
21154
21250
|
|
|
21155
|
-
static bool Equals(const
|
|
21156
|
-
hash_t Hash() const override;
|
|
21251
|
+
static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
|
|
21157
21252
|
|
|
21158
21253
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21159
21254
|
|
|
21160
|
-
void Serialize(
|
|
21161
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21255
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21256
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21162
21257
|
};
|
|
21163
|
-
|
|
21164
21258
|
} // namespace duckdb
|
|
21165
21259
|
//===----------------------------------------------------------------------===//
|
|
21166
21260
|
// DuckDB
|
|
21167
21261
|
//
|
|
21168
|
-
// duckdb/parser/expression/
|
|
21262
|
+
// duckdb/parser/expression/constant_expression.hpp
|
|
21169
21263
|
//
|
|
21170
21264
|
//
|
|
21171
21265
|
//===----------------------------------------------------------------------===//
|
|
@@ -21174,32 +21268,34 @@ public:
|
|
|
21174
21268
|
|
|
21175
21269
|
|
|
21176
21270
|
|
|
21271
|
+
|
|
21177
21272
|
namespace duckdb {
|
|
21178
|
-
|
|
21273
|
+
|
|
21274
|
+
//! ConstantExpression represents a constant value in the query
|
|
21275
|
+
class ConstantExpression : public ParsedExpression {
|
|
21179
21276
|
public:
|
|
21180
|
-
|
|
21277
|
+
explicit ConstantExpression(Value val);
|
|
21181
21278
|
|
|
21182
|
-
|
|
21279
|
+
//! The constant value referenced
|
|
21280
|
+
Value value;
|
|
21183
21281
|
|
|
21184
21282
|
public:
|
|
21185
|
-
bool IsScalar() const override {
|
|
21186
|
-
return false;
|
|
21187
|
-
}
|
|
21188
|
-
|
|
21189
21283
|
string ToString() const override;
|
|
21190
21284
|
|
|
21191
|
-
static bool Equals(const
|
|
21192
|
-
unique_ptr<ParsedExpression> Copy() const override;
|
|
21285
|
+
static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
|
|
21193
21286
|
hash_t Hash() const override;
|
|
21194
21287
|
|
|
21195
|
-
|
|
21196
|
-
|
|
21288
|
+
unique_ptr<ParsedExpression> Copy() const override;
|
|
21289
|
+
|
|
21290
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21291
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21197
21292
|
};
|
|
21293
|
+
|
|
21198
21294
|
} // namespace duckdb
|
|
21199
21295
|
//===----------------------------------------------------------------------===//
|
|
21200
21296
|
// DuckDB
|
|
21201
21297
|
//
|
|
21202
|
-
// duckdb/parser/expression/
|
|
21298
|
+
// duckdb/parser/expression/operator_expression.hpp
|
|
21203
21299
|
//
|
|
21204
21300
|
//
|
|
21205
21301
|
//===----------------------------------------------------------------------===//
|
|
@@ -21210,29 +21306,24 @@ public:
|
|
|
21210
21306
|
|
|
21211
21307
|
|
|
21212
21308
|
namespace duckdb {
|
|
21213
|
-
|
|
21214
|
-
|
|
21215
|
-
unique_ptr<ParsedExpression> when_expr;
|
|
21216
|
-
unique_ptr<ParsedExpression> then_expr;
|
|
21217
|
-
};
|
|
21218
|
-
|
|
21219
|
-
//! The CaseExpression represents a CASE expression in the query
|
|
21220
|
-
class CaseExpression : public ParsedExpression {
|
|
21309
|
+
//! Represents a built-in operator expression
|
|
21310
|
+
class OperatorExpression : public ParsedExpression {
|
|
21221
21311
|
public:
|
|
21222
|
-
|
|
21312
|
+
explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
|
|
21313
|
+
unique_ptr<ParsedExpression> right = nullptr);
|
|
21314
|
+
OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
21223
21315
|
|
|
21224
|
-
vector<
|
|
21225
|
-
unique_ptr<ParsedExpression> else_expr;
|
|
21316
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
21226
21317
|
|
|
21227
21318
|
public:
|
|
21228
21319
|
string ToString() const override;
|
|
21229
21320
|
|
|
21230
|
-
static bool Equals(const
|
|
21321
|
+
static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
|
|
21231
21322
|
|
|
21232
21323
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21233
21324
|
|
|
21234
|
-
void Serialize(
|
|
21235
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21325
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21326
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21236
21327
|
};
|
|
21237
21328
|
} // namespace duckdb
|
|
21238
21329
|
//===----------------------------------------------------------------------===//
|
|
@@ -21265,14 +21356,14 @@ public:
|
|
|
21265
21356
|
|
|
21266
21357
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21267
21358
|
|
|
21268
|
-
void Serialize(
|
|
21269
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21359
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21360
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21270
21361
|
};
|
|
21271
21362
|
} // namespace duckdb
|
|
21272
21363
|
//===----------------------------------------------------------------------===//
|
|
21273
21364
|
// DuckDB
|
|
21274
21365
|
//
|
|
21275
|
-
// duckdb/parser/expression/
|
|
21366
|
+
// duckdb/parser/expression/positional_reference_expression.hpp
|
|
21276
21367
|
//
|
|
21277
21368
|
//
|
|
21278
21369
|
//===----------------------------------------------------------------------===//
|
|
@@ -21282,26 +21373,30 @@ public:
|
|
|
21282
21373
|
|
|
21283
21374
|
|
|
21284
21375
|
namespace duckdb {
|
|
21285
|
-
|
|
21286
|
-
//! and has two children.
|
|
21287
|
-
class ComparisonExpression : public ParsedExpression {
|
|
21376
|
+
class PositionalReferenceExpression : public ParsedExpression {
|
|
21288
21377
|
public:
|
|
21289
|
-
|
|
21378
|
+
PositionalReferenceExpression(idx_t index);
|
|
21290
21379
|
|
|
21291
|
-
|
|
21292
|
-
unique_ptr<ParsedExpression> right;
|
|
21380
|
+
idx_t index;
|
|
21293
21381
|
|
|
21294
21382
|
public:
|
|
21295
|
-
|
|
21383
|
+
bool IsScalar() const override {
|
|
21384
|
+
return false;
|
|
21385
|
+
}
|
|
21296
21386
|
|
|
21297
|
-
|
|
21387
|
+
string ToString() const override;
|
|
21298
21388
|
|
|
21389
|
+
static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
|
|
21299
21390
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21391
|
+
hash_t Hash() const override;
|
|
21300
21392
|
|
|
21301
|
-
void Serialize(
|
|
21302
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21393
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21394
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21303
21395
|
};
|
|
21304
21396
|
} // namespace duckdb
|
|
21397
|
+
|
|
21398
|
+
|
|
21399
|
+
|
|
21305
21400
|
//===----------------------------------------------------------------------===//
|
|
21306
21401
|
// DuckDB
|
|
21307
21402
|
//
|
|
@@ -21336,23 +21431,15 @@ public:
|
|
|
21336
21431
|
|
|
21337
21432
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21338
21433
|
|
|
21339
|
-
void Serialize(
|
|
21340
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21434
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21435
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21341
21436
|
};
|
|
21342
21437
|
} // namespace duckdb
|
|
21343
21438
|
|
|
21344
|
-
|
|
21345
|
-
|
|
21346
|
-
|
|
21347
|
-
|
|
21348
|
-
|
|
21349
|
-
|
|
21350
|
-
|
|
21351
|
-
|
|
21352
21439
|
//===----------------------------------------------------------------------===//
|
|
21353
21440
|
// DuckDB
|
|
21354
21441
|
//
|
|
21355
|
-
// duckdb/parser/expression/
|
|
21442
|
+
// duckdb/parser/expression/collate_expression.hpp
|
|
21356
21443
|
//
|
|
21357
21444
|
//
|
|
21358
21445
|
//===----------------------------------------------------------------------===//
|
|
@@ -21362,28 +21449,41 @@ public:
|
|
|
21362
21449
|
|
|
21363
21450
|
|
|
21364
21451
|
namespace duckdb {
|
|
21365
|
-
//! Represents the default value of a column
|
|
21366
|
-
class DefaultExpression : public ParsedExpression {
|
|
21367
|
-
public:
|
|
21368
|
-
DefaultExpression();
|
|
21369
21452
|
|
|
21453
|
+
//! CollateExpression represents a COLLATE statement
|
|
21454
|
+
class CollateExpression : public ParsedExpression {
|
|
21370
21455
|
public:
|
|
21371
|
-
|
|
21372
|
-
|
|
21373
|
-
|
|
21456
|
+
CollateExpression(string collation, unique_ptr<ParsedExpression> child);
|
|
21457
|
+
|
|
21458
|
+
//! The child of the cast expression
|
|
21459
|
+
unique_ptr<ParsedExpression> child;
|
|
21460
|
+
//! The collation clause
|
|
21461
|
+
string collation;
|
|
21374
21462
|
|
|
21463
|
+
public:
|
|
21375
21464
|
string ToString() const override;
|
|
21376
21465
|
|
|
21466
|
+
static bool Equals(const CollateExpression *a, const CollateExpression *b);
|
|
21467
|
+
|
|
21377
21468
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21378
21469
|
|
|
21379
|
-
|
|
21470
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21471
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21380
21472
|
};
|
|
21381
21473
|
} // namespace duckdb
|
|
21382
21474
|
|
|
21475
|
+
|
|
21476
|
+
|
|
21477
|
+
|
|
21478
|
+
|
|
21479
|
+
|
|
21480
|
+
|
|
21481
|
+
|
|
21482
|
+
|
|
21383
21483
|
//===----------------------------------------------------------------------===//
|
|
21384
21484
|
// DuckDB
|
|
21385
21485
|
//
|
|
21386
|
-
// duckdb/parser/expression/
|
|
21486
|
+
// duckdb/parser/expression/parameter_expression.hpp
|
|
21387
21487
|
//
|
|
21388
21488
|
//
|
|
21389
21489
|
//===----------------------------------------------------------------------===//
|
|
@@ -21392,46 +21492,28 @@ public:
|
|
|
21392
21492
|
|
|
21393
21493
|
|
|
21394
21494
|
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
21495
|
namespace duckdb {
|
|
21398
|
-
|
|
21399
|
-
class FunctionExpression : public ParsedExpression {
|
|
21496
|
+
class ParameterExpression : public ParsedExpression {
|
|
21400
21497
|
public:
|
|
21401
|
-
|
|
21402
|
-
unique_ptr<ParsedExpression> filter = nullptr, unique_ptr<OrderModifier> order_bys = nullptr,
|
|
21403
|
-
bool distinct = false, bool is_operator = false);
|
|
21404
|
-
FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
|
|
21405
|
-
unique_ptr<ParsedExpression> filter = nullptr, unique_ptr<OrderModifier> order_bys = nullptr,
|
|
21406
|
-
bool distinct = false, bool is_operator = false);
|
|
21498
|
+
ParameterExpression();
|
|
21407
21499
|
|
|
21408
|
-
|
|
21409
|
-
string schema;
|
|
21410
|
-
//! Function name
|
|
21411
|
-
string function_name;
|
|
21412
|
-
//! Whether or not the function is an operator, only used for rendering
|
|
21413
|
-
bool is_operator;
|
|
21414
|
-
//! List of arguments to the function
|
|
21415
|
-
vector<unique_ptr<ParsedExpression>> children;
|
|
21416
|
-
//! Whether or not the aggregate function is distinct, only used for aggregates
|
|
21417
|
-
bool distinct;
|
|
21418
|
-
//! Expression representing a filter, only used for aggregates
|
|
21419
|
-
unique_ptr<ParsedExpression> filter;
|
|
21420
|
-
//! Modifier representing an ORDER BY, only used for aggregates
|
|
21421
|
-
unique_ptr<OrderModifier> order_bys;
|
|
21500
|
+
idx_t parameter_nr;
|
|
21422
21501
|
|
|
21423
21502
|
public:
|
|
21503
|
+
bool IsScalar() const override {
|
|
21504
|
+
return true;
|
|
21505
|
+
}
|
|
21506
|
+
bool HasParameter() const override {
|
|
21507
|
+
return true;
|
|
21508
|
+
}
|
|
21509
|
+
|
|
21424
21510
|
string ToString() const override;
|
|
21425
21511
|
|
|
21426
21512
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21427
|
-
|
|
21428
|
-
static bool Equals(const FunctionExpression *a, const FunctionExpression *b);
|
|
21429
21513
|
hash_t Hash() const override;
|
|
21430
21514
|
|
|
21431
|
-
|
|
21432
|
-
|
|
21433
|
-
//! Deserializes a blob back into an FunctionExpression
|
|
21434
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
|
|
21515
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21516
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21435
21517
|
};
|
|
21436
21518
|
} // namespace duckdb
|
|
21437
21519
|
|
|
@@ -21439,7 +21521,7 @@ public:
|
|
|
21439
21521
|
//===----------------------------------------------------------------------===//
|
|
21440
21522
|
// DuckDB
|
|
21441
21523
|
//
|
|
21442
|
-
// duckdb/parser/expression/
|
|
21524
|
+
// duckdb/parser/expression/star_expression.hpp
|
|
21443
21525
|
//
|
|
21444
21526
|
//
|
|
21445
21527
|
//===----------------------------------------------------------------------===//
|
|
@@ -21450,31 +21532,35 @@ public:
|
|
|
21450
21532
|
|
|
21451
21533
|
|
|
21452
21534
|
namespace duckdb {
|
|
21453
|
-
|
|
21454
|
-
|
|
21535
|
+
|
|
21536
|
+
//! Represents a * expression in the SELECT clause
|
|
21537
|
+
class StarExpression : public ParsedExpression {
|
|
21455
21538
|
public:
|
|
21456
|
-
|
|
21457
|
-
unique_ptr<ParsedExpression> right = nullptr);
|
|
21458
|
-
OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
21539
|
+
StarExpression(string relation_name = string());
|
|
21459
21540
|
|
|
21460
|
-
|
|
21541
|
+
//! The relation name in case of tbl.*, or empty if this is a normal *
|
|
21542
|
+
string relation_name;
|
|
21543
|
+
//! List of columns to exclude from the STAR expression
|
|
21544
|
+
case_insensitive_set_t exclude_list;
|
|
21545
|
+
//! List of columns to replace with another expression
|
|
21546
|
+
case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
|
|
21461
21547
|
|
|
21462
21548
|
public:
|
|
21463
21549
|
string ToString() const override;
|
|
21464
21550
|
|
|
21465
|
-
static bool Equals(const
|
|
21551
|
+
static bool Equals(const StarExpression *a, const StarExpression *b);
|
|
21466
21552
|
|
|
21467
21553
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21468
21554
|
|
|
21469
|
-
void Serialize(
|
|
21470
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21555
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21556
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21471
21557
|
};
|
|
21472
21558
|
} // namespace duckdb
|
|
21473
21559
|
|
|
21474
21560
|
//===----------------------------------------------------------------------===//
|
|
21475
21561
|
// DuckDB
|
|
21476
21562
|
//
|
|
21477
|
-
// duckdb/parser/expression/
|
|
21563
|
+
// duckdb/parser/expression/subquery_expression.hpp
|
|
21478
21564
|
//
|
|
21479
21565
|
//
|
|
21480
21566
|
//===----------------------------------------------------------------------===//
|
|
@@ -21483,39 +21569,49 @@ public:
|
|
|
21483
21569
|
|
|
21484
21570
|
|
|
21485
21571
|
|
|
21572
|
+
|
|
21573
|
+
|
|
21486
21574
|
namespace duckdb {
|
|
21487
|
-
|
|
21575
|
+
|
|
21576
|
+
//! Represents a subquery
|
|
21577
|
+
class SubqueryExpression : public ParsedExpression {
|
|
21488
21578
|
public:
|
|
21489
|
-
|
|
21579
|
+
SubqueryExpression();
|
|
21490
21580
|
|
|
21491
|
-
|
|
21581
|
+
//! The actual subquery
|
|
21582
|
+
unique_ptr<SelectStatement> subquery;
|
|
21583
|
+
//! The subquery type
|
|
21584
|
+
SubqueryType subquery_type;
|
|
21585
|
+
//! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
|
|
21586
|
+
//! subquery)
|
|
21587
|
+
unique_ptr<ParsedExpression> child;
|
|
21588
|
+
//! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
|
|
21589
|
+
ExpressionType comparison_type;
|
|
21492
21590
|
|
|
21493
21591
|
public:
|
|
21494
|
-
bool
|
|
21592
|
+
bool HasSubquery() const override {
|
|
21495
21593
|
return true;
|
|
21496
21594
|
}
|
|
21497
|
-
bool
|
|
21498
|
-
return
|
|
21595
|
+
bool IsScalar() const override {
|
|
21596
|
+
return false;
|
|
21499
21597
|
}
|
|
21500
21598
|
|
|
21501
21599
|
string ToString() const override;
|
|
21502
21600
|
|
|
21601
|
+
static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
|
|
21602
|
+
|
|
21503
21603
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21504
|
-
hash_t Hash() const override;
|
|
21505
21604
|
|
|
21506
|
-
void Serialize(
|
|
21507
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21605
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21606
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21508
21607
|
};
|
|
21509
21608
|
} // namespace duckdb
|
|
21510
21609
|
|
|
21511
21610
|
|
|
21512
|
-
|
|
21513
|
-
|
|
21514
|
-
|
|
21515
21611
|
//===----------------------------------------------------------------------===//
|
|
21516
21612
|
// DuckDB
|
|
21517
21613
|
//
|
|
21518
|
-
// duckdb/parser/parsed_data/
|
|
21614
|
+
// duckdb/parser/parsed_data/create_collation_info.hpp
|
|
21519
21615
|
//
|
|
21520
21616
|
//
|
|
21521
21617
|
//===----------------------------------------------------------------------===//
|
|
@@ -21525,26 +21621,30 @@ public:
|
|
|
21525
21621
|
|
|
21526
21622
|
|
|
21527
21623
|
|
|
21528
|
-
|
|
21529
|
-
|
|
21530
21624
|
namespace duckdb {
|
|
21531
21625
|
|
|
21532
|
-
struct
|
|
21533
|
-
|
|
21534
|
-
|
|
21626
|
+
struct CreateCollationInfo : public CreateInfo {
|
|
21627
|
+
CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
|
|
21628
|
+
: CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
|
|
21629
|
+
not_required_for_equality(not_required_for_equality_p) {
|
|
21630
|
+
this->name = move(name_p);
|
|
21535
21631
|
}
|
|
21536
21632
|
|
|
21537
|
-
//!
|
|
21633
|
+
//! The name of the collation
|
|
21538
21634
|
string name;
|
|
21539
|
-
//!
|
|
21540
|
-
|
|
21635
|
+
//! The collation function to push in case collation is required
|
|
21636
|
+
ScalarFunction function;
|
|
21637
|
+
//! Whether or not the collation can be combined with other collations.
|
|
21638
|
+
bool combinable;
|
|
21639
|
+
//! Whether or not the collation is required for equality comparisons or not. For many collations a binary
|
|
21640
|
+
//! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
|
|
21641
|
+
//! speeds up processing.
|
|
21642
|
+
bool not_required_for_equality;
|
|
21541
21643
|
|
|
21542
21644
|
public:
|
|
21543
21645
|
unique_ptr<CreateInfo> Copy() const override {
|
|
21544
|
-
auto result = make_unique<
|
|
21646
|
+
auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
|
|
21545
21647
|
CopyProperties(*result);
|
|
21546
|
-
result->name = name;
|
|
21547
|
-
result->type = make_unique<LogicalType>(*type);
|
|
21548
21648
|
return move(result);
|
|
21549
21649
|
}
|
|
21550
21650
|
};
|
|
@@ -21583,7 +21683,7 @@ public:
|
|
|
21583
21683
|
//===----------------------------------------------------------------------===//
|
|
21584
21684
|
// DuckDB
|
|
21585
21685
|
//
|
|
21586
|
-
// duckdb/parser/parsed_data/
|
|
21686
|
+
// duckdb/parser/parsed_data/show_select_info.hpp
|
|
21587
21687
|
//
|
|
21588
21688
|
//
|
|
21589
21689
|
//===----------------------------------------------------------------------===//
|
|
@@ -21595,26 +21695,31 @@ public:
|
|
|
21595
21695
|
|
|
21596
21696
|
namespace duckdb {
|
|
21597
21697
|
|
|
21598
|
-
struct
|
|
21599
|
-
//!
|
|
21600
|
-
|
|
21601
|
-
|
|
21602
|
-
|
|
21603
|
-
|
|
21604
|
-
|
|
21605
|
-
//!
|
|
21606
|
-
|
|
21607
|
-
};
|
|
21698
|
+
struct ShowSelectInfo : public ParseInfo {
|
|
21699
|
+
//! Types of projected columns
|
|
21700
|
+
vector<LogicalType> types;
|
|
21701
|
+
//! The QueryNode of select query
|
|
21702
|
+
unique_ptr<QueryNode> query;
|
|
21703
|
+
//! Aliases of projected columns
|
|
21704
|
+
vector<string> aliases;
|
|
21705
|
+
//! Whether or not we are requesting a summary or a describe
|
|
21706
|
+
bool is_summary;
|
|
21608
21707
|
|
|
21609
|
-
|
|
21610
|
-
|
|
21708
|
+
unique_ptr<ShowSelectInfo> Copy() {
|
|
21709
|
+
auto result = make_unique<ShowSelectInfo>();
|
|
21710
|
+
result->types = types;
|
|
21711
|
+
result->query = query->Copy();
|
|
21712
|
+
result->aliases = aliases;
|
|
21713
|
+
result->is_summary = is_summary;
|
|
21714
|
+
return result;
|
|
21715
|
+
}
|
|
21611
21716
|
};
|
|
21612
21717
|
|
|
21613
21718
|
} // namespace duckdb
|
|
21614
21719
|
//===----------------------------------------------------------------------===//
|
|
21615
21720
|
// DuckDB
|
|
21616
21721
|
//
|
|
21617
|
-
// duckdb/parser/parsed_data/
|
|
21722
|
+
// duckdb/parser/parsed_data/create_aggregate_function_info.hpp
|
|
21618
21723
|
//
|
|
21619
21724
|
//
|
|
21620
21725
|
//===----------------------------------------------------------------------===//
|
|
@@ -21623,17 +21728,39 @@ struct BoundExportData : public ParseInfo {
|
|
|
21623
21728
|
|
|
21624
21729
|
|
|
21625
21730
|
|
|
21731
|
+
|
|
21626
21732
|
namespace duckdb {
|
|
21627
21733
|
|
|
21628
|
-
struct
|
|
21629
|
-
|
|
21734
|
+
struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
|
|
21735
|
+
explicit CreateAggregateFunctionInfo(AggregateFunction function)
|
|
21736
|
+
: CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
|
|
21737
|
+
this->name = function.name;
|
|
21738
|
+
functions.AddFunction(move(function));
|
|
21739
|
+
}
|
|
21740
|
+
|
|
21741
|
+
explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
|
|
21742
|
+
: CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
|
|
21743
|
+
this->name = functions.name;
|
|
21744
|
+
for (auto &func : functions.functions) {
|
|
21745
|
+
func.name = functions.name;
|
|
21746
|
+
}
|
|
21747
|
+
}
|
|
21748
|
+
|
|
21749
|
+
AggregateFunctionSet functions;
|
|
21750
|
+
|
|
21751
|
+
public:
|
|
21752
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
21753
|
+
auto result = make_unique<CreateAggregateFunctionInfo>(functions);
|
|
21754
|
+
CopyProperties(*result);
|
|
21755
|
+
return move(result);
|
|
21756
|
+
}
|
|
21630
21757
|
};
|
|
21631
21758
|
|
|
21632
21759
|
} // namespace duckdb
|
|
21633
21760
|
//===----------------------------------------------------------------------===//
|
|
21634
21761
|
// DuckDB
|
|
21635
21762
|
//
|
|
21636
|
-
// duckdb/parser/parsed_data/
|
|
21763
|
+
// duckdb/parser/parsed_data/create_type_info.hpp
|
|
21637
21764
|
//
|
|
21638
21765
|
//
|
|
21639
21766
|
//===----------------------------------------------------------------------===//
|
|
@@ -21643,34 +21770,49 @@ struct VacuumInfo : public ParseInfo {
|
|
|
21643
21770
|
|
|
21644
21771
|
|
|
21645
21772
|
|
|
21773
|
+
|
|
21774
|
+
|
|
21646
21775
|
namespace duckdb {
|
|
21647
21776
|
|
|
21648
|
-
struct
|
|
21649
|
-
|
|
21650
|
-
|
|
21651
|
-
not_required_for_equality(not_required_for_equality_p) {
|
|
21652
|
-
this->name = move(name_p);
|
|
21777
|
+
struct CreateTypeInfo : public CreateInfo {
|
|
21778
|
+
|
|
21779
|
+
CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
|
|
21653
21780
|
}
|
|
21654
21781
|
|
|
21655
|
-
//!
|
|
21782
|
+
//! Name of the Type
|
|
21656
21783
|
string name;
|
|
21657
|
-
//!
|
|
21658
|
-
|
|
21659
|
-
//! Whether or not the collation can be combined with other collations.
|
|
21660
|
-
bool combinable;
|
|
21661
|
-
//! Whether or not the collation is required for equality comparisons or not. For many collations a binary
|
|
21662
|
-
//! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
|
|
21663
|
-
//! speeds up processing.
|
|
21664
|
-
bool not_required_for_equality;
|
|
21784
|
+
//! Logical Type
|
|
21785
|
+
LogicalType type;
|
|
21665
21786
|
|
|
21666
21787
|
public:
|
|
21667
21788
|
unique_ptr<CreateInfo> Copy() const override {
|
|
21668
|
-
auto result = make_unique<
|
|
21789
|
+
auto result = make_unique<CreateTypeInfo>();
|
|
21669
21790
|
CopyProperties(*result);
|
|
21791
|
+
result->name = name;
|
|
21792
|
+
result->type = type;
|
|
21670
21793
|
return move(result);
|
|
21671
21794
|
}
|
|
21672
21795
|
};
|
|
21673
21796
|
|
|
21797
|
+
} // namespace duckdb
|
|
21798
|
+
//===----------------------------------------------------------------------===//
|
|
21799
|
+
// DuckDB
|
|
21800
|
+
//
|
|
21801
|
+
// duckdb/parser/parsed_data/vacuum_info.hpp
|
|
21802
|
+
//
|
|
21803
|
+
//
|
|
21804
|
+
//===----------------------------------------------------------------------===//
|
|
21805
|
+
|
|
21806
|
+
|
|
21807
|
+
|
|
21808
|
+
|
|
21809
|
+
|
|
21810
|
+
namespace duckdb {
|
|
21811
|
+
|
|
21812
|
+
struct VacuumInfo : public ParseInfo {
|
|
21813
|
+
// nothing for now
|
|
21814
|
+
};
|
|
21815
|
+
|
|
21674
21816
|
} // namespace duckdb
|
|
21675
21817
|
//===----------------------------------------------------------------------===//
|
|
21676
21818
|
// DuckDB
|
|
@@ -21719,7 +21861,43 @@ public:
|
|
|
21719
21861
|
//===----------------------------------------------------------------------===//
|
|
21720
21862
|
// DuckDB
|
|
21721
21863
|
//
|
|
21722
|
-
// duckdb/parser/parsed_data/
|
|
21864
|
+
// duckdb/parser/parsed_data/transaction_info.hpp
|
|
21865
|
+
//
|
|
21866
|
+
//
|
|
21867
|
+
//===----------------------------------------------------------------------===//
|
|
21868
|
+
|
|
21869
|
+
|
|
21870
|
+
|
|
21871
|
+
|
|
21872
|
+
|
|
21873
|
+
namespace duckdb {
|
|
21874
|
+
|
|
21875
|
+
enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
|
|
21876
|
+
|
|
21877
|
+
struct TransactionInfo : public ParseInfo {
|
|
21878
|
+
explicit TransactionInfo(TransactionType type) : type(type) {
|
|
21879
|
+
}
|
|
21880
|
+
|
|
21881
|
+
//! The type of transaction statement
|
|
21882
|
+
TransactionType type;
|
|
21883
|
+
};
|
|
21884
|
+
|
|
21885
|
+
} // namespace duckdb
|
|
21886
|
+
//===----------------------------------------------------------------------===//
|
|
21887
|
+
// DuckDB
|
|
21888
|
+
//
|
|
21889
|
+
// duckdb/parser/parsed_data/create_macro_info.hpp
|
|
21890
|
+
//
|
|
21891
|
+
//
|
|
21892
|
+
//===----------------------------------------------------------------------===//
|
|
21893
|
+
|
|
21894
|
+
|
|
21895
|
+
|
|
21896
|
+
|
|
21897
|
+
//===----------------------------------------------------------------------===//
|
|
21898
|
+
// DuckDB
|
|
21899
|
+
//
|
|
21900
|
+
// duckdb/function/macro_function.hpp
|
|
21723
21901
|
//
|
|
21724
21902
|
//
|
|
21725
21903
|
//===----------------------------------------------------------------------===//
|
|
@@ -21729,31 +21907,75 @@ public:
|
|
|
21729
21907
|
|
|
21730
21908
|
|
|
21731
21909
|
|
|
21910
|
+
|
|
21911
|
+
|
|
21732
21912
|
namespace duckdb {
|
|
21733
21913
|
|
|
21734
|
-
|
|
21735
|
-
|
|
21914
|
+
class MacroCatalogEntry;
|
|
21915
|
+
|
|
21916
|
+
class MacroFunction {
|
|
21917
|
+
public:
|
|
21918
|
+
explicit MacroFunction(unique_ptr<ParsedExpression> expression);
|
|
21919
|
+
|
|
21920
|
+
//! Check whether the supplied arguments are valid
|
|
21921
|
+
static string ValidateArguments(MacroCatalogEntry ¯o_func, FunctionExpression &function_expr,
|
|
21922
|
+
vector<unique_ptr<ParsedExpression>> &positionals,
|
|
21923
|
+
unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
|
|
21924
|
+
//! The macro expression
|
|
21925
|
+
unique_ptr<ParsedExpression> expression;
|
|
21926
|
+
//! The positional parameters
|
|
21927
|
+
vector<unique_ptr<ParsedExpression>> parameters;
|
|
21928
|
+
//! The default parameters and their associated values
|
|
21929
|
+
unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
|
|
21930
|
+
|
|
21931
|
+
public:
|
|
21932
|
+
unique_ptr<MacroFunction> Copy();
|
|
21933
|
+
};
|
|
21934
|
+
|
|
21935
|
+
} // namespace duckdb
|
|
21936
|
+
|
|
21937
|
+
|
|
21938
|
+
namespace duckdb {
|
|
21939
|
+
|
|
21940
|
+
struct CreateMacroInfo : public CreateFunctionInfo {
|
|
21941
|
+
CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
|
|
21736
21942
|
}
|
|
21737
|
-
|
|
21738
|
-
|
|
21943
|
+
|
|
21944
|
+
unique_ptr<MacroFunction> function;
|
|
21945
|
+
|
|
21946
|
+
public:
|
|
21947
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
21948
|
+
auto result = make_unique<CreateMacroInfo>();
|
|
21949
|
+
result->function = function->Copy();
|
|
21950
|
+
result->name = name;
|
|
21951
|
+
CopyProperties(*result);
|
|
21952
|
+
return move(result);
|
|
21739
21953
|
}
|
|
21954
|
+
};
|
|
21740
21955
|
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
|
|
21746
|
-
|
|
21747
|
-
|
|
21748
|
-
|
|
21956
|
+
} // namespace duckdb
|
|
21957
|
+
//===----------------------------------------------------------------------===//
|
|
21958
|
+
// DuckDB
|
|
21959
|
+
//
|
|
21960
|
+
// duckdb/parser/parsed_data/create_schema_info.hpp
|
|
21961
|
+
//
|
|
21962
|
+
//
|
|
21963
|
+
//===----------------------------------------------------------------------===//
|
|
21964
|
+
|
|
21965
|
+
|
|
21966
|
+
|
|
21967
|
+
|
|
21968
|
+
|
|
21969
|
+
namespace duckdb {
|
|
21970
|
+
|
|
21971
|
+
struct CreateSchemaInfo : public CreateInfo {
|
|
21972
|
+
CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
|
|
21973
|
+
}
|
|
21749
21974
|
|
|
21750
21975
|
public:
|
|
21751
21976
|
unique_ptr<CreateInfo> Copy() const override {
|
|
21752
|
-
auto result = make_unique<
|
|
21977
|
+
auto result = make_unique<CreateSchemaInfo>();
|
|
21753
21978
|
CopyProperties(*result);
|
|
21754
|
-
result->aliases = aliases;
|
|
21755
|
-
result->types = types;
|
|
21756
|
-
result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
|
|
21757
21979
|
return move(result);
|
|
21758
21980
|
}
|
|
21759
21981
|
};
|
|
@@ -21806,9 +22028,9 @@ public:
|
|
|
21806
22028
|
unique_ptr<TableRef> Copy() override;
|
|
21807
22029
|
|
|
21808
22030
|
//! Serializes a blob into a BaseTableRef
|
|
21809
|
-
void Serialize(
|
|
22031
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
21810
22032
|
//! Deserializes a blob back into a BaseTableRef
|
|
21811
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22033
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
21812
22034
|
};
|
|
21813
22035
|
} // namespace duckdb
|
|
21814
22036
|
|
|
@@ -21850,95 +22072,7 @@ public:
|
|
|
21850
22072
|
//===----------------------------------------------------------------------===//
|
|
21851
22073
|
// DuckDB
|
|
21852
22074
|
//
|
|
21853
|
-
// duckdb/parser/parsed_data/
|
|
21854
|
-
//
|
|
21855
|
-
//
|
|
21856
|
-
//===----------------------------------------------------------------------===//
|
|
21857
|
-
|
|
21858
|
-
|
|
21859
|
-
|
|
21860
|
-
|
|
21861
|
-
|
|
21862
|
-
|
|
21863
|
-
namespace duckdb {
|
|
21864
|
-
|
|
21865
|
-
struct ShowSelectInfo : public ParseInfo {
|
|
21866
|
-
//! Types of projected columns
|
|
21867
|
-
vector<LogicalType> types;
|
|
21868
|
-
//! The QueryNode of select query
|
|
21869
|
-
unique_ptr<QueryNode> query;
|
|
21870
|
-
//! Aliases of projected columns
|
|
21871
|
-
vector<string> aliases;
|
|
21872
|
-
//! Whether or not we are requesting a summary or a describe
|
|
21873
|
-
bool is_summary;
|
|
21874
|
-
|
|
21875
|
-
unique_ptr<ShowSelectInfo> Copy() {
|
|
21876
|
-
auto result = make_unique<ShowSelectInfo>();
|
|
21877
|
-
result->types = types;
|
|
21878
|
-
result->query = query->Copy();
|
|
21879
|
-
result->aliases = aliases;
|
|
21880
|
-
result->is_summary = is_summary;
|
|
21881
|
-
return result;
|
|
21882
|
-
}
|
|
21883
|
-
};
|
|
21884
|
-
|
|
21885
|
-
} // namespace duckdb
|
|
21886
|
-
//===----------------------------------------------------------------------===//
|
|
21887
|
-
// DuckDB
|
|
21888
|
-
//
|
|
21889
|
-
// duckdb/parser/parsed_data/transaction_info.hpp
|
|
21890
|
-
//
|
|
21891
|
-
//
|
|
21892
|
-
//===----------------------------------------------------------------------===//
|
|
21893
|
-
|
|
21894
|
-
|
|
21895
|
-
|
|
21896
|
-
|
|
21897
|
-
|
|
21898
|
-
namespace duckdb {
|
|
21899
|
-
|
|
21900
|
-
enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
|
|
21901
|
-
|
|
21902
|
-
struct TransactionInfo : public ParseInfo {
|
|
21903
|
-
explicit TransactionInfo(TransactionType type) : type(type) {
|
|
21904
|
-
}
|
|
21905
|
-
|
|
21906
|
-
//! The type of transaction statement
|
|
21907
|
-
TransactionType type;
|
|
21908
|
-
};
|
|
21909
|
-
|
|
21910
|
-
} // namespace duckdb
|
|
21911
|
-
//===----------------------------------------------------------------------===//
|
|
21912
|
-
// DuckDB
|
|
21913
|
-
//
|
|
21914
|
-
// duckdb/parser/parsed_data/create_schema_info.hpp
|
|
21915
|
-
//
|
|
21916
|
-
//
|
|
21917
|
-
//===----------------------------------------------------------------------===//
|
|
21918
|
-
|
|
21919
|
-
|
|
21920
|
-
|
|
21921
|
-
|
|
21922
|
-
|
|
21923
|
-
namespace duckdb {
|
|
21924
|
-
|
|
21925
|
-
struct CreateSchemaInfo : public CreateInfo {
|
|
21926
|
-
CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
|
|
21927
|
-
}
|
|
21928
|
-
|
|
21929
|
-
public:
|
|
21930
|
-
unique_ptr<CreateInfo> Copy() const override {
|
|
21931
|
-
auto result = make_unique<CreateSchemaInfo>();
|
|
21932
|
-
CopyProperties(*result);
|
|
21933
|
-
return move(result);
|
|
21934
|
-
}
|
|
21935
|
-
};
|
|
21936
|
-
|
|
21937
|
-
} // namespace duckdb
|
|
21938
|
-
//===----------------------------------------------------------------------===//
|
|
21939
|
-
// DuckDB
|
|
21940
|
-
//
|
|
21941
|
-
// duckdb/parser/parsed_data/create_pragma_function_info.hpp
|
|
22075
|
+
// duckdb/parser/parsed_data/create_pragma_function_info.hpp
|
|
21942
22076
|
//
|
|
21943
22077
|
//
|
|
21944
22078
|
//===----------------------------------------------------------------------===//
|
|
@@ -21978,7 +22112,7 @@ public:
|
|
|
21978
22112
|
//===----------------------------------------------------------------------===//
|
|
21979
22113
|
// DuckDB
|
|
21980
22114
|
//
|
|
21981
|
-
// duckdb/parser/parsed_data/
|
|
22115
|
+
// duckdb/parser/parsed_data/export_table_data.hpp
|
|
21982
22116
|
//
|
|
21983
22117
|
//
|
|
21984
22118
|
//===----------------------------------------------------------------------===//
|
|
@@ -21990,47 +22124,26 @@ public:
|
|
|
21990
22124
|
|
|
21991
22125
|
namespace duckdb {
|
|
21992
22126
|
|
|
21993
|
-
struct
|
|
21994
|
-
|
|
21995
|
-
|
|
21996
|
-
this->name = function.name;
|
|
21997
|
-
functions.AddFunction(move(function));
|
|
21998
|
-
}
|
|
22127
|
+
struct ExportedTableData {
|
|
22128
|
+
//! Name of the exported table
|
|
22129
|
+
string table_name;
|
|
21999
22130
|
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
this->name = functions.name;
|
|
22003
|
-
for (auto &func : functions.functions) {
|
|
22004
|
-
func.name = functions.name;
|
|
22005
|
-
}
|
|
22006
|
-
}
|
|
22131
|
+
//! Name of the schema
|
|
22132
|
+
string schema_name;
|
|
22007
22133
|
|
|
22008
|
-
|
|
22134
|
+
//! Path to be exported
|
|
22135
|
+
string file_path;
|
|
22136
|
+
};
|
|
22009
22137
|
|
|
22010
|
-
public
|
|
22011
|
-
|
|
22012
|
-
auto result = make_unique<CreateAggregateFunctionInfo>(functions);
|
|
22013
|
-
CopyProperties(*result);
|
|
22014
|
-
return move(result);
|
|
22015
|
-
}
|
|
22138
|
+
struct BoundExportData : public ParseInfo {
|
|
22139
|
+
unordered_map<TableCatalogEntry *, ExportedTableData> data;
|
|
22016
22140
|
};
|
|
22017
22141
|
|
|
22018
22142
|
} // namespace duckdb
|
|
22019
22143
|
//===----------------------------------------------------------------------===//
|
|
22020
22144
|
// DuckDB
|
|
22021
22145
|
//
|
|
22022
|
-
// duckdb/parser/parsed_data/
|
|
22023
|
-
//
|
|
22024
|
-
//
|
|
22025
|
-
//===----------------------------------------------------------------------===//
|
|
22026
|
-
|
|
22027
|
-
|
|
22028
|
-
|
|
22029
|
-
|
|
22030
|
-
//===----------------------------------------------------------------------===//
|
|
22031
|
-
// DuckDB
|
|
22032
|
-
//
|
|
22033
|
-
// duckdb/function/macro_function.hpp
|
|
22146
|
+
// duckdb/parser/parsed_data/create_view_info.hpp
|
|
22034
22147
|
//
|
|
22035
22148
|
//
|
|
22036
22149
|
//===----------------------------------------------------------------------===//
|
|
@@ -22040,48 +22153,31 @@ public:
|
|
|
22040
22153
|
|
|
22041
22154
|
|
|
22042
22155
|
|
|
22043
|
-
|
|
22044
|
-
|
|
22045
|
-
namespace duckdb {
|
|
22046
|
-
|
|
22047
|
-
class MacroCatalogEntry;
|
|
22048
|
-
|
|
22049
|
-
class MacroFunction {
|
|
22050
|
-
public:
|
|
22051
|
-
explicit MacroFunction(unique_ptr<ParsedExpression> expression);
|
|
22052
|
-
|
|
22053
|
-
//! Check whether the supplied arguments are valid
|
|
22054
|
-
static string ValidateArguments(MacroCatalogEntry ¯o_func, FunctionExpression &function_expr,
|
|
22055
|
-
vector<unique_ptr<ParsedExpression>> &positionals,
|
|
22056
|
-
unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
|
|
22057
|
-
//! The macro expression
|
|
22058
|
-
unique_ptr<ParsedExpression> expression;
|
|
22059
|
-
//! The positional parameters
|
|
22060
|
-
vector<unique_ptr<ParsedExpression>> parameters;
|
|
22061
|
-
//! The default parameters and their associated values
|
|
22062
|
-
unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
|
|
22063
|
-
|
|
22064
|
-
public:
|
|
22065
|
-
unique_ptr<MacroFunction> Copy();
|
|
22066
|
-
};
|
|
22067
|
-
|
|
22068
|
-
} // namespace duckdb
|
|
22069
|
-
|
|
22070
|
-
|
|
22071
22156
|
namespace duckdb {
|
|
22072
22157
|
|
|
22073
|
-
struct
|
|
22074
|
-
|
|
22158
|
+
struct CreateViewInfo : public CreateInfo {
|
|
22159
|
+
CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
|
|
22160
|
+
}
|
|
22161
|
+
CreateViewInfo(string schema, string view_name)
|
|
22162
|
+
: CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
|
|
22075
22163
|
}
|
|
22076
22164
|
|
|
22077
|
-
|
|
22165
|
+
//! Table name to insert to
|
|
22166
|
+
string view_name;
|
|
22167
|
+
//! Aliases of the view
|
|
22168
|
+
vector<string> aliases;
|
|
22169
|
+
//! Return types
|
|
22170
|
+
vector<LogicalType> types;
|
|
22171
|
+
//! The SelectStatement of the view
|
|
22172
|
+
unique_ptr<SelectStatement> query;
|
|
22078
22173
|
|
|
22079
22174
|
public:
|
|
22080
22175
|
unique_ptr<CreateInfo> Copy() const override {
|
|
22081
|
-
auto result = make_unique<
|
|
22082
|
-
result->function = function->Copy();
|
|
22083
|
-
result->name = name;
|
|
22176
|
+
auto result = make_unique<CreateViewInfo>(schema, view_name);
|
|
22084
22177
|
CopyProperties(*result);
|
|
22178
|
+
result->aliases = aliases;
|
|
22179
|
+
result->types = types;
|
|
22180
|
+
result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
|
|
22085
22181
|
return move(result);
|
|
22086
22182
|
}
|
|
22087
22183
|
};
|
|
@@ -22090,7 +22186,7 @@ public:
|
|
|
22090
22186
|
//===----------------------------------------------------------------------===//
|
|
22091
22187
|
// DuckDB
|
|
22092
22188
|
//
|
|
22093
|
-
// duckdb/parser/tableref/
|
|
22189
|
+
// duckdb/parser/tableref/table_function_ref.hpp
|
|
22094
22190
|
//
|
|
22095
22191
|
//
|
|
22096
22192
|
//===----------------------------------------------------------------------===//
|
|
@@ -22100,26 +22196,32 @@ public:
|
|
|
22100
22196
|
|
|
22101
22197
|
|
|
22102
22198
|
|
|
22199
|
+
|
|
22200
|
+
|
|
22103
22201
|
namespace duckdb {
|
|
22104
|
-
//! Represents a
|
|
22105
|
-
class
|
|
22202
|
+
//! Represents a Table producing function
|
|
22203
|
+
class TableFunctionRef : public TableRef {
|
|
22106
22204
|
public:
|
|
22107
|
-
|
|
22205
|
+
TableFunctionRef() : TableRef(TableReferenceType::TABLE_FUNCTION) {
|
|
22206
|
+
}
|
|
22108
22207
|
|
|
22109
|
-
|
|
22110
|
-
unique_ptr<SelectStatement> subquery;
|
|
22111
|
-
//! Aliases for the column names
|
|
22208
|
+
unique_ptr<ParsedExpression> function;
|
|
22112
22209
|
vector<string> column_name_alias;
|
|
22113
22210
|
|
|
22211
|
+
// if the function takes a subquery as argument its in here
|
|
22212
|
+
unique_ptr<SelectStatement> subquery;
|
|
22213
|
+
|
|
22114
22214
|
public:
|
|
22215
|
+
string ToString() const override;
|
|
22216
|
+
|
|
22115
22217
|
bool Equals(const TableRef *other_p) const override;
|
|
22116
22218
|
|
|
22117
22219
|
unique_ptr<TableRef> Copy() override;
|
|
22118
22220
|
|
|
22119
|
-
//! Serializes a blob into a
|
|
22120
|
-
void Serialize(
|
|
22121
|
-
//! Deserializes a blob back into a
|
|
22122
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22221
|
+
//! Serializes a blob into a BaseTableRef
|
|
22222
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22223
|
+
//! Deserializes a blob back into a BaseTableRef
|
|
22224
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22123
22225
|
};
|
|
22124
22226
|
} // namespace duckdb
|
|
22125
22227
|
//===----------------------------------------------------------------------===//
|
|
@@ -22152,15 +22254,15 @@ public:
|
|
|
22152
22254
|
unique_ptr<TableRef> Copy() override;
|
|
22153
22255
|
|
|
22154
22256
|
//! Serializes a blob into a CrossProductRef
|
|
22155
|
-
void Serialize(
|
|
22257
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22156
22258
|
//! Deserializes a blob back into a CrossProductRef
|
|
22157
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22259
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22158
22260
|
};
|
|
22159
22261
|
} // namespace duckdb
|
|
22160
22262
|
//===----------------------------------------------------------------------===//
|
|
22161
22263
|
// DuckDB
|
|
22162
22264
|
//
|
|
22163
|
-
// duckdb/parser/tableref/
|
|
22265
|
+
// duckdb/parser/tableref/emptytableref.hpp
|
|
22164
22266
|
//
|
|
22165
22267
|
//
|
|
22166
22268
|
//===----------------------------------------------------------------------===//
|
|
@@ -22169,41 +22271,27 @@ public:
|
|
|
22169
22271
|
|
|
22170
22272
|
|
|
22171
22273
|
|
|
22172
|
-
|
|
22173
|
-
|
|
22174
|
-
|
|
22175
|
-
|
|
22176
22274
|
namespace duckdb {
|
|
22177
|
-
//! Represents a
|
|
22178
|
-
class
|
|
22275
|
+
//! Represents a cross product
|
|
22276
|
+
class EmptyTableRef : public TableRef {
|
|
22179
22277
|
public:
|
|
22180
|
-
|
|
22278
|
+
EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
|
|
22181
22279
|
}
|
|
22182
22280
|
|
|
22183
|
-
//! The left hand side of the join
|
|
22184
|
-
unique_ptr<TableRef> left;
|
|
22185
|
-
//! The right hand side of the join
|
|
22186
|
-
unique_ptr<TableRef> right;
|
|
22187
|
-
//! The join condition
|
|
22188
|
-
unique_ptr<ParsedExpression> condition;
|
|
22189
|
-
//! The join type
|
|
22190
|
-
JoinType type;
|
|
22191
|
-
//! Natural join
|
|
22192
|
-
bool is_natural;
|
|
22193
|
-
//! The set of USING columns (if any)
|
|
22194
|
-
vector<string> using_columns;
|
|
22195
|
-
|
|
22196
22281
|
public:
|
|
22197
22282
|
bool Equals(const TableRef *other_p) const override;
|
|
22198
22283
|
|
|
22199
22284
|
unique_ptr<TableRef> Copy() override;
|
|
22200
22285
|
|
|
22201
|
-
//! Serializes a blob into a
|
|
22202
|
-
void Serialize(
|
|
22203
|
-
//! Deserializes a blob back into a
|
|
22204
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22286
|
+
//! Serializes a blob into a DummyTableRef
|
|
22287
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22288
|
+
//! Deserializes a blob back into a DummyTableRef
|
|
22289
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22205
22290
|
};
|
|
22206
22291
|
} // namespace duckdb
|
|
22292
|
+
|
|
22293
|
+
|
|
22294
|
+
|
|
22207
22295
|
//===----------------------------------------------------------------------===//
|
|
22208
22296
|
// DuckDB
|
|
22209
22297
|
//
|
|
@@ -22239,15 +22327,16 @@ public:
|
|
|
22239
22327
|
unique_ptr<TableRef> Copy() override;
|
|
22240
22328
|
|
|
22241
22329
|
//! Serializes a blob into a ExpressionListRef
|
|
22242
|
-
void Serialize(
|
|
22330
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22243
22331
|
//! Deserializes a blob back into a ExpressionListRef
|
|
22244
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22332
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22245
22333
|
};
|
|
22246
22334
|
} // namespace duckdb
|
|
22335
|
+
|
|
22247
22336
|
//===----------------------------------------------------------------------===//
|
|
22248
22337
|
// DuckDB
|
|
22249
22338
|
//
|
|
22250
|
-
// duckdb/parser/tableref/
|
|
22339
|
+
// duckdb/parser/tableref/joinref.hpp
|
|
22251
22340
|
//
|
|
22252
22341
|
//
|
|
22253
22342
|
//===----------------------------------------------------------------------===//
|
|
@@ -22256,28 +22345,46 @@ public:
|
|
|
22256
22345
|
|
|
22257
22346
|
|
|
22258
22347
|
|
|
22348
|
+
|
|
22349
|
+
|
|
22350
|
+
|
|
22351
|
+
|
|
22259
22352
|
namespace duckdb {
|
|
22260
|
-
//! Represents a
|
|
22261
|
-
class
|
|
22353
|
+
//! Represents a JOIN between two expressions
|
|
22354
|
+
class JoinRef : public TableRef {
|
|
22262
22355
|
public:
|
|
22263
|
-
|
|
22356
|
+
JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
|
|
22264
22357
|
}
|
|
22265
22358
|
|
|
22359
|
+
//! The left hand side of the join
|
|
22360
|
+
unique_ptr<TableRef> left;
|
|
22361
|
+
//! The right hand side of the join
|
|
22362
|
+
unique_ptr<TableRef> right;
|
|
22363
|
+
//! The join condition
|
|
22364
|
+
unique_ptr<ParsedExpression> condition;
|
|
22365
|
+
//! The join type
|
|
22366
|
+
JoinType type;
|
|
22367
|
+
//! Natural join
|
|
22368
|
+
bool is_natural;
|
|
22369
|
+
//! The set of USING columns (if any)
|
|
22370
|
+
vector<string> using_columns;
|
|
22371
|
+
|
|
22266
22372
|
public:
|
|
22267
22373
|
bool Equals(const TableRef *other_p) const override;
|
|
22268
22374
|
|
|
22269
22375
|
unique_ptr<TableRef> Copy() override;
|
|
22270
22376
|
|
|
22271
|
-
//! Serializes a blob into a
|
|
22272
|
-
void Serialize(
|
|
22273
|
-
//! Deserializes a blob back into a
|
|
22274
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22377
|
+
//! Serializes a blob into a JoinRef
|
|
22378
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22379
|
+
//! Deserializes a blob back into a JoinRef
|
|
22380
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22275
22381
|
};
|
|
22276
22382
|
} // namespace duckdb
|
|
22383
|
+
|
|
22277
22384
|
//===----------------------------------------------------------------------===//
|
|
22278
22385
|
// DuckDB
|
|
22279
22386
|
//
|
|
22280
|
-
// duckdb/parser/tableref/
|
|
22387
|
+
// duckdb/parser/tableref/subqueryref.hpp
|
|
22281
22388
|
//
|
|
22282
22389
|
//
|
|
22283
22390
|
//===----------------------------------------------------------------------===//
|
|
@@ -22287,38 +22394,27 @@ public:
|
|
|
22287
22394
|
|
|
22288
22395
|
|
|
22289
22396
|
|
|
22290
|
-
|
|
22291
|
-
|
|
22292
22397
|
namespace duckdb {
|
|
22293
|
-
//! Represents a
|
|
22294
|
-
class
|
|
22398
|
+
//! Represents a subquery
|
|
22399
|
+
class SubqueryRef : public TableRef {
|
|
22295
22400
|
public:
|
|
22296
|
-
|
|
22297
|
-
}
|
|
22298
|
-
|
|
22299
|
-
unique_ptr<ParsedExpression> function;
|
|
22300
|
-
vector<string> column_name_alias;
|
|
22401
|
+
explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
|
|
22301
22402
|
|
|
22302
|
-
|
|
22403
|
+
//! The subquery
|
|
22303
22404
|
unique_ptr<SelectStatement> subquery;
|
|
22405
|
+
//! Aliases for the column names
|
|
22406
|
+
vector<string> column_name_alias;
|
|
22304
22407
|
|
|
22305
22408
|
public:
|
|
22306
|
-
string ToString() const override;
|
|
22307
|
-
|
|
22308
22409
|
bool Equals(const TableRef *other_p) const override;
|
|
22309
22410
|
|
|
22310
22411
|
unique_ptr<TableRef> Copy() override;
|
|
22311
22412
|
|
|
22312
|
-
//! Serializes a blob into a
|
|
22313
|
-
void Serialize(
|
|
22314
|
-
//! Deserializes a blob back into a
|
|
22315
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22413
|
+
//! Serializes a blob into a SubqueryRef
|
|
22414
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22415
|
+
//! Deserializes a blob back into a SubqueryRef
|
|
22416
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22316
22417
|
};
|
|
22317
22418
|
} // namespace duckdb
|
|
22318
22419
|
|
|
22319
22420
|
|
|
22320
|
-
|
|
22321
|
-
|
|
22322
|
-
|
|
22323
|
-
|
|
22324
|
-
|