duckdb 0.3.5-dev505.0 → 0.3.5-dev514.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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
- "version": "0.3.5-dev505.0",
4
+ "version": "0.3.5-dev514.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -159268,6 +159268,11 @@ BindResult ExpressionBinder::BindExpression(CollateExpression &expr, idx_t depth
159268
159268
 
159269
159269
 
159270
159270
 
159271
+
159272
+
159273
+
159274
+
159275
+
159271
159276
  //===----------------------------------------------------------------------===//
159272
159277
  // DuckDB
159273
159278
  //
@@ -159304,11 +159309,6 @@ private:
159304
159309
  } // namespace duckdb
159305
159310
 
159306
159311
 
159307
-
159308
-
159309
-
159310
-
159311
-
159312
159312
  namespace duckdb {
159313
159313
 
159314
159314
  unique_ptr<ParsedExpression> ExpressionBinder::QualifyColumnName(const string &column_name, string &error_message) {
@@ -159393,6 +159393,33 @@ unique_ptr<ParsedExpression> ExpressionBinder::CreateStructExtract(unique_ptr<Pa
159393
159393
  return move(extract_fun);
159394
159394
  }
159395
159395
 
159396
+ unique_ptr<ParsedExpression> ExpressionBinder::CreateStructPack(ColumnRefExpression &colref) {
159397
+ D_ASSERT(colref.column_names.size() <= 2);
159398
+ string error_message;
159399
+ auto &table_name = colref.column_names.back();
159400
+ auto binding = binder.bind_context.GetBinding(table_name, error_message);
159401
+ if (!binding) {
159402
+ return nullptr;
159403
+ }
159404
+ if (colref.column_names.size() == 2) {
159405
+ // "schema_name.table_name"
159406
+ auto table_entry = binding->GetTableEntry();
159407
+ if (!table_entry) {
159408
+ return nullptr;
159409
+ }
159410
+ auto &schema_name = colref.column_names[0];
159411
+ if (table_entry->schema->name != schema_name || table_entry->name != table_name) {
159412
+ return nullptr;
159413
+ }
159414
+ }
159415
+ // We found the table, now create the struct_pack expression
159416
+ vector<unique_ptr<ParsedExpression>> child_exprs;
159417
+ for (const auto &column_name : binding->names) {
159418
+ child_exprs.push_back(make_unique<ColumnRefExpression>(column_name, table_name));
159419
+ }
159420
+ return make_unique<FunctionExpression>("struct_pack", move(child_exprs));
159421
+ }
159422
+
159396
159423
  unique_ptr<ParsedExpression> ExpressionBinder::QualifyColumnName(ColumnRefExpression &colref, string &error_message) {
159397
159424
  idx_t column_parts = colref.column_names.size();
159398
159425
  // column names can have an arbitrary amount of dots
@@ -159401,7 +159428,13 @@ unique_ptr<ParsedExpression> ExpressionBinder::QualifyColumnName(ColumnRefExpres
159401
159428
  // no dots (i.e. "part1")
159402
159429
  // -> part1 refers to a column
159403
159430
  // check if we can qualify the column name with the table name
159404
- return QualifyColumnName(colref.GetColumnName(), error_message);
159431
+ auto qualified_colref = QualifyColumnName(colref.GetColumnName(), error_message);
159432
+ if (qualified_colref) {
159433
+ // we could: return it
159434
+ return qualified_colref;
159435
+ }
159436
+ // we could not! Try creating an implicit struct_pack
159437
+ return CreateStructPack(colref);
159405
159438
  } else if (column_parts == 2) {
159406
159439
  // one dot (i.e. "part1.part2")
159407
159440
  // EITHER:
@@ -159417,12 +159450,12 @@ unique_ptr<ParsedExpression> ExpressionBinder::QualifyColumnName(ColumnRefExpres
159417
159450
  auto new_colref = make_unique<ColumnRefExpression>(colref.column_names[0]);
159418
159451
  string other_error;
159419
159452
  auto qualified_colref = QualifyColumnName(colref.column_names[0], other_error);
159420
- if (!qualified_colref) {
159421
- // we could not! bail
159422
- return nullptr;
159453
+ if (qualified_colref) {
159454
+ // we could: create a struct extract
159455
+ return CreateStructExtract(move(qualified_colref), colref.column_names[1]);
159423
159456
  }
159424
- // we could: create a struct extract
159425
- return CreateStructExtract(move(qualified_colref), colref.column_names[1]);
159457
+ // we could not! Try creating an implicit struct_pack
159458
+ return CreateStructPack(colref);
159426
159459
  }
159427
159460
  } else {
159428
159461
  // two or more dots (i.e. "part1.part2.part3.part4...")
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 "98b3708d1"
15
- #define DUCKDB_VERSION "v0.3.5-dev505"
14
+ #define DUCKDB_SOURCE_ID "8451e9078"
15
+ #define DUCKDB_VERSION "v0.3.5-dev514"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //
@@ -13218,6 +13218,7 @@ public:
13218
13218
  string Bind(unique_ptr<ParsedExpression> *expr, idx_t depth, bool root_expression = false);
13219
13219
 
13220
13220
  unique_ptr<ParsedExpression> CreateStructExtract(unique_ptr<ParsedExpression> base, string field_name);
13221
+ unique_ptr<ParsedExpression> CreateStructPack(ColumnRefExpression &colref);
13221
13222
  BindResult BindQualifiedColumnName(ColumnRefExpression &colref, const string &table_name);
13222
13223
 
13223
13224
  unique_ptr<ParsedExpression> QualifyColumnName(const string &column_name, string &error_message);