duckdb 0.3.2-dev996.0 → 0.3.3-dev108.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 +17024 -15521
- package/src/duckdb.hpp +1277 -1160
- package/src/parquet-amalgamation.cpp +35996 -35886
- 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 "6eb39f78f"
|
|
15
|
+
#define DUCKDB_VERSION "v0.3.3-dev108"
|
|
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__)
|
|
@@ -959,11 +961,15 @@ enum class LogicalTypeId : uint8_t {
|
|
|
959
961
|
LIST = 101,
|
|
960
962
|
MAP = 102,
|
|
961
963
|
TABLE = 103,
|
|
962
|
-
ENUM = 104
|
|
964
|
+
ENUM = 104,
|
|
965
|
+
AGGREGATE_STATE = 105
|
|
963
966
|
};
|
|
964
967
|
|
|
965
968
|
struct ExtraTypeInfo;
|
|
966
969
|
|
|
970
|
+
|
|
971
|
+
struct aggregate_state_t;
|
|
972
|
+
|
|
967
973
|
struct LogicalType {
|
|
968
974
|
DUCKDB_API LogicalType();
|
|
969
975
|
DUCKDB_API LogicalType(LogicalTypeId id); // NOLINT: Allow implicit conversion from `LogicalTypeId`
|
|
@@ -1067,6 +1073,7 @@ public:
|
|
|
1067
1073
|
DUCKDB_API static LogicalType VARCHAR_COLLATION(string collation); // NOLINT
|
|
1068
1074
|
DUCKDB_API static LogicalType LIST( LogicalType child); // NOLINT
|
|
1069
1075
|
DUCKDB_API static LogicalType STRUCT( child_list_t<LogicalType> children); // NOLINT
|
|
1076
|
+
DUCKDB_API static LogicalType AGGREGATE_STATE(aggregate_state_t state_type); // NOLINT
|
|
1070
1077
|
DUCKDB_API static LogicalType MAP( child_list_t<LogicalType> children); // NOLINT
|
|
1071
1078
|
DUCKDB_API static LogicalType MAP(LogicalType key, LogicalType value); // NOLINT
|
|
1072
1079
|
DUCKDB_API static LogicalType ENUM(const string &enum_name, Vector &ordered_data, idx_t size); // NOLINT
|
|
@@ -1119,6 +1126,11 @@ struct MapType {
|
|
|
1119
1126
|
DUCKDB_API static const LogicalType &ValueType(const LogicalType &type);
|
|
1120
1127
|
};
|
|
1121
1128
|
|
|
1129
|
+
struct AggregateStateType {
|
|
1130
|
+
DUCKDB_API static const string GetTypeName(const LogicalType &type);
|
|
1131
|
+
DUCKDB_API static const aggregate_state_t &GetStateType(const LogicalType &type);
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1122
1134
|
|
|
1123
1135
|
string LogicalTypeIdToString(LogicalTypeId type);
|
|
1124
1136
|
|
|
@@ -1194,6 +1206,15 @@ bool IsIntegerType() {
|
|
|
1194
1206
|
bool ApproxEqual(float l, float r);
|
|
1195
1207
|
bool ApproxEqual(double l, double r);
|
|
1196
1208
|
|
|
1209
|
+
struct aggregate_state_t {
|
|
1210
|
+
aggregate_state_t(string function_name_p, LogicalType return_type_p, vector<LogicalType> bound_argument_types_p) : function_name(move(function_name_p)), return_type(move(return_type_p)), bound_argument_types(move(bound_argument_types_p)) {
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
string function_name;
|
|
1214
|
+
LogicalType return_type;
|
|
1215
|
+
vector<LogicalType> bound_argument_types;
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1197
1218
|
} // namespace duckdb
|
|
1198
1219
|
|
|
1199
1220
|
|
|
@@ -1548,6 +1569,7 @@ public:
|
|
|
1548
1569
|
} // namespace duckdb
|
|
1549
1570
|
|
|
1550
1571
|
|
|
1572
|
+
#include <type_traits>
|
|
1551
1573
|
|
|
1552
1574
|
namespace duckdb {
|
|
1553
1575
|
|
|
@@ -1561,19 +1583,18 @@ public:
|
|
|
1561
1583
|
|
|
1562
1584
|
template <class T>
|
|
1563
1585
|
void Write(T element) {
|
|
1586
|
+
static_assert(std::is_trivially_destructible<T>(), "Write element must be trivially destructible");
|
|
1587
|
+
|
|
1564
1588
|
WriteData((const_data_ptr_t)&element, sizeof(T));
|
|
1565
1589
|
}
|
|
1566
1590
|
|
|
1567
|
-
//! Write data from a string buffer directly (
|
|
1591
|
+
//! Write data from a string buffer directly (without length prefix)
|
|
1568
1592
|
void WriteBufferData(const string &str) {
|
|
1569
1593
|
WriteData((const_data_ptr_t)str.c_str(), str.size());
|
|
1570
1594
|
}
|
|
1571
1595
|
//! Write a string with a length prefix
|
|
1572
1596
|
void WriteString(const string &val) {
|
|
1573
|
-
|
|
1574
|
-
if (!val.empty()) {
|
|
1575
|
-
WriteData((const_data_ptr_t)val.c_str(), val.size());
|
|
1576
|
-
}
|
|
1597
|
+
WriteStringLen((const_data_ptr_t)val.c_str(), val.size());
|
|
1577
1598
|
}
|
|
1578
1599
|
void WriteStringLen(const_data_ptr_t val, idx_t len) {
|
|
1579
1600
|
Write<uint32_t>((uint32_t)len);
|
|
@@ -1583,7 +1604,7 @@ public:
|
|
|
1583
1604
|
}
|
|
1584
1605
|
|
|
1585
1606
|
template <class T>
|
|
1586
|
-
void WriteList(vector<unique_ptr<T>> &list) {
|
|
1607
|
+
void WriteList(const vector<unique_ptr<T>> &list) {
|
|
1587
1608
|
Write<uint32_t>((uint32_t)list.size());
|
|
1588
1609
|
for (auto &child : list) {
|
|
1589
1610
|
child->Serialize(*this);
|
|
@@ -1812,30 +1833,28 @@ enum class FileType {
|
|
|
1812
1833
|
|
|
1813
1834
|
struct FileHandle {
|
|
1814
1835
|
public:
|
|
1815
|
-
FileHandle(FileSystem &file_system, string path)
|
|
1816
|
-
}
|
|
1836
|
+
DUCKDB_API FileHandle(FileSystem &file_system, string path);
|
|
1817
1837
|
FileHandle(const FileHandle &) = delete;
|
|
1818
|
-
virtual ~FileHandle()
|
|
1819
|
-
}
|
|
1838
|
+
DUCKDB_API virtual ~FileHandle();
|
|
1820
1839
|
|
|
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();
|
|
1840
|
+
DUCKDB_API int64_t Read(void *buffer, idx_t nr_bytes);
|
|
1841
|
+
DUCKDB_API int64_t Write(void *buffer, idx_t nr_bytes);
|
|
1842
|
+
DUCKDB_API void Read(void *buffer, idx_t nr_bytes, idx_t location);
|
|
1843
|
+
DUCKDB_API void Write(void *buffer, idx_t nr_bytes, idx_t location);
|
|
1844
|
+
DUCKDB_API void Seek(idx_t location);
|
|
1845
|
+
DUCKDB_API void Reset();
|
|
1846
|
+
DUCKDB_API idx_t SeekPosition();
|
|
1847
|
+
DUCKDB_API void Sync();
|
|
1848
|
+
DUCKDB_API void Truncate(int64_t new_size);
|
|
1849
|
+
DUCKDB_API string ReadLine();
|
|
1831
1850
|
|
|
1832
|
-
bool CanSeek();
|
|
1833
|
-
bool OnDiskFile();
|
|
1834
|
-
idx_t GetFileSize();
|
|
1835
|
-
FileType GetType();
|
|
1851
|
+
DUCKDB_API bool CanSeek();
|
|
1852
|
+
DUCKDB_API bool OnDiskFile();
|
|
1853
|
+
DUCKDB_API idx_t GetFileSize();
|
|
1854
|
+
DUCKDB_API FileType GetType();
|
|
1836
1855
|
|
|
1837
1856
|
//! Closes the file handle.
|
|
1838
|
-
virtual void Close() = 0;
|
|
1857
|
+
DUCKDB_API virtual void Close() = 0;
|
|
1839
1858
|
|
|
1840
1859
|
public:
|
|
1841
1860
|
FileSystem &file_system;
|
|
@@ -1862,107 +1881,107 @@ public:
|
|
|
1862
1881
|
|
|
1863
1882
|
class FileSystem {
|
|
1864
1883
|
public:
|
|
1865
|
-
virtual ~FileSystem()
|
|
1866
|
-
}
|
|
1884
|
+
DUCKDB_API virtual ~FileSystem();
|
|
1867
1885
|
|
|
1868
1886
|
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);
|
|
1887
|
+
DUCKDB_API static constexpr FileLockType DEFAULT_LOCK = FileLockType::NO_LOCK;
|
|
1888
|
+
DUCKDB_API static constexpr FileCompressionType DEFAULT_COMPRESSION = FileCompressionType::UNCOMPRESSED;
|
|
1889
|
+
DUCKDB_API static FileSystem &GetFileSystem(ClientContext &context);
|
|
1890
|
+
DUCKDB_API static FileSystem &GetFileSystem(DatabaseInstance &db);
|
|
1891
|
+
DUCKDB_API static FileOpener *GetFileOpener(ClientContext &context);
|
|
1874
1892
|
|
|
1875
|
-
virtual unique_ptr<FileHandle> OpenFile(const string &path, uint8_t flags,
|
|
1876
|
-
|
|
1877
|
-
|
|
1893
|
+
DUCKDB_API virtual unique_ptr<FileHandle> OpenFile(const string &path, uint8_t flags,
|
|
1894
|
+
FileLockType lock = DEFAULT_LOCK,
|
|
1895
|
+
FileCompressionType compression = DEFAULT_COMPRESSION,
|
|
1896
|
+
FileOpener *opener = nullptr);
|
|
1878
1897
|
|
|
1879
1898
|
//! Read exactly nr_bytes from the specified location in the file. Fails if nr_bytes could not be read. This is
|
|
1880
1899
|
//! equivalent to calling SetFilePointer(location) followed by calling Read().
|
|
1881
|
-
virtual void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location);
|
|
1900
|
+
DUCKDB_API virtual void Read(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location);
|
|
1882
1901
|
//! Write exactly nr_bytes to the specified location in the file. Fails if nr_bytes could not be read. This is
|
|
1883
1902
|
//! equivalent to calling SetFilePointer(location) followed by calling Write().
|
|
1884
|
-
virtual void Write(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location);
|
|
1903
|
+
DUCKDB_API virtual void Write(FileHandle &handle, void *buffer, int64_t nr_bytes, idx_t location);
|
|
1885
1904
|
//! Read nr_bytes from the specified file into the buffer, moving the file pointer forward by nr_bytes. Returns the
|
|
1886
1905
|
//! amount of bytes read.
|
|
1887
|
-
virtual int64_t Read(FileHandle &handle, void *buffer, int64_t nr_bytes);
|
|
1906
|
+
DUCKDB_API virtual int64_t Read(FileHandle &handle, void *buffer, int64_t nr_bytes);
|
|
1888
1907
|
//! 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);
|
|
1908
|
+
DUCKDB_API virtual int64_t Write(FileHandle &handle, void *buffer, int64_t nr_bytes);
|
|
1890
1909
|
|
|
1891
1910
|
//! Returns the file size of a file handle, returns -1 on error
|
|
1892
|
-
virtual int64_t GetFileSize(FileHandle &handle);
|
|
1911
|
+
DUCKDB_API virtual int64_t GetFileSize(FileHandle &handle);
|
|
1893
1912
|
//! 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);
|
|
1913
|
+
DUCKDB_API virtual time_t GetLastModifiedTime(FileHandle &handle);
|
|
1895
1914
|
//! 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);
|
|
1915
|
+
DUCKDB_API virtual FileType GetFileType(FileHandle &handle);
|
|
1897
1916
|
//! Truncate a file to a maximum size of new_size, new_size should be smaller than or equal to the current size of
|
|
1898
1917
|
//! the file
|
|
1899
|
-
virtual void Truncate(FileHandle &handle, int64_t new_size);
|
|
1918
|
+
DUCKDB_API virtual void Truncate(FileHandle &handle, int64_t new_size);
|
|
1900
1919
|
|
|
1901
1920
|
//! Check if a directory exists
|
|
1902
|
-
virtual bool DirectoryExists(const string &directory);
|
|
1921
|
+
DUCKDB_API virtual bool DirectoryExists(const string &directory);
|
|
1903
1922
|
//! Create a directory if it does not exist
|
|
1904
|
-
virtual void CreateDirectory(const string &directory);
|
|
1923
|
+
DUCKDB_API virtual void CreateDirectory(const string &directory);
|
|
1905
1924
|
//! Recursively remove a directory and all files in it
|
|
1906
|
-
virtual void RemoveDirectory(const string &directory);
|
|
1925
|
+
DUCKDB_API virtual void RemoveDirectory(const string &directory);
|
|
1907
1926
|
//! 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);
|
|
1927
|
+
DUCKDB_API virtual bool ListFiles(const string &directory, const std::function<void(string, bool)> &callback);
|
|
1909
1928
|
//! Move a file from source path to the target, StorageManager relies on this being an atomic action for ACID
|
|
1910
1929
|
//! properties
|
|
1911
|
-
virtual void MoveFile(const string &source, const string &target);
|
|
1930
|
+
DUCKDB_API virtual void MoveFile(const string &source, const string &target);
|
|
1912
1931
|
//! Check if a file exists
|
|
1913
|
-
virtual bool FileExists(const string &filename);
|
|
1932
|
+
DUCKDB_API virtual bool FileExists(const string &filename);
|
|
1914
1933
|
//! Remove a file from disk
|
|
1915
|
-
virtual void RemoveFile(const string &filename);
|
|
1934
|
+
DUCKDB_API virtual void RemoveFile(const string &filename);
|
|
1916
1935
|
//! Sync a file handle to disk
|
|
1917
|
-
virtual void FileSync(FileHandle &handle);
|
|
1936
|
+
DUCKDB_API virtual void FileSync(FileHandle &handle);
|
|
1918
1937
|
|
|
1919
1938
|
//! Sets the working directory
|
|
1920
|
-
static void SetWorkingDirectory(const string &path);
|
|
1939
|
+
DUCKDB_API static void SetWorkingDirectory(const string &path);
|
|
1921
1940
|
//! Gets the working directory
|
|
1922
|
-
static string GetWorkingDirectory();
|
|
1941
|
+
DUCKDB_API static string GetWorkingDirectory();
|
|
1923
1942
|
//! Gets the users home directory
|
|
1924
|
-
static string GetHomeDirectory();
|
|
1943
|
+
DUCKDB_API static string GetHomeDirectory();
|
|
1925
1944
|
//! Returns the system-available memory in bytes
|
|
1926
|
-
static idx_t GetAvailableMemory();
|
|
1945
|
+
DUCKDB_API static idx_t GetAvailableMemory();
|
|
1927
1946
|
//! Path separator for the current file system
|
|
1928
|
-
static string PathSeparator();
|
|
1947
|
+
DUCKDB_API static string PathSeparator();
|
|
1929
1948
|
//! Join two paths together
|
|
1930
|
-
static string JoinPath(const string &a, const string &path);
|
|
1949
|
+
DUCKDB_API static string JoinPath(const string &a, const string &path);
|
|
1931
1950
|
//! Convert separators in a path to the local separators (e.g. convert "/" into \\ on windows)
|
|
1932
|
-
static string ConvertSeparators(const string &path);
|
|
1951
|
+
DUCKDB_API static string ConvertSeparators(const string &path);
|
|
1933
1952
|
//! 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);
|
|
1953
|
+
DUCKDB_API static string ExtractBaseName(const string &path);
|
|
1935
1954
|
|
|
1936
1955
|
//! Runs a glob on the file system, returning a list of matching files
|
|
1937
|
-
virtual vector<string> Glob(const string &path);
|
|
1956
|
+
DUCKDB_API virtual vector<string> Glob(const string &path);
|
|
1938
1957
|
|
|
1939
1958
|
//! 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);
|
|
1959
|
+
DUCKDB_API virtual void RegisterSubSystem(unique_ptr<FileSystem> sub_fs);
|
|
1960
|
+
DUCKDB_API virtual void RegisterSubSystem(FileCompressionType compression_type, unique_ptr<FileSystem> fs);
|
|
1942
1961
|
|
|
1943
1962
|
//! Whether or not a sub-system can handle a specific file path
|
|
1944
|
-
virtual bool CanHandleFile(const string &fpath);
|
|
1963
|
+
DUCKDB_API virtual bool CanHandleFile(const string &fpath);
|
|
1945
1964
|
|
|
1946
1965
|
//! 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);
|
|
1966
|
+
DUCKDB_API virtual void Seek(FileHandle &handle, idx_t location);
|
|
1948
1967
|
//! 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);
|
|
1968
|
+
DUCKDB_API virtual void Reset(FileHandle &handle);
|
|
1969
|
+
DUCKDB_API virtual idx_t SeekPosition(FileHandle &handle);
|
|
1951
1970
|
|
|
1952
1971
|
//! Whether or not we can seek into the file
|
|
1953
|
-
virtual bool CanSeek();
|
|
1972
|
+
DUCKDB_API virtual bool CanSeek();
|
|
1954
1973
|
//! Whether or not the FS handles plain files on disk. This is relevant for certain optimizations, as random reads
|
|
1955
1974
|
//! 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);
|
|
1975
|
+
DUCKDB_API virtual bool OnDiskFile(FileHandle &handle);
|
|
1957
1976
|
|
|
1958
|
-
virtual unique_ptr<FileHandle> OpenCompressedFile(unique_ptr<FileHandle> handle, bool write);
|
|
1977
|
+
DUCKDB_API virtual unique_ptr<FileHandle> OpenCompressedFile(unique_ptr<FileHandle> handle, bool write);
|
|
1959
1978
|
|
|
1960
1979
|
//! Create a LocalFileSystem.
|
|
1961
|
-
static unique_ptr<FileSystem> CreateLocal();
|
|
1980
|
+
DUCKDB_API static unique_ptr<FileSystem> CreateLocal();
|
|
1962
1981
|
|
|
1963
1982
|
protected:
|
|
1964
1983
|
//! Return the name of the filesytem. Used for forming diagnosis messages.
|
|
1965
|
-
virtual std::string GetName() const = 0;
|
|
1984
|
+
DUCKDB_API virtual std::string GetName() const = 0;
|
|
1966
1985
|
};
|
|
1967
1986
|
|
|
1968
1987
|
} // namespace duckdb
|
|
@@ -2368,6 +2387,41 @@ public:
|
|
|
2368
2387
|
return true;
|
|
2369
2388
|
}
|
|
2370
2389
|
|
|
2390
|
+
idx_t CountValid(const idx_t count) const {
|
|
2391
|
+
if (AllValid() || count == 0) {
|
|
2392
|
+
return count;
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
idx_t valid = 0;
|
|
2396
|
+
const auto entry_count = EntryCount(count);
|
|
2397
|
+
for (idx_t entry_idx = 0; entry_idx < entry_count;) {
|
|
2398
|
+
auto entry = GetValidityEntry(entry_idx++);
|
|
2399
|
+
// Handle ragged end
|
|
2400
|
+
if (entry_idx == entry_count) {
|
|
2401
|
+
idx_t idx_in_entry;
|
|
2402
|
+
GetEntryIndex(count, entry_idx, idx_in_entry);
|
|
2403
|
+
for (idx_t i = 0; i < idx_in_entry; ++i) {
|
|
2404
|
+
valid += idx_t(RowIsValid(entry, i));
|
|
2405
|
+
}
|
|
2406
|
+
break;
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
// Handle all set
|
|
2410
|
+
if (AllValid(entry)) {
|
|
2411
|
+
valid += BITS_PER_VALUE;
|
|
2412
|
+
continue;
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
// Count partial entry (Kernighan's algorithm)
|
|
2416
|
+
while (entry) {
|
|
2417
|
+
entry &= (entry - 1);
|
|
2418
|
+
++valid;
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
|
|
2422
|
+
return valid;
|
|
2423
|
+
}
|
|
2424
|
+
|
|
2371
2425
|
inline V *GetData() const {
|
|
2372
2426
|
return validity_mask;
|
|
2373
2427
|
}
|
|
@@ -2742,7 +2796,7 @@ public:
|
|
|
2742
2796
|
DUCKDB_API bool TryCastAs(const LogicalType &target_type, bool strict = false);
|
|
2743
2797
|
|
|
2744
2798
|
//! Serializes a Value to a stand-alone binary blob
|
|
2745
|
-
DUCKDB_API void Serialize(Serializer &serializer);
|
|
2799
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
2746
2800
|
//! Deserializes a Value from a blob
|
|
2747
2801
|
DUCKDB_API static Value Deserialize(Deserializer &source);
|
|
2748
2802
|
|
|
@@ -3288,6 +3342,21 @@ enum class VectorBufferType : uint8_t {
|
|
|
3288
3342
|
OPAQUE_BUFFER // opaque buffer, can be created for example by the parquet reader
|
|
3289
3343
|
};
|
|
3290
3344
|
|
|
3345
|
+
enum class VectorAuxiliaryDataType : uint8_t {
|
|
3346
|
+
ARROW_AUXILIARY // Holds Arrow Chunks that this vector depends on
|
|
3347
|
+
};
|
|
3348
|
+
|
|
3349
|
+
struct VectorAuxiliaryData {
|
|
3350
|
+
explicit VectorAuxiliaryData(VectorAuxiliaryDataType type_p)
|
|
3351
|
+
: type(type_p) {
|
|
3352
|
+
|
|
3353
|
+
};
|
|
3354
|
+
VectorAuxiliaryDataType type;
|
|
3355
|
+
|
|
3356
|
+
virtual ~VectorAuxiliaryData() {
|
|
3357
|
+
}
|
|
3358
|
+
};
|
|
3359
|
+
|
|
3291
3360
|
//! The VectorBuffer is a class used by the vector to hold its data
|
|
3292
3361
|
class VectorBuffer {
|
|
3293
3362
|
public:
|
|
@@ -3310,10 +3379,19 @@ public:
|
|
|
3310
3379
|
data_ptr_t GetData() {
|
|
3311
3380
|
return data.get();
|
|
3312
3381
|
}
|
|
3382
|
+
|
|
3313
3383
|
void SetData(unique_ptr<data_t[]> new_data) {
|
|
3314
3384
|
data = move(new_data);
|
|
3315
3385
|
}
|
|
3316
3386
|
|
|
3387
|
+
VectorAuxiliaryData *GetAuxiliaryData() {
|
|
3388
|
+
return aux_data.get();
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
void SetAuxiliaryData(unique_ptr<VectorAuxiliaryData> aux_data_p, VectorAuxiliaryDataType aux_type_p) {
|
|
3392
|
+
aux_data = move(aux_data_p);
|
|
3393
|
+
}
|
|
3394
|
+
|
|
3317
3395
|
static buffer_ptr<VectorBuffer> CreateStandardVector(PhysicalType type, idx_t capacity = STANDARD_VECTOR_SIZE);
|
|
3318
3396
|
static buffer_ptr<VectorBuffer> CreateConstantVector(PhysicalType type);
|
|
3319
3397
|
static buffer_ptr<VectorBuffer> CreateConstantVector(const LogicalType &logical_type);
|
|
@@ -3324,8 +3402,13 @@ public:
|
|
|
3324
3402
|
return buffer_type;
|
|
3325
3403
|
}
|
|
3326
3404
|
|
|
3405
|
+
inline VectorAuxiliaryDataType GetAuxiliaryDataType() const {
|
|
3406
|
+
return aux_data->type;
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3327
3409
|
protected:
|
|
3328
3410
|
VectorBufferType buffer_type;
|
|
3411
|
+
unique_ptr<VectorAuxiliaryData> aux_data;
|
|
3329
3412
|
unique_ptr<data_t[]> data;
|
|
3330
3413
|
};
|
|
3331
3414
|
|
|
@@ -3811,6 +3894,141 @@ struct SequenceVector {
|
|
|
3811
3894
|
|
|
3812
3895
|
|
|
3813
3896
|
|
|
3897
|
+
//===----------------------------------------------------------------------===//
|
|
3898
|
+
// DuckDB
|
|
3899
|
+
//
|
|
3900
|
+
// duckdb/common/arrow_wrapper.hpp
|
|
3901
|
+
//
|
|
3902
|
+
//
|
|
3903
|
+
//===----------------------------------------------------------------------===//
|
|
3904
|
+
|
|
3905
|
+
|
|
3906
|
+
//===----------------------------------------------------------------------===//
|
|
3907
|
+
// DuckDB
|
|
3908
|
+
//
|
|
3909
|
+
// duckdb/common/arrow.hpp
|
|
3910
|
+
//
|
|
3911
|
+
//
|
|
3912
|
+
//===----------------------------------------------------------------------===//
|
|
3913
|
+
|
|
3914
|
+
#ifndef ARROW_FLAG_DICTIONARY_ORDERED
|
|
3915
|
+
|
|
3916
|
+
#include <stdint.h>
|
|
3917
|
+
|
|
3918
|
+
#ifdef __cplusplus
|
|
3919
|
+
extern "C" {
|
|
3920
|
+
#endif
|
|
3921
|
+
|
|
3922
|
+
#define ARROW_FLAG_DICTIONARY_ORDERED 1
|
|
3923
|
+
#define ARROW_FLAG_NULLABLE 2
|
|
3924
|
+
#define ARROW_FLAG_MAP_KEYS_SORTED 4
|
|
3925
|
+
|
|
3926
|
+
struct ArrowSchema {
|
|
3927
|
+
// Array type description
|
|
3928
|
+
const char *format;
|
|
3929
|
+
const char *name;
|
|
3930
|
+
const char *metadata;
|
|
3931
|
+
int64_t flags;
|
|
3932
|
+
int64_t n_children;
|
|
3933
|
+
struct ArrowSchema **children;
|
|
3934
|
+
struct ArrowSchema *dictionary;
|
|
3935
|
+
|
|
3936
|
+
// Release callback
|
|
3937
|
+
void (*release)(struct ArrowSchema *);
|
|
3938
|
+
// Opaque producer-specific data
|
|
3939
|
+
void *private_data;
|
|
3940
|
+
};
|
|
3941
|
+
|
|
3942
|
+
struct ArrowArray {
|
|
3943
|
+
// Array data description
|
|
3944
|
+
int64_t length;
|
|
3945
|
+
int64_t null_count;
|
|
3946
|
+
int64_t offset;
|
|
3947
|
+
int64_t n_buffers;
|
|
3948
|
+
int64_t n_children;
|
|
3949
|
+
const void **buffers;
|
|
3950
|
+
struct ArrowArray **children;
|
|
3951
|
+
struct ArrowArray *dictionary;
|
|
3952
|
+
|
|
3953
|
+
// Release callback
|
|
3954
|
+
void (*release)(struct ArrowArray *);
|
|
3955
|
+
// Opaque producer-specific data
|
|
3956
|
+
void *private_data;
|
|
3957
|
+
};
|
|
3958
|
+
|
|
3959
|
+
// EXPERIMENTAL
|
|
3960
|
+
struct ArrowArrayStream {
|
|
3961
|
+
// Callback to get the stream type
|
|
3962
|
+
// (will be the same for all arrays in the stream).
|
|
3963
|
+
// Return value: 0 if successful, an `errno`-compatible error code otherwise.
|
|
3964
|
+
int (*get_schema)(struct ArrowArrayStream *, struct ArrowSchema *out);
|
|
3965
|
+
// Callback to get the next array
|
|
3966
|
+
// (if no error and the array is released, the stream has ended)
|
|
3967
|
+
// Return value: 0 if successful, an `errno`-compatible error code otherwise.
|
|
3968
|
+
int (*get_next)(struct ArrowArrayStream *, struct ArrowArray *out);
|
|
3969
|
+
|
|
3970
|
+
// Callback to get optional detailed error information.
|
|
3971
|
+
// This must only be called if the last stream operation failed
|
|
3972
|
+
// with a non-0 return code. The returned pointer is only valid until
|
|
3973
|
+
// the next operation on this stream (including release).
|
|
3974
|
+
// If unavailable, NULL is returned.
|
|
3975
|
+
const char *(*get_last_error)(struct ArrowArrayStream *);
|
|
3976
|
+
|
|
3977
|
+
// Release callback: release the stream's own resources.
|
|
3978
|
+
// Note that arrays returned by `get_next` must be individually released.
|
|
3979
|
+
void (*release)(struct ArrowArrayStream *);
|
|
3980
|
+
// Opaque producer-specific data
|
|
3981
|
+
void *private_data;
|
|
3982
|
+
};
|
|
3983
|
+
|
|
3984
|
+
#ifdef __cplusplus
|
|
3985
|
+
}
|
|
3986
|
+
#endif
|
|
3987
|
+
|
|
3988
|
+
#endif
|
|
3989
|
+
|
|
3990
|
+
|
|
3991
|
+
|
|
3992
|
+
//! Here we have the internal duckdb classes that interact with Arrow's Internal Header (i.e., duckdb/commons/arrow.hpp)
|
|
3993
|
+
namespace duckdb {
|
|
3994
|
+
class ArrowSchemaWrapper {
|
|
3995
|
+
public:
|
|
3996
|
+
ArrowSchema arrow_schema;
|
|
3997
|
+
|
|
3998
|
+
ArrowSchemaWrapper() {
|
|
3999
|
+
arrow_schema.release = nullptr;
|
|
4000
|
+
}
|
|
4001
|
+
|
|
4002
|
+
~ArrowSchemaWrapper();
|
|
4003
|
+
};
|
|
4004
|
+
class ArrowArrayWrapper {
|
|
4005
|
+
public:
|
|
4006
|
+
ArrowArray arrow_array;
|
|
4007
|
+
ArrowArrayWrapper() {
|
|
4008
|
+
arrow_array.length = 0;
|
|
4009
|
+
arrow_array.release = nullptr;
|
|
4010
|
+
}
|
|
4011
|
+
~ArrowArrayWrapper();
|
|
4012
|
+
};
|
|
4013
|
+
|
|
4014
|
+
class ArrowArrayStreamWrapper {
|
|
4015
|
+
public:
|
|
4016
|
+
ArrowArrayStream arrow_array_stream;
|
|
4017
|
+
int64_t number_of_rows;
|
|
4018
|
+
void GetSchema(ArrowSchemaWrapper &schema);
|
|
4019
|
+
|
|
4020
|
+
shared_ptr<ArrowArrayWrapper> GetNextChunk();
|
|
4021
|
+
|
|
4022
|
+
const char *GetError();
|
|
4023
|
+
|
|
4024
|
+
~ArrowArrayStreamWrapper();
|
|
4025
|
+
ArrowArrayStreamWrapper() {
|
|
4026
|
+
arrow_array_stream.release = nullptr;
|
|
4027
|
+
}
|
|
4028
|
+
};
|
|
4029
|
+
} // namespace duckdb
|
|
4030
|
+
|
|
4031
|
+
|
|
3814
4032
|
struct ArrowArray;
|
|
3815
4033
|
|
|
3816
4034
|
namespace duckdb {
|
|
@@ -5258,27 +5476,20 @@ private:
|
|
|
5258
5476
|
|
|
5259
5477
|
|
|
5260
5478
|
|
|
5261
|
-
|
|
5262
5479
|
//===----------------------------------------------------------------------===//
|
|
5263
5480
|
// DuckDB
|
|
5264
5481
|
//
|
|
5265
|
-
// duckdb/common/
|
|
5482
|
+
// duckdb/common/named_parameter_map.hpp
|
|
5266
5483
|
//
|
|
5267
5484
|
//
|
|
5268
5485
|
//===----------------------------------------------------------------------===//
|
|
5269
5486
|
|
|
5270
5487
|
|
|
5271
5488
|
|
|
5272
|
-
#include <unordered_set>
|
|
5273
|
-
|
|
5274
|
-
namespace duckdb {
|
|
5275
|
-
using std::unordered_set;
|
|
5276
|
-
}
|
|
5277
|
-
|
|
5278
5489
|
//===----------------------------------------------------------------------===//
|
|
5279
5490
|
// DuckDB
|
|
5280
5491
|
//
|
|
5281
|
-
// duckdb/
|
|
5492
|
+
// duckdb/common/case_insensitive_map.hpp
|
|
5282
5493
|
//
|
|
5283
5494
|
//
|
|
5284
5495
|
//===----------------------------------------------------------------------===//
|
|
@@ -5286,32 +5497,27 @@ using std::unordered_set;
|
|
|
5286
5497
|
|
|
5287
5498
|
|
|
5288
5499
|
|
|
5289
|
-
|
|
5290
5500
|
//===----------------------------------------------------------------------===//
|
|
5291
5501
|
// DuckDB
|
|
5292
5502
|
//
|
|
5293
|
-
// duckdb/
|
|
5503
|
+
// duckdb/common/unordered_set.hpp
|
|
5294
5504
|
//
|
|
5295
5505
|
//
|
|
5296
5506
|
//===----------------------------------------------------------------------===//
|
|
5297
5507
|
|
|
5298
5508
|
|
|
5299
5509
|
|
|
5300
|
-
|
|
5301
|
-
// DuckDB
|
|
5302
|
-
//
|
|
5303
|
-
// duckdb/parser/base_expression.hpp
|
|
5304
|
-
//
|
|
5305
|
-
//
|
|
5306
|
-
//===----------------------------------------------------------------------===//
|
|
5307
|
-
|
|
5510
|
+
#include <unordered_set>
|
|
5308
5511
|
|
|
5512
|
+
namespace duckdb {
|
|
5513
|
+
using std::unordered_set;
|
|
5514
|
+
}
|
|
5309
5515
|
|
|
5310
5516
|
|
|
5311
5517
|
//===----------------------------------------------------------------------===//
|
|
5312
5518
|
// DuckDB
|
|
5313
5519
|
//
|
|
5314
|
-
// duckdb/common/
|
|
5520
|
+
// duckdb/common/string_util.hpp
|
|
5315
5521
|
//
|
|
5316
5522
|
//
|
|
5317
5523
|
//===----------------------------------------------------------------------===//
|
|
@@ -5320,22 +5526,219 @@ using std::unordered_set;
|
|
|
5320
5526
|
|
|
5321
5527
|
|
|
5322
5528
|
|
|
5529
|
+
|
|
5530
|
+
|
|
5323
5531
|
namespace duckdb {
|
|
5532
|
+
/**
|
|
5533
|
+
* String Utility Functions
|
|
5534
|
+
* Note that these are not the most efficient implementations (i.e., they copy
|
|
5535
|
+
* memory) and therefore they should only be used for debug messages and other
|
|
5536
|
+
* such things.
|
|
5537
|
+
*/
|
|
5538
|
+
class StringUtil {
|
|
5539
|
+
public:
|
|
5540
|
+
DUCKDB_API static bool CharacterIsSpace(char c) {
|
|
5541
|
+
return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r';
|
|
5542
|
+
}
|
|
5543
|
+
DUCKDB_API static bool CharacterIsNewline(char c) {
|
|
5544
|
+
return c == '\n' || c == '\r';
|
|
5545
|
+
}
|
|
5546
|
+
DUCKDB_API static bool CharacterIsDigit(char c) {
|
|
5547
|
+
return c >= '0' && c <= '9';
|
|
5548
|
+
}
|
|
5549
|
+
DUCKDB_API static char CharacterToLower(char c) {
|
|
5550
|
+
if (c >= 'A' && c <= 'Z') {
|
|
5551
|
+
return c - ('A' - 'a');
|
|
5552
|
+
}
|
|
5553
|
+
return c;
|
|
5554
|
+
}
|
|
5324
5555
|
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
//===--------------------------------------------------------------------===//
|
|
5328
|
-
enum class ExpressionType : uint8_t {
|
|
5329
|
-
INVALID = 0,
|
|
5556
|
+
//! Returns true if the needle string exists in the haystack
|
|
5557
|
+
DUCKDB_API static bool Contains(const string &haystack, const string &needle);
|
|
5330
5558
|
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5559
|
+
//! Returns true if the target string starts with the given prefix
|
|
5560
|
+
DUCKDB_API static bool StartsWith(string str, string prefix);
|
|
5561
|
+
|
|
5562
|
+
//! Returns true if the target string <b>ends</b> with the given suffix.
|
|
5563
|
+
DUCKDB_API static bool EndsWith(const string &str, const string &suffix);
|
|
5564
|
+
|
|
5565
|
+
//! Repeat a string multiple times
|
|
5566
|
+
DUCKDB_API static string Repeat(const string &str, const idx_t n);
|
|
5567
|
+
|
|
5568
|
+
//! Split the input string based on newline char
|
|
5569
|
+
DUCKDB_API static vector<string> Split(const string &str, char delimiter);
|
|
5570
|
+
|
|
5571
|
+
//! Split the input string allong a quote. Note that any escaping is NOT supported.
|
|
5572
|
+
DUCKDB_API static vector<string> SplitWithQuote(const string &str, char delimiter = ',', char quote = '"');
|
|
5573
|
+
|
|
5574
|
+
//! Join multiple strings into one string. Components are concatenated by the given separator
|
|
5575
|
+
DUCKDB_API static string Join(const vector<string> &input, const string &separator);
|
|
5576
|
+
|
|
5577
|
+
//! Join multiple items of container with given size, transformed to string
|
|
5578
|
+
//! using function, into one string using the given separator
|
|
5579
|
+
template <typename C, typename S, typename Func>
|
|
5580
|
+
static string Join(const C &input, S count, const string &separator, Func f) {
|
|
5581
|
+
// The result
|
|
5582
|
+
std::string result;
|
|
5583
|
+
|
|
5584
|
+
// If the input isn't empty, append the first element. We do this so we
|
|
5585
|
+
// don't need to introduce an if into the loop.
|
|
5586
|
+
if (count > 0) {
|
|
5587
|
+
result += f(input[0]);
|
|
5588
|
+
}
|
|
5589
|
+
|
|
5590
|
+
// Append the remaining input components, after the first
|
|
5591
|
+
for (size_t i = 1; i < count; i++) {
|
|
5592
|
+
result += separator + f(input[i]);
|
|
5593
|
+
}
|
|
5594
|
+
|
|
5595
|
+
return result;
|
|
5596
|
+
}
|
|
5597
|
+
|
|
5598
|
+
//! Return a string that formats the give number of bytes
|
|
5599
|
+
DUCKDB_API static string BytesToHumanReadableString(idx_t bytes);
|
|
5600
|
+
|
|
5601
|
+
//! Convert a string to uppercase
|
|
5602
|
+
DUCKDB_API static string Upper(const string &str);
|
|
5603
|
+
|
|
5604
|
+
//! Convert a string to lowercase
|
|
5605
|
+
DUCKDB_API static string Lower(const string &str);
|
|
5606
|
+
|
|
5607
|
+
//! Format a string using printf semantics
|
|
5608
|
+
template <typename... Args>
|
|
5609
|
+
static string Format(const string fmt_str, Args... params) {
|
|
5610
|
+
return Exception::ConstructMessage(fmt_str, params...);
|
|
5611
|
+
}
|
|
5612
|
+
|
|
5613
|
+
//! Split the input string into a vector of strings based on the split string
|
|
5614
|
+
DUCKDB_API static vector<string> Split(const string &input, const string &split);
|
|
5615
|
+
|
|
5616
|
+
//! Remove the whitespace char in the left end of the string
|
|
5617
|
+
DUCKDB_API static void LTrim(string &str);
|
|
5618
|
+
//! Remove the whitespace char in the right end of the string
|
|
5619
|
+
DUCKDB_API static void RTrim(string &str);
|
|
5620
|
+
//! Remove the whitespace char in the left and right end of the string
|
|
5621
|
+
DUCKDB_API static void Trim(string &str);
|
|
5622
|
+
|
|
5623
|
+
DUCKDB_API static string Replace(string source, const string &from, const string &to);
|
|
5624
|
+
|
|
5625
|
+
//! Get the levenshtein distance from two strings
|
|
5626
|
+
DUCKDB_API static idx_t LevenshteinDistance(const string &s1, const string &s2);
|
|
5627
|
+
|
|
5628
|
+
//! Get the top-n strings (sorted by the given score distance) from a set of scores.
|
|
5629
|
+
//! At least one entry is returned (if there is one).
|
|
5630
|
+
//! Strings are only returned if they have a score less than the threshold.
|
|
5631
|
+
DUCKDB_API static vector<string> TopNStrings(vector<std::pair<string, idx_t>> scores, idx_t n = 5,
|
|
5632
|
+
idx_t threshold = 5);
|
|
5633
|
+
//! Computes the levenshtein distance of each string in strings, and compares it to target, then returns TopNStrings
|
|
5634
|
+
//! with the given params.
|
|
5635
|
+
DUCKDB_API static vector<string> TopNLevenshtein(const vector<string> &strings, const string &target, idx_t n = 5,
|
|
5636
|
+
idx_t threshold = 5);
|
|
5637
|
+
DUCKDB_API static string CandidatesMessage(const vector<string> &candidates,
|
|
5638
|
+
const string &candidate = "Candidate bindings");
|
|
5639
|
+
|
|
5640
|
+
//! Generate an error message in the form of "{message_prefix}: nearest_string, nearest_string2, ...
|
|
5641
|
+
//! Equivalent to calling TopNLevenshtein followed by CandidatesMessage
|
|
5642
|
+
DUCKDB_API static string CandidatesErrorMessage(const vector<string> &strings, const string &target,
|
|
5643
|
+
const string &message_prefix, idx_t n = 5);
|
|
5644
|
+
};
|
|
5645
|
+
|
|
5646
|
+
} // namespace duckdb
|
|
5647
|
+
|
|
5648
|
+
|
|
5649
|
+
namespace duckdb {
|
|
5650
|
+
|
|
5651
|
+
struct CaseInsensitiveStringHashFunction {
|
|
5652
|
+
uint64_t operator()(const string &str) const {
|
|
5653
|
+
std::hash<string> hasher;
|
|
5654
|
+
return hasher(StringUtil::Lower(str));
|
|
5655
|
+
}
|
|
5656
|
+
};
|
|
5657
|
+
|
|
5658
|
+
struct CaseInsensitiveStringEquality {
|
|
5659
|
+
bool operator()(const string &a, const string &b) const {
|
|
5660
|
+
return StringUtil::Lower(a) == StringUtil::Lower(b);
|
|
5661
|
+
}
|
|
5662
|
+
};
|
|
5663
|
+
|
|
5664
|
+
template <typename T>
|
|
5665
|
+
using case_insensitive_map_t =
|
|
5666
|
+
unordered_map<string, T, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality>;
|
|
5667
|
+
|
|
5668
|
+
using case_insensitive_set_t = unordered_set<string, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality>;
|
|
5669
|
+
|
|
5670
|
+
} // namespace duckdb
|
|
5671
|
+
|
|
5672
|
+
|
|
5673
|
+
namespace duckdb {
|
|
5674
|
+
|
|
5675
|
+
using named_parameter_type_map_t = case_insensitive_map_t<LogicalType>;
|
|
5676
|
+
using named_parameter_map_t = case_insensitive_map_t<Value>;
|
|
5677
|
+
|
|
5678
|
+
} // namespace duckdb
|
|
5679
|
+
|
|
5680
|
+
|
|
5681
|
+
//===----------------------------------------------------------------------===//
|
|
5682
|
+
// DuckDB
|
|
5683
|
+
//
|
|
5684
|
+
// duckdb/parser/column_definition.hpp
|
|
5685
|
+
//
|
|
5686
|
+
//
|
|
5687
|
+
//===----------------------------------------------------------------------===//
|
|
5688
|
+
|
|
5689
|
+
|
|
5690
|
+
|
|
5691
|
+
|
|
5692
|
+
|
|
5693
|
+
//===----------------------------------------------------------------------===//
|
|
5694
|
+
// DuckDB
|
|
5695
|
+
//
|
|
5696
|
+
// duckdb/parser/parsed_expression.hpp
|
|
5697
|
+
//
|
|
5698
|
+
//
|
|
5699
|
+
//===----------------------------------------------------------------------===//
|
|
5700
|
+
|
|
5701
|
+
|
|
5702
|
+
|
|
5703
|
+
//===----------------------------------------------------------------------===//
|
|
5704
|
+
// DuckDB
|
|
5705
|
+
//
|
|
5706
|
+
// duckdb/parser/base_expression.hpp
|
|
5707
|
+
//
|
|
5708
|
+
//
|
|
5709
|
+
//===----------------------------------------------------------------------===//
|
|
5710
|
+
|
|
5711
|
+
|
|
5712
|
+
|
|
5713
|
+
|
|
5714
|
+
//===----------------------------------------------------------------------===//
|
|
5715
|
+
// DuckDB
|
|
5716
|
+
//
|
|
5717
|
+
// duckdb/common/enums/expression_type.hpp
|
|
5718
|
+
//
|
|
5719
|
+
//
|
|
5720
|
+
//===----------------------------------------------------------------------===//
|
|
5721
|
+
|
|
5722
|
+
|
|
5723
|
+
|
|
5724
|
+
|
|
5725
|
+
|
|
5726
|
+
namespace duckdb {
|
|
5727
|
+
|
|
5728
|
+
//===--------------------------------------------------------------------===//
|
|
5729
|
+
// Predicate Expression Operation Types
|
|
5730
|
+
//===--------------------------------------------------------------------===//
|
|
5731
|
+
enum class ExpressionType : uint8_t {
|
|
5732
|
+
INVALID = 0,
|
|
5733
|
+
|
|
5734
|
+
// explicitly cast left as right (right is integer in ValueType enum)
|
|
5735
|
+
OPERATOR_CAST = 12,
|
|
5736
|
+
// logical not operator
|
|
5737
|
+
OPERATOR_NOT = 13,
|
|
5738
|
+
// is null operator
|
|
5739
|
+
OPERATOR_IS_NULL = 14,
|
|
5740
|
+
// is not null operator
|
|
5741
|
+
OPERATOR_IS_NOT_NULL = 15,
|
|
5339
5742
|
|
|
5340
5743
|
// -----------------------------
|
|
5341
5744
|
// Comparison Operators
|
|
@@ -5598,6 +6001,8 @@ public:
|
|
|
5598
6001
|
namespace duckdb {
|
|
5599
6002
|
class Serializer;
|
|
5600
6003
|
class Deserializer;
|
|
6004
|
+
class FieldWriter;
|
|
6005
|
+
class FieldReader;
|
|
5601
6006
|
|
|
5602
6007
|
//! The ParsedExpression class is a base class that can represent any expression
|
|
5603
6008
|
//! part of a SQL statement.
|
|
@@ -5631,7 +6036,10 @@ public:
|
|
|
5631
6036
|
virtual unique_ptr<ParsedExpression> Copy() const = 0;
|
|
5632
6037
|
|
|
5633
6038
|
//! Serializes an Expression to a stand-alone binary blob
|
|
5634
|
-
|
|
6039
|
+
void Serialize(Serializer &serializer) const;
|
|
6040
|
+
//! Serializes an Expression to a stand-alone binary blob
|
|
6041
|
+
virtual void Serialize(FieldWriter &writer) const = 0;
|
|
6042
|
+
|
|
5635
6043
|
//! Deserializes a blob back into an Expression [CAN THROW:
|
|
5636
6044
|
//! SerializationException]
|
|
5637
6045
|
static unique_ptr<ParsedExpression> Deserialize(Deserializer &source);
|
|
@@ -5742,7 +6150,7 @@ struct TableFunctionData : public FunctionData {
|
|
|
5742
6150
|
|
|
5743
6151
|
struct FunctionParameters {
|
|
5744
6152
|
vector<Value> values;
|
|
5745
|
-
|
|
6153
|
+
named_parameter_map_t named_parameters;
|
|
5746
6154
|
};
|
|
5747
6155
|
|
|
5748
6156
|
//! Function is the base class used for any type of function (scalar, aggregate or simple function)
|
|
@@ -5762,7 +6170,7 @@ public:
|
|
|
5762
6170
|
const LogicalType &return_type);
|
|
5763
6171
|
//! Returns the formatted string name(arg1, arg2.., np1=a, np2=b, ...)
|
|
5764
6172
|
DUCKDB_API static string CallToString(const string &name, const vector<LogicalType> &arguments,
|
|
5765
|
-
const
|
|
6173
|
+
const named_parameter_type_map_t &named_parameters);
|
|
5766
6174
|
|
|
5767
6175
|
//! Bind a scalar function from the set of functions and input arguments. Returns the index of the chosen function,
|
|
5768
6176
|
//! returns DConstants::INVALID_INDEX and sets error if none could be found
|
|
@@ -5812,14 +6220,14 @@ public:
|
|
|
5812
6220
|
DUCKDB_API ~SimpleNamedParameterFunction() override;
|
|
5813
6221
|
|
|
5814
6222
|
//! The named parameters of the function
|
|
5815
|
-
|
|
6223
|
+
named_parameter_type_map_t named_parameters;
|
|
5816
6224
|
|
|
5817
6225
|
public:
|
|
5818
6226
|
DUCKDB_API string ToString() override;
|
|
5819
6227
|
DUCKDB_API bool HasNamedParameters();
|
|
5820
6228
|
|
|
5821
6229
|
DUCKDB_API void EvaluateInputParameters(vector<LogicalType> &arguments, vector<Value> ¶meters,
|
|
5822
|
-
|
|
6230
|
+
named_parameter_map_t &named_parameters,
|
|
5823
6231
|
vector<unique_ptr<ParsedExpression>> &children);
|
|
5824
6232
|
};
|
|
5825
6233
|
|
|
@@ -6511,6 +6919,8 @@ struct SelectionVector;
|
|
|
6511
6919
|
|
|
6512
6920
|
class Serializer;
|
|
6513
6921
|
class Deserializer;
|
|
6922
|
+
class FieldWriter;
|
|
6923
|
+
class FieldReader;
|
|
6514
6924
|
class Vector;
|
|
6515
6925
|
class ValidityStatistics;
|
|
6516
6926
|
|
|
@@ -6525,24 +6935,27 @@ public:
|
|
|
6525
6935
|
unique_ptr<BaseStatistics> validity_stats;
|
|
6526
6936
|
|
|
6527
6937
|
public:
|
|
6528
|
-
bool CanHaveNull();
|
|
6529
|
-
bool CanHaveNoNull();
|
|
6938
|
+
bool CanHaveNull() const;
|
|
6939
|
+
bool CanHaveNoNull() const;
|
|
6530
6940
|
|
|
6531
|
-
virtual bool IsConstant() {
|
|
6941
|
+
virtual bool IsConstant() const {
|
|
6532
6942
|
return false;
|
|
6533
6943
|
}
|
|
6534
6944
|
|
|
6535
6945
|
static unique_ptr<BaseStatistics> CreateEmpty(LogicalType type);
|
|
6536
6946
|
|
|
6537
6947
|
virtual void Merge(const BaseStatistics &other);
|
|
6538
|
-
|
|
6539
|
-
virtual
|
|
6948
|
+
|
|
6949
|
+
virtual unique_ptr<BaseStatistics> Copy() const;
|
|
6950
|
+
void Serialize(Serializer &serializer) const;
|
|
6951
|
+
virtual void Serialize(FieldWriter &writer) const;
|
|
6540
6952
|
static unique_ptr<BaseStatistics> Deserialize(Deserializer &source, LogicalType type);
|
|
6953
|
+
|
|
6541
6954
|
//! 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);
|
|
6955
|
+
virtual void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const;
|
|
6956
|
+
void Verify(Vector &vector, idx_t count) const;
|
|
6544
6957
|
|
|
6545
|
-
virtual string ToString();
|
|
6958
|
+
virtual string ToString() const;
|
|
6546
6959
|
};
|
|
6547
6960
|
|
|
6548
6961
|
} // namespace duckdb
|
|
@@ -7167,6 +7580,8 @@ enum class OrderByNullType : uint8_t { INVALID = 0, ORDER_DEFAULT = 1, NULLS_FIR
|
|
|
7167
7580
|
|
|
7168
7581
|
|
|
7169
7582
|
namespace duckdb {
|
|
7583
|
+
class FieldWriter;
|
|
7584
|
+
class FieldReader;
|
|
7170
7585
|
|
|
7171
7586
|
enum ResultModifierType : uint8_t {
|
|
7172
7587
|
LIMIT_MODIFIER = 1,
|
|
@@ -7190,9 +7605,11 @@ public:
|
|
|
7190
7605
|
virtual bool Equals(const ResultModifier *other) const;
|
|
7191
7606
|
|
|
7192
7607
|
//! Create a copy of this ResultModifier
|
|
7193
|
-
virtual unique_ptr<ResultModifier> Copy() = 0;
|
|
7608
|
+
virtual unique_ptr<ResultModifier> Copy() const = 0;
|
|
7194
7609
|
//! Serializes a ResultModifier to a stand-alone binary blob
|
|
7195
|
-
|
|
7610
|
+
void Serialize(Serializer &serializer) const;
|
|
7611
|
+
//! Serializes a ResultModifier to a stand-alone binary blob
|
|
7612
|
+
virtual void Serialize(FieldWriter &writer) const = 0;
|
|
7196
7613
|
//! Deserializes a blob back into a ResultModifier
|
|
7197
7614
|
static unique_ptr<ResultModifier> Deserialize(Deserializer &source);
|
|
7198
7615
|
};
|
|
@@ -7211,7 +7628,7 @@ struct OrderByNode {
|
|
|
7211
7628
|
unique_ptr<ParsedExpression> expression;
|
|
7212
7629
|
|
|
7213
7630
|
public:
|
|
7214
|
-
void Serialize(Serializer &serializer);
|
|
7631
|
+
void Serialize(Serializer &serializer) const;
|
|
7215
7632
|
string ToString() const;
|
|
7216
7633
|
static OrderByNode Deserialize(Deserializer &source);
|
|
7217
7634
|
};
|
|
@@ -7228,9 +7645,9 @@ public:
|
|
|
7228
7645
|
|
|
7229
7646
|
public:
|
|
7230
7647
|
bool Equals(const ResultModifier *other) const override;
|
|
7231
|
-
unique_ptr<ResultModifier> Copy() override;
|
|
7232
|
-
void Serialize(
|
|
7233
|
-
static unique_ptr<ResultModifier> Deserialize(
|
|
7648
|
+
unique_ptr<ResultModifier> Copy() const override;
|
|
7649
|
+
void Serialize(FieldWriter &writer) const override;
|
|
7650
|
+
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
|
7234
7651
|
};
|
|
7235
7652
|
|
|
7236
7653
|
class OrderModifier : public ResultModifier {
|
|
@@ -7243,9 +7660,9 @@ public:
|
|
|
7243
7660
|
|
|
7244
7661
|
public:
|
|
7245
7662
|
bool Equals(const ResultModifier *other) const override;
|
|
7246
|
-
unique_ptr<ResultModifier> Copy() override;
|
|
7247
|
-
void Serialize(
|
|
7248
|
-
static unique_ptr<ResultModifier> Deserialize(
|
|
7663
|
+
unique_ptr<ResultModifier> Copy() const override;
|
|
7664
|
+
void Serialize(FieldWriter &writer) const override;
|
|
7665
|
+
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
|
7249
7666
|
};
|
|
7250
7667
|
|
|
7251
7668
|
class DistinctModifier : public ResultModifier {
|
|
@@ -7258,9 +7675,9 @@ public:
|
|
|
7258
7675
|
|
|
7259
7676
|
public:
|
|
7260
7677
|
bool Equals(const ResultModifier *other) const override;
|
|
7261
|
-
unique_ptr<ResultModifier> Copy() override;
|
|
7262
|
-
void Serialize(
|
|
7263
|
-
static unique_ptr<ResultModifier> Deserialize(
|
|
7678
|
+
unique_ptr<ResultModifier> Copy() const override;
|
|
7679
|
+
void Serialize(FieldWriter &writer) const override;
|
|
7680
|
+
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
|
7264
7681
|
};
|
|
7265
7682
|
|
|
7266
7683
|
class LimitPercentModifier : public ResultModifier {
|
|
@@ -7275,9 +7692,9 @@ public:
|
|
|
7275
7692
|
|
|
7276
7693
|
public:
|
|
7277
7694
|
bool Equals(const ResultModifier *other) const override;
|
|
7278
|
-
unique_ptr<ResultModifier> Copy() override;
|
|
7279
|
-
void Serialize(
|
|
7280
|
-
static unique_ptr<ResultModifier> Deserialize(
|
|
7695
|
+
unique_ptr<ResultModifier> Copy() const override;
|
|
7696
|
+
void Serialize(FieldWriter &writer) const override;
|
|
7697
|
+
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
|
7281
7698
|
};
|
|
7282
7699
|
|
|
7283
7700
|
} // namespace duckdb
|
|
@@ -9638,8 +10055,6 @@ public:
|
|
|
9638
10055
|
|
|
9639
10056
|
|
|
9640
10057
|
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
10058
|
#include <functional>
|
|
9644
10059
|
|
|
9645
10060
|
namespace duckdb {
|
|
@@ -9659,7 +10074,7 @@ struct TableFilterCollection {
|
|
|
9659
10074
|
};
|
|
9660
10075
|
|
|
9661
10076
|
typedef unique_ptr<FunctionData> (*table_function_bind_t)(ClientContext &context, vector<Value> &inputs,
|
|
9662
|
-
|
|
10077
|
+
named_parameter_map_t &named_parameters,
|
|
9663
10078
|
vector<LogicalType> &input_table_types,
|
|
9664
10079
|
vector<string> &input_table_names,
|
|
9665
10080
|
vector<LogicalType> &return_types, vector<string> &names);
|
|
@@ -10462,6 +10877,9 @@ public:
|
|
|
10462
10877
|
DUCKDB_API shared_ptr<Relation> Join(const shared_ptr<Relation> &other, const string &condition,
|
|
10463
10878
|
JoinType type = JoinType::INNER);
|
|
10464
10879
|
|
|
10880
|
+
// CROSS PRODUCT operation
|
|
10881
|
+
DUCKDB_API shared_ptr<Relation> CrossProduct(const shared_ptr<Relation> &other);
|
|
10882
|
+
|
|
10465
10883
|
// SET operations
|
|
10466
10884
|
DUCKDB_API shared_ptr<Relation> Union(const shared_ptr<Relation> &other);
|
|
10467
10885
|
DUCKDB_API shared_ptr<Relation> Except(const shared_ptr<Relation> &other);
|
|
@@ -10499,7 +10917,7 @@ public:
|
|
|
10499
10917
|
//! Create a relation from calling a table in/out function on the input relation
|
|
10500
10918
|
DUCKDB_API shared_ptr<Relation> TableFunction(const std::string &fname, const vector<Value> &values);
|
|
10501
10919
|
DUCKDB_API shared_ptr<Relation> TableFunction(const std::string &fname, const vector<Value> &values,
|
|
10502
|
-
const
|
|
10920
|
+
const named_parameter_map_t &named_parameters);
|
|
10503
10921
|
|
|
10504
10922
|
public:
|
|
10505
10923
|
//! Whether or not the relation inherits column bindings from its child or not, only relevant for binding
|
|
@@ -10656,6 +11074,9 @@ public:
|
|
|
10656
11074
|
//! The query text that corresponds to this SQL statement
|
|
10657
11075
|
string query;
|
|
10658
11076
|
|
|
11077
|
+
protected:
|
|
11078
|
+
SQLStatement(const SQLStatement &other) = default;
|
|
11079
|
+
|
|
10659
11080
|
public:
|
|
10660
11081
|
//! Create a copy of this SelectStatement
|
|
10661
11082
|
virtual unique_ptr<SQLStatement> Copy() const = 0;
|
|
@@ -10670,6 +11091,7 @@ class ClientContext;
|
|
|
10670
11091
|
class DatabaseInstance;
|
|
10671
11092
|
class DuckDB;
|
|
10672
11093
|
class LogicalOperator;
|
|
11094
|
+
class SelectStatement;
|
|
10673
11095
|
|
|
10674
11096
|
typedef void (*warning_callback)(std::string);
|
|
10675
11097
|
|
|
@@ -10756,7 +11178,7 @@ public:
|
|
|
10756
11178
|
//! Returns a relation that calls a specified table function
|
|
10757
11179
|
DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname);
|
|
10758
11180
|
DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname, const vector<Value> &values,
|
|
10759
|
-
const
|
|
11181
|
+
const named_parameter_map_t &named_parameters);
|
|
10760
11182
|
DUCKDB_API shared_ptr<Relation> TableFunction(const string &tname, const vector<Value> &values);
|
|
10761
11183
|
//! Returns a relation that produces values
|
|
10762
11184
|
DUCKDB_API shared_ptr<Relation> Values(const vector<vector<Value>> &values);
|
|
@@ -10769,7 +11191,10 @@ public:
|
|
|
10769
11191
|
DUCKDB_API shared_ptr<Relation> ReadCSV(const string &csv_file);
|
|
10770
11192
|
DUCKDB_API shared_ptr<Relation> ReadCSV(const string &csv_file, const vector<string> &columns);
|
|
10771
11193
|
//! Returns a relation from a query
|
|
10772
|
-
DUCKDB_API shared_ptr<Relation> RelationFromQuery(const string &query,
|
|
11194
|
+
DUCKDB_API shared_ptr<Relation> RelationFromQuery(const string &query, string alias = "queryrelation",
|
|
11195
|
+
const string &error = "Expected a single SELECT statement");
|
|
11196
|
+
DUCKDB_API shared_ptr<Relation> RelationFromQuery(unique_ptr<SelectStatement> select_stmt,
|
|
11197
|
+
string alias = "queryrelation");
|
|
10773
11198
|
|
|
10774
11199
|
DUCKDB_API void BeginTransaction();
|
|
10775
11200
|
DUCKDB_API void Commit();
|
|
@@ -10967,10 +11392,17 @@ private:
|
|
|
10967
11392
|
|
|
10968
11393
|
} // namespace duckdb
|
|
10969
11394
|
|
|
11395
|
+
|
|
11396
|
+
|
|
11397
|
+
|
|
11398
|
+
|
|
11399
|
+
|
|
11400
|
+
|
|
11401
|
+
|
|
10970
11402
|
//===----------------------------------------------------------------------===//
|
|
10971
11403
|
// DuckDB
|
|
10972
11404
|
//
|
|
10973
|
-
// duckdb/
|
|
11405
|
+
// duckdb/function/replacement_scan.hpp
|
|
10974
11406
|
//
|
|
10975
11407
|
//
|
|
10976
11408
|
//===----------------------------------------------------------------------===//
|
|
@@ -10979,222 +11411,48 @@ private:
|
|
|
10979
11411
|
|
|
10980
11412
|
|
|
10981
11413
|
|
|
11414
|
+
namespace duckdb {
|
|
11415
|
+
|
|
11416
|
+
class TableFunctionRef;
|
|
11417
|
+
|
|
11418
|
+
typedef unique_ptr<TableFunctionRef> (*replacement_scan_t)(const string &table_name, void *data);
|
|
11419
|
+
|
|
11420
|
+
//! Replacement table scans are automatically attempted when a table name cannot be found in the schema
|
|
11421
|
+
//! This allows you to do e.g. SELECT * FROM 'filename.csv', and automatically convert this into a CSV scan
|
|
11422
|
+
struct ReplacementScan {
|
|
11423
|
+
explicit ReplacementScan(replacement_scan_t function, void *data = nullptr) : function(function), data(data) {
|
|
11424
|
+
}
|
|
11425
|
+
|
|
11426
|
+
replacement_scan_t function;
|
|
11427
|
+
void *data;
|
|
11428
|
+
};
|
|
11429
|
+
|
|
11430
|
+
} // namespace duckdb
|
|
10982
11431
|
|
|
10983
11432
|
//===----------------------------------------------------------------------===//
|
|
10984
11433
|
// DuckDB
|
|
10985
11434
|
//
|
|
10986
|
-
// duckdb/common/
|
|
11435
|
+
// duckdb/common/set.hpp
|
|
10987
11436
|
//
|
|
10988
11437
|
//
|
|
10989
11438
|
//===----------------------------------------------------------------------===//
|
|
10990
11439
|
|
|
10991
11440
|
|
|
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
|
-
//===----------------------------------------------------------------------===//
|
|
11441
|
+
|
|
11442
|
+
#include <set>
|
|
11443
|
+
|
|
11444
|
+
namespace duckdb {
|
|
11445
|
+
using std::set;
|
|
11446
|
+
}
|
|
11447
|
+
|
|
11448
|
+
|
|
11449
|
+
//===----------------------------------------------------------------------===//
|
|
11450
|
+
// DuckDB
|
|
11451
|
+
//
|
|
11452
|
+
// duckdb/common/enums/optimizer_type.hpp
|
|
11453
|
+
//
|
|
11454
|
+
//
|
|
11455
|
+
//===----------------------------------------------------------------------===//
|
|
11198
11456
|
|
|
11199
11457
|
|
|
11200
11458
|
|
|
@@ -11455,17 +11713,17 @@ public:
|
|
|
11455
11713
|
DBConfig config;
|
|
11456
11714
|
|
|
11457
11715
|
public:
|
|
11458
|
-
StorageManager &GetStorageManager();
|
|
11459
|
-
Catalog &GetCatalog();
|
|
11460
|
-
FileSystem &GetFileSystem();
|
|
11461
|
-
TransactionManager &GetTransactionManager();
|
|
11462
|
-
TaskScheduler &GetScheduler();
|
|
11463
|
-
ObjectCache &GetObjectCache();
|
|
11464
|
-
ConnectionManager &GetConnectionManager();
|
|
11716
|
+
DUCKDB_API StorageManager &GetStorageManager();
|
|
11717
|
+
DUCKDB_API Catalog &GetCatalog();
|
|
11718
|
+
DUCKDB_API FileSystem &GetFileSystem();
|
|
11719
|
+
DUCKDB_API TransactionManager &GetTransactionManager();
|
|
11720
|
+
DUCKDB_API TaskScheduler &GetScheduler();
|
|
11721
|
+
DUCKDB_API ObjectCache &GetObjectCache();
|
|
11722
|
+
DUCKDB_API ConnectionManager &GetConnectionManager();
|
|
11465
11723
|
|
|
11466
11724
|
idx_t NumberOfThreads();
|
|
11467
11725
|
|
|
11468
|
-
static DatabaseInstance &GetDatabase(ClientContext &context);
|
|
11726
|
+
DUCKDB_API static DatabaseInstance &GetDatabase(ClientContext &context);
|
|
11469
11727
|
|
|
11470
11728
|
private:
|
|
11471
11729
|
void Initialize(const char *path, DBConfig *config);
|
|
@@ -12775,7 +13033,9 @@ public:
|
|
|
12775
13033
|
//! contains January 4 of that year.
|
|
12776
13034
|
//! In the ISO week-numbering system, it is possible for early-January dates
|
|
12777
13035
|
//! to be part of the 52nd or 53rd week of the previous year.
|
|
13036
|
+
DUCKDB_API static void ExtractISOYearWeek(date_t date, int32_t &year, int32_t &week);
|
|
12778
13037
|
DUCKDB_API static int32_t ExtractISOWeekNumber(date_t date);
|
|
13038
|
+
DUCKDB_API static int32_t ExtractISOYearNumber(date_t date);
|
|
12779
13039
|
//! Extract the week number as Python handles it.
|
|
12780
13040
|
//! Either Monday or Sunday is the first day of the week,
|
|
12781
13041
|
//! and any date before the first Monday/Sunday returns week 0
|
|
@@ -12797,121 +13057,38 @@ private:
|
|
|
12797
13057
|
//===----------------------------------------------------------------------===//
|
|
12798
13058
|
// DuckDB
|
|
12799
13059
|
//
|
|
12800
|
-
// duckdb/common/
|
|
13060
|
+
// duckdb/common/types/blob.hpp
|
|
12801
13061
|
//
|
|
12802
13062
|
//
|
|
12803
13063
|
//===----------------------------------------------------------------------===//
|
|
12804
13064
|
|
|
12805
|
-
#ifndef ARROW_FLAG_DICTIONARY_ORDERED
|
|
12806
13065
|
|
|
12807
|
-
#include <stdint.h>
|
|
12808
13066
|
|
|
12809
|
-
#ifdef __cplusplus
|
|
12810
|
-
extern "C" {
|
|
12811
|
-
#endif
|
|
12812
13067
|
|
|
12813
|
-
#define ARROW_FLAG_DICTIONARY_ORDERED 1
|
|
12814
|
-
#define ARROW_FLAG_NULLABLE 2
|
|
12815
|
-
#define ARROW_FLAG_MAP_KEYS_SORTED 4
|
|
12816
13068
|
|
|
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
13069
|
|
|
12827
|
-
|
|
12828
|
-
void (*release)(struct ArrowSchema *);
|
|
12829
|
-
// Opaque producer-specific data
|
|
12830
|
-
void *private_data;
|
|
12831
|
-
};
|
|
13070
|
+
namespace duckdb {
|
|
12832
13071
|
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
13072
|
+
//! The Blob class is a static class that holds helper functions for the Blob type.
|
|
13073
|
+
class Blob {
|
|
13074
|
+
public:
|
|
13075
|
+
// map of integer -> hex value
|
|
13076
|
+
static constexpr const char *HEX_TABLE = "0123456789ABCDEF";
|
|
13077
|
+
// reverse map of byte -> integer value, or -1 for invalid hex values
|
|
13078
|
+
static const int HEX_MAP[256];
|
|
13079
|
+
//! map of index -> base64 character
|
|
13080
|
+
static constexpr const char *BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
13081
|
+
//! padding character used in base64 encoding
|
|
13082
|
+
static constexpr const char BASE64_PADDING = '=';
|
|
12843
13083
|
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
// Callback to get the stream type
|
|
12853
|
-
// (will be the same for all arrays in the stream).
|
|
12854
|
-
// Return value: 0 if successful, an `errno`-compatible error code otherwise.
|
|
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 = '=';
|
|
12906
|
-
|
|
12907
|
-
public:
|
|
12908
|
-
//! Returns the string size of a blob -> string conversion
|
|
12909
|
-
static idx_t GetStringSize(string_t blob);
|
|
12910
|
-
//! Converts a blob to a string, writing the output to the designated output string.
|
|
12911
|
-
//! The string needs to have space for at least GetStringSize(blob) bytes.
|
|
12912
|
-
static void ToString(string_t blob, char *output);
|
|
12913
|
-
//! Convert a blob object to a string
|
|
12914
|
-
static string ToString(string_t blob);
|
|
13084
|
+
public:
|
|
13085
|
+
//! Returns the string size of a blob -> string conversion
|
|
13086
|
+
static idx_t GetStringSize(string_t blob);
|
|
13087
|
+
//! Converts a blob to a string, writing the output to the designated output string.
|
|
13088
|
+
//! The string needs to have space for at least GetStringSize(blob) bytes.
|
|
13089
|
+
static void ToString(string_t blob, char *output);
|
|
13090
|
+
//! Convert a blob object to a string
|
|
13091
|
+
static string ToString(string_t blob);
|
|
12915
13092
|
|
|
12916
13093
|
//! Returns the blob size of a string -> blob conversion
|
|
12917
13094
|
static bool TryGetBlobSize(string_t str, idx_t &result_size, string *error_message);
|
|
@@ -13480,6 +13657,8 @@ namespace duckdb {
|
|
|
13480
13657
|
|
|
13481
13658
|
class Serializer;
|
|
13482
13659
|
class Deserializer;
|
|
13660
|
+
class FieldWriter;
|
|
13661
|
+
class FieldReader;
|
|
13483
13662
|
|
|
13484
13663
|
//===--------------------------------------------------------------------===//
|
|
13485
13664
|
// Constraint Types
|
|
@@ -13502,13 +13681,14 @@ public:
|
|
|
13502
13681
|
|
|
13503
13682
|
public:
|
|
13504
13683
|
DUCKDB_API virtual string ToString() const = 0;
|
|
13505
|
-
DUCKDB_API void Print();
|
|
13684
|
+
DUCKDB_API void Print() const;
|
|
13506
13685
|
|
|
13507
|
-
DUCKDB_API virtual unique_ptr<Constraint> Copy() = 0;
|
|
13686
|
+
DUCKDB_API virtual unique_ptr<Constraint> Copy() const = 0;
|
|
13508
13687
|
//! Serializes a Constraint to a stand-alone binary blob
|
|
13509
|
-
DUCKDB_API
|
|
13510
|
-
//!
|
|
13511
|
-
|
|
13688
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
13689
|
+
//! Serializes a Constraint to a stand-alone binary blob
|
|
13690
|
+
DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
|
|
13691
|
+
//! Deserializes a blob back into a Constraint
|
|
13512
13692
|
DUCKDB_API static unique_ptr<Constraint> Deserialize(Deserializer &source);
|
|
13513
13693
|
};
|
|
13514
13694
|
} // namespace duckdb
|
|
@@ -13779,10 +13959,8 @@ enum class AlterType : uint8_t {
|
|
|
13779
13959
|
};
|
|
13780
13960
|
|
|
13781
13961
|
struct AlterInfo : public ParseInfo {
|
|
13782
|
-
AlterInfo(AlterType type, string schema, string name)
|
|
13783
|
-
|
|
13784
|
-
~AlterInfo() override {
|
|
13785
|
-
}
|
|
13962
|
+
AlterInfo(AlterType type, string schema, string name);
|
|
13963
|
+
~AlterInfo() override;
|
|
13786
13964
|
|
|
13787
13965
|
AlterType type;
|
|
13788
13966
|
//! Schema name to alter
|
|
@@ -13791,9 +13969,10 @@ struct AlterInfo : public ParseInfo {
|
|
|
13791
13969
|
string name;
|
|
13792
13970
|
|
|
13793
13971
|
public:
|
|
13794
|
-
virtual CatalogType GetCatalogType() = 0;
|
|
13972
|
+
virtual CatalogType GetCatalogType() const = 0;
|
|
13795
13973
|
virtual unique_ptr<AlterInfo> Copy() const = 0;
|
|
13796
|
-
|
|
13974
|
+
void Serialize(Serializer &serializer) const;
|
|
13975
|
+
virtual void Serialize(FieldWriter &writer) const = 0;
|
|
13797
13976
|
static unique_ptr<AlterInfo> Deserialize(Deserializer &source);
|
|
13798
13977
|
};
|
|
13799
13978
|
|
|
@@ -13802,10 +13981,7 @@ public:
|
|
|
13802
13981
|
//===--------------------------------------------------------------------===//
|
|
13803
13982
|
struct ChangeOwnershipInfo : public AlterInfo {
|
|
13804
13983
|
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
|
-
}
|
|
13984
|
+
string owner_name);
|
|
13809
13985
|
|
|
13810
13986
|
// Catalog type refers to the entry type, since this struct is usually built from an
|
|
13811
13987
|
// ALTER <TYPE> <schema>.<name> OWNED BY <owner_schema>.<owner_name> statement
|
|
@@ -13816,8 +13992,9 @@ struct ChangeOwnershipInfo : public AlterInfo {
|
|
|
13816
13992
|
string owner_name;
|
|
13817
13993
|
|
|
13818
13994
|
public:
|
|
13819
|
-
CatalogType GetCatalogType() override;
|
|
13995
|
+
CatalogType GetCatalogType() const override;
|
|
13820
13996
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13997
|
+
void Serialize(FieldWriter &writer) const override;
|
|
13821
13998
|
};
|
|
13822
13999
|
|
|
13823
14000
|
//===--------------------------------------------------------------------===//
|
|
@@ -13834,32 +14011,24 @@ enum class AlterTableType : uint8_t {
|
|
|
13834
14011
|
};
|
|
13835
14012
|
|
|
13836
14013
|
struct AlterTableInfo : public AlterInfo {
|
|
13837
|
-
AlterTableInfo(AlterTableType type, string schema, string table)
|
|
13838
|
-
|
|
13839
|
-
}
|
|
13840
|
-
~AlterTableInfo() override {
|
|
13841
|
-
}
|
|
14014
|
+
AlterTableInfo(AlterTableType type, string schema, string table);
|
|
14015
|
+
~AlterTableInfo() override;
|
|
13842
14016
|
|
|
13843
14017
|
AlterTableType alter_table_type;
|
|
13844
14018
|
|
|
13845
14019
|
public:
|
|
13846
|
-
CatalogType GetCatalogType() override
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
static unique_ptr<AlterInfo> Deserialize(Deserializer &source);
|
|
14020
|
+
CatalogType GetCatalogType() const override;
|
|
14021
|
+
void Serialize(FieldWriter &writer) const override;
|
|
14022
|
+
virtual void SerializeAlterTable(FieldWriter &writer) const = 0;
|
|
14023
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
|
|
13851
14024
|
};
|
|
13852
14025
|
|
|
13853
14026
|
//===--------------------------------------------------------------------===//
|
|
13854
14027
|
// RenameColumnInfo
|
|
13855
14028
|
//===--------------------------------------------------------------------===//
|
|
13856
14029
|
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
|
-
}
|
|
14030
|
+
RenameColumnInfo(string schema, string table, string old_name_p, string new_name_p);
|
|
14031
|
+
~RenameColumnInfo() override;
|
|
13863
14032
|
|
|
13864
14033
|
//! Column old name
|
|
13865
14034
|
string old_name;
|
|
@@ -13868,58 +14037,48 @@ struct RenameColumnInfo : public AlterTableInfo {
|
|
|
13868
14037
|
|
|
13869
14038
|
public:
|
|
13870
14039
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13871
|
-
void
|
|
13872
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14040
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14041
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13873
14042
|
};
|
|
13874
14043
|
|
|
13875
14044
|
//===--------------------------------------------------------------------===//
|
|
13876
14045
|
// RenameTableInfo
|
|
13877
14046
|
//===--------------------------------------------------------------------===//
|
|
13878
14047
|
struct RenameTableInfo : public AlterTableInfo {
|
|
13879
|
-
RenameTableInfo(string schema, string table, string new_name)
|
|
13880
|
-
|
|
13881
|
-
}
|
|
13882
|
-
~RenameTableInfo() override {
|
|
13883
|
-
}
|
|
14048
|
+
RenameTableInfo(string schema, string table, string new_name);
|
|
14049
|
+
~RenameTableInfo() override;
|
|
13884
14050
|
|
|
13885
14051
|
//! Relation new name
|
|
13886
14052
|
string new_table_name;
|
|
13887
14053
|
|
|
13888
14054
|
public:
|
|
13889
14055
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13890
|
-
void
|
|
13891
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14056
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14057
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13892
14058
|
};
|
|
13893
14059
|
|
|
13894
14060
|
//===--------------------------------------------------------------------===//
|
|
13895
14061
|
// AddColumnInfo
|
|
13896
14062
|
//===--------------------------------------------------------------------===//
|
|
13897
14063
|
struct AddColumnInfo : public AlterTableInfo {
|
|
13898
|
-
AddColumnInfo(string schema, string table, ColumnDefinition new_column)
|
|
13899
|
-
|
|
13900
|
-
}
|
|
13901
|
-
~AddColumnInfo() override {
|
|
13902
|
-
}
|
|
14064
|
+
AddColumnInfo(string schema, string table, ColumnDefinition new_column);
|
|
14065
|
+
~AddColumnInfo() override;
|
|
13903
14066
|
|
|
13904
14067
|
//! New column
|
|
13905
14068
|
ColumnDefinition new_column;
|
|
13906
14069
|
|
|
13907
14070
|
public:
|
|
13908
14071
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13909
|
-
void
|
|
13910
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14072
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14073
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13911
14074
|
};
|
|
13912
14075
|
|
|
13913
14076
|
//===--------------------------------------------------------------------===//
|
|
13914
14077
|
// RemoveColumnInfo
|
|
13915
14078
|
//===--------------------------------------------------------------------===//
|
|
13916
14079
|
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
|
-
}
|
|
14080
|
+
RemoveColumnInfo(string schema, string table, string removed_column, bool if_exists);
|
|
14081
|
+
~RemoveColumnInfo() override;
|
|
13923
14082
|
|
|
13924
14083
|
//! The column to remove
|
|
13925
14084
|
string removed_column;
|
|
@@ -13928,8 +14087,8 @@ struct RemoveColumnInfo : public AlterTableInfo {
|
|
|
13928
14087
|
|
|
13929
14088
|
public:
|
|
13930
14089
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13931
|
-
void
|
|
13932
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14090
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14091
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13933
14092
|
};
|
|
13934
14093
|
|
|
13935
14094
|
//===--------------------------------------------------------------------===//
|
|
@@ -13937,12 +14096,8 @@ public:
|
|
|
13937
14096
|
//===--------------------------------------------------------------------===//
|
|
13938
14097
|
struct ChangeColumnTypeInfo : public AlterTableInfo {
|
|
13939
14098
|
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
|
-
}
|
|
14099
|
+
unique_ptr<ParsedExpression> expression);
|
|
14100
|
+
~ChangeColumnTypeInfo() override;
|
|
13946
14101
|
|
|
13947
14102
|
//! The column name to alter
|
|
13948
14103
|
string column_name;
|
|
@@ -13953,20 +14108,16 @@ struct ChangeColumnTypeInfo : public AlterTableInfo {
|
|
|
13953
14108
|
|
|
13954
14109
|
public:
|
|
13955
14110
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13956
|
-
void
|
|
13957
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14111
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14112
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13958
14113
|
};
|
|
13959
14114
|
|
|
13960
14115
|
//===--------------------------------------------------------------------===//
|
|
13961
14116
|
// SetDefaultInfo
|
|
13962
14117
|
//===--------------------------------------------------------------------===//
|
|
13963
14118
|
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
|
-
}
|
|
14119
|
+
SetDefaultInfo(string schema, string table, string column_name, unique_ptr<ParsedExpression> new_default);
|
|
14120
|
+
~SetDefaultInfo() override;
|
|
13970
14121
|
|
|
13971
14122
|
//! The column name to alter
|
|
13972
14123
|
string column_name;
|
|
@@ -13975,8 +14126,8 @@ struct SetDefaultInfo : public AlterTableInfo {
|
|
|
13975
14126
|
|
|
13976
14127
|
public:
|
|
13977
14128
|
unique_ptr<AlterInfo> Copy() const override;
|
|
13978
|
-
void
|
|
13979
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14129
|
+
void SerializeAlterTable(FieldWriter &writer) const override;
|
|
14130
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
13980
14131
|
};
|
|
13981
14132
|
|
|
13982
14133
|
//===--------------------------------------------------------------------===//
|
|
@@ -13985,39 +14136,32 @@ public:
|
|
|
13985
14136
|
enum class AlterViewType : uint8_t { INVALID = 0, RENAME_VIEW = 1 };
|
|
13986
14137
|
|
|
13987
14138
|
struct AlterViewInfo : public AlterInfo {
|
|
13988
|
-
AlterViewInfo(AlterViewType type, string schema, string view)
|
|
13989
|
-
|
|
13990
|
-
}
|
|
13991
|
-
~AlterViewInfo() override {
|
|
13992
|
-
}
|
|
14139
|
+
AlterViewInfo(AlterViewType type, string schema, string view);
|
|
14140
|
+
~AlterViewInfo() override;
|
|
13993
14141
|
|
|
13994
14142
|
AlterViewType alter_view_type;
|
|
13995
14143
|
|
|
13996
14144
|
public:
|
|
13997
|
-
CatalogType GetCatalogType() override
|
|
13998
|
-
|
|
13999
|
-
|
|
14000
|
-
|
|
14001
|
-
static unique_ptr<AlterInfo> Deserialize(Deserializer &source);
|
|
14145
|
+
CatalogType GetCatalogType() const override;
|
|
14146
|
+
void Serialize(FieldWriter &writer) const override;
|
|
14147
|
+
virtual void SerializeAlterView(FieldWriter &writer) const = 0;
|
|
14148
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader);
|
|
14002
14149
|
};
|
|
14003
14150
|
|
|
14004
14151
|
//===--------------------------------------------------------------------===//
|
|
14005
14152
|
// RenameViewInfo
|
|
14006
14153
|
//===--------------------------------------------------------------------===//
|
|
14007
14154
|
struct RenameViewInfo : public AlterViewInfo {
|
|
14008
|
-
RenameViewInfo(string schema, string view, string new_name)
|
|
14009
|
-
|
|
14010
|
-
}
|
|
14011
|
-
~RenameViewInfo() override {
|
|
14012
|
-
}
|
|
14155
|
+
RenameViewInfo(string schema, string view, string new_name);
|
|
14156
|
+
~RenameViewInfo() override;
|
|
14013
14157
|
|
|
14014
14158
|
//! Relation new name
|
|
14015
14159
|
string new_view_name;
|
|
14016
14160
|
|
|
14017
14161
|
public:
|
|
14018
14162
|
unique_ptr<AlterInfo> Copy() const override;
|
|
14019
|
-
void
|
|
14020
|
-
static unique_ptr<AlterInfo> Deserialize(
|
|
14163
|
+
void SerializeAlterView(FieldWriter &writer) const override;
|
|
14164
|
+
static unique_ptr<AlterInfo> Deserialize(FieldReader &reader, string schema, string table);
|
|
14021
14165
|
};
|
|
14022
14166
|
|
|
14023
14167
|
} // namespace duckdb
|
|
@@ -15103,8 +15247,8 @@ public:
|
|
|
15103
15247
|
|
|
15104
15248
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
15105
15249
|
|
|
15106
|
-
void Serialize(
|
|
15107
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
15250
|
+
void Serialize(FieldWriter &writer) const override;
|
|
15251
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
15108
15252
|
};
|
|
15109
15253
|
} // namespace duckdb
|
|
15110
15254
|
|
|
@@ -15338,6 +15482,10 @@ public:
|
|
|
15338
15482
|
unique_ptr<ParsedExpression> Copy() const override {
|
|
15339
15483
|
throw SerializationException("Cannot copy or serialize bound expression");
|
|
15340
15484
|
}
|
|
15485
|
+
|
|
15486
|
+
void Serialize(FieldWriter &writer) const override {
|
|
15487
|
+
throw SerializationException("Cannot copy or serialize bound expression");
|
|
15488
|
+
}
|
|
15341
15489
|
};
|
|
15342
15490
|
|
|
15343
15491
|
} // namespace duckdb
|
|
@@ -15782,7 +15930,7 @@ public:
|
|
|
15782
15930
|
SchemaCatalogEntry *BindCreateFunctionInfo(CreateInfo &info);
|
|
15783
15931
|
|
|
15784
15932
|
//! Check usage, and cast named parameters to their types
|
|
15785
|
-
static void BindNamedParameters(
|
|
15933
|
+
static void BindNamedParameters(named_parameter_type_map_t &types, named_parameter_map_t &values,
|
|
15786
15934
|
QueryErrorContext &error_context, string &func_name);
|
|
15787
15935
|
|
|
15788
15936
|
unique_ptr<BoundTableRef> Bind(TableRef &ref);
|
|
@@ -15798,6 +15946,9 @@ public:
|
|
|
15798
15946
|
|
|
15799
15947
|
bool CTEIsAlreadyBound(CommonTableExpressionInfo *cte);
|
|
15800
15948
|
|
|
15949
|
+
//! Add the view to the set of currently bound views - used for detecting recursive view definitions
|
|
15950
|
+
void AddBoundView(ViewCatalogEntry *view);
|
|
15951
|
+
|
|
15801
15952
|
void PushExpressionBinder(ExpressionBinder *binder);
|
|
15802
15953
|
void PopExpressionBinder();
|
|
15803
15954
|
void SetActiveBinder(ExpressionBinder *binder);
|
|
@@ -15859,6 +16010,8 @@ private:
|
|
|
15859
16010
|
BindingMode mode = BindingMode::STANDARD_BINDING;
|
|
15860
16011
|
//! Table names extracted for BindingMode::EXTRACT_NAMES
|
|
15861
16012
|
unordered_set<string> table_names;
|
|
16013
|
+
//! The set of bound views
|
|
16014
|
+
unordered_set<ViewCatalogEntry *> bound_views;
|
|
15862
16015
|
|
|
15863
16016
|
private:
|
|
15864
16017
|
//! Bind the default values of the columns of a table
|
|
@@ -15909,7 +16062,7 @@ private:
|
|
|
15909
16062
|
unique_ptr<BoundTableRef> Bind(ExpressionListRef &ref);
|
|
15910
16063
|
|
|
15911
16064
|
bool BindFunctionParameters(vector<unique_ptr<ParsedExpression>> &expressions, vector<LogicalType> &arguments,
|
|
15912
|
-
vector<Value> ¶meters,
|
|
16065
|
+
vector<Value> ¶meters, named_parameter_map_t &named_parameters,
|
|
15913
16066
|
unique_ptr<BoundSubqueryRef> &subquery, string &error);
|
|
15914
16067
|
|
|
15915
16068
|
unique_ptr<LogicalOperator> CreatePlan(BoundBaseTableRef &ref);
|
|
@@ -16117,9 +16270,11 @@ public:
|
|
|
16117
16270
|
virtual unique_ptr<TableRef> Copy() = 0;
|
|
16118
16271
|
|
|
16119
16272
|
//! Serializes a TableRef to a stand-alone binary blob
|
|
16120
|
-
|
|
16273
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
16274
|
+
//! Serializes a TableRef to a stand-alone binary blob
|
|
16275
|
+
DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
|
|
16121
16276
|
//! Deserializes a blob back into a TableRef
|
|
16122
|
-
static unique_ptr<TableRef> Deserialize(Deserializer &source);
|
|
16277
|
+
DUCKDB_API static unique_ptr<TableRef> Deserialize(Deserializer &source);
|
|
16123
16278
|
|
|
16124
16279
|
//! Copy the properties of this table ref to the target
|
|
16125
16280
|
void CopyProperties(TableRef &target) const;
|
|
@@ -16140,11 +16295,14 @@ public:
|
|
|
16140
16295
|
//! The main query node
|
|
16141
16296
|
unique_ptr<QueryNode> node;
|
|
16142
16297
|
|
|
16298
|
+
protected:
|
|
16299
|
+
SelectStatement(const SelectStatement &other);
|
|
16300
|
+
|
|
16143
16301
|
public:
|
|
16144
16302
|
//! Create a copy of this SelectStatement
|
|
16145
16303
|
unique_ptr<SQLStatement> Copy() const override;
|
|
16146
16304
|
//! Serializes a SelectStatement to a stand-alone binary blob
|
|
16147
|
-
void Serialize(Serializer &serializer);
|
|
16305
|
+
void Serialize(Serializer &serializer) const;
|
|
16148
16306
|
//! Deserializes a blob back into a SelectStatement, returns nullptr if
|
|
16149
16307
|
//! deserialization is not possible
|
|
16150
16308
|
static unique_ptr<SelectStatement> Deserialize(Deserializer &source);
|
|
@@ -16195,12 +16353,13 @@ public:
|
|
|
16195
16353
|
virtual bool Equals(const QueryNode *other) const;
|
|
16196
16354
|
|
|
16197
16355
|
//! Create a copy of this QueryNode
|
|
16198
|
-
virtual unique_ptr<QueryNode> Copy() = 0;
|
|
16356
|
+
virtual unique_ptr<QueryNode> Copy() const = 0;
|
|
16199
16357
|
//! Serializes a QueryNode to a stand-alone binary blob
|
|
16200
|
-
|
|
16201
|
-
//!
|
|
16202
|
-
|
|
16203
|
-
|
|
16358
|
+
DUCKDB_API void Serialize(Serializer &serializer) const;
|
|
16359
|
+
//! Serializes a QueryNode to a stand-alone binary blob
|
|
16360
|
+
DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
|
|
16361
|
+
//! Deserializes a blob back into a QueryNode
|
|
16362
|
+
DUCKDB_API static unique_ptr<QueryNode> Deserialize(Deserializer &source);
|
|
16204
16363
|
|
|
16205
16364
|
protected:
|
|
16206
16365
|
//! Copy base QueryNode properties from another expression to this one,
|
|
@@ -16395,8 +16554,8 @@ public:
|
|
|
16395
16554
|
|
|
16396
16555
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
16397
16556
|
|
|
16398
|
-
void Serialize(
|
|
16399
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
16557
|
+
void Serialize(FieldWriter &writer) const override;
|
|
16558
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
16400
16559
|
};
|
|
16401
16560
|
} // namespace duckdb
|
|
16402
16561
|
|
|
@@ -17250,6 +17409,10 @@ struct ClientConfig {
|
|
|
17250
17409
|
//! The wait time before showing the progress bar
|
|
17251
17410
|
int wait_time = 2000;
|
|
17252
17411
|
|
|
17412
|
+
//! Preserve identifier case while parsing.
|
|
17413
|
+
//! If false, all unquoted identifiers are lower-cased (e.g. "MyTable" -> "mytable").
|
|
17414
|
+
bool preserve_identifier_case = true;
|
|
17415
|
+
|
|
17253
17416
|
// Whether or not aggressive query verification is enabled
|
|
17254
17417
|
bool query_verification_enabled = false;
|
|
17255
17418
|
//! Enable the running of optimizers
|
|
@@ -17294,6 +17457,7 @@ class ClientContextLock;
|
|
|
17294
17457
|
struct CreateScalarFunctionInfo;
|
|
17295
17458
|
class ScalarFunctionCatalogEntry;
|
|
17296
17459
|
struct ActiveQueryContext;
|
|
17460
|
+
struct ParserOptions;
|
|
17297
17461
|
|
|
17298
17462
|
//! The ClientContext holds information relevant to the current client session
|
|
17299
17463
|
//! during execution
|
|
@@ -17411,6 +17575,9 @@ public:
|
|
|
17411
17575
|
//! Equivalent to CURRENT_SETTING(key) SQL function.
|
|
17412
17576
|
DUCKDB_API bool TryGetCurrentSetting(const std::string &key, Value &result);
|
|
17413
17577
|
|
|
17578
|
+
//! Returns the parser options for this client context
|
|
17579
|
+
DUCKDB_API ParserOptions GetParserOptions();
|
|
17580
|
+
|
|
17414
17581
|
DUCKDB_API unique_ptr<DataChunk> Fetch(ClientContextLock &lock, StreamQueryResult &result);
|
|
17415
17582
|
|
|
17416
17583
|
//! Whether or not the given result object (streaming query result or pending query result) is active
|
|
@@ -18544,12 +18711,12 @@ public:
|
|
|
18544
18711
|
public:
|
|
18545
18712
|
DUCKDB_API string ToString() const override;
|
|
18546
18713
|
|
|
18547
|
-
DUCKDB_API unique_ptr<Constraint> Copy() override;
|
|
18714
|
+
DUCKDB_API unique_ptr<Constraint> Copy() const override;
|
|
18548
18715
|
|
|
18549
18716
|
//! Serialize to a stand-alone binary blob
|
|
18550
|
-
DUCKDB_API void Serialize(
|
|
18717
|
+
DUCKDB_API void Serialize(FieldWriter &writer) const override;
|
|
18551
18718
|
//! Deserializes a NotNullConstraint
|
|
18552
|
-
DUCKDB_API static unique_ptr<Constraint> Deserialize(
|
|
18719
|
+
DUCKDB_API static unique_ptr<Constraint> Deserialize(FieldReader &source);
|
|
18553
18720
|
};
|
|
18554
18721
|
|
|
18555
18722
|
} // namespace duckdb
|
|
@@ -19728,7 +19895,7 @@ struct PragmaInfo : public ParseInfo {
|
|
|
19728
19895
|
//! Parameter list (if any)
|
|
19729
19896
|
vector<Value> parameters;
|
|
19730
19897
|
//! Named parameter list (if any)
|
|
19731
|
-
|
|
19898
|
+
named_parameter_map_t named_parameters;
|
|
19732
19899
|
|
|
19733
19900
|
public:
|
|
19734
19901
|
unique_ptr<PragmaInfo> Copy() const {
|
|
@@ -19779,7 +19946,7 @@ public:
|
|
|
19779
19946
|
|
|
19780
19947
|
pragma_query_t query;
|
|
19781
19948
|
pragma_function_t function;
|
|
19782
|
-
|
|
19949
|
+
named_parameter_type_map_t named_parameters;
|
|
19783
19950
|
|
|
19784
19951
|
private:
|
|
19785
19952
|
PragmaFunction(string name, PragmaType pragma_type, pragma_query_t query, pragma_function_t function,
|
|
@@ -19848,12 +20015,16 @@ struct PGList;
|
|
|
19848
20015
|
|
|
19849
20016
|
namespace duckdb {
|
|
19850
20017
|
|
|
20018
|
+
struct ParserOptions {
|
|
20019
|
+
bool preserve_identifier_case = true;
|
|
20020
|
+
};
|
|
20021
|
+
|
|
19851
20022
|
//! The parser is responsible for parsing the query and converting it into a set
|
|
19852
20023
|
//! of parsed statements. The parsed statements can then be converted into a
|
|
19853
20024
|
//! plan and executed.
|
|
19854
20025
|
class Parser {
|
|
19855
20026
|
public:
|
|
19856
|
-
Parser();
|
|
20027
|
+
Parser(ParserOptions options = ParserOptions());
|
|
19857
20028
|
|
|
19858
20029
|
//! The parsed SQL statements from an invocation to ParseQuery.
|
|
19859
20030
|
vector<unique_ptr<SQLStatement>> statements;
|
|
@@ -19874,16 +20045,22 @@ public:
|
|
|
19874
20045
|
static vector<ParserKeyword> KeywordList();
|
|
19875
20046
|
|
|
19876
20047
|
//! 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
|
|
20048
|
+
static vector<unique_ptr<ParsedExpression>> ParseExpressionList(const string &select_list,
|
|
20049
|
+
ParserOptions options = ParserOptions());
|
|
19878
20050
|
//! 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);
|
|
20051
|
+
static vector<OrderByNode> ParseOrderList(const string &select_list, ParserOptions options = ParserOptions());
|
|
19880
20052
|
//! Parses an update list (i.e. the list found in the SET clause of an UPDATE statement)
|
|
19881
20053
|
static void ParseUpdateList(const string &update_list, vector<string> &update_columns,
|
|
19882
|
-
vector<unique_ptr<ParsedExpression>> &expressions
|
|
20054
|
+
vector<unique_ptr<ParsedExpression>> &expressions,
|
|
20055
|
+
ParserOptions options = ParserOptions());
|
|
19883
20056
|
//! 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
|
|
20057
|
+
static vector<vector<unique_ptr<ParsedExpression>>> ParseValuesList(const string &value_list,
|
|
20058
|
+
ParserOptions options = ParserOptions());
|
|
19885
20059
|
//! Parses a column list (i.e. as found in a CREATE TABLE statement)
|
|
19886
|
-
static vector<ColumnDefinition> ParseColumnList(const string &column_list);
|
|
20060
|
+
static vector<ColumnDefinition> ParseColumnList(const string &column_list, ParserOptions options = ParserOptions());
|
|
20061
|
+
|
|
20062
|
+
private:
|
|
20063
|
+
ParserOptions options;
|
|
19887
20064
|
};
|
|
19888
20065
|
} // namespace duckdb
|
|
19889
20066
|
//===----------------------------------------------------------------------===//
|
|
@@ -20093,17 +20270,17 @@ public:
|
|
|
20093
20270
|
public:
|
|
20094
20271
|
void Merge(const BaseStatistics &other) override;
|
|
20095
20272
|
|
|
20096
|
-
bool IsConstant() override;
|
|
20273
|
+
bool IsConstant() const override;
|
|
20097
20274
|
|
|
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;
|
|
20275
|
+
unique_ptr<BaseStatistics> Copy() const override;
|
|
20276
|
+
void Serialize(FieldWriter &writer) const override;
|
|
20277
|
+
static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader);
|
|
20278
|
+
void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
|
|
20102
20279
|
|
|
20103
20280
|
static unique_ptr<BaseStatistics> Combine(const unique_ptr<BaseStatistics> &lstats,
|
|
20104
20281
|
const unique_ptr<BaseStatistics> &rstats);
|
|
20105
20282
|
|
|
20106
|
-
string ToString() override;
|
|
20283
|
+
string ToString() const override;
|
|
20107
20284
|
};
|
|
20108
20285
|
|
|
20109
20286
|
} // namespace duckdb
|
|
@@ -20133,14 +20310,14 @@ public:
|
|
|
20133
20310
|
void Update(const string_t &value);
|
|
20134
20311
|
void Merge(const BaseStatistics &other) override;
|
|
20135
20312
|
|
|
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;
|
|
20313
|
+
unique_ptr<BaseStatistics> Copy() const override;
|
|
20314
|
+
void Serialize(FieldWriter &writer) const override;
|
|
20315
|
+
static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader, LogicalType type);
|
|
20316
|
+
void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
|
|
20140
20317
|
|
|
20141
|
-
FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const string &value);
|
|
20318
|
+
FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const string &value) const;
|
|
20142
20319
|
|
|
20143
|
-
string ToString() override;
|
|
20320
|
+
string ToString() const override;
|
|
20144
20321
|
};
|
|
20145
20322
|
|
|
20146
20323
|
} // namespace duckdb
|
|
@@ -20221,20 +20398,20 @@ public:
|
|
|
20221
20398
|
public:
|
|
20222
20399
|
void Merge(const BaseStatistics &other) override;
|
|
20223
20400
|
|
|
20224
|
-
bool IsConstant() override;
|
|
20401
|
+
bool IsConstant() const override;
|
|
20225
20402
|
|
|
20226
|
-
FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant);
|
|
20403
|
+
FilterPropagateResult CheckZonemap(ExpressionType comparison_type, const Value &constant) const;
|
|
20227
20404
|
|
|
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;
|
|
20405
|
+
unique_ptr<BaseStatistics> Copy() const override;
|
|
20406
|
+
void Serialize(FieldWriter &writer) const override;
|
|
20407
|
+
static unique_ptr<BaseStatistics> Deserialize(FieldReader &reader, LogicalType type);
|
|
20408
|
+
void Verify(Vector &vector, const SelectionVector &sel, idx_t count) const override;
|
|
20232
20409
|
|
|
20233
|
-
string ToString() override;
|
|
20410
|
+
string ToString() const override;
|
|
20234
20411
|
|
|
20235
20412
|
private:
|
|
20236
20413
|
template <class T>
|
|
20237
|
-
void TemplatedVerify(Vector &vector, const SelectionVector &sel, idx_t count);
|
|
20414
|
+
void TemplatedVerify(Vector &vector, const SelectionVector &sel, idx_t count) const;
|
|
20238
20415
|
|
|
20239
20416
|
public:
|
|
20240
20417
|
template <class T>
|
|
@@ -20444,7 +20621,7 @@ struct StrfTimeFormat : public StrTimeFormat {
|
|
|
20444
20621
|
void FormatString(date_t date, int32_t data[7], char *target);
|
|
20445
20622
|
void FormatString(date_t date, dtime_t time, char *target);
|
|
20446
20623
|
|
|
20447
|
-
static string Format(timestamp_t timestamp, const string &format);
|
|
20624
|
+
DUCKDB_API static string Format(timestamp_t timestamp, const string &format);
|
|
20448
20625
|
|
|
20449
20626
|
protected:
|
|
20450
20627
|
//! The variable-length specifiers. To determine total string size, these need to be checked.
|
|
@@ -20478,9 +20655,14 @@ public:
|
|
|
20478
20655
|
timestamp_t ToTimestamp();
|
|
20479
20656
|
string FormatError(string_t input, const string &format_specifier);
|
|
20480
20657
|
};
|
|
20658
|
+
|
|
20659
|
+
public:
|
|
20481
20660
|
//! The full format specifier, for error messages
|
|
20482
20661
|
string format_specifier;
|
|
20483
20662
|
|
|
20663
|
+
public:
|
|
20664
|
+
DUCKDB_API static ParseResult Parse(const string &format, const string &text);
|
|
20665
|
+
|
|
20484
20666
|
bool Parse(string_t str, ParseResult &result);
|
|
20485
20667
|
|
|
20486
20668
|
bool TryParseDate(string_t str, date_t &result, string &error_message);
|
|
@@ -20583,6 +20765,9 @@ struct BufferedCSVReaderOptions {
|
|
|
20583
20765
|
idx_t buffer_size = STANDARD_VECTOR_SIZE * 100;
|
|
20584
20766
|
//! Consider all columns to be of type varchar
|
|
20585
20767
|
bool all_varchar = false;
|
|
20768
|
+
//! Maximum CSV line size: specified because if we reach this amount, we likely have wrong delimiters (default: 2MB)
|
|
20769
|
+
idx_t maximum_line_size = 2097152;
|
|
20770
|
+
|
|
20586
20771
|
//! The date format to use (if any is specified)
|
|
20587
20772
|
std::map<LogicalTypeId, StrpTimeFormat> date_format = {{LogicalTypeId::DATE, {}}, {LogicalTypeId::TIMESTAMP, {}}};
|
|
20588
20773
|
//! Whether or not a type format is specified
|
|
@@ -20599,8 +20784,6 @@ enum class ParserMode : uint8_t { PARSING = 0, SNIFFING_DIALECT = 1, SNIFFING_DA
|
|
|
20599
20784
|
class BufferedCSVReader {
|
|
20600
20785
|
//! Initial buffer read size; can be extended for long lines
|
|
20601
20786
|
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
20787
|
ParserMode mode;
|
|
20605
20788
|
|
|
20606
20789
|
public:
|
|
@@ -20783,73 +20966,6 @@ public:
|
|
|
20783
20966
|
string ToString(const string &column_name) override;
|
|
20784
20967
|
};
|
|
20785
20968
|
|
|
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
20969
|
} // namespace duckdb
|
|
20854
20970
|
//===----------------------------------------------------------------------===//
|
|
20855
20971
|
// DuckDB
|
|
@@ -20933,7 +21049,7 @@ private:
|
|
|
20933
21049
|
//===----------------------------------------------------------------------===//
|
|
20934
21050
|
// DuckDB
|
|
20935
21051
|
//
|
|
20936
|
-
// duckdb/parser/expression/
|
|
21052
|
+
// duckdb/parser/expression/lambda_expression.hpp
|
|
20937
21053
|
//
|
|
20938
21054
|
//
|
|
20939
21055
|
//===----------------------------------------------------------------------===//
|
|
@@ -20945,33 +21061,32 @@ private:
|
|
|
20945
21061
|
|
|
20946
21062
|
namespace duckdb {
|
|
20947
21063
|
|
|
20948
|
-
//!
|
|
20949
|
-
|
|
21064
|
+
//! LambdaExpression represents a lambda operator that can be used for e.g. mapping an expression to a list
|
|
21065
|
+
//! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1"
|
|
21066
|
+
class LambdaExpression : public ParsedExpression {
|
|
20950
21067
|
public:
|
|
20951
|
-
|
|
21068
|
+
LambdaExpression(vector<string> parameters, unique_ptr<ParsedExpression> expression);
|
|
20952
21069
|
|
|
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;
|
|
21070
|
+
vector<string> parameters;
|
|
21071
|
+
unique_ptr<ParsedExpression> expression;
|
|
20959
21072
|
|
|
20960
21073
|
public:
|
|
20961
21074
|
string ToString() const override;
|
|
20962
21075
|
|
|
20963
|
-
static bool Equals(const
|
|
21076
|
+
static bool Equals(const LambdaExpression *a, const LambdaExpression *b);
|
|
21077
|
+
hash_t Hash() const override;
|
|
20964
21078
|
|
|
20965
21079
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
20966
21080
|
|
|
20967
|
-
void Serialize(
|
|
20968
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21081
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21082
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
20969
21083
|
};
|
|
21084
|
+
|
|
20970
21085
|
} // namespace duckdb
|
|
20971
21086
|
//===----------------------------------------------------------------------===//
|
|
20972
21087
|
// DuckDB
|
|
20973
21088
|
//
|
|
20974
|
-
// duckdb/parser/expression/
|
|
21089
|
+
// duckdb/parser/expression/case_expression.hpp
|
|
20975
21090
|
//
|
|
20976
21091
|
//
|
|
20977
21092
|
//===----------------------------------------------------------------------===//
|
|
@@ -20983,32 +21098,34 @@ public:
|
|
|
20983
21098
|
|
|
20984
21099
|
namespace duckdb {
|
|
20985
21100
|
|
|
20986
|
-
|
|
20987
|
-
|
|
21101
|
+
struct CaseCheck {
|
|
21102
|
+
unique_ptr<ParsedExpression> when_expr;
|
|
21103
|
+
unique_ptr<ParsedExpression> then_expr;
|
|
21104
|
+
};
|
|
21105
|
+
|
|
21106
|
+
//! The CaseExpression represents a CASE expression in the query
|
|
21107
|
+
class CaseExpression : public ParsedExpression {
|
|
20988
21108
|
public:
|
|
20989
|
-
|
|
20990
|
-
ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
20991
|
-
ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
|
|
21109
|
+
CaseExpression();
|
|
20992
21110
|
|
|
20993
|
-
vector<
|
|
21111
|
+
vector<CaseCheck> case_checks;
|
|
21112
|
+
unique_ptr<ParsedExpression> else_expr;
|
|
20994
21113
|
|
|
20995
21114
|
public:
|
|
20996
|
-
void AddExpression(unique_ptr<ParsedExpression> expr);
|
|
20997
|
-
|
|
20998
21115
|
string ToString() const override;
|
|
20999
21116
|
|
|
21000
|
-
static bool Equals(const
|
|
21117
|
+
static bool Equals(const CaseExpression *a, const CaseExpression *b);
|
|
21001
21118
|
|
|
21002
21119
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21003
21120
|
|
|
21004
|
-
void Serialize(
|
|
21005
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21121
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21122
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21006
21123
|
};
|
|
21007
21124
|
} // namespace duckdb
|
|
21008
21125
|
//===----------------------------------------------------------------------===//
|
|
21009
21126
|
// DuckDB
|
|
21010
21127
|
//
|
|
21011
|
-
// duckdb/parser/expression/
|
|
21128
|
+
// duckdb/parser/expression/conjunction_expression.hpp
|
|
21012
21129
|
//
|
|
21013
21130
|
//
|
|
21014
21131
|
//===----------------------------------------------------------------------===//
|
|
@@ -21017,33 +21134,35 @@ public:
|
|
|
21017
21134
|
|
|
21018
21135
|
|
|
21019
21136
|
|
|
21137
|
+
|
|
21020
21138
|
namespace duckdb {
|
|
21021
21139
|
|
|
21022
|
-
//!
|
|
21023
|
-
class
|
|
21140
|
+
//! Represents a conjunction (AND/OR)
|
|
21141
|
+
class ConjunctionExpression : public ParsedExpression {
|
|
21024
21142
|
public:
|
|
21025
|
-
|
|
21143
|
+
explicit ConjunctionExpression(ExpressionType type);
|
|
21144
|
+
ConjunctionExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
21145
|
+
ConjunctionExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
|
|
21026
21146
|
|
|
21027
|
-
|
|
21028
|
-
unique_ptr<ParsedExpression> child;
|
|
21029
|
-
//! The collation clause
|
|
21030
|
-
string collation;
|
|
21147
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
21031
21148
|
|
|
21032
21149
|
public:
|
|
21150
|
+
void AddExpression(unique_ptr<ParsedExpression> expr);
|
|
21151
|
+
|
|
21033
21152
|
string ToString() const override;
|
|
21034
21153
|
|
|
21035
|
-
static bool Equals(const
|
|
21154
|
+
static bool Equals(const ConjunctionExpression *a, const ConjunctionExpression *b);
|
|
21036
21155
|
|
|
21037
21156
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21038
21157
|
|
|
21039
|
-
void Serialize(
|
|
21040
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21158
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21159
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21041
21160
|
};
|
|
21042
21161
|
} // namespace duckdb
|
|
21043
21162
|
//===----------------------------------------------------------------------===//
|
|
21044
21163
|
// DuckDB
|
|
21045
21164
|
//
|
|
21046
|
-
// duckdb/parser/expression/
|
|
21165
|
+
// duckdb/parser/expression/function_expression.hpp
|
|
21047
21166
|
//
|
|
21048
21167
|
//
|
|
21049
21168
|
//===----------------------------------------------------------------------===//
|
|
@@ -21055,44 +21174,49 @@ public:
|
|
|
21055
21174
|
|
|
21056
21175
|
|
|
21057
21176
|
namespace duckdb {
|
|
21058
|
-
|
|
21059
|
-
|
|
21060
|
-
class SubqueryExpression : public ParsedExpression {
|
|
21177
|
+
//! Represents a function call
|
|
21178
|
+
class FunctionExpression : public ParsedExpression {
|
|
21061
21179
|
public:
|
|
21062
|
-
|
|
21180
|
+
FunctionExpression(string schema_name, const string &function_name, vector<unique_ptr<ParsedExpression>> children,
|
|
21181
|
+
unique_ptr<ParsedExpression> filter = nullptr, unique_ptr<OrderModifier> order_bys = nullptr,
|
|
21182
|
+
bool distinct = false, bool is_operator = false, bool export_state = false);
|
|
21183
|
+
FunctionExpression(const string &function_name, vector<unique_ptr<ParsedExpression>> children,
|
|
21184
|
+
unique_ptr<ParsedExpression> filter = nullptr, unique_ptr<OrderModifier> order_bys = nullptr,
|
|
21185
|
+
bool distinct = false, bool is_operator = false, bool export_state = false);
|
|
21063
21186
|
|
|
21064
|
-
//!
|
|
21065
|
-
|
|
21066
|
-
//!
|
|
21067
|
-
|
|
21068
|
-
//!
|
|
21069
|
-
|
|
21070
|
-
|
|
21071
|
-
|
|
21072
|
-
|
|
21187
|
+
//! Schema of the function
|
|
21188
|
+
string schema;
|
|
21189
|
+
//! Function name
|
|
21190
|
+
string function_name;
|
|
21191
|
+
//! Whether or not the function is an operator, only used for rendering
|
|
21192
|
+
bool is_operator;
|
|
21193
|
+
//! List of arguments to the function
|
|
21194
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
21195
|
+
//! Whether or not the aggregate function is distinct, only used for aggregates
|
|
21196
|
+
bool distinct;
|
|
21197
|
+
//! Expression representing a filter, only used for aggregates
|
|
21198
|
+
unique_ptr<ParsedExpression> filter;
|
|
21199
|
+
//! Modifier representing an ORDER BY, only used for aggregates
|
|
21200
|
+
unique_ptr<OrderModifier> order_bys;
|
|
21201
|
+
//! whether this function should export its state or not
|
|
21202
|
+
bool export_state;
|
|
21073
21203
|
|
|
21074
21204
|
public:
|
|
21075
|
-
bool HasSubquery() const override {
|
|
21076
|
-
return true;
|
|
21077
|
-
}
|
|
21078
|
-
bool IsScalar() const override {
|
|
21079
|
-
return false;
|
|
21080
|
-
}
|
|
21081
|
-
|
|
21082
21205
|
string ToString() const override;
|
|
21083
21206
|
|
|
21084
|
-
static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
|
|
21085
|
-
|
|
21086
21207
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21087
21208
|
|
|
21088
|
-
|
|
21089
|
-
|
|
21209
|
+
static bool Equals(const FunctionExpression *a, const FunctionExpression *b);
|
|
21210
|
+
hash_t Hash() const override;
|
|
21211
|
+
|
|
21212
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21213
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21090
21214
|
};
|
|
21091
21215
|
} // namespace duckdb
|
|
21092
21216
|
//===----------------------------------------------------------------------===//
|
|
21093
21217
|
// DuckDB
|
|
21094
21218
|
//
|
|
21095
|
-
// duckdb/parser/expression/
|
|
21219
|
+
// duckdb/parser/expression/default_expression.hpp
|
|
21096
21220
|
//
|
|
21097
21221
|
//
|
|
21098
21222
|
//===----------------------------------------------------------------------===//
|
|
@@ -21101,34 +21225,29 @@ public:
|
|
|
21101
21225
|
|
|
21102
21226
|
|
|
21103
21227
|
|
|
21104
|
-
|
|
21105
21228
|
namespace duckdb {
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
class ConstantExpression : public ParsedExpression {
|
|
21229
|
+
//! Represents the default value of a column
|
|
21230
|
+
class DefaultExpression : public ParsedExpression {
|
|
21109
21231
|
public:
|
|
21110
|
-
|
|
21111
|
-
|
|
21112
|
-
//! The constant value referenced
|
|
21113
|
-
Value value;
|
|
21232
|
+
DefaultExpression();
|
|
21114
21233
|
|
|
21115
21234
|
public:
|
|
21116
|
-
|
|
21235
|
+
bool IsScalar() const override {
|
|
21236
|
+
return false;
|
|
21237
|
+
}
|
|
21117
21238
|
|
|
21118
|
-
|
|
21119
|
-
hash_t Hash() const override;
|
|
21239
|
+
string ToString() const override;
|
|
21120
21240
|
|
|
21121
21241
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21122
21242
|
|
|
21123
|
-
void Serialize(
|
|
21124
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21243
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21244
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21125
21245
|
};
|
|
21126
|
-
|
|
21127
21246
|
} // namespace duckdb
|
|
21128
21247
|
//===----------------------------------------------------------------------===//
|
|
21129
21248
|
// DuckDB
|
|
21130
21249
|
//
|
|
21131
|
-
// duckdb/parser/expression/
|
|
21250
|
+
// duckdb/parser/expression/comparison_expression.hpp
|
|
21132
21251
|
//
|
|
21133
21252
|
//
|
|
21134
21253
|
//===----------------------------------------------------------------------===//
|
|
@@ -21137,35 +21256,31 @@ public:
|
|
|
21137
21256
|
|
|
21138
21257
|
|
|
21139
21258
|
|
|
21140
|
-
|
|
21141
21259
|
namespace duckdb {
|
|
21142
|
-
|
|
21143
|
-
//!
|
|
21144
|
-
|
|
21145
|
-
class LambdaExpression : public ParsedExpression {
|
|
21260
|
+
//! ComparisonExpression represents a boolean comparison (e.g. =, >=, <>). Always returns a boolean
|
|
21261
|
+
//! and has two children.
|
|
21262
|
+
class ComparisonExpression : public ParsedExpression {
|
|
21146
21263
|
public:
|
|
21147
|
-
|
|
21264
|
+
ComparisonExpression(ExpressionType type, unique_ptr<ParsedExpression> left, unique_ptr<ParsedExpression> right);
|
|
21148
21265
|
|
|
21149
|
-
|
|
21150
|
-
unique_ptr<ParsedExpression>
|
|
21266
|
+
unique_ptr<ParsedExpression> left;
|
|
21267
|
+
unique_ptr<ParsedExpression> right;
|
|
21151
21268
|
|
|
21152
21269
|
public:
|
|
21153
21270
|
string ToString() const override;
|
|
21154
21271
|
|
|
21155
|
-
static bool Equals(const
|
|
21156
|
-
hash_t Hash() const override;
|
|
21272
|
+
static bool Equals(const ComparisonExpression *a, const ComparisonExpression *b);
|
|
21157
21273
|
|
|
21158
21274
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21159
21275
|
|
|
21160
|
-
void Serialize(
|
|
21161
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21276
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21277
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21162
21278
|
};
|
|
21163
|
-
|
|
21164
21279
|
} // namespace duckdb
|
|
21165
21280
|
//===----------------------------------------------------------------------===//
|
|
21166
21281
|
// DuckDB
|
|
21167
21282
|
//
|
|
21168
|
-
// duckdb/parser/expression/
|
|
21283
|
+
// duckdb/parser/expression/constant_expression.hpp
|
|
21169
21284
|
//
|
|
21170
21285
|
//
|
|
21171
21286
|
//===----------------------------------------------------------------------===//
|
|
@@ -21174,32 +21289,34 @@ public:
|
|
|
21174
21289
|
|
|
21175
21290
|
|
|
21176
21291
|
|
|
21292
|
+
|
|
21177
21293
|
namespace duckdb {
|
|
21178
|
-
|
|
21294
|
+
|
|
21295
|
+
//! ConstantExpression represents a constant value in the query
|
|
21296
|
+
class ConstantExpression : public ParsedExpression {
|
|
21179
21297
|
public:
|
|
21180
|
-
|
|
21298
|
+
explicit ConstantExpression(Value val);
|
|
21181
21299
|
|
|
21182
|
-
|
|
21300
|
+
//! The constant value referenced
|
|
21301
|
+
Value value;
|
|
21183
21302
|
|
|
21184
21303
|
public:
|
|
21185
|
-
bool IsScalar() const override {
|
|
21186
|
-
return false;
|
|
21187
|
-
}
|
|
21188
|
-
|
|
21189
21304
|
string ToString() const override;
|
|
21190
21305
|
|
|
21191
|
-
static bool Equals(const
|
|
21192
|
-
unique_ptr<ParsedExpression> Copy() const override;
|
|
21306
|
+
static bool Equals(const ConstantExpression *a, const ConstantExpression *b);
|
|
21193
21307
|
hash_t Hash() const override;
|
|
21194
21308
|
|
|
21195
|
-
|
|
21196
|
-
|
|
21309
|
+
unique_ptr<ParsedExpression> Copy() const override;
|
|
21310
|
+
|
|
21311
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21312
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21197
21313
|
};
|
|
21314
|
+
|
|
21198
21315
|
} // namespace duckdb
|
|
21199
21316
|
//===----------------------------------------------------------------------===//
|
|
21200
21317
|
// DuckDB
|
|
21201
21318
|
//
|
|
21202
|
-
// duckdb/parser/expression/
|
|
21319
|
+
// duckdb/parser/expression/operator_expression.hpp
|
|
21203
21320
|
//
|
|
21204
21321
|
//
|
|
21205
21322
|
//===----------------------------------------------------------------------===//
|
|
@@ -21210,29 +21327,24 @@ public:
|
|
|
21210
21327
|
|
|
21211
21328
|
|
|
21212
21329
|
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 {
|
|
21330
|
+
//! Represents a built-in operator expression
|
|
21331
|
+
class OperatorExpression : public ParsedExpression {
|
|
21221
21332
|
public:
|
|
21222
|
-
|
|
21333
|
+
explicit OperatorExpression(ExpressionType type, unique_ptr<ParsedExpression> left = nullptr,
|
|
21334
|
+
unique_ptr<ParsedExpression> right = nullptr);
|
|
21335
|
+
OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
21223
21336
|
|
|
21224
|
-
vector<
|
|
21225
|
-
unique_ptr<ParsedExpression> else_expr;
|
|
21337
|
+
vector<unique_ptr<ParsedExpression>> children;
|
|
21226
21338
|
|
|
21227
21339
|
public:
|
|
21228
21340
|
string ToString() const override;
|
|
21229
21341
|
|
|
21230
|
-
static bool Equals(const
|
|
21342
|
+
static bool Equals(const OperatorExpression *a, const OperatorExpression *b);
|
|
21231
21343
|
|
|
21232
21344
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21233
21345
|
|
|
21234
|
-
void Serialize(
|
|
21235
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21346
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21347
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21236
21348
|
};
|
|
21237
21349
|
} // namespace duckdb
|
|
21238
21350
|
//===----------------------------------------------------------------------===//
|
|
@@ -21265,14 +21377,14 @@ public:
|
|
|
21265
21377
|
|
|
21266
21378
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21267
21379
|
|
|
21268
|
-
void Serialize(
|
|
21269
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21380
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21381
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21270
21382
|
};
|
|
21271
21383
|
} // namespace duckdb
|
|
21272
21384
|
//===----------------------------------------------------------------------===//
|
|
21273
21385
|
// DuckDB
|
|
21274
21386
|
//
|
|
21275
|
-
// duckdb/parser/expression/
|
|
21387
|
+
// duckdb/parser/expression/positional_reference_expression.hpp
|
|
21276
21388
|
//
|
|
21277
21389
|
//
|
|
21278
21390
|
//===----------------------------------------------------------------------===//
|
|
@@ -21282,26 +21394,30 @@ public:
|
|
|
21282
21394
|
|
|
21283
21395
|
|
|
21284
21396
|
namespace duckdb {
|
|
21285
|
-
|
|
21286
|
-
//! and has two children.
|
|
21287
|
-
class ComparisonExpression : public ParsedExpression {
|
|
21397
|
+
class PositionalReferenceExpression : public ParsedExpression {
|
|
21288
21398
|
public:
|
|
21289
|
-
|
|
21399
|
+
PositionalReferenceExpression(idx_t index);
|
|
21290
21400
|
|
|
21291
|
-
|
|
21292
|
-
unique_ptr<ParsedExpression> right;
|
|
21401
|
+
idx_t index;
|
|
21293
21402
|
|
|
21294
21403
|
public:
|
|
21295
|
-
|
|
21404
|
+
bool IsScalar() const override {
|
|
21405
|
+
return false;
|
|
21406
|
+
}
|
|
21296
21407
|
|
|
21297
|
-
|
|
21408
|
+
string ToString() const override;
|
|
21298
21409
|
|
|
21410
|
+
static bool Equals(const PositionalReferenceExpression *a, const PositionalReferenceExpression *b);
|
|
21299
21411
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21412
|
+
hash_t Hash() const override;
|
|
21300
21413
|
|
|
21301
|
-
void Serialize(
|
|
21302
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21414
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21415
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21303
21416
|
};
|
|
21304
21417
|
} // namespace duckdb
|
|
21418
|
+
|
|
21419
|
+
|
|
21420
|
+
|
|
21305
21421
|
//===----------------------------------------------------------------------===//
|
|
21306
21422
|
// DuckDB
|
|
21307
21423
|
//
|
|
@@ -21336,23 +21452,15 @@ public:
|
|
|
21336
21452
|
|
|
21337
21453
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21338
21454
|
|
|
21339
|
-
void Serialize(
|
|
21340
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21455
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21456
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21341
21457
|
};
|
|
21342
21458
|
} // namespace duckdb
|
|
21343
21459
|
|
|
21344
|
-
|
|
21345
|
-
|
|
21346
|
-
|
|
21347
|
-
|
|
21348
|
-
|
|
21349
|
-
|
|
21350
|
-
|
|
21351
|
-
|
|
21352
21460
|
//===----------------------------------------------------------------------===//
|
|
21353
21461
|
// DuckDB
|
|
21354
21462
|
//
|
|
21355
|
-
// duckdb/parser/expression/
|
|
21463
|
+
// duckdb/parser/expression/collate_expression.hpp
|
|
21356
21464
|
//
|
|
21357
21465
|
//
|
|
21358
21466
|
//===----------------------------------------------------------------------===//
|
|
@@ -21362,28 +21470,41 @@ public:
|
|
|
21362
21470
|
|
|
21363
21471
|
|
|
21364
21472
|
namespace duckdb {
|
|
21365
|
-
//! Represents the default value of a column
|
|
21366
|
-
class DefaultExpression : public ParsedExpression {
|
|
21367
|
-
public:
|
|
21368
|
-
DefaultExpression();
|
|
21369
21473
|
|
|
21474
|
+
//! CollateExpression represents a COLLATE statement
|
|
21475
|
+
class CollateExpression : public ParsedExpression {
|
|
21370
21476
|
public:
|
|
21371
|
-
|
|
21372
|
-
return false;
|
|
21373
|
-
}
|
|
21477
|
+
CollateExpression(string collation, unique_ptr<ParsedExpression> child);
|
|
21374
21478
|
|
|
21479
|
+
//! The child of the cast expression
|
|
21480
|
+
unique_ptr<ParsedExpression> child;
|
|
21481
|
+
//! The collation clause
|
|
21482
|
+
string collation;
|
|
21483
|
+
|
|
21484
|
+
public:
|
|
21375
21485
|
string ToString() const override;
|
|
21376
21486
|
|
|
21487
|
+
static bool Equals(const CollateExpression *a, const CollateExpression *b);
|
|
21488
|
+
|
|
21377
21489
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21378
21490
|
|
|
21379
|
-
|
|
21491
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21492
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21380
21493
|
};
|
|
21381
21494
|
} // namespace duckdb
|
|
21382
21495
|
|
|
21496
|
+
|
|
21497
|
+
|
|
21498
|
+
|
|
21499
|
+
|
|
21500
|
+
|
|
21501
|
+
|
|
21502
|
+
|
|
21503
|
+
|
|
21383
21504
|
//===----------------------------------------------------------------------===//
|
|
21384
21505
|
// DuckDB
|
|
21385
21506
|
//
|
|
21386
|
-
// duckdb/parser/expression/
|
|
21507
|
+
// duckdb/parser/expression/parameter_expression.hpp
|
|
21387
21508
|
//
|
|
21388
21509
|
//
|
|
21389
21510
|
//===----------------------------------------------------------------------===//
|
|
@@ -21392,46 +21513,28 @@ public:
|
|
|
21392
21513
|
|
|
21393
21514
|
|
|
21394
21515
|
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
21516
|
namespace duckdb {
|
|
21398
|
-
|
|
21399
|
-
class FunctionExpression : public ParsedExpression {
|
|
21517
|
+
class ParameterExpression : public ParsedExpression {
|
|
21400
21518
|
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);
|
|
21519
|
+
ParameterExpression();
|
|
21407
21520
|
|
|
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;
|
|
21521
|
+
idx_t parameter_nr;
|
|
21422
21522
|
|
|
21423
21523
|
public:
|
|
21524
|
+
bool IsScalar() const override {
|
|
21525
|
+
return true;
|
|
21526
|
+
}
|
|
21527
|
+
bool HasParameter() const override {
|
|
21528
|
+
return true;
|
|
21529
|
+
}
|
|
21530
|
+
|
|
21424
21531
|
string ToString() const override;
|
|
21425
21532
|
|
|
21426
21533
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21427
|
-
|
|
21428
|
-
static bool Equals(const FunctionExpression *a, const FunctionExpression *b);
|
|
21429
21534
|
hash_t Hash() const override;
|
|
21430
21535
|
|
|
21431
|
-
|
|
21432
|
-
|
|
21433
|
-
//! Deserializes a blob back into an FunctionExpression
|
|
21434
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, Deserializer &source);
|
|
21536
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21537
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21435
21538
|
};
|
|
21436
21539
|
} // namespace duckdb
|
|
21437
21540
|
|
|
@@ -21439,7 +21542,7 @@ public:
|
|
|
21439
21542
|
//===----------------------------------------------------------------------===//
|
|
21440
21543
|
// DuckDB
|
|
21441
21544
|
//
|
|
21442
|
-
// duckdb/parser/expression/
|
|
21545
|
+
// duckdb/parser/expression/star_expression.hpp
|
|
21443
21546
|
//
|
|
21444
21547
|
//
|
|
21445
21548
|
//===----------------------------------------------------------------------===//
|
|
@@ -21450,31 +21553,35 @@ public:
|
|
|
21450
21553
|
|
|
21451
21554
|
|
|
21452
21555
|
namespace duckdb {
|
|
21453
|
-
|
|
21454
|
-
|
|
21556
|
+
|
|
21557
|
+
//! Represents a * expression in the SELECT clause
|
|
21558
|
+
class StarExpression : public ParsedExpression {
|
|
21455
21559
|
public:
|
|
21456
|
-
|
|
21457
|
-
unique_ptr<ParsedExpression> right = nullptr);
|
|
21458
|
-
OperatorExpression(ExpressionType type, vector<unique_ptr<ParsedExpression>> children);
|
|
21560
|
+
StarExpression(string relation_name = string());
|
|
21459
21561
|
|
|
21460
|
-
|
|
21562
|
+
//! The relation name in case of tbl.*, or empty if this is a normal *
|
|
21563
|
+
string relation_name;
|
|
21564
|
+
//! List of columns to exclude from the STAR expression
|
|
21565
|
+
case_insensitive_set_t exclude_list;
|
|
21566
|
+
//! List of columns to replace with another expression
|
|
21567
|
+
case_insensitive_map_t<unique_ptr<ParsedExpression>> replace_list;
|
|
21461
21568
|
|
|
21462
21569
|
public:
|
|
21463
21570
|
string ToString() const override;
|
|
21464
21571
|
|
|
21465
|
-
static bool Equals(const
|
|
21572
|
+
static bool Equals(const StarExpression *a, const StarExpression *b);
|
|
21466
21573
|
|
|
21467
21574
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21468
21575
|
|
|
21469
|
-
void Serialize(
|
|
21470
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21576
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21577
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21471
21578
|
};
|
|
21472
21579
|
} // namespace duckdb
|
|
21473
21580
|
|
|
21474
21581
|
//===----------------------------------------------------------------------===//
|
|
21475
21582
|
// DuckDB
|
|
21476
21583
|
//
|
|
21477
|
-
// duckdb/parser/expression/
|
|
21584
|
+
// duckdb/parser/expression/subquery_expression.hpp
|
|
21478
21585
|
//
|
|
21479
21586
|
//
|
|
21480
21587
|
//===----------------------------------------------------------------------===//
|
|
@@ -21483,39 +21590,49 @@ public:
|
|
|
21483
21590
|
|
|
21484
21591
|
|
|
21485
21592
|
|
|
21593
|
+
|
|
21594
|
+
|
|
21486
21595
|
namespace duckdb {
|
|
21487
|
-
|
|
21596
|
+
|
|
21597
|
+
//! Represents a subquery
|
|
21598
|
+
class SubqueryExpression : public ParsedExpression {
|
|
21488
21599
|
public:
|
|
21489
|
-
|
|
21600
|
+
SubqueryExpression();
|
|
21490
21601
|
|
|
21491
|
-
|
|
21602
|
+
//! The actual subquery
|
|
21603
|
+
unique_ptr<SelectStatement> subquery;
|
|
21604
|
+
//! The subquery type
|
|
21605
|
+
SubqueryType subquery_type;
|
|
21606
|
+
//! the child expression to compare with (in case of IN, ANY, ALL operators, empty for EXISTS queries and scalar
|
|
21607
|
+
//! subquery)
|
|
21608
|
+
unique_ptr<ParsedExpression> child;
|
|
21609
|
+
//! The comparison type of the child expression with the subquery (in case of ANY, ALL operators), empty otherwise
|
|
21610
|
+
ExpressionType comparison_type;
|
|
21492
21611
|
|
|
21493
21612
|
public:
|
|
21494
|
-
bool
|
|
21613
|
+
bool HasSubquery() const override {
|
|
21495
21614
|
return true;
|
|
21496
21615
|
}
|
|
21497
|
-
bool
|
|
21498
|
-
return
|
|
21616
|
+
bool IsScalar() const override {
|
|
21617
|
+
return false;
|
|
21499
21618
|
}
|
|
21500
21619
|
|
|
21501
21620
|
string ToString() const override;
|
|
21502
21621
|
|
|
21622
|
+
static bool Equals(const SubqueryExpression *a, const SubqueryExpression *b);
|
|
21623
|
+
|
|
21503
21624
|
unique_ptr<ParsedExpression> Copy() const override;
|
|
21504
|
-
hash_t Hash() const override;
|
|
21505
21625
|
|
|
21506
|
-
void Serialize(
|
|
21507
|
-
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type,
|
|
21626
|
+
void Serialize(FieldWriter &writer) const override;
|
|
21627
|
+
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
|
21508
21628
|
};
|
|
21509
21629
|
} // namespace duckdb
|
|
21510
21630
|
|
|
21511
21631
|
|
|
21512
|
-
|
|
21513
|
-
|
|
21514
|
-
|
|
21515
21632
|
//===----------------------------------------------------------------------===//
|
|
21516
21633
|
// DuckDB
|
|
21517
21634
|
//
|
|
21518
|
-
// duckdb/parser/parsed_data/
|
|
21635
|
+
// duckdb/parser/parsed_data/create_collation_info.hpp
|
|
21519
21636
|
//
|
|
21520
21637
|
//
|
|
21521
21638
|
//===----------------------------------------------------------------------===//
|
|
@@ -21525,26 +21642,30 @@ public:
|
|
|
21525
21642
|
|
|
21526
21643
|
|
|
21527
21644
|
|
|
21528
|
-
|
|
21529
|
-
|
|
21530
21645
|
namespace duckdb {
|
|
21531
21646
|
|
|
21532
|
-
struct
|
|
21533
|
-
|
|
21534
|
-
|
|
21647
|
+
struct CreateCollationInfo : public CreateInfo {
|
|
21648
|
+
CreateCollationInfo(string name_p, ScalarFunction function_p, bool combinable_p, bool not_required_for_equality_p)
|
|
21649
|
+
: CreateInfo(CatalogType::COLLATION_ENTRY), function(move(function_p)), combinable(combinable_p),
|
|
21650
|
+
not_required_for_equality(not_required_for_equality_p) {
|
|
21651
|
+
this->name = move(name_p);
|
|
21535
21652
|
}
|
|
21536
21653
|
|
|
21537
|
-
//!
|
|
21654
|
+
//! The name of the collation
|
|
21538
21655
|
string name;
|
|
21539
|
-
//!
|
|
21540
|
-
|
|
21656
|
+
//! The collation function to push in case collation is required
|
|
21657
|
+
ScalarFunction function;
|
|
21658
|
+
//! Whether or not the collation can be combined with other collations.
|
|
21659
|
+
bool combinable;
|
|
21660
|
+
//! Whether or not the collation is required for equality comparisons or not. For many collations a binary
|
|
21661
|
+
//! comparison for equality comparisons is correct, allowing us to skip the collation in these cases which greatly
|
|
21662
|
+
//! speeds up processing.
|
|
21663
|
+
bool not_required_for_equality;
|
|
21541
21664
|
|
|
21542
21665
|
public:
|
|
21543
21666
|
unique_ptr<CreateInfo> Copy() const override {
|
|
21544
|
-
auto result = make_unique<
|
|
21667
|
+
auto result = make_unique<CreateCollationInfo>(name, function, combinable, not_required_for_equality);
|
|
21545
21668
|
CopyProperties(*result);
|
|
21546
|
-
result->name = name;
|
|
21547
|
-
result->type = make_unique<LogicalType>(*type);
|
|
21548
21669
|
return move(result);
|
|
21549
21670
|
}
|
|
21550
21671
|
};
|
|
@@ -21583,7 +21704,7 @@ public:
|
|
|
21583
21704
|
//===----------------------------------------------------------------------===//
|
|
21584
21705
|
// DuckDB
|
|
21585
21706
|
//
|
|
21586
|
-
// duckdb/parser/parsed_data/
|
|
21707
|
+
// duckdb/parser/parsed_data/show_select_info.hpp
|
|
21587
21708
|
//
|
|
21588
21709
|
//
|
|
21589
21710
|
//===----------------------------------------------------------------------===//
|
|
@@ -21595,26 +21716,31 @@ public:
|
|
|
21595
21716
|
|
|
21596
21717
|
namespace duckdb {
|
|
21597
21718
|
|
|
21598
|
-
struct
|
|
21599
|
-
//!
|
|
21600
|
-
|
|
21601
|
-
|
|
21602
|
-
|
|
21603
|
-
|
|
21604
|
-
|
|
21605
|
-
//!
|
|
21606
|
-
|
|
21607
|
-
};
|
|
21719
|
+
struct ShowSelectInfo : public ParseInfo {
|
|
21720
|
+
//! Types of projected columns
|
|
21721
|
+
vector<LogicalType> types;
|
|
21722
|
+
//! The QueryNode of select query
|
|
21723
|
+
unique_ptr<QueryNode> query;
|
|
21724
|
+
//! Aliases of projected columns
|
|
21725
|
+
vector<string> aliases;
|
|
21726
|
+
//! Whether or not we are requesting a summary or a describe
|
|
21727
|
+
bool is_summary;
|
|
21608
21728
|
|
|
21609
|
-
|
|
21610
|
-
|
|
21729
|
+
unique_ptr<ShowSelectInfo> Copy() {
|
|
21730
|
+
auto result = make_unique<ShowSelectInfo>();
|
|
21731
|
+
result->types = types;
|
|
21732
|
+
result->query = query->Copy();
|
|
21733
|
+
result->aliases = aliases;
|
|
21734
|
+
result->is_summary = is_summary;
|
|
21735
|
+
return result;
|
|
21736
|
+
}
|
|
21611
21737
|
};
|
|
21612
21738
|
|
|
21613
21739
|
} // namespace duckdb
|
|
21614
21740
|
//===----------------------------------------------------------------------===//
|
|
21615
21741
|
// DuckDB
|
|
21616
21742
|
//
|
|
21617
|
-
// duckdb/parser/parsed_data/
|
|
21743
|
+
// duckdb/parser/parsed_data/create_aggregate_function_info.hpp
|
|
21618
21744
|
//
|
|
21619
21745
|
//
|
|
21620
21746
|
//===----------------------------------------------------------------------===//
|
|
@@ -21623,17 +21749,39 @@ struct BoundExportData : public ParseInfo {
|
|
|
21623
21749
|
|
|
21624
21750
|
|
|
21625
21751
|
|
|
21752
|
+
|
|
21626
21753
|
namespace duckdb {
|
|
21627
21754
|
|
|
21628
|
-
struct
|
|
21629
|
-
|
|
21755
|
+
struct CreateAggregateFunctionInfo : public CreateFunctionInfo {
|
|
21756
|
+
explicit CreateAggregateFunctionInfo(AggregateFunction function)
|
|
21757
|
+
: CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(function.name) {
|
|
21758
|
+
this->name = function.name;
|
|
21759
|
+
functions.AddFunction(move(function));
|
|
21760
|
+
}
|
|
21761
|
+
|
|
21762
|
+
explicit CreateAggregateFunctionInfo(AggregateFunctionSet set)
|
|
21763
|
+
: CreateFunctionInfo(CatalogType::AGGREGATE_FUNCTION_ENTRY), functions(move(set)) {
|
|
21764
|
+
this->name = functions.name;
|
|
21765
|
+
for (auto &func : functions.functions) {
|
|
21766
|
+
func.name = functions.name;
|
|
21767
|
+
}
|
|
21768
|
+
}
|
|
21769
|
+
|
|
21770
|
+
AggregateFunctionSet functions;
|
|
21771
|
+
|
|
21772
|
+
public:
|
|
21773
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
21774
|
+
auto result = make_unique<CreateAggregateFunctionInfo>(functions);
|
|
21775
|
+
CopyProperties(*result);
|
|
21776
|
+
return move(result);
|
|
21777
|
+
}
|
|
21630
21778
|
};
|
|
21631
21779
|
|
|
21632
21780
|
} // namespace duckdb
|
|
21633
21781
|
//===----------------------------------------------------------------------===//
|
|
21634
21782
|
// DuckDB
|
|
21635
21783
|
//
|
|
21636
|
-
// duckdb/parser/parsed_data/
|
|
21784
|
+
// duckdb/parser/parsed_data/create_type_info.hpp
|
|
21637
21785
|
//
|
|
21638
21786
|
//
|
|
21639
21787
|
//===----------------------------------------------------------------------===//
|
|
@@ -21643,34 +21791,49 @@ struct VacuumInfo : public ParseInfo {
|
|
|
21643
21791
|
|
|
21644
21792
|
|
|
21645
21793
|
|
|
21794
|
+
|
|
21795
|
+
|
|
21646
21796
|
namespace duckdb {
|
|
21647
21797
|
|
|
21648
|
-
struct
|
|
21649
|
-
|
|
21650
|
-
|
|
21651
|
-
not_required_for_equality(not_required_for_equality_p) {
|
|
21652
|
-
this->name = move(name_p);
|
|
21798
|
+
struct CreateTypeInfo : public CreateInfo {
|
|
21799
|
+
|
|
21800
|
+
CreateTypeInfo() : CreateInfo(CatalogType::TYPE_ENTRY) {
|
|
21653
21801
|
}
|
|
21654
21802
|
|
|
21655
|
-
//!
|
|
21803
|
+
//! Name of the Type
|
|
21656
21804
|
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;
|
|
21805
|
+
//! Logical Type
|
|
21806
|
+
LogicalType type;
|
|
21665
21807
|
|
|
21666
21808
|
public:
|
|
21667
21809
|
unique_ptr<CreateInfo> Copy() const override {
|
|
21668
|
-
auto result = make_unique<
|
|
21810
|
+
auto result = make_unique<CreateTypeInfo>();
|
|
21669
21811
|
CopyProperties(*result);
|
|
21812
|
+
result->name = name;
|
|
21813
|
+
result->type = type;
|
|
21670
21814
|
return move(result);
|
|
21671
21815
|
}
|
|
21672
21816
|
};
|
|
21673
21817
|
|
|
21818
|
+
} // namespace duckdb
|
|
21819
|
+
//===----------------------------------------------------------------------===//
|
|
21820
|
+
// DuckDB
|
|
21821
|
+
//
|
|
21822
|
+
// duckdb/parser/parsed_data/vacuum_info.hpp
|
|
21823
|
+
//
|
|
21824
|
+
//
|
|
21825
|
+
//===----------------------------------------------------------------------===//
|
|
21826
|
+
|
|
21827
|
+
|
|
21828
|
+
|
|
21829
|
+
|
|
21830
|
+
|
|
21831
|
+
namespace duckdb {
|
|
21832
|
+
|
|
21833
|
+
struct VacuumInfo : public ParseInfo {
|
|
21834
|
+
// nothing for now
|
|
21835
|
+
};
|
|
21836
|
+
|
|
21674
21837
|
} // namespace duckdb
|
|
21675
21838
|
//===----------------------------------------------------------------------===//
|
|
21676
21839
|
// DuckDB
|
|
@@ -21719,7 +21882,43 @@ public:
|
|
|
21719
21882
|
//===----------------------------------------------------------------------===//
|
|
21720
21883
|
// DuckDB
|
|
21721
21884
|
//
|
|
21722
|
-
// duckdb/parser/parsed_data/
|
|
21885
|
+
// duckdb/parser/parsed_data/transaction_info.hpp
|
|
21886
|
+
//
|
|
21887
|
+
//
|
|
21888
|
+
//===----------------------------------------------------------------------===//
|
|
21889
|
+
|
|
21890
|
+
|
|
21891
|
+
|
|
21892
|
+
|
|
21893
|
+
|
|
21894
|
+
namespace duckdb {
|
|
21895
|
+
|
|
21896
|
+
enum class TransactionType : uint8_t { INVALID, BEGIN_TRANSACTION, COMMIT, ROLLBACK };
|
|
21897
|
+
|
|
21898
|
+
struct TransactionInfo : public ParseInfo {
|
|
21899
|
+
explicit TransactionInfo(TransactionType type) : type(type) {
|
|
21900
|
+
}
|
|
21901
|
+
|
|
21902
|
+
//! The type of transaction statement
|
|
21903
|
+
TransactionType type;
|
|
21904
|
+
};
|
|
21905
|
+
|
|
21906
|
+
} // namespace duckdb
|
|
21907
|
+
//===----------------------------------------------------------------------===//
|
|
21908
|
+
// DuckDB
|
|
21909
|
+
//
|
|
21910
|
+
// duckdb/parser/parsed_data/create_macro_info.hpp
|
|
21911
|
+
//
|
|
21912
|
+
//
|
|
21913
|
+
//===----------------------------------------------------------------------===//
|
|
21914
|
+
|
|
21915
|
+
|
|
21916
|
+
|
|
21917
|
+
|
|
21918
|
+
//===----------------------------------------------------------------------===//
|
|
21919
|
+
// DuckDB
|
|
21920
|
+
//
|
|
21921
|
+
// duckdb/function/macro_function.hpp
|
|
21723
21922
|
//
|
|
21724
21923
|
//
|
|
21725
21924
|
//===----------------------------------------------------------------------===//
|
|
@@ -21729,31 +21928,75 @@ public:
|
|
|
21729
21928
|
|
|
21730
21929
|
|
|
21731
21930
|
|
|
21931
|
+
|
|
21932
|
+
|
|
21732
21933
|
namespace duckdb {
|
|
21733
21934
|
|
|
21734
|
-
|
|
21735
|
-
|
|
21935
|
+
class MacroCatalogEntry;
|
|
21936
|
+
|
|
21937
|
+
class MacroFunction {
|
|
21938
|
+
public:
|
|
21939
|
+
explicit MacroFunction(unique_ptr<ParsedExpression> expression);
|
|
21940
|
+
|
|
21941
|
+
//! Check whether the supplied arguments are valid
|
|
21942
|
+
static string ValidateArguments(MacroCatalogEntry ¯o_func, FunctionExpression &function_expr,
|
|
21943
|
+
vector<unique_ptr<ParsedExpression>> &positionals,
|
|
21944
|
+
unordered_map<string, unique_ptr<ParsedExpression>> &defaults);
|
|
21945
|
+
//! The macro expression
|
|
21946
|
+
unique_ptr<ParsedExpression> expression;
|
|
21947
|
+
//! The positional parameters
|
|
21948
|
+
vector<unique_ptr<ParsedExpression>> parameters;
|
|
21949
|
+
//! The default parameters and their associated values
|
|
21950
|
+
unordered_map<string, unique_ptr<ParsedExpression>> default_parameters;
|
|
21951
|
+
|
|
21952
|
+
public:
|
|
21953
|
+
unique_ptr<MacroFunction> Copy();
|
|
21954
|
+
};
|
|
21955
|
+
|
|
21956
|
+
} // namespace duckdb
|
|
21957
|
+
|
|
21958
|
+
|
|
21959
|
+
namespace duckdb {
|
|
21960
|
+
|
|
21961
|
+
struct CreateMacroInfo : public CreateFunctionInfo {
|
|
21962
|
+
CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) {
|
|
21736
21963
|
}
|
|
21737
|
-
|
|
21738
|
-
|
|
21964
|
+
|
|
21965
|
+
unique_ptr<MacroFunction> function;
|
|
21966
|
+
|
|
21967
|
+
public:
|
|
21968
|
+
unique_ptr<CreateInfo> Copy() const override {
|
|
21969
|
+
auto result = make_unique<CreateMacroInfo>();
|
|
21970
|
+
result->function = function->Copy();
|
|
21971
|
+
result->name = name;
|
|
21972
|
+
CopyProperties(*result);
|
|
21973
|
+
return move(result);
|
|
21739
21974
|
}
|
|
21975
|
+
};
|
|
21976
|
+
|
|
21977
|
+
} // namespace duckdb
|
|
21978
|
+
//===----------------------------------------------------------------------===//
|
|
21979
|
+
// DuckDB
|
|
21980
|
+
//
|
|
21981
|
+
// duckdb/parser/parsed_data/create_schema_info.hpp
|
|
21982
|
+
//
|
|
21983
|
+
//
|
|
21984
|
+
//===----------------------------------------------------------------------===//
|
|
21985
|
+
|
|
21986
|
+
|
|
21740
21987
|
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
|
|
21746
|
-
|
|
21747
|
-
|
|
21748
|
-
unique_ptr<SelectStatement> query;
|
|
21988
|
+
|
|
21989
|
+
|
|
21990
|
+
namespace duckdb {
|
|
21991
|
+
|
|
21992
|
+
struct CreateSchemaInfo : public CreateInfo {
|
|
21993
|
+
CreateSchemaInfo() : CreateInfo(CatalogType::SCHEMA_ENTRY) {
|
|
21994
|
+
}
|
|
21749
21995
|
|
|
21750
21996
|
public:
|
|
21751
21997
|
unique_ptr<CreateInfo> Copy() const override {
|
|
21752
|
-
auto result = make_unique<
|
|
21998
|
+
auto result = make_unique<CreateSchemaInfo>();
|
|
21753
21999
|
CopyProperties(*result);
|
|
21754
|
-
result->aliases = aliases;
|
|
21755
|
-
result->types = types;
|
|
21756
|
-
result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
|
|
21757
22000
|
return move(result);
|
|
21758
22001
|
}
|
|
21759
22002
|
};
|
|
@@ -21806,9 +22049,9 @@ public:
|
|
|
21806
22049
|
unique_ptr<TableRef> Copy() override;
|
|
21807
22050
|
|
|
21808
22051
|
//! Serializes a blob into a BaseTableRef
|
|
21809
|
-
void Serialize(
|
|
22052
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
21810
22053
|
//! Deserializes a blob back into a BaseTableRef
|
|
21811
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22054
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
21812
22055
|
};
|
|
21813
22056
|
} // namespace duckdb
|
|
21814
22057
|
|
|
@@ -21850,95 +22093,7 @@ public:
|
|
|
21850
22093
|
//===----------------------------------------------------------------------===//
|
|
21851
22094
|
// DuckDB
|
|
21852
22095
|
//
|
|
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
|
|
22096
|
+
// duckdb/parser/parsed_data/create_pragma_function_info.hpp
|
|
21942
22097
|
//
|
|
21943
22098
|
//
|
|
21944
22099
|
//===----------------------------------------------------------------------===//
|
|
@@ -21978,7 +22133,7 @@ public:
|
|
|
21978
22133
|
//===----------------------------------------------------------------------===//
|
|
21979
22134
|
// DuckDB
|
|
21980
22135
|
//
|
|
21981
|
-
// duckdb/parser/parsed_data/
|
|
22136
|
+
// duckdb/parser/parsed_data/export_table_data.hpp
|
|
21982
22137
|
//
|
|
21983
22138
|
//
|
|
21984
22139
|
//===----------------------------------------------------------------------===//
|
|
@@ -21990,47 +22145,26 @@ public:
|
|
|
21990
22145
|
|
|
21991
22146
|
namespace duckdb {
|
|
21992
22147
|
|
|
21993
|
-
struct
|
|
21994
|
-
|
|
21995
|
-
|
|
21996
|
-
this->name = function.name;
|
|
21997
|
-
functions.AddFunction(move(function));
|
|
21998
|
-
}
|
|
22148
|
+
struct ExportedTableData {
|
|
22149
|
+
//! Name of the exported table
|
|
22150
|
+
string table_name;
|
|
21999
22151
|
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
this->name = functions.name;
|
|
22003
|
-
for (auto &func : functions.functions) {
|
|
22004
|
-
func.name = functions.name;
|
|
22005
|
-
}
|
|
22006
|
-
}
|
|
22152
|
+
//! Name of the schema
|
|
22153
|
+
string schema_name;
|
|
22007
22154
|
|
|
22008
|
-
|
|
22155
|
+
//! Path to be exported
|
|
22156
|
+
string file_path;
|
|
22157
|
+
};
|
|
22009
22158
|
|
|
22010
|
-
public
|
|
22011
|
-
|
|
22012
|
-
auto result = make_unique<CreateAggregateFunctionInfo>(functions);
|
|
22013
|
-
CopyProperties(*result);
|
|
22014
|
-
return move(result);
|
|
22015
|
-
}
|
|
22159
|
+
struct BoundExportData : public ParseInfo {
|
|
22160
|
+
unordered_map<TableCatalogEntry *, ExportedTableData> data;
|
|
22016
22161
|
};
|
|
22017
22162
|
|
|
22018
22163
|
} // namespace duckdb
|
|
22019
22164
|
//===----------------------------------------------------------------------===//
|
|
22020
22165
|
// DuckDB
|
|
22021
22166
|
//
|
|
22022
|
-
// duckdb/parser/parsed_data/
|
|
22023
|
-
//
|
|
22024
|
-
//
|
|
22025
|
-
//===----------------------------------------------------------------------===//
|
|
22026
|
-
|
|
22027
|
-
|
|
22028
|
-
|
|
22029
|
-
|
|
22030
|
-
//===----------------------------------------------------------------------===//
|
|
22031
|
-
// DuckDB
|
|
22032
|
-
//
|
|
22033
|
-
// duckdb/function/macro_function.hpp
|
|
22167
|
+
// duckdb/parser/parsed_data/create_view_info.hpp
|
|
22034
22168
|
//
|
|
22035
22169
|
//
|
|
22036
22170
|
//===----------------------------------------------------------------------===//
|
|
@@ -22040,48 +22174,31 @@ public:
|
|
|
22040
22174
|
|
|
22041
22175
|
|
|
22042
22176
|
|
|
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
22177
|
namespace duckdb {
|
|
22072
22178
|
|
|
22073
|
-
struct
|
|
22074
|
-
|
|
22179
|
+
struct CreateViewInfo : public CreateInfo {
|
|
22180
|
+
CreateViewInfo() : CreateInfo(CatalogType::VIEW_ENTRY, INVALID_SCHEMA) {
|
|
22181
|
+
}
|
|
22182
|
+
CreateViewInfo(string schema, string view_name)
|
|
22183
|
+
: CreateInfo(CatalogType::VIEW_ENTRY, schema), view_name(view_name) {
|
|
22075
22184
|
}
|
|
22076
22185
|
|
|
22077
|
-
|
|
22186
|
+
//! Table name to insert to
|
|
22187
|
+
string view_name;
|
|
22188
|
+
//! Aliases of the view
|
|
22189
|
+
vector<string> aliases;
|
|
22190
|
+
//! Return types
|
|
22191
|
+
vector<LogicalType> types;
|
|
22192
|
+
//! The SelectStatement of the view
|
|
22193
|
+
unique_ptr<SelectStatement> query;
|
|
22078
22194
|
|
|
22079
22195
|
public:
|
|
22080
22196
|
unique_ptr<CreateInfo> Copy() const override {
|
|
22081
|
-
auto result = make_unique<
|
|
22082
|
-
result->function = function->Copy();
|
|
22083
|
-
result->name = name;
|
|
22197
|
+
auto result = make_unique<CreateViewInfo>(schema, view_name);
|
|
22084
22198
|
CopyProperties(*result);
|
|
22199
|
+
result->aliases = aliases;
|
|
22200
|
+
result->types = types;
|
|
22201
|
+
result->query = unique_ptr_cast<SQLStatement, SelectStatement>(query->Copy());
|
|
22085
22202
|
return move(result);
|
|
22086
22203
|
}
|
|
22087
22204
|
};
|
|
@@ -22090,7 +22207,7 @@ public:
|
|
|
22090
22207
|
//===----------------------------------------------------------------------===//
|
|
22091
22208
|
// DuckDB
|
|
22092
22209
|
//
|
|
22093
|
-
// duckdb/parser/tableref/
|
|
22210
|
+
// duckdb/parser/tableref/table_function_ref.hpp
|
|
22094
22211
|
//
|
|
22095
22212
|
//
|
|
22096
22213
|
//===----------------------------------------------------------------------===//
|
|
@@ -22100,26 +22217,32 @@ public:
|
|
|
22100
22217
|
|
|
22101
22218
|
|
|
22102
22219
|
|
|
22220
|
+
|
|
22221
|
+
|
|
22103
22222
|
namespace duckdb {
|
|
22104
|
-
//! Represents a
|
|
22105
|
-
class
|
|
22223
|
+
//! Represents a Table producing function
|
|
22224
|
+
class TableFunctionRef : public TableRef {
|
|
22106
22225
|
public:
|
|
22107
|
-
|
|
22226
|
+
TableFunctionRef() : TableRef(TableReferenceType::TABLE_FUNCTION) {
|
|
22227
|
+
}
|
|
22108
22228
|
|
|
22109
|
-
|
|
22110
|
-
unique_ptr<SelectStatement> subquery;
|
|
22111
|
-
//! Aliases for the column names
|
|
22229
|
+
unique_ptr<ParsedExpression> function;
|
|
22112
22230
|
vector<string> column_name_alias;
|
|
22113
22231
|
|
|
22232
|
+
// if the function takes a subquery as argument its in here
|
|
22233
|
+
unique_ptr<SelectStatement> subquery;
|
|
22234
|
+
|
|
22114
22235
|
public:
|
|
22236
|
+
string ToString() const override;
|
|
22237
|
+
|
|
22115
22238
|
bool Equals(const TableRef *other_p) const override;
|
|
22116
22239
|
|
|
22117
22240
|
unique_ptr<TableRef> Copy() override;
|
|
22118
22241
|
|
|
22119
|
-
//! Serializes a blob into a
|
|
22120
|
-
void Serialize(
|
|
22121
|
-
//! Deserializes a blob back into a
|
|
22122
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22242
|
+
//! Serializes a blob into a BaseTableRef
|
|
22243
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22244
|
+
//! Deserializes a blob back into a BaseTableRef
|
|
22245
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22123
22246
|
};
|
|
22124
22247
|
} // namespace duckdb
|
|
22125
22248
|
//===----------------------------------------------------------------------===//
|
|
@@ -22152,15 +22275,15 @@ public:
|
|
|
22152
22275
|
unique_ptr<TableRef> Copy() override;
|
|
22153
22276
|
|
|
22154
22277
|
//! Serializes a blob into a CrossProductRef
|
|
22155
|
-
void Serialize(
|
|
22278
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22156
22279
|
//! Deserializes a blob back into a CrossProductRef
|
|
22157
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22280
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22158
22281
|
};
|
|
22159
22282
|
} // namespace duckdb
|
|
22160
22283
|
//===----------------------------------------------------------------------===//
|
|
22161
22284
|
// DuckDB
|
|
22162
22285
|
//
|
|
22163
|
-
// duckdb/parser/tableref/
|
|
22286
|
+
// duckdb/parser/tableref/emptytableref.hpp
|
|
22164
22287
|
//
|
|
22165
22288
|
//
|
|
22166
22289
|
//===----------------------------------------------------------------------===//
|
|
@@ -22169,41 +22292,27 @@ public:
|
|
|
22169
22292
|
|
|
22170
22293
|
|
|
22171
22294
|
|
|
22172
|
-
|
|
22173
|
-
|
|
22174
|
-
|
|
22175
|
-
|
|
22176
22295
|
namespace duckdb {
|
|
22177
|
-
//! Represents a
|
|
22178
|
-
class
|
|
22296
|
+
//! Represents a cross product
|
|
22297
|
+
class EmptyTableRef : public TableRef {
|
|
22179
22298
|
public:
|
|
22180
|
-
|
|
22299
|
+
EmptyTableRef() : TableRef(TableReferenceType::EMPTY) {
|
|
22181
22300
|
}
|
|
22182
22301
|
|
|
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
22302
|
public:
|
|
22197
22303
|
bool Equals(const TableRef *other_p) const override;
|
|
22198
22304
|
|
|
22199
22305
|
unique_ptr<TableRef> Copy() override;
|
|
22200
22306
|
|
|
22201
|
-
//! Serializes a blob into a
|
|
22202
|
-
void Serialize(
|
|
22203
|
-
//! Deserializes a blob back into a
|
|
22204
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22307
|
+
//! Serializes a blob into a DummyTableRef
|
|
22308
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22309
|
+
//! Deserializes a blob back into a DummyTableRef
|
|
22310
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22205
22311
|
};
|
|
22206
22312
|
} // namespace duckdb
|
|
22313
|
+
|
|
22314
|
+
|
|
22315
|
+
|
|
22207
22316
|
//===----------------------------------------------------------------------===//
|
|
22208
22317
|
// DuckDB
|
|
22209
22318
|
//
|
|
@@ -22239,15 +22348,16 @@ public:
|
|
|
22239
22348
|
unique_ptr<TableRef> Copy() override;
|
|
22240
22349
|
|
|
22241
22350
|
//! Serializes a blob into a ExpressionListRef
|
|
22242
|
-
void Serialize(
|
|
22351
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22243
22352
|
//! Deserializes a blob back into a ExpressionListRef
|
|
22244
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22353
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22245
22354
|
};
|
|
22246
22355
|
} // namespace duckdb
|
|
22356
|
+
|
|
22247
22357
|
//===----------------------------------------------------------------------===//
|
|
22248
22358
|
// DuckDB
|
|
22249
22359
|
//
|
|
22250
|
-
// duckdb/parser/tableref/
|
|
22360
|
+
// duckdb/parser/tableref/joinref.hpp
|
|
22251
22361
|
//
|
|
22252
22362
|
//
|
|
22253
22363
|
//===----------------------------------------------------------------------===//
|
|
@@ -22256,28 +22366,46 @@ public:
|
|
|
22256
22366
|
|
|
22257
22367
|
|
|
22258
22368
|
|
|
22369
|
+
|
|
22370
|
+
|
|
22371
|
+
|
|
22372
|
+
|
|
22259
22373
|
namespace duckdb {
|
|
22260
|
-
//! Represents a
|
|
22261
|
-
class
|
|
22374
|
+
//! Represents a JOIN between two expressions
|
|
22375
|
+
class JoinRef : public TableRef {
|
|
22262
22376
|
public:
|
|
22263
|
-
|
|
22377
|
+
JoinRef() : TableRef(TableReferenceType::JOIN), is_natural(false) {
|
|
22264
22378
|
}
|
|
22265
22379
|
|
|
22380
|
+
//! The left hand side of the join
|
|
22381
|
+
unique_ptr<TableRef> left;
|
|
22382
|
+
//! The right hand side of the join
|
|
22383
|
+
unique_ptr<TableRef> right;
|
|
22384
|
+
//! The join condition
|
|
22385
|
+
unique_ptr<ParsedExpression> condition;
|
|
22386
|
+
//! The join type
|
|
22387
|
+
JoinType type;
|
|
22388
|
+
//! Natural join
|
|
22389
|
+
bool is_natural;
|
|
22390
|
+
//! The set of USING columns (if any)
|
|
22391
|
+
vector<string> using_columns;
|
|
22392
|
+
|
|
22266
22393
|
public:
|
|
22267
22394
|
bool Equals(const TableRef *other_p) const override;
|
|
22268
22395
|
|
|
22269
22396
|
unique_ptr<TableRef> Copy() override;
|
|
22270
22397
|
|
|
22271
|
-
//! Serializes a blob into a
|
|
22272
|
-
void Serialize(
|
|
22273
|
-
//! Deserializes a blob back into a
|
|
22274
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22398
|
+
//! Serializes a blob into a JoinRef
|
|
22399
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22400
|
+
//! Deserializes a blob back into a JoinRef
|
|
22401
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22275
22402
|
};
|
|
22276
22403
|
} // namespace duckdb
|
|
22404
|
+
|
|
22277
22405
|
//===----------------------------------------------------------------------===//
|
|
22278
22406
|
// DuckDB
|
|
22279
22407
|
//
|
|
22280
|
-
// duckdb/parser/tableref/
|
|
22408
|
+
// duckdb/parser/tableref/subqueryref.hpp
|
|
22281
22409
|
//
|
|
22282
22410
|
//
|
|
22283
22411
|
//===----------------------------------------------------------------------===//
|
|
@@ -22287,38 +22415,27 @@ public:
|
|
|
22287
22415
|
|
|
22288
22416
|
|
|
22289
22417
|
|
|
22290
|
-
|
|
22291
|
-
|
|
22292
22418
|
namespace duckdb {
|
|
22293
|
-
//! Represents a
|
|
22294
|
-
class
|
|
22419
|
+
//! Represents a subquery
|
|
22420
|
+
class SubqueryRef : public TableRef {
|
|
22295
22421
|
public:
|
|
22296
|
-
|
|
22297
|
-
}
|
|
22298
|
-
|
|
22299
|
-
unique_ptr<ParsedExpression> function;
|
|
22300
|
-
vector<string> column_name_alias;
|
|
22422
|
+
explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string());
|
|
22301
22423
|
|
|
22302
|
-
|
|
22424
|
+
//! The subquery
|
|
22303
22425
|
unique_ptr<SelectStatement> subquery;
|
|
22426
|
+
//! Aliases for the column names
|
|
22427
|
+
vector<string> column_name_alias;
|
|
22304
22428
|
|
|
22305
22429
|
public:
|
|
22306
|
-
string ToString() const override;
|
|
22307
|
-
|
|
22308
22430
|
bool Equals(const TableRef *other_p) const override;
|
|
22309
22431
|
|
|
22310
22432
|
unique_ptr<TableRef> Copy() override;
|
|
22311
22433
|
|
|
22312
|
-
//! Serializes a blob into a
|
|
22313
|
-
void Serialize(
|
|
22314
|
-
//! Deserializes a blob back into a
|
|
22315
|
-
static unique_ptr<TableRef> Deserialize(
|
|
22434
|
+
//! Serializes a blob into a SubqueryRef
|
|
22435
|
+
void Serialize(FieldWriter &serializer) const override;
|
|
22436
|
+
//! Deserializes a blob back into a SubqueryRef
|
|
22437
|
+
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
|
22316
22438
|
};
|
|
22317
22439
|
} // namespace duckdb
|
|
22318
22440
|
|
|
22319
22441
|
|
|
22320
|
-
|
|
22321
|
-
|
|
22322
|
-
|
|
22323
|
-
|
|
22324
|
-
|