duckdb 0.5.1-dev56.0 → 0.5.1-dev72.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.5.1-dev56.0",
4
+ "version": "0.5.1-dev72.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -620,7 +620,88 @@ public:
620
620
 
621
621
  } // namespace duckdb
622
622
 
623
+ //===----------------------------------------------------------------------===//
624
+ // DuckDB
625
+ //
626
+ // extension_functions.hpp
627
+ //
628
+ //
629
+ //===----------------------------------------------------------------------===//
630
+
631
+
632
+
633
+
634
+
635
+ namespace duckdb {
636
+
637
+ struct ExtensionFunction {
638
+ char function[48];
639
+ char extension[48];
640
+ };
641
+
642
+ static constexpr ExtensionFunction EXTENSION_FUNCTIONS[] = {
643
+ {"->>", "json"},
644
+ {"array_to_json", "json"},
645
+ {"create_fts_index", "fts"},
646
+ {"dbgen", "tpch"},
647
+ {"drop_fts_index", "fts"},
648
+ {"dsdgen", "tpcds"},
649
+ {"excel_text", "excel"},
650
+ {"from_json", "json"},
651
+ {"from_json_strict", "json"},
652
+ {"from_substrait", "substrait"},
653
+ {"get_substrait", "substrait"},
654
+ {"get_substrait_json", "substrait"},
655
+ {"icu_calendar_names", "icu"},
656
+ {"icu_sort_key", "icu"},
657
+ {"json", "json"},
658
+ {"json_array", "json"},
659
+ {"json_array_length", "json"},
660
+ {"json_extract", "json"},
661
+ {"json_extract_path", "json"},
662
+ {"json_extract_path_text", "json"},
663
+ {"json_extract_string", "json"},
664
+ {"json_group_array", "json"},
665
+ {"json_group_object", "json"},
666
+ {"json_group_structure", "json"},
667
+ {"json_merge_patch", "json"},
668
+ {"json_object", "json"},
669
+ {"json_quote", "json"},
670
+ {"json_structure", "json"},
671
+ {"json_transform", "json"},
672
+ {"json_transform_strict", "json"},
673
+ {"json_type", "json"},
674
+ {"json_valid", "json"},
675
+ {"make_timestamptz", "icu"},
676
+ {"parquet_metadata", "parquet"},
677
+ {"parquet_scan", "parquet"},
678
+ {"parquet_schema", "parquet"},
679
+ {"pg_timezone_names", "icu"},
680
+ {"postgres_attach", "postgres_scanner"},
681
+ {"postgres_scan", "postgres_scanner"},
682
+ {"postgres_scan_pushdown", "postgres_scanner"},
683
+ {"read_json_objects", "json"},
684
+ {"read_ndjson_objects", "json"},
685
+ {"read_parquet", "parquet"},
686
+ {"row_to_json", "json"},
687
+ {"sqlite_attach", "sqlite_scanner"},
688
+ {"sqlite_scan", "sqlite_scanner"},
689
+ {"stem", "fts"},
690
+ {"text", "excel"},
691
+ {"to_json", "json"},
692
+ {"tpcds", "tpcds"},
693
+ {"tpcds_answers", "tpcds"},
694
+ {"tpcds_queries", "tpcds"},
695
+ {"tpch", "tpch"},
696
+ {"tpch_answers", "tpch"},
697
+ {"tpch_queries", "tpch"},
698
+ {"visualize_diff_profiling_output", "visualizer"},
699
+ {"visualize_json_profiling_output", "visualizer"},
700
+ {"visualize_last_profiling_output", "visualizer"},
701
+ };
702
+ } // namespace duckdb
623
703
 
704
+ #include <algorithm>
624
705
  namespace duckdb {
625
706
 
626
707
  string SimilarCatalogEntry::GetQualifiedName() const {
@@ -823,6 +904,16 @@ SimilarCatalogEntry Catalog::SimilarEntryInSchemas(ClientContext &context, const
823
904
  return {most_similar.first, most_similar.second, schema_of_most_similar};
824
905
  }
825
906
 
907
+ string FindExtension(const string &function_name) {
908
+ auto size = sizeof(EXTENSION_FUNCTIONS) / sizeof(ExtensionFunction);
909
+ auto it = std::lower_bound(
910
+ EXTENSION_FUNCTIONS, EXTENSION_FUNCTIONS + size, function_name,
911
+ [](const ExtensionFunction &element, const string &value) { return element.function < value; });
912
+ if (it != EXTENSION_FUNCTIONS + size && it->function == function_name) {
913
+ return it->extension;
914
+ }
915
+ return "";
916
+ }
826
917
  CatalogException Catalog::CreateMissingEntryException(ClientContext &context, const string &entry_name,
827
918
  CatalogType type, const vector<SchemaCatalogEntry *> &schemas,
828
919
  QueryErrorContext error_context) {
@@ -836,7 +927,12 @@ CatalogException Catalog::CreateMissingEntryException(ClientContext &context, co
836
927
  }
837
928
  });
838
929
  auto unseen_entry = SimilarEntryInSchemas(context, entry_name, type, unseen_schemas);
839
-
930
+ auto extension_name = FindExtension(entry_name);
931
+ if (!extension_name.empty()) {
932
+ return CatalogException("Function with name %s is not on the catalog, but it exists in the %s extension. To "
933
+ "Install and Load the extension, run: INSTALL %s; LOAD %s;",
934
+ entry_name, extension_name, extension_name, extension_name);
935
+ }
840
936
  string did_you_mean;
841
937
  if (unseen_entry.Found() && unseen_entry.distance < entry.distance) {
842
938
  did_you_mean = "\nDid you mean \"" + unseen_entry.GetQualifiedName() + "\"?";
@@ -35676,7 +35772,10 @@ struct SortConstants {
35676
35772
 
35677
35773
  struct SortLayout {
35678
35774
  public:
35775
+ SortLayout() {
35776
+ }
35679
35777
  explicit SortLayout(const vector<BoundOrderByNode> &orders);
35778
+ SortLayout GetPrefixComparisonLayout(idx_t num_prefix_cols) const;
35680
35779
 
35681
35780
  public:
35682
35781
  idx_t column_count;
@@ -37327,6 +37426,32 @@ SortLayout::SortLayout(const vector<BoundOrderByNode> &orders)
37327
37426
  blob_layout.Initialize(blob_layout_types);
37328
37427
  }
37329
37428
 
37429
+ SortLayout SortLayout::GetPrefixComparisonLayout(idx_t num_prefix_cols) const {
37430
+ SortLayout result;
37431
+ result.column_count = num_prefix_cols;
37432
+ result.all_constant = true;
37433
+ result.comparison_size = 0;
37434
+ for (idx_t col_idx = 0; col_idx < num_prefix_cols; col_idx++) {
37435
+ result.order_types.push_back(order_types[col_idx]);
37436
+ result.order_by_null_types.push_back(order_by_null_types[col_idx]);
37437
+ result.logical_types.push_back(logical_types[col_idx]);
37438
+
37439
+ result.all_constant = result.all_constant && constant_size[col_idx];
37440
+ result.constant_size.push_back(constant_size[col_idx]);
37441
+
37442
+ result.comparison_size += column_sizes[col_idx];
37443
+ result.column_sizes.push_back(column_sizes[col_idx]);
37444
+
37445
+ result.prefix_lengths.push_back(prefix_lengths[col_idx]);
37446
+ result.stats.push_back(stats[col_idx]);
37447
+ result.has_null.push_back(has_null[col_idx]);
37448
+ }
37449
+ result.entry_size = entry_size;
37450
+ result.blob_layout = blob_layout;
37451
+ result.sorting_to_blob_col = sorting_to_blob_col;
37452
+ return result;
37453
+ }
37454
+
37330
37455
  LocalSortState::LocalSortState() : initialized(false) {
37331
37456
  }
37332
37457
 
@@ -64930,12 +65055,14 @@ public:
64930
65055
 
64931
65056
  WindowGlobalHashGroup(BufferManager &buffer_manager, const Orders &partitions, const Orders &orders,
64932
65057
  const Types &payload_types, idx_t max_mem, bool external)
64933
- : memory_per_thread(max_mem), count(0), partition_layout(partitions) {
65058
+ : memory_per_thread(max_mem), count(0) {
64934
65059
 
64935
65060
  RowLayout payload_layout;
64936
65061
  payload_layout.Initialize(payload_types);
64937
65062
  global_sort = make_unique<GlobalSortState>(buffer_manager, orders, payload_layout);
64938
65063
  global_sort->external = external;
65064
+
65065
+ partition_layout = global_sort->sort_layout.GetPrefixComparisonLayout(partitions.size());
64939
65066
  }
64940
65067
 
64941
65068
  void Combine(LocalSortState &local_sort) {
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 "c96d09d7b"
15
- #define DUCKDB_VERSION "v0.5.1-dev56"
14
+ #define DUCKDB_SOURCE_ID "62c4acd27"
15
+ #define DUCKDB_VERSION "v0.5.1-dev72"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //