duckdb 0.3.2-dev955.0 → 0.3.2-dev957.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 +161 -0
- package/src/duckdb.hpp +15 -11
- package/src/parquet-amalgamation.cpp +34450 -34450
package/package.json
CHANGED
package/src/duckdb.cpp
CHANGED
|
@@ -91590,6 +91590,10 @@ struct DuckDBFunctionsFun {
|
|
|
91590
91590
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
91591
91591
|
};
|
|
91592
91592
|
|
|
91593
|
+
struct DuckDBKeywordsFun {
|
|
91594
|
+
static void RegisterFunction(BuiltinFunctions &set);
|
|
91595
|
+
};
|
|
91596
|
+
|
|
91593
91597
|
struct DuckDBIndexesFun {
|
|
91594
91598
|
static void RegisterFunction(BuiltinFunctions &set);
|
|
91595
91599
|
};
|
|
@@ -93771,6 +93775,90 @@ void DuckDBIndexesFun::RegisterFunction(BuiltinFunctions &set) {
|
|
|
93771
93775
|
|
|
93772
93776
|
|
|
93773
93777
|
|
|
93778
|
+
namespace duckdb {
|
|
93779
|
+
|
|
93780
|
+
struct DuckDBKeywordsData : public FunctionOperatorData {
|
|
93781
|
+
DuckDBKeywordsData() : offset(0) {
|
|
93782
|
+
}
|
|
93783
|
+
|
|
93784
|
+
vector<ParserKeyword> entries;
|
|
93785
|
+
idx_t offset;
|
|
93786
|
+
};
|
|
93787
|
+
|
|
93788
|
+
static unique_ptr<FunctionData> DuckDBKeywordsBind(ClientContext &context, vector<Value> &inputs,
|
|
93789
|
+
unordered_map<string, Value> &named_parameters,
|
|
93790
|
+
vector<LogicalType> &input_table_types,
|
|
93791
|
+
vector<string> &input_table_names, vector<LogicalType> &return_types,
|
|
93792
|
+
vector<string> &names) {
|
|
93793
|
+
names.emplace_back("keyword_name");
|
|
93794
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
93795
|
+
|
|
93796
|
+
names.emplace_back("keyword_category");
|
|
93797
|
+
return_types.emplace_back(LogicalType::VARCHAR);
|
|
93798
|
+
|
|
93799
|
+
return nullptr;
|
|
93800
|
+
}
|
|
93801
|
+
|
|
93802
|
+
unique_ptr<FunctionOperatorData> DuckDBKeywordsInit(ClientContext &context, const FunctionData *bind_data,
|
|
93803
|
+
const vector<column_t> &column_ids,
|
|
93804
|
+
TableFilterCollection *filters) {
|
|
93805
|
+
auto result = make_unique<DuckDBKeywordsData>();
|
|
93806
|
+
result->entries = Parser::KeywordList();
|
|
93807
|
+
return move(result);
|
|
93808
|
+
}
|
|
93809
|
+
|
|
93810
|
+
void DuckDBKeywordsFunction(ClientContext &context, const FunctionData *bind_data, FunctionOperatorData *operator_state,
|
|
93811
|
+
DataChunk *input, DataChunk &output) {
|
|
93812
|
+
auto &data = (DuckDBKeywordsData &)*operator_state;
|
|
93813
|
+
if (data.offset >= data.entries.size()) {
|
|
93814
|
+
// finished returning values
|
|
93815
|
+
return;
|
|
93816
|
+
}
|
|
93817
|
+
// start returning values
|
|
93818
|
+
// either fill up the chunk or return all the remaining columns
|
|
93819
|
+
idx_t count = 0;
|
|
93820
|
+
while (data.offset < data.entries.size() && count < STANDARD_VECTOR_SIZE) {
|
|
93821
|
+
auto &entry = data.entries[data.offset++];
|
|
93822
|
+
|
|
93823
|
+
// keyword_name, VARCHAR
|
|
93824
|
+
output.SetValue(0, count, Value(entry.name));
|
|
93825
|
+
// keyword_category, VARCHAR
|
|
93826
|
+
string category_name;
|
|
93827
|
+
switch (entry.category) {
|
|
93828
|
+
case KeywordCategory::KEYWORD_RESERVED:
|
|
93829
|
+
category_name = "reserved";
|
|
93830
|
+
break;
|
|
93831
|
+
case KeywordCategory::KEYWORD_UNRESERVED:
|
|
93832
|
+
category_name = "unreserved";
|
|
93833
|
+
break;
|
|
93834
|
+
case KeywordCategory::KEYWORD_TYPE_FUNC:
|
|
93835
|
+
category_name = "type_function";
|
|
93836
|
+
break;
|
|
93837
|
+
case KeywordCategory::KEYWORD_COL_NAME:
|
|
93838
|
+
category_name = "column_name";
|
|
93839
|
+
break;
|
|
93840
|
+
default:
|
|
93841
|
+
throw InternalException("Unrecognized keyword category");
|
|
93842
|
+
}
|
|
93843
|
+
output.SetValue(1, count, Value(move(category_name)));
|
|
93844
|
+
|
|
93845
|
+
count++;
|
|
93846
|
+
}
|
|
93847
|
+
output.SetCardinality(count);
|
|
93848
|
+
}
|
|
93849
|
+
|
|
93850
|
+
void DuckDBKeywordsFun::RegisterFunction(BuiltinFunctions &set) {
|
|
93851
|
+
set.AddFunction(
|
|
93852
|
+
TableFunction("duckdb_keywords", {}, DuckDBKeywordsFunction, DuckDBKeywordsBind, DuckDBKeywordsInit));
|
|
93853
|
+
}
|
|
93854
|
+
|
|
93855
|
+
} // namespace duckdb
|
|
93856
|
+
|
|
93857
|
+
|
|
93858
|
+
|
|
93859
|
+
|
|
93860
|
+
|
|
93861
|
+
|
|
93774
93862
|
|
|
93775
93863
|
namespace duckdb {
|
|
93776
93864
|
|
|
@@ -95461,6 +95549,7 @@ void BuiltinFunctions::RegisterSQLiteFunctions() {
|
|
|
95461
95549
|
DuckDBColumnsFun::RegisterFunction(*this);
|
|
95462
95550
|
DuckDBConstraintsFun::RegisterFunction(*this);
|
|
95463
95551
|
DuckDBFunctionsFun::RegisterFunction(*this);
|
|
95552
|
+
DuckDBKeywordsFun::RegisterFunction(*this);
|
|
95464
95553
|
DuckDBIndexesFun::RegisterFunction(*this);
|
|
95465
95554
|
DuckDBSchemasFun::RegisterFunction(*this);
|
|
95466
95555
|
DuckDBDependenciesFun::RegisterFunction(*this);
|
|
@@ -134906,6 +134995,7 @@ private:
|
|
|
134906
134995
|
|
|
134907
134996
|
|
|
134908
134997
|
#include <cstdint>
|
|
134998
|
+
#include <string>
|
|
134909
134999
|
|
|
134910
135000
|
namespace duckdb_libpgquery {
|
|
134911
135001
|
|
|
@@ -134923,6 +135013,18 @@ struct PGSimplifiedToken {
|
|
|
134923
135013
|
int32_t start;
|
|
134924
135014
|
};
|
|
134925
135015
|
|
|
135016
|
+
enum class PGKeywordCategory : uint8_t {
|
|
135017
|
+
PG_KEYWORD_RESERVED,
|
|
135018
|
+
PG_KEYWORD_UNRESERVED,
|
|
135019
|
+
PG_KEYWORD_TYPE_FUNC,
|
|
135020
|
+
PG_KEYWORD_COL_NAME
|
|
135021
|
+
};
|
|
135022
|
+
|
|
135023
|
+
struct PGKeyword {
|
|
135024
|
+
std::string text;
|
|
135025
|
+
PGKeywordCategory category;
|
|
135026
|
+
};
|
|
135027
|
+
|
|
134926
135028
|
}
|
|
134927
135029
|
|
|
134928
135030
|
|
|
@@ -134944,6 +135046,7 @@ public:
|
|
|
134944
135046
|
static std::vector<duckdb_libpgquery::PGSimplifiedToken> Tokenize(const std::string &query);
|
|
134945
135047
|
|
|
134946
135048
|
static bool IsKeyword(const std::string &text);
|
|
135049
|
+
static std::vector<duckdb_libpgquery::PGKeyword> KeywordList();
|
|
134947
135050
|
};
|
|
134948
135051
|
}
|
|
134949
135052
|
|
|
@@ -134990,6 +135093,7 @@ typedef enum PGBackslashQuoteType {
|
|
|
134990
135093
|
PGList *raw_parser(const char *str);
|
|
134991
135094
|
|
|
134992
135095
|
bool is_keyword(const char *str);
|
|
135096
|
+
std::vector<PGKeyword> keyword_list();
|
|
134993
135097
|
|
|
134994
135098
|
std::vector<PGSimplifiedToken> tokenize(const char *str);
|
|
134995
135099
|
|
|
@@ -135065,6 +135169,8 @@ vector<SimplifiedToken> Parser::Tokenize(const string &query) {
|
|
|
135065
135169
|
case duckdb_libpgquery::PGSimplifiedTokenType::PG_SIMPLIFIED_TOKEN_COMMENT: // LCOV_EXCL_START
|
|
135066
135170
|
token.type = SimplifiedTokenType::SIMPLIFIED_TOKEN_COMMENT;
|
|
135067
135171
|
break;
|
|
135172
|
+
default:
|
|
135173
|
+
throw InternalException("Unrecognized token category");
|
|
135068
135174
|
} // LCOV_EXCL_STOP
|
|
135069
135175
|
token.start = pg_token.start;
|
|
135070
135176
|
result.push_back(token);
|
|
@@ -135076,6 +135182,33 @@ bool Parser::IsKeyword(const string &text) {
|
|
|
135076
135182
|
return PostgresParser::IsKeyword(text);
|
|
135077
135183
|
}
|
|
135078
135184
|
|
|
135185
|
+
vector<ParserKeyword> Parser::KeywordList() {
|
|
135186
|
+
auto keywords = PostgresParser::KeywordList();
|
|
135187
|
+
vector<ParserKeyword> result;
|
|
135188
|
+
for (auto &kw : keywords) {
|
|
135189
|
+
ParserKeyword res;
|
|
135190
|
+
res.name = kw.text;
|
|
135191
|
+
switch (kw.category) {
|
|
135192
|
+
case duckdb_libpgquery::PGKeywordCategory::PG_KEYWORD_RESERVED:
|
|
135193
|
+
res.category = KeywordCategory::KEYWORD_RESERVED;
|
|
135194
|
+
break;
|
|
135195
|
+
case duckdb_libpgquery::PGKeywordCategory::PG_KEYWORD_UNRESERVED:
|
|
135196
|
+
res.category = KeywordCategory::KEYWORD_UNRESERVED;
|
|
135197
|
+
break;
|
|
135198
|
+
case duckdb_libpgquery::PGKeywordCategory::PG_KEYWORD_TYPE_FUNC:
|
|
135199
|
+
res.category = KeywordCategory::KEYWORD_TYPE_FUNC;
|
|
135200
|
+
break;
|
|
135201
|
+
case duckdb_libpgquery::PGKeywordCategory::PG_KEYWORD_COL_NAME:
|
|
135202
|
+
res.category = KeywordCategory::KEYWORD_COL_NAME;
|
|
135203
|
+
break;
|
|
135204
|
+
default:
|
|
135205
|
+
throw InternalException("Unrecognized keyword category");
|
|
135206
|
+
}
|
|
135207
|
+
result.push_back(res);
|
|
135208
|
+
}
|
|
135209
|
+
return result;
|
|
135210
|
+
}
|
|
135211
|
+
|
|
135079
135212
|
vector<unique_ptr<ParsedExpression>> Parser::ParseExpressionList(const string &select_list) {
|
|
135080
135213
|
// construct a mock query prefixed with SELECT
|
|
135081
135214
|
string mock_query = "SELECT " + select_list;
|
|
@@ -222100,6 +222233,10 @@ bool PostgresParser::IsKeyword(const std::string &text) {
|
|
|
222100
222233
|
return duckdb_libpgquery::is_keyword(text.c_str());
|
|
222101
222234
|
}
|
|
222102
222235
|
|
|
222236
|
+
vector<duckdb_libpgquery::PGKeyword> PostgresParser::KeywordList() {
|
|
222237
|
+
return duckdb_libpgquery::keyword_list();
|
|
222238
|
+
}
|
|
222239
|
+
|
|
222103
222240
|
}
|
|
222104
222241
|
|
|
222105
222242
|
|
|
@@ -250882,6 +251019,30 @@ bool is_keyword(const char *text) {
|
|
|
250882
251019
|
return ScanKeywordLookup(text, ScanKeywords, NumScanKeywords) != NULL;
|
|
250883
251020
|
}
|
|
250884
251021
|
|
|
251022
|
+
std::vector<PGKeyword> keyword_list() {
|
|
251023
|
+
std::vector<PGKeyword> result;
|
|
251024
|
+
for(size_t i = 0; i < NumScanKeywords; i++) {
|
|
251025
|
+
PGKeyword keyword;
|
|
251026
|
+
keyword.text = ScanKeywords[i].name;
|
|
251027
|
+
switch(ScanKeywords[i].category) {
|
|
251028
|
+
case UNRESERVED_KEYWORD:
|
|
251029
|
+
keyword.category = PGKeywordCategory::PG_KEYWORD_UNRESERVED;
|
|
251030
|
+
break;
|
|
251031
|
+
case RESERVED_KEYWORD:
|
|
251032
|
+
keyword.category = PGKeywordCategory::PG_KEYWORD_RESERVED;
|
|
251033
|
+
break;
|
|
251034
|
+
case TYPE_FUNC_NAME_KEYWORD:
|
|
251035
|
+
keyword.category = PGKeywordCategory::PG_KEYWORD_TYPE_FUNC;
|
|
251036
|
+
break;
|
|
251037
|
+
case COL_NAME_KEYWORD:
|
|
251038
|
+
keyword.category = PGKeywordCategory::PG_KEYWORD_COL_NAME;
|
|
251039
|
+
break;
|
|
251040
|
+
}
|
|
251041
|
+
result.push_back(keyword);
|
|
251042
|
+
}
|
|
251043
|
+
return result;
|
|
251044
|
+
}
|
|
251045
|
+
|
|
250885
251046
|
std::vector<PGSimplifiedToken> tokenize(const char *str) {
|
|
250886
251047
|
core_yyscan_t yyscanner;
|
|
250887
251048
|
base_yy_extra_type yyextra;
|
package/src/duckdb.hpp
CHANGED
|
@@ -11,8 +11,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
11
11
|
#pragma once
|
|
12
12
|
#define DUCKDB_AMALGAMATION 1
|
|
13
13
|
#define DUCKDB_AMALGAMATION_EXTENDED 1
|
|
14
|
-
#define DUCKDB_SOURCE_ID "
|
|
15
|
-
#define DUCKDB_VERSION "0.3.2-
|
|
14
|
+
#define DUCKDB_SOURCE_ID "b33df7694"
|
|
15
|
+
#define DUCKDB_VERSION "0.3.2-dev957"
|
|
16
16
|
//===----------------------------------------------------------------------===//
|
|
17
17
|
// DuckDB
|
|
18
18
|
//
|
|
@@ -19831,6 +19831,13 @@ struct SimplifiedToken {
|
|
|
19831
19831
|
idx_t start;
|
|
19832
19832
|
};
|
|
19833
19833
|
|
|
19834
|
+
enum class KeywordCategory : uint8_t { KEYWORD_RESERVED, KEYWORD_UNRESERVED, KEYWORD_TYPE_FUNC, KEYWORD_COL_NAME };
|
|
19835
|
+
|
|
19836
|
+
struct ParserKeyword {
|
|
19837
|
+
string name;
|
|
19838
|
+
KeywordCategory category;
|
|
19839
|
+
};
|
|
19840
|
+
|
|
19834
19841
|
} // namespace duckdb
|
|
19835
19842
|
|
|
19836
19843
|
|
|
@@ -19848,6 +19855,10 @@ class Parser {
|
|
|
19848
19855
|
public:
|
|
19849
19856
|
Parser();
|
|
19850
19857
|
|
|
19858
|
+
//! The parsed SQL statements from an invocation to ParseQuery.
|
|
19859
|
+
vector<unique_ptr<SQLStatement>> statements;
|
|
19860
|
+
|
|
19861
|
+
public:
|
|
19851
19862
|
//! Attempts to parse a query into a series of SQL statements. Returns
|
|
19852
19863
|
//! whether or not the parsing was successful. If the parsing was
|
|
19853
19864
|
//! successful, the parsed statements will be stored in the statements
|
|
@@ -19859,6 +19870,8 @@ public:
|
|
|
19859
19870
|
|
|
19860
19871
|
//! Returns true if the given text matches a keyword of the parser
|
|
19861
19872
|
static bool IsKeyword(const string &text);
|
|
19873
|
+
//! Returns a list of all keywords in the parser
|
|
19874
|
+
static vector<ParserKeyword> KeywordList();
|
|
19862
19875
|
|
|
19863
19876
|
//! Parses a list of expressions (i.e. the list found in a SELECT clause)
|
|
19864
19877
|
static vector<unique_ptr<ParsedExpression>> ParseExpressionList(const string &select_list);
|
|
@@ -19871,15 +19884,6 @@ public:
|
|
|
19871
19884
|
static vector<vector<unique_ptr<ParsedExpression>>> ParseValuesList(const string &value_list);
|
|
19872
19885
|
//! Parses a column list (i.e. as found in a CREATE TABLE statement)
|
|
19873
19886
|
static vector<ColumnDefinition> ParseColumnList(const string &column_list);
|
|
19874
|
-
|
|
19875
|
-
//! The parsed SQL statements from an invocation to ParseQuery.
|
|
19876
|
-
vector<unique_ptr<SQLStatement>> statements;
|
|
19877
|
-
|
|
19878
|
-
private:
|
|
19879
|
-
//! Transform a Postgres parse tree into a set of SQL Statements
|
|
19880
|
-
bool TransformList(duckdb_libpgquery::PGList *tree);
|
|
19881
|
-
//! Transform a single Postgres parse node into a SQL Statement.
|
|
19882
|
-
unique_ptr<SQLStatement> TransformNode(duckdb_libpgquery::PGNode *stmt);
|
|
19883
19887
|
};
|
|
19884
19888
|
} // namespace duckdb
|
|
19885
19889
|
//===----------------------------------------------------------------------===//
|