duckdb 0.7.2-dev654.0 → 0.7.2-dev832.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/binding.gyp +2 -0
- package/lib/duckdb.d.ts +12 -1
- package/lib/duckdb.js +19 -0
- package/package.json +1 -1
- package/src/duckdb/extension/json/include/json_common.hpp +1 -0
- package/src/duckdb/extension/json/include/json_functions.hpp +2 -0
- package/src/duckdb/extension/json/include/json_serializer.hpp +77 -0
- package/src/duckdb/extension/json/json_functions/json_serialize_sql.cpp +147 -0
- package/src/duckdb/extension/json/json_functions.cpp +12 -4
- package/src/duckdb/extension/json/json_scan.cpp +2 -2
- package/src/duckdb/extension/json/json_serializer.cpp +217 -0
- package/src/duckdb/src/common/enums/expression_type.cpp +8 -222
- package/src/duckdb/src/common/enums/join_type.cpp +3 -22
- package/src/duckdb/src/common/exception.cpp +2 -2
- package/src/duckdb/src/common/serializer/enum_serializer.cpp +1172 -0
- package/src/duckdb/src/common/types/column_data_collection_segment.cpp +11 -6
- package/src/duckdb/src/common/types/value.cpp +117 -0
- package/src/duckdb/src/common/types/vector.cpp +140 -1
- package/src/duckdb/src/common/types.cpp +166 -89
- package/src/duckdb/src/common/vector_operations/vector_cast.cpp +2 -1
- package/src/duckdb/src/execution/aggregate_hashtable.cpp +10 -5
- package/src/duckdb/src/execution/expression_executor/execute_cast.cpp +2 -1
- package/src/duckdb/src/execution/index/art/art.cpp +5 -5
- package/src/duckdb/src/execution/operator/persistent/base_csv_reader.cpp +3 -0
- package/src/duckdb/src/execution/partitionable_hashtable.cpp +14 -2
- package/src/duckdb/src/function/cast/cast_function_set.cpp +1 -1
- package/src/duckdb/src/function/cast/enum_casts.cpp +25 -3
- package/src/duckdb/src/function/cast/list_casts.cpp +17 -4
- package/src/duckdb/src/function/cast/map_cast.cpp +5 -2
- package/src/duckdb/src/function/cast/string_cast.cpp +36 -10
- package/src/duckdb/src/function/cast/struct_cast.cpp +23 -3
- package/src/duckdb/src/function/cast/union_casts.cpp +33 -7
- package/src/duckdb/src/function/scalar/string/regexp/regexp_extract_all.cpp +243 -0
- package/src/duckdb/src/function/scalar/string/regexp/regexp_util.cpp +79 -0
- package/src/duckdb/src/function/scalar/string/regexp.cpp +21 -80
- package/src/duckdb/src/function/table/arrow_conversion.cpp +7 -1
- package/src/duckdb/src/function/table/table_scan.cpp +1 -1
- package/src/duckdb/src/function/table/version/pragma_version.cpp +2 -2
- package/src/duckdb/src/include/duckdb/common/enums/aggregate_handling.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/expression_type.hpp +2 -3
- package/src/duckdb/src/include/duckdb/common/enums/joinref_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/order_type.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/enums/set_operation_type.hpp +2 -1
- package/src/duckdb/src/include/duckdb/common/exception.hpp +40 -9
- package/src/duckdb/src/include/duckdb/common/optional_ptr.hpp +45 -0
- package/src/duckdb/src/include/duckdb/common/preserved_error.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/serializer/enum_serializer.hpp +113 -0
- package/src/duckdb/src/include/duckdb/common/serializer/format_deserializer.hpp +336 -0
- package/src/duckdb/src/include/duckdb/common/serializer/format_serializer.hpp +268 -0
- package/src/duckdb/src/include/duckdb/common/serializer/serialization_traits.hpp +126 -0
- package/src/duckdb/src/include/duckdb/common/string_util.hpp +12 -0
- package/src/duckdb/src/include/duckdb/common/types/value.hpp +2 -0
- package/src/duckdb/src/include/duckdb/common/types/vector.hpp +3 -0
- package/src/duckdb/src/include/duckdb/common/types.hpp +8 -2
- package/src/duckdb/src/include/duckdb/execution/aggregate_hashtable.hpp +1 -0
- package/src/duckdb/src/include/duckdb/execution/index/art/art.hpp +2 -2
- package/src/duckdb/src/include/duckdb/execution/partitionable_hashtable.hpp +3 -0
- package/src/duckdb/src/include/duckdb/function/cast/bound_cast_data.hpp +84 -0
- package/src/duckdb/src/include/duckdb/function/cast/cast_function_set.hpp +2 -2
- package/src/duckdb/src/include/duckdb/function/cast/default_casts.hpp +28 -64
- package/src/duckdb/src/include/duckdb/function/scalar/regexp.hpp +81 -1
- package/src/duckdb/src/include/duckdb/main/extension_entries.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/common_table_expression_info.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/between_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/bound_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/case_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/expression/cast_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/collate_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/columnref_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/comparison_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/conjunction_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/constant_expression.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/expression/default_expression.hpp +1 -0
- package/src/duckdb/src/include/duckdb/parser/expression/function_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/lambda_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/operator_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/parameter_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/positional_reference_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/star_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/subquery_expression.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/expression/window_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_data/sample_options.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/parsed_expression.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/recursive_cte_node.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/select_node.hpp +5 -0
- package/src/duckdb/src/include/duckdb/parser/query_node/set_operation_node.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/query_node.hpp +11 -1
- package/src/duckdb/src/include/duckdb/parser/result_modifier.hpp +24 -1
- package/src/duckdb/src/include/duckdb/parser/sql_statement.hpp +2 -1
- package/src/duckdb/src/include/duckdb/parser/statement/select_statement.hpp +6 -1
- package/src/duckdb/src/include/duckdb/parser/tableref/basetableref.hpp +4 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/emptytableref.hpp +2 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/expressionlistref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/joinref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/pivotref.hpp +9 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/subqueryref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref/table_function_ref.hpp +3 -0
- package/src/duckdb/src/include/duckdb/parser/tableref.hpp +3 -1
- package/src/duckdb/src/include/duckdb/storage/data_table.hpp +2 -2
- package/src/duckdb/src/include/duckdb/storage/index.hpp +4 -3
- package/src/duckdb/src/include/duckdb/transaction/local_storage.hpp +2 -2
- package/src/duckdb/src/main/extension/extension_install.cpp +7 -2
- package/src/duckdb/src/optimizer/deliminator.cpp +1 -1
- package/src/duckdb/src/optimizer/filter_combiner.cpp +1 -1
- package/src/duckdb/src/optimizer/join_order/join_order_optimizer.cpp +3 -3
- package/src/duckdb/src/optimizer/rule/move_constants.cpp +2 -2
- package/src/duckdb/src/optimizer/statistics/operator/propagate_filter.cpp +1 -1
- package/src/duckdb/src/parser/common_table_expression_info.cpp +19 -0
- package/src/duckdb/src/parser/expression/between_expression.cpp +17 -0
- package/src/duckdb/src/parser/expression/case_expression.cpp +28 -0
- package/src/duckdb/src/parser/expression/cast_expression.cpp +17 -0
- package/src/duckdb/src/parser/expression/collate_expression.cpp +16 -0
- package/src/duckdb/src/parser/expression/columnref_expression.cpp +15 -0
- package/src/duckdb/src/parser/expression/comparison_expression.cpp +16 -0
- package/src/duckdb/src/parser/expression/conjunction_expression.cpp +15 -0
- package/src/duckdb/src/parser/expression/constant_expression.cpp +14 -0
- package/src/duckdb/src/parser/expression/default_expression.cpp +7 -0
- package/src/duckdb/src/parser/expression/function_expression.cpp +35 -0
- package/src/duckdb/src/parser/expression/lambda_expression.cpp +16 -0
- package/src/duckdb/src/parser/expression/operator_expression.cpp +15 -0
- package/src/duckdb/src/parser/expression/parameter_expression.cpp +15 -0
- package/src/duckdb/src/parser/expression/positional_reference_expression.cpp +14 -0
- package/src/duckdb/src/parser/expression/star_expression.cpp +20 -0
- package/src/duckdb/src/parser/expression/subquery_expression.cpp +20 -0
- package/src/duckdb/src/parser/expression/window_expression.cpp +43 -0
- package/src/duckdb/src/parser/parsed_data/sample_options.cpp +22 -10
- package/src/duckdb/src/parser/parsed_expression.cpp +72 -0
- package/src/duckdb/src/parser/query_node/recursive_cte_node.cpp +21 -0
- package/src/duckdb/src/parser/query_node/select_node.cpp +31 -0
- package/src/duckdb/src/parser/query_node/set_operation_node.cpp +17 -0
- package/src/duckdb/src/parser/query_node.cpp +50 -0
- package/src/duckdb/src/parser/result_modifier.cpp +78 -0
- package/src/duckdb/src/parser/statement/select_statement.cpp +12 -0
- package/src/duckdb/src/parser/tableref/basetableref.cpp +21 -0
- package/src/duckdb/src/parser/tableref/emptytableref.cpp +4 -0
- package/src/duckdb/src/parser/tableref/expressionlistref.cpp +17 -0
- package/src/duckdb/src/parser/tableref/joinref.cpp +25 -0
- package/src/duckdb/src/parser/tableref/pivotref.cpp +53 -0
- package/src/duckdb/src/parser/tableref/subqueryref.cpp +15 -0
- package/src/duckdb/src/parser/tableref/table_function.cpp +17 -0
- package/src/duckdb/src/parser/tableref.cpp +46 -0
- package/src/duckdb/src/parser/transform/expression/transform_bool_expr.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_function.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_operator.cpp +1 -1
- package/src/duckdb/src/parser/transform/expression/transform_subquery.cpp +1 -1
- package/src/duckdb/src/planner/binder/expression/bind_subquery_expression.cpp +4 -0
- package/src/duckdb/src/planner/binder/statement/bind_copy.cpp +3 -1
- package/src/duckdb/src/planner/binder/tableref/plan_joinref.cpp +1 -1
- package/src/duckdb/src/planner/expression/bound_expression.cpp +4 -0
- package/src/duckdb/src/storage/data_table.cpp +15 -13
- package/src/duckdb/src/storage/index.cpp +12 -1
- package/src/duckdb/src/storage/local_storage.cpp +20 -23
- package/src/duckdb/src/verification/deserialized_statement_verifier.cpp +0 -1
- package/src/duckdb/third_party/re2/re2/re2.cc +9 -0
- package/src/duckdb/third_party/re2/re2/re2.h +2 -0
- package/src/duckdb/ub_extension_json_json_functions.cpp +2 -0
- package/src/duckdb/ub_src_common_serializer.cpp +2 -0
- package/src/duckdb/ub_src_function_scalar_string_regexp.cpp +4 -0
- package/src/duckdb/ub_src_parser.cpp +2 -0
- package/src/utils.cpp +12 -0
- package/test/extension.test.ts +44 -26
@@ -30,6 +30,8 @@ public:
|
|
30
30
|
|
31
31
|
void Serialize(FieldWriter &writer) const override;
|
32
32
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
33
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
34
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
33
35
|
|
34
36
|
public:
|
35
37
|
template <class T, class BASE>
|
@@ -34,6 +34,8 @@ public:
|
|
34
34
|
|
35
35
|
void Serialize(FieldWriter &writer) const override;
|
36
36
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
37
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
38
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
37
39
|
|
38
40
|
public:
|
39
41
|
template <class T, class BASE>
|
@@ -31,6 +31,9 @@ public:
|
|
31
31
|
|
32
32
|
void Serialize(FieldWriter &writer) const override;
|
33
33
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
34
|
+
|
35
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
36
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
34
37
|
};
|
35
38
|
|
36
39
|
} // namespace duckdb
|
@@ -55,6 +55,8 @@ public:
|
|
55
55
|
|
56
56
|
void Serialize(FieldWriter &writer) const override;
|
57
57
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
58
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
59
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
58
60
|
|
59
61
|
void Verify() const override;
|
60
62
|
|
@@ -37,6 +37,8 @@ public:
|
|
37
37
|
|
38
38
|
void Serialize(FieldWriter &writer) const override;
|
39
39
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
40
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
41
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
40
42
|
};
|
41
43
|
|
42
44
|
} // namespace duckdb
|
@@ -32,6 +32,8 @@ public:
|
|
32
32
|
|
33
33
|
void Serialize(FieldWriter &writer) const override;
|
34
34
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
35
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
36
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
35
37
|
|
36
38
|
public:
|
37
39
|
template <class T, class BASE>
|
@@ -34,5 +34,7 @@ public:
|
|
34
34
|
|
35
35
|
void Serialize(FieldWriter &writer) const override;
|
36
36
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
37
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
38
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
37
39
|
};
|
38
40
|
} // namespace duckdb
|
@@ -30,5 +30,7 @@ public:
|
|
30
30
|
|
31
31
|
void Serialize(FieldWriter &writer) const override;
|
32
32
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
33
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
34
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
33
35
|
};
|
34
36
|
} // namespace duckdb
|
@@ -38,5 +38,7 @@ public:
|
|
38
38
|
|
39
39
|
void Serialize(FieldWriter &writer) const override;
|
40
40
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
41
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
42
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
41
43
|
};
|
42
44
|
} // namespace duckdb
|
@@ -45,5 +45,7 @@ public:
|
|
45
45
|
|
46
46
|
void Serialize(FieldWriter &writer) const override;
|
47
47
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
48
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
49
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
48
50
|
};
|
49
51
|
} // namespace duckdb
|
@@ -25,6 +25,8 @@ enum class WindowBoundary : uint8_t {
|
|
25
25
|
EXPR_FOLLOWING_RANGE = 8
|
26
26
|
};
|
27
27
|
|
28
|
+
const char *ToString(WindowBoundary value);
|
29
|
+
|
28
30
|
//! The WindowExpression represents a window function in the query. They are a special case of aggregates which is why
|
29
31
|
//! they inherit from them.
|
30
32
|
class WindowExpression : public ParsedExpression {
|
@@ -71,6 +73,8 @@ public:
|
|
71
73
|
|
72
74
|
void Serialize(FieldWriter &writer) const override;
|
73
75
|
static unique_ptr<ParsedExpression> Deserialize(ExpressionType type, FieldReader &source);
|
76
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
77
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(ExpressionType type, FormatDeserializer &deserializer);
|
74
78
|
|
75
79
|
public:
|
76
80
|
template <class T, class BASE, class ORDER_NODE>
|
@@ -200,4 +204,5 @@ public:
|
|
200
204
|
return result;
|
201
205
|
}
|
202
206
|
};
|
207
|
+
|
203
208
|
} // namespace duckdb
|
@@ -29,6 +29,8 @@ struct SampleOptions {
|
|
29
29
|
void Serialize(Serializer &serializer);
|
30
30
|
static unique_ptr<SampleOptions> Deserialize(Deserializer &source);
|
31
31
|
static bool Equals(SampleOptions *a, SampleOptions *b);
|
32
|
+
void FormatSerialize(FormatSerializer &serializer) const;
|
33
|
+
static unique_ptr<SampleOptions> FormatDeserialize(FormatDeserializer &deserializer);
|
32
34
|
};
|
33
35
|
|
34
36
|
} // namespace duckdb
|
@@ -19,6 +19,8 @@ class Serializer;
|
|
19
19
|
class Deserializer;
|
20
20
|
class FieldWriter;
|
21
21
|
class FieldReader;
|
22
|
+
class FormatDeserializer;
|
23
|
+
class FormatSerializer;
|
22
24
|
|
23
25
|
//! The ParsedExpression class is a base class that can represent any expression
|
24
26
|
//! part of a SQL statement.
|
@@ -60,6 +62,9 @@ public:
|
|
60
62
|
//! SerializationException]
|
61
63
|
static unique_ptr<ParsedExpression> Deserialize(Deserializer &source);
|
62
64
|
|
65
|
+
virtual void FormatSerialize(FormatSerializer &serializer) const;
|
66
|
+
static unique_ptr<ParsedExpression> FormatDeserialize(FormatDeserializer &deserializer);
|
67
|
+
|
63
68
|
protected:
|
64
69
|
//! Copy base Expression properties from another expression to this one,
|
65
70
|
//! used in Copy method
|
@@ -44,6 +44,9 @@ public:
|
|
44
44
|
void Serialize(FieldWriter &writer) const override;
|
45
45
|
//! Deserializes a blob back into a QueryNode
|
46
46
|
static unique_ptr<QueryNode> Deserialize(FieldReader &reader);
|
47
|
+
|
48
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
49
|
+
static unique_ptr<QueryNode> FormatDeserialize(FormatDeserializer &source);
|
47
50
|
};
|
48
51
|
|
49
52
|
} // namespace duckdb
|
@@ -49,13 +49,18 @@ public:
|
|
49
49
|
string ToString() const override;
|
50
50
|
|
51
51
|
bool Equals(const QueryNode *other) const override;
|
52
|
+
|
52
53
|
//! Create a copy of this SelectNode
|
53
54
|
unique_ptr<QueryNode> Copy() const override;
|
54
55
|
|
55
56
|
//! Serializes a QueryNode to a stand-alone binary blob
|
56
57
|
void Serialize(FieldWriter &writer) const override;
|
58
|
+
|
57
59
|
//! Deserializes a blob back into a QueryNode
|
58
60
|
static unique_ptr<QueryNode> Deserialize(FieldReader &reader);
|
61
|
+
|
62
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
63
|
+
static unique_ptr<QueryNode> FormatDeserialize(FormatDeserializer &deserializer);
|
59
64
|
};
|
60
65
|
|
61
66
|
} // namespace duckdb
|
@@ -43,6 +43,9 @@ public:
|
|
43
43
|
void Serialize(FieldWriter &writer) const override;
|
44
44
|
//! Deserializes a blob back into a QueryNode
|
45
45
|
static unique_ptr<QueryNode> Deserialize(FieldReader &reader);
|
46
|
+
|
47
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
48
|
+
static unique_ptr<QueryNode> FormatDeserialize(FormatDeserializer &source);
|
46
49
|
};
|
47
50
|
|
48
51
|
} // namespace duckdb
|
@@ -17,7 +17,10 @@
|
|
17
17
|
|
18
18
|
namespace duckdb {
|
19
19
|
|
20
|
-
|
20
|
+
class FormatDeserializer;
|
21
|
+
class FormatSerializer;
|
22
|
+
|
23
|
+
enum class QueryNodeType : uint8_t {
|
21
24
|
SELECT_NODE = 1,
|
22
25
|
SET_OPERATION_NODE = 2,
|
23
26
|
BOUND_SUBQUERY_NODE = 3,
|
@@ -35,6 +38,10 @@ public:
|
|
35
38
|
public:
|
36
39
|
string ToString() const;
|
37
40
|
CommonTableExpressionMap Copy() const;
|
41
|
+
|
42
|
+
void FormatSerialize(FormatSerializer &serializer) const;
|
43
|
+
// static void FormatDeserialize(FormatDeserializer &deserializer, CommonTableExpressionMap &ret);
|
44
|
+
static CommonTableExpressionMap FormatDeserialize(FormatDeserializer &deserializer);
|
38
45
|
};
|
39
46
|
|
40
47
|
class QueryNode {
|
@@ -73,6 +80,9 @@ public:
|
|
73
80
|
//! Adds a distinct modifier to the query node
|
74
81
|
void AddDistinct();
|
75
82
|
|
83
|
+
virtual void FormatSerialize(FormatSerializer &serializer) const;
|
84
|
+
static unique_ptr<QueryNode> FormatDeserialize(FormatDeserializer &deserializer);
|
85
|
+
|
76
86
|
protected:
|
77
87
|
//! Copy base QueryNode properties from another expression to this one,
|
78
88
|
//! used in Copy method
|
@@ -16,14 +16,19 @@
|
|
16
16
|
namespace duckdb {
|
17
17
|
class FieldWriter;
|
18
18
|
class FieldReader;
|
19
|
+
class FormatDeserializer;
|
20
|
+
class FormatSerializer;
|
19
21
|
|
20
|
-
enum ResultModifierType : uint8_t {
|
22
|
+
enum class ResultModifierType : uint8_t {
|
21
23
|
LIMIT_MODIFIER = 1,
|
22
24
|
ORDER_MODIFIER = 2,
|
23
25
|
DISTINCT_MODIFIER = 3,
|
24
26
|
LIMIT_PERCENT_MODIFIER = 4
|
25
27
|
};
|
26
28
|
|
29
|
+
const char *ToString(ResultModifierType value);
|
30
|
+
ResultModifierType ResultModifierFromString(const char *value);
|
31
|
+
|
27
32
|
//! A ResultModifier
|
28
33
|
class ResultModifier {
|
29
34
|
public:
|
@@ -46,6 +51,9 @@ public:
|
|
46
51
|
virtual void Serialize(FieldWriter &writer) const = 0;
|
47
52
|
//! Deserializes a blob back into a ResultModifier
|
48
53
|
static unique_ptr<ResultModifier> Deserialize(Deserializer &source);
|
54
|
+
|
55
|
+
virtual void FormatSerialize(FormatSerializer &serializer) const;
|
56
|
+
static unique_ptr<ResultModifier> FormatDeserialize(FormatDeserializer &deserializer);
|
49
57
|
};
|
50
58
|
|
51
59
|
//! Single node in ORDER BY statement
|
@@ -65,6 +73,9 @@ public:
|
|
65
73
|
void Serialize(Serializer &serializer) const;
|
66
74
|
string ToString() const;
|
67
75
|
static OrderByNode Deserialize(Deserializer &source);
|
76
|
+
|
77
|
+
void FormatSerialize(FormatSerializer &serializer) const;
|
78
|
+
static OrderByNode FormatDeserialize(FormatDeserializer &deserializer);
|
68
79
|
};
|
69
80
|
|
70
81
|
class LimitModifier : public ResultModifier {
|
@@ -82,6 +93,9 @@ public:
|
|
82
93
|
unique_ptr<ResultModifier> Copy() const override;
|
83
94
|
void Serialize(FieldWriter &writer) const override;
|
84
95
|
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
96
|
+
|
97
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
98
|
+
static unique_ptr<ResultModifier> FormatDeserialize(FormatDeserializer &deserializer);
|
85
99
|
};
|
86
100
|
|
87
101
|
class OrderModifier : public ResultModifier {
|
@@ -97,6 +111,9 @@ public:
|
|
97
111
|
unique_ptr<ResultModifier> Copy() const override;
|
98
112
|
void Serialize(FieldWriter &writer) const override;
|
99
113
|
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
114
|
+
|
115
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
116
|
+
static unique_ptr<ResultModifier> FormatDeserialize(FormatDeserializer &deserializer);
|
100
117
|
};
|
101
118
|
|
102
119
|
class DistinctModifier : public ResultModifier {
|
@@ -112,6 +129,9 @@ public:
|
|
112
129
|
unique_ptr<ResultModifier> Copy() const override;
|
113
130
|
void Serialize(FieldWriter &writer) const override;
|
114
131
|
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
132
|
+
|
133
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
134
|
+
static unique_ptr<ResultModifier> FormatDeserialize(FormatDeserializer &deserializer);
|
115
135
|
};
|
116
136
|
|
117
137
|
class LimitPercentModifier : public ResultModifier {
|
@@ -129,6 +149,9 @@ public:
|
|
129
149
|
unique_ptr<ResultModifier> Copy() const override;
|
130
150
|
void Serialize(FieldWriter &writer) const override;
|
131
151
|
static unique_ptr<ResultModifier> Deserialize(FieldReader &reader);
|
152
|
+
|
153
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
154
|
+
static unique_ptr<ResultModifier> FormatDeserialize(FormatDeserializer &deserializer);
|
132
155
|
};
|
133
156
|
|
134
157
|
} // namespace duckdb
|
@@ -19,7 +19,8 @@ namespace duckdb {
|
|
19
19
|
//! SQLStatement is the base class of any type of SQL statement.
|
20
20
|
class SQLStatement {
|
21
21
|
public:
|
22
|
-
explicit SQLStatement(StatementType type) : type(type) {
|
22
|
+
explicit SQLStatement(StatementType type) : type(type) {
|
23
|
+
}
|
23
24
|
virtual ~SQLStatement() {
|
24
25
|
}
|
25
26
|
|
@@ -10,13 +10,15 @@
|
|
10
10
|
|
11
11
|
#include "duckdb/common/unordered_map.hpp"
|
12
12
|
#include "duckdb/parser/parsed_expression.hpp"
|
13
|
-
#include "duckdb/parser/query_node.hpp"
|
14
13
|
#include "duckdb/parser/sql_statement.hpp"
|
15
14
|
#include "duckdb/parser/tableref.hpp"
|
15
|
+
#include "duckdb/parser/query_node.hpp"
|
16
16
|
|
17
17
|
namespace duckdb {
|
18
18
|
|
19
19
|
class QueryNode;
|
20
|
+
class FormatSerializer;
|
21
|
+
class FormatDeserializer;
|
20
22
|
|
21
23
|
//! SelectStatement is a typical SELECT clause
|
22
24
|
class SelectStatement : public SQLStatement {
|
@@ -42,5 +44,8 @@ public:
|
|
42
44
|
static unique_ptr<SelectStatement> Deserialize(Deserializer &source);
|
43
45
|
//! Whether or not the statements are equivalent
|
44
46
|
bool Equals(const SQLStatement *other) const;
|
47
|
+
|
48
|
+
void FormatSerialize(FormatSerializer &serializer) const;
|
49
|
+
static unique_ptr<SelectStatement> FormatDeserialize(FormatDeserializer &deserializer);
|
45
50
|
};
|
46
51
|
} // namespace duckdb
|
@@ -38,5 +38,9 @@ public:
|
|
38
38
|
void Serialize(FieldWriter &serializer) const override;
|
39
39
|
//! Deserializes a blob back into a BaseTableRef
|
40
40
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
41
|
+
|
42
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
43
|
+
|
44
|
+
static unique_ptr<TableRef> FormatDeserialize(FormatDeserializer &source);
|
41
45
|
};
|
42
46
|
} // namespace duckdb
|
@@ -27,5 +27,7 @@ public:
|
|
27
27
|
void Serialize(FieldWriter &serializer) const override;
|
28
28
|
//! Deserializes a blob back into a DummyTableRef
|
29
29
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
30
|
+
|
31
|
+
static unique_ptr<TableRef> FormatDeserialize(FormatDeserializer &source);
|
30
32
|
};
|
31
33
|
} // namespace duckdb
|
@@ -37,5 +37,8 @@ public:
|
|
37
37
|
void Serialize(FieldWriter &serializer) const override;
|
38
38
|
//! Deserializes a blob back into a ExpressionListRef
|
39
39
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
40
|
+
|
41
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
42
|
+
static unique_ptr<TableRef> FormatDeserialize(FormatDeserializer &source);
|
40
43
|
};
|
41
44
|
} // namespace duckdb
|
@@ -47,5 +47,8 @@ public:
|
|
47
47
|
void Serialize(FieldWriter &serializer) const override;
|
48
48
|
//! Deserializes a blob back into a JoinRef
|
49
49
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
50
|
+
|
51
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
52
|
+
static unique_ptr<TableRef> FormatDeserialize(FormatDeserializer &source);
|
50
53
|
};
|
51
54
|
} // namespace duckdb
|
@@ -24,6 +24,9 @@ struct PivotColumnEntry {
|
|
24
24
|
void Serialize(Serializer &serializer) const;
|
25
25
|
PivotColumnEntry Copy() const;
|
26
26
|
static PivotColumnEntry Deserialize(Deserializer &source);
|
27
|
+
|
28
|
+
void FormatSerialize(FormatSerializer &serializer) const;
|
29
|
+
static PivotColumnEntry FormatDeserialize(FormatDeserializer &source);
|
27
30
|
};
|
28
31
|
|
29
32
|
struct PivotColumn {
|
@@ -39,6 +42,9 @@ struct PivotColumn {
|
|
39
42
|
void Serialize(Serializer &serializer) const;
|
40
43
|
PivotColumn Copy() const;
|
41
44
|
static PivotColumn Deserialize(Deserializer &source);
|
45
|
+
|
46
|
+
void FormatSerialize(FormatSerializer &serializer) const;
|
47
|
+
static PivotColumn FormatDeserialize(FormatDeserializer &source);
|
42
48
|
};
|
43
49
|
|
44
50
|
//! Represents a PIVOT or UNPIVOT expression
|
@@ -72,5 +78,8 @@ public:
|
|
72
78
|
void Serialize(FieldWriter &serializer) const override;
|
73
79
|
//! Deserializes a blob back into a JoinRef
|
74
80
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
81
|
+
|
82
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
83
|
+
static unique_ptr<TableRef> FormatDeserialize(FormatDeserializer &source);
|
75
84
|
};
|
76
85
|
} // namespace duckdb
|
@@ -32,5 +32,8 @@ public:
|
|
32
32
|
void Serialize(FieldWriter &serializer) const override;
|
33
33
|
//! Deserializes a blob back into a SubqueryRef
|
34
34
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
35
|
+
|
36
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
37
|
+
static unique_ptr<TableRef> FormatDeserialize(FormatDeserializer &source);
|
35
38
|
};
|
36
39
|
} // namespace duckdb
|
@@ -40,5 +40,8 @@ public:
|
|
40
40
|
void Serialize(FieldWriter &serializer) const override;
|
41
41
|
//! Deserializes a blob back into a BaseTableRef
|
42
42
|
static unique_ptr<TableRef> Deserialize(FieldReader &source);
|
43
|
+
|
44
|
+
void FormatSerialize(FormatSerializer &serializer) const override;
|
45
|
+
static unique_ptr<TableRef> FormatDeserialize(FormatDeserializer &source);
|
43
46
|
};
|
44
47
|
} // namespace duckdb
|
@@ -48,8 +48,10 @@ public:
|
|
48
48
|
DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0;
|
49
49
|
//! Deserializes a blob back into a TableRef
|
50
50
|
DUCKDB_API static unique_ptr<TableRef> Deserialize(Deserializer &source);
|
51
|
-
|
52
51
|
//! Copy the properties of this table ref to the target
|
53
52
|
void CopyProperties(TableRef &target) const;
|
53
|
+
|
54
|
+
virtual void FormatSerialize(FormatSerializer &serializer) const;
|
55
|
+
static unique_ptr<TableRef> FormatDeserialize(FormatDeserializer &deserializer);
|
54
56
|
};
|
55
57
|
} // namespace duckdb
|
@@ -150,8 +150,8 @@ public:
|
|
150
150
|
|
151
151
|
//! Append a chunk with the row ids [row_start, ..., row_start + chunk.size()] to all indexes of the table, returns
|
152
152
|
//! whether or not the append succeeded
|
153
|
-
|
154
|
-
static
|
153
|
+
PreservedError AppendToIndexes(DataChunk &chunk, row_t row_start);
|
154
|
+
static PreservedError AppendToIndexes(TableIndexList &indexes, DataChunk &chunk, row_t row_start);
|
155
155
|
//! Remove a chunk with the row ids [row_start, ..., row_start + chunk.size()] from all indexes of the table
|
156
156
|
void RemoveFromIndexes(TableAppendState &state, DataChunk &chunk, row_t row_start);
|
157
157
|
//! Remove the chunk with the specified set of row identifiers from all indexes of the table
|
@@ -80,9 +80,9 @@ public:
|
|
80
80
|
//! Obtain a lock on the index
|
81
81
|
virtual void InitializeLock(IndexLock &state);
|
82
82
|
//! Called when data is appended to the index. The lock obtained from InitializeLock must be held
|
83
|
-
virtual
|
83
|
+
virtual PreservedError Append(IndexLock &state, DataChunk &entries, Vector &row_identifiers) = 0;
|
84
84
|
//! Obtains a lock and calls Append while holding that lock
|
85
|
-
|
85
|
+
PreservedError Append(DataChunk &entries, Vector &row_identifiers);
|
86
86
|
//! Verify that data can be appended to the index without a constraint violation
|
87
87
|
virtual void VerifyAppend(DataChunk &chunk) = 0;
|
88
88
|
//! Verify that data can be appended to the index without a constraint violation using the conflict manager
|
@@ -96,7 +96,7 @@ public:
|
|
96
96
|
void Delete(DataChunk &entries, Vector &row_identifiers);
|
97
97
|
|
98
98
|
//! Insert a chunk of entries into the index
|
99
|
-
virtual
|
99
|
+
virtual PreservedError Insert(IndexLock &lock, DataChunk &input, Vector &row_identifiers) = 0;
|
100
100
|
|
101
101
|
//! Merge another index into this index. The lock obtained from InitializeLock must be held, and the other
|
102
102
|
//! index must also be locked during the merge
|
@@ -147,6 +147,7 @@ public:
|
|
147
147
|
|
148
148
|
//! Execute the index expressions on an input chunk
|
149
149
|
void ExecuteExpressions(DataChunk &input, DataChunk &result);
|
150
|
+
static string AppendRowError(DataChunk &input, idx_t index);
|
150
151
|
|
151
152
|
protected:
|
152
153
|
//! Lock used for any changes to the index
|
@@ -88,8 +88,8 @@ public:
|
|
88
88
|
|
89
89
|
void AppendToIndexes(DuckTransaction &transaction, TableAppendState &append_state, idx_t append_count,
|
90
90
|
bool append_to_table);
|
91
|
-
|
92
|
-
|
91
|
+
PreservedError AppendToIndexes(DuckTransaction &transaction, RowGroupCollection &source, TableIndexList &index_list,
|
92
|
+
const vector<LogicalType> &table_types, row_t &start_row);
|
93
93
|
|
94
94
|
//! Creates an optimistic writer for this table
|
95
95
|
OptimisticDataWriter *CreateOptimisticWriter();
|
@@ -206,8 +206,13 @@ void ExtensionHelper::InstallExtensionInternal(DBConfig &config, ClientConfig *c
|
|
206
206
|
if (exact_match) {
|
207
207
|
message += "\nAre you using a development build? In this case, extensions might not (yet) be uploaded.";
|
208
208
|
}
|
209
|
-
|
210
|
-
|
209
|
+
if (res.error() == duckdb_httplib::Error::Success) {
|
210
|
+
throw HTTPException(res.value(), "Failed to download extension \"%s\" at URL \"%s%s\"\n%s", extension_name,
|
211
|
+
url_base, url_local_part, message);
|
212
|
+
} else {
|
213
|
+
throw IOException("Failed to download extension \"%s\" at URL \"%s%s\"\n%s (ERROR %s)", extension_name,
|
214
|
+
url_base, url_local_part, message, to_string(res.error()));
|
215
|
+
}
|
211
216
|
}
|
212
217
|
auto decompressed_body = GZipFileSystem::UncompressGZIPString(res->body);
|
213
218
|
std::ofstream out(temp_path, std::ios::binary);
|
@@ -424,7 +424,7 @@ bool Deliminator::RemoveInequalityCandidate(unique_ptr<LogicalOperator> *plan, u
|
|
424
424
|
parent_expr =
|
425
425
|
make_unique<BoundColumnRefExpression>(parent_expr->alias, parent_expr->return_type, it->first);
|
426
426
|
parent_cond.comparison =
|
427
|
-
parent_delim_get_side == 0 ? child_cond.comparison :
|
427
|
+
parent_delim_get_side == 0 ? child_cond.comparison : FlipComparisonExpression(child_cond.comparison);
|
428
428
|
break;
|
429
429
|
}
|
430
430
|
}
|
@@ -604,7 +604,7 @@ FilterResult FilterCombiner::AddBoundComparisonFilter(Expression *expr) {
|
|
604
604
|
|
605
605
|
// create the ExpressionValueInformation
|
606
606
|
ExpressionValueInformation info;
|
607
|
-
info.comparison_type = left_is_scalar ?
|
607
|
+
info.comparison_type = left_is_scalar ? FlipComparisonExpression(comparison.type) : comparison.type;
|
608
608
|
info.constant = constant_value;
|
609
609
|
|
610
610
|
// get the current bucket of constant values
|
@@ -138,7 +138,7 @@ bool JoinOrderOptimizer::ExtractJoinRelations(LogicalOperator &input_op, vector<
|
|
138
138
|
std::swap(join.children[0], join.children[1]);
|
139
139
|
for (auto &cond : join.conditions) {
|
140
140
|
std::swap(cond.left, cond.right);
|
141
|
-
cond.comparison =
|
141
|
+
cond.comparison = FlipComparisonExpression(cond.comparison);
|
142
142
|
}
|
143
143
|
}
|
144
144
|
}
|
@@ -769,7 +769,7 @@ JoinOrderOptimizer::GenerateJoins(vector<unique_ptr<LogicalOperator>> &extracted
|
|
769
769
|
|
770
770
|
if (invert) {
|
771
771
|
// reverse comparison expression if we reverse the order of the children
|
772
|
-
cond.comparison =
|
772
|
+
cond.comparison = FlipComparisonExpression(cond.comparison);
|
773
773
|
}
|
774
774
|
join->conditions.push_back(std::move(cond));
|
775
775
|
}
|
@@ -846,7 +846,7 @@ JoinOrderOptimizer::GenerateJoins(vector<unique_ptr<LogicalOperator>> &extracted
|
|
846
846
|
cond.comparison = comparison.type;
|
847
847
|
if (invert) {
|
848
848
|
// reverse comparison expression if we reverse the order of the children
|
849
|
-
cond.comparison =
|
849
|
+
cond.comparison = FlipComparisonExpression(comparison.type);
|
850
850
|
}
|
851
851
|
// now find the join to push it into
|
852
852
|
auto node = result_operator.get();
|
@@ -99,7 +99,7 @@ unique_ptr<Expression> MoveConstantsRule::Apply(LogicalOperator &op, vector<Expr
|
|
99
99
|
outer_constant->value = std::move(result_value);
|
100
100
|
// in this case, we should also flip the comparison
|
101
101
|
// e.g. if we have [4 - x < 2] then we should have [x > 2]
|
102
|
-
comparison->type =
|
102
|
+
comparison->type = FlipComparisonExpression(comparison->type);
|
103
103
|
}
|
104
104
|
} else {
|
105
105
|
D_ASSERT(op_type == "*");
|
@@ -129,7 +129,7 @@ unique_ptr<Expression> MoveConstantsRule::Apply(LogicalOperator &op, vector<Expr
|
|
129
129
|
}
|
130
130
|
if (inner_value < 0) {
|
131
131
|
// multiply by negative value, need to flip expression
|
132
|
-
comparison->type =
|
132
|
+
comparison->type = FlipComparisonExpression(comparison->type);
|
133
133
|
}
|
134
134
|
// else divide the RHS by the LHS
|
135
135
|
// we need to do a range check on the cast even though we do a division
|
@@ -165,7 +165,7 @@ void StatisticsPropagator::UpdateFilterStatistics(Expression &left, Expression &
|
|
165
165
|
if (left.type == ExpressionType::VALUE_CONSTANT && right.type == ExpressionType::BOUND_COLUMN_REF) {
|
166
166
|
constant = (BoundConstantExpression *)&left;
|
167
167
|
columnref = (BoundColumnRefExpression *)&right;
|
168
|
-
comparison_type =
|
168
|
+
comparison_type = FlipComparisonExpression(comparison_type);
|
169
169
|
} else if (left.type == ExpressionType::BOUND_COLUMN_REF && right.type == ExpressionType::VALUE_CONSTANT) {
|
170
170
|
columnref = (BoundColumnRefExpression *)&left;
|
171
171
|
constant = (BoundConstantExpression *)&right;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#include "duckdb/parser/common_table_expression_info.hpp"
|
2
|
+
#include "duckdb/common/serializer/format_serializer.hpp"
|
3
|
+
#include "duckdb/common/serializer/format_deserializer.hpp"
|
4
|
+
|
5
|
+
namespace duckdb {
|
6
|
+
|
7
|
+
void CommonTableExpressionInfo::FormatSerialize(FormatSerializer &serializer) const {
|
8
|
+
serializer.WriteProperty("aliases", aliases);
|
9
|
+
serializer.WriteProperty("query", query);
|
10
|
+
}
|
11
|
+
|
12
|
+
unique_ptr<CommonTableExpressionInfo> CommonTableExpressionInfo::FormatDeserialize(FormatDeserializer &deserializer) {
|
13
|
+
auto result = make_unique<CommonTableExpressionInfo>();
|
14
|
+
result->aliases = deserializer.ReadProperty<vector<string>>("aliases");
|
15
|
+
result->query = deserializer.ReadProperty<unique_ptr<SelectStatement>>("query");
|
16
|
+
return result;
|
17
|
+
}
|
18
|
+
|
19
|
+
} // namespace duckdb
|