duckdb 0.7.2-dev2675.0 → 0.7.2-dev2706.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.7.2-dev2675.0",
5
+ "version": "0.7.2-dev2706.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -55,6 +55,8 @@ void TableCatalogEntry::Serialize(Serializer &serializer) const {
55
55
  D_ASSERT(!internal);
56
56
 
57
57
  FieldWriter writer(serializer);
58
+ auto catalog_name = catalog.GetName();
59
+ writer.WriteString(catalog_name);
58
60
  writer.WriteString(schema.name);
59
61
  writer.WriteString(name);
60
62
  columns.Serialize(writer);
@@ -66,6 +68,7 @@ unique_ptr<CreateTableInfo> TableCatalogEntry::Deserialize(Deserializer &source,
66
68
  auto info = make_uniq<CreateTableInfo>();
67
69
 
68
70
  FieldReader reader(source);
71
+ info->catalog = reader.ReadRequired<string>();
69
72
  info->schema = reader.ReadRequired<string>();
70
73
  info->table = reader.ReadRequired<string>();
71
74
  info->columns = ColumnList::Deserialize(reader);
@@ -72,7 +72,10 @@ AdbcStatusCode DatabaseNew(struct AdbcDatabase *database, struct AdbcError *erro
72
72
  CHECK_TRUE(database, error, "Missing database object");
73
73
 
74
74
  database->private_data = nullptr;
75
- auto wrapper = (DuckDBAdbcDatabaseWrapper *)malloc(sizeof(DuckDBAdbcDatabaseWrapper));
75
+ // you can't malloc a struct with a non-trivial C++ constructor
76
+ // and std::string has a non-trivial constructor. so we need
77
+ // to use new and delete rather than malloc and free.
78
+ auto wrapper = new DuckDBAdbcDatabaseWrapper;
76
79
  CHECK_TRUE(wrapper, error, "Allocation error");
77
80
 
78
81
  database->private_data = wrapper;
@@ -112,7 +115,7 @@ AdbcStatusCode DatabaseRelease(struct AdbcDatabase *database, struct AdbcError *
112
115
 
113
116
  duckdb_close(&wrapper->database);
114
117
  duckdb_destroy_config(&wrapper->config);
115
- free(database->private_data);
118
+ delete wrapper;
116
119
  database->private_data = nullptr;
117
120
  }
118
121
  return ADBC_STATUS_OK;
@@ -124,6 +124,8 @@ bool ParallelCSVReader::SetPosition(DataChunk &insert_chunk) {
124
124
  while (!successfully_read_first_line) {
125
125
  DataChunk first_line_chunk;
126
126
  first_line_chunk.Initialize(allocator, return_types);
127
+ // Ensure that parse_chunk has no gunk when trying to figure new line
128
+ parse_chunk.Reset();
127
129
  for (; position_buffer < end_buffer; position_buffer++) {
128
130
  if (StringUtil::CharacterIsNewline((*buffer)[position_buffer])) {
129
131
  bool carriage_return = (*buffer)[position_buffer] == '\r';
@@ -183,6 +185,8 @@ bool ParallelCSVReader::SetPosition(DataChunk &insert_chunk) {
183
185
  if (verification_positions.beginning_of_first_line == 0) {
184
186
  verification_positions.beginning_of_first_line = position_buffer;
185
187
  }
188
+ // Ensure that parse_chunk has no gunk when trying to figure new line
189
+ parse_chunk.Reset();
186
190
 
187
191
  verification_positions.end_of_last_line = position_buffer;
188
192
  finished = false;
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.7.2-dev2675"
2
+ #define DUCKDB_VERSION "0.7.2-dev2706"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "688b2f1f8c"
5
+ #define DUCKDB_SOURCE_ID "43a97f9078"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -20,7 +20,7 @@ enum class QueryResultType : uint8_t { MATERIALIZED_RESULT, STREAM_RESULT, PENDI
20
20
 
21
21
  //! A set of properties from the client context that can be used to interpret the query result
22
22
  struct ClientProperties {
23
- string timezone;
23
+ string time_zone;
24
24
  };
25
25
 
26
26
  class BaseQueryResult {
@@ -1156,7 +1156,7 @@ ParserOptions ClientContext::GetParserOptions() const {
1156
1156
 
1157
1157
  ClientProperties ClientContext::GetClientProperties() const {
1158
1158
  ClientProperties properties;
1159
- properties.timezone = ClientConfig::GetConfig(*this).ExtractTimezone();
1159
+ properties.time_zone = ClientConfig::GetConfig(*this).ExtractTimezone();
1160
1160
  return properties;
1161
1161
  }
1162
1162
 
@@ -165,7 +165,7 @@ string QueryResult::HeaderToString() {
165
165
  }
166
166
 
167
167
  string QueryResult::GetConfigTimezone(QueryResult &query_result) {
168
- return query_result.client_properties.timezone;
168
+ return query_result.client_properties.time_zone;
169
169
  }
170
170
 
171
171
  } // namespace duckdb
@@ -10,8 +10,7 @@ unique_ptr<LogicalOperator> LogicalCreate::Deserialize(LogicalDeserializationSta
10
10
  auto &context = state.gstate.context;
11
11
  auto info = CreateInfo::Deserialize(reader.GetSource());
12
12
 
13
- auto schema_catalog_entry =
14
- Catalog::GetSchema(context, INVALID_CATALOG, info->schema, OnEntryNotFound::RETURN_NULL);
13
+ auto schema_catalog_entry = Catalog::GetSchema(context, info->catalog, info->schema, OnEntryNotFound::RETURN_NULL);
15
14
  return make_uniq<LogicalCreate>(state.type, std::move(info), schema_catalog_entry);
16
15
  }
17
16
 
@@ -22,7 +22,7 @@ unique_ptr<LogicalOperator> LogicalCreateIndex::Deserialize(LogicalDeserializati
22
22
  auto catalog_info = TableCatalogEntry::Deserialize(reader.GetSource(), context);
23
23
 
24
24
  auto &table =
25
- Catalog::GetEntry<TableCatalogEntry>(context, INVALID_CATALOG, catalog_info->schema, catalog_info->table);
25
+ Catalog::GetEntry<TableCatalogEntry>(context, catalog_info->catalog, catalog_info->schema, catalog_info->table);
26
26
  auto unbound_expressions = reader.ReadRequiredSerializableList<Expression>(state.gstate);
27
27
 
28
28
  auto create_info = reader.ReadOptional<CreateInfo>(nullptr);
@@ -1,6 +1,7 @@
1
1
  #include "duckdb/planner/operator/logical_delete.hpp"
2
- #include "duckdb/parser/parsed_data/create_table_info.hpp"
2
+
3
3
  #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp"
4
+ #include "duckdb/parser/parsed_data/create_table_info.hpp"
4
5
 
5
6
  namespace duckdb {
6
7
 
@@ -19,8 +20,7 @@ unique_ptr<LogicalOperator> LogicalDelete::Deserialize(LogicalDeserializationSta
19
20
  auto &context = state.gstate.context;
20
21
  auto info = TableCatalogEntry::Deserialize(reader.GetSource(), context);
21
22
 
22
- auto &table_catalog_entry =
23
- Catalog::GetEntry<TableCatalogEntry>(context, INVALID_CATALOG, info->schema, info->table);
23
+ auto &table_catalog_entry = Catalog::GetEntry<TableCatalogEntry>(context, info->catalog, info->schema, info->table);
24
24
 
25
25
  auto table_index = reader.ReadRequired<idx_t>();
26
26
  auto result = make_uniq<LogicalDelete>(table_catalog_entry, table_index);
@@ -41,7 +41,7 @@ unique_ptr<LogicalOperator> LogicalInsert::Deserialize(LogicalDeserializationSta
41
41
  auto bound_defaults = reader.ReadRequiredSerializableList<Expression>(state.gstate);
42
42
  auto action_type = reader.ReadRequired<OnConflictAction>();
43
43
 
44
- auto &catalog = Catalog::GetCatalog(context, INVALID_CATALOG);
44
+ auto &catalog = Catalog::GetCatalog(context, info->catalog);
45
45
 
46
46
  auto &table_catalog_entry = catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->table);
47
47
  auto result = make_uniq<LogicalInsert>(table_catalog_entry, table_index);
@@ -21,7 +21,7 @@ void LogicalUpdate::Serialize(FieldWriter &writer) const {
21
21
  unique_ptr<LogicalOperator> LogicalUpdate::Deserialize(LogicalDeserializationState &state, FieldReader &reader) {
22
22
  auto &context = state.gstate.context;
23
23
  auto info = TableCatalogEntry::Deserialize(reader.GetSource(), context);
24
- auto &catalog = Catalog::GetCatalog(context, INVALID_CATALOG);
24
+ auto &catalog = Catalog::GetCatalog(context, info->catalog);
25
25
 
26
26
  auto &table_catalog_entry = catalog.GetEntry<TableCatalogEntry>(context, info->schema, info->table);
27
27
  auto result = make_uniq<LogicalUpdate>(table_catalog_entry);
@@ -5,46 +5,25 @@
5
5
 
6
6
  namespace duckdb {
7
7
  void BoundCreateTableInfo::Serialize(Serializer &serializer) const {
8
- schema.Serialize(serializer);
9
8
  serializer.WriteOptional(base);
10
-
11
- // TODO[YLM]: Review if we want/need to serialize more of the fields.
12
- //! The map of column names -> column index, used during binding
13
- // case_insensitive_map_t<column_t> name_map;
14
-
15
- //! Column dependency manager of the table
16
- // ColumnDependencyManager column_dependency_manager;
17
-
18
9
  serializer.WriteList(constraints);
19
10
  serializer.WriteList(bound_constraints);
20
11
  serializer.WriteList(bound_defaults);
21
-
22
- //! Dependents of the table (in e.g. default values)
23
- // unordered_set<CatalogEntry *> dependencies;
24
-
25
- //! The existing table data on disk (if any)
26
- // unique_ptr<PersistentTableData> data;
27
-
28
- //! CREATE TABLE from QUERY
29
12
  serializer.WriteOptional(query);
30
-
31
- //! Indexes created by this table <Block_ID, Offset>
32
- // vector<BlockPointer> indexes;
33
13
  }
34
14
 
35
15
  unique_ptr<BoundCreateTableInfo> BoundCreateTableInfo::Deserialize(Deserializer &source,
36
16
  PlanDeserializationState &state) {
37
- auto &context = state.context;
38
- auto create_info = SchemaCatalogEntry::Deserialize(source);
39
- auto schema_name = create_info->schema;
40
- auto &schema = Catalog::GetSchema(context, INVALID_CATALOG, schema_name);
41
- auto result = make_uniq<BoundCreateTableInfo>(schema, std::move(create_info));
42
- result->base = source.ReadOptional<CreateInfo>();
17
+ auto create_info_base = source.ReadOptional<CreateInfo>();
18
+ // Get schema from the catalog to create BoundCreateTableInfo
19
+ auto schema_name = create_info_base->schema;
20
+ auto catalog = create_info_base->catalog;
21
+ auto &schema_catalog_entry = Catalog::GetSchema(state.context, catalog, schema_name);
43
22
 
23
+ auto result = make_uniq<BoundCreateTableInfo>(schema_catalog_entry, std::move(create_info_base));
44
24
  source.ReadList<Constraint>(result->constraints);
45
25
  source.ReadList<BoundConstraint>(result->bound_constraints);
46
26
  source.ReadList<Expression>(result->bound_defaults, state);
47
-
48
27
  result->query = source.ReadOptional<LogicalOperator>(state);
49
28
  return result;
50
29
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  namespace duckdb {
4
4
 
5
- const uint64_t VERSION_NUMBER = 49;
5
+ const uint64_t VERSION_NUMBER = 50;
6
6
 
7
7
  struct StorageVersionInfo {
8
8
  const char *version_name;