duckdb 0.6.2-dev1241.0 → 0.6.2-dev1247.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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.6.2-dev1241.0",
5
+ "version": "0.6.2-dev1247.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.6.2-dev1241"
2
+ #define DUCKDB_VERSION "0.6.2-dev1247"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "7fb3c46a62"
5
+ #define DUCKDB_SOURCE_ID "5fb349c5ab"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -8,8 +8,9 @@
8
8
 
9
9
  #pragma once
10
10
 
11
- #include "duckdb/parser/parsed_data/parse_info.hpp"
12
11
  #include "duckdb/common/enums/catalog_type.hpp"
12
+ #include "duckdb/common/field_writer.hpp"
13
+ #include "duckdb/parser/parsed_data/parse_info.hpp"
13
14
 
14
15
  namespace duckdb {
15
16
 
@@ -45,6 +46,32 @@ public:
45
46
  result->allow_drop_internal = allow_drop_internal;
46
47
  return result;
47
48
  }
49
+
50
+ void Serialize(Serializer &serializer) const {
51
+ FieldWriter writer(serializer);
52
+ writer.WriteField<CatalogType>(type);
53
+ writer.WriteString(catalog);
54
+ writer.WriteString(schema);
55
+ writer.WriteString(name);
56
+ writer.WriteField(if_exists);
57
+ writer.WriteField(cascade);
58
+ writer.WriteField(allow_drop_internal);
59
+ writer.Finalize();
60
+ }
61
+
62
+ static unique_ptr<ParseInfo> Deserialize(Deserializer &deserializer) {
63
+ FieldReader reader(deserializer);
64
+ auto drop_info = make_unique<DropInfo>();
65
+ drop_info->type = reader.ReadRequired<CatalogType>();
66
+ drop_info->catalog = reader.ReadRequired<string>();
67
+ drop_info->schema = reader.ReadRequired<string>();
68
+ drop_info->name = reader.ReadRequired<string>();
69
+ drop_info->if_exists = reader.ReadRequired<bool>();
70
+ drop_info->cascade = reader.ReadRequired<bool>();
71
+ drop_info->allow_drop_internal = reader.ReadRequired<bool>();
72
+ reader.Finalize();
73
+ return std::move(drop_info);
74
+ }
48
75
  };
49
76
 
50
77
  } // namespace duckdb
@@ -8,6 +8,7 @@
8
8
 
9
9
  #pragma once
10
10
 
11
+ #include "duckdb/common/field_writer.hpp"
11
12
  #include "duckdb/parser/parsed_data/parse_info.hpp"
12
13
 
13
14
  namespace duckdb {
@@ -25,6 +26,22 @@ public:
25
26
  result->load_type = load_type;
26
27
  return result;
27
28
  }
29
+
30
+ void Serialize(Serializer &serializer) const {
31
+ FieldWriter writer(serializer);
32
+ writer.WriteString(filename);
33
+ writer.WriteField<LoadType>(load_type);
34
+ writer.Finalize();
35
+ }
36
+
37
+ static unique_ptr<ParseInfo> Deserialize(Deserializer &deserializer) {
38
+ FieldReader reader(deserializer);
39
+ auto load_info = make_unique<LoadInfo>();
40
+ load_info->filename = reader.ReadRequired<string>();
41
+ load_info->load_type = reader.ReadRequired<LoadType>();
42
+ reader.Finalize();
43
+ return std::move(load_info);
44
+ }
28
45
  };
29
46
 
30
47
  } // namespace duckdb
@@ -1,16 +1,16 @@
1
1
  #include "duckdb/catalog/catalog.hpp"
2
2
  #include "duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp"
3
3
  #include "duckdb/execution/expression_executor.hpp"
4
+ #include "duckdb/function/function_binder.hpp"
4
5
  #include "duckdb/parser/expression/function_expression.hpp"
6
+ #include "duckdb/parser/expression/lambda_expression.hpp"
7
+ #include "duckdb/planner/binder.hpp"
5
8
  #include "duckdb/planner/expression/bound_cast_expression.hpp"
6
9
  #include "duckdb/planner/expression/bound_constant_expression.hpp"
7
10
  #include "duckdb/planner/expression/bound_function_expression.hpp"
8
- #include "duckdb/planner/expression/bound_reference_expression.hpp"
9
11
  #include "duckdb/planner/expression/bound_lambda_expression.hpp"
12
+ #include "duckdb/planner/expression/bound_reference_expression.hpp"
10
13
  #include "duckdb/planner/expression_binder.hpp"
11
- #include "duckdb/planner/binder.hpp"
12
- #include "duckdb/parser/expression/lambda_expression.hpp"
13
- #include "duckdb/function/function_binder.hpp"
14
14
 
15
15
  namespace duckdb {
16
16
 
@@ -28,6 +28,13 @@ BindResult ExpressionBinder::BindExpression(FunctionExpression &function, idx_t
28
28
  auto func = Catalog::GetEntry(context, CatalogType::SCALAR_FUNCTION_ENTRY, function.catalog, function.schema,
29
29
  function.function_name, false, error_context);
30
30
 
31
+ if (func->type != CatalogType::AGGREGATE_FUNCTION_ENTRY &&
32
+ (function.distinct || function.filter || !function.order_bys->orders.empty())) {
33
+ throw InvalidInputException("Function \"%s\" is a %s. \"DISTINCT\", \"FILTER\", and \"ORDER BY\" are only "
34
+ "applicable to aggregate functions.",
35
+ function.function_name, CatalogTypeToString(func->type));
36
+ }
37
+
31
38
  switch (func->type) {
32
39
  case CatalogType::SCALAR_FUNCTION_ENTRY:
33
40
  // scalar function
@@ -1,13 +1,44 @@
1
1
  #include "duckdb/planner/operator/logical_simple.hpp"
2
+ #include "duckdb/parser/parsed_data/alter_info.hpp"
3
+ #include "duckdb/parser/parsed_data/drop_info.hpp"
4
+ #include "duckdb/parser/parsed_data/load_info.hpp"
2
5
 
3
6
  namespace duckdb {
4
7
 
5
8
  void LogicalSimple::Serialize(FieldWriter &writer) const {
6
- throw NotImplementedException(LogicalOperatorToString(type));
9
+ writer.WriteField<LogicalOperatorType>(type);
10
+ switch (type) {
11
+ case LogicalOperatorType::LOGICAL_ALTER:
12
+ static_cast<const AlterInfo &>(*info).Serialize(writer.GetSerializer());
13
+ break;
14
+ case LogicalOperatorType::LOGICAL_DROP:
15
+ static_cast<const DropInfo &>(*info).Serialize(writer.GetSerializer());
16
+ break;
17
+ case LogicalOperatorType::LOGICAL_LOAD:
18
+ static_cast<const LoadInfo &>(*info).Serialize(writer.GetSerializer());
19
+ break;
20
+ default:
21
+ throw NotImplementedException(LogicalOperatorToString(type));
22
+ }
7
23
  }
8
24
 
9
25
  unique_ptr<LogicalOperator> LogicalSimple::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
10
- throw NotImplementedException(LogicalOperatorToString(state.type));
26
+ auto type = reader.ReadRequired<LogicalOperatorType>();
27
+ unique_ptr<ParseInfo> parse_info;
28
+ switch (type) {
29
+ case LogicalOperatorType::LOGICAL_ALTER:
30
+ parse_info = AlterInfo::Deserialize(reader.GetSource());
31
+ break;
32
+ case LogicalOperatorType::LOGICAL_DROP:
33
+ parse_info = DropInfo::Deserialize(reader.GetSource());
34
+ break;
35
+ case LogicalOperatorType::LOGICAL_LOAD:
36
+ parse_info = LoadInfo::Deserialize(reader.GetSource());
37
+ break;
38
+ default:
39
+ throw NotImplementedException(LogicalOperatorToString(state.type));
40
+ }
41
+ return make_unique<LogicalSimple>(type, std::move(parse_info));
11
42
  }
12
43
 
13
44
  idx_t LogicalSimple::EstimateCardinality(ClientContext &context) {
@@ -154,13 +154,11 @@ static bool OperatorSupportsSerialization(LogicalOperator &op) {
154
154
  case LogicalOperatorType::LOGICAL_CREATE_VIEW:
155
155
  case LogicalOperatorType::LOGICAL_CREATE_SCHEMA:
156
156
  case LogicalOperatorType::LOGICAL_CREATE_MACRO:
157
- case LogicalOperatorType::LOGICAL_DROP:
158
157
  case LogicalOperatorType::LOGICAL_PRAGMA:
159
158
  case LogicalOperatorType::LOGICAL_TRANSACTION:
160
159
  case LogicalOperatorType::LOGICAL_CREATE_TYPE:
161
160
  case LogicalOperatorType::LOGICAL_EXPLAIN:
162
161
  case LogicalOperatorType::LOGICAL_COPY_TO_FILE:
163
- case LogicalOperatorType::LOGICAL_LOAD:
164
162
  case LogicalOperatorType::LOGICAL_VACUUM:
165
163
  // unsupported (for now)
166
164
  return false;