duckdb 0.3.5-dev1323.0 → 0.3.5-dev1334.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-dev1323.0",
4
+ "version": "0.3.5-dev1334.0",
5
5
  "description": "DuckDB node.js API",
6
6
  "gypfile": true,
7
7
  "dependencies": {
package/src/duckdb.cpp CHANGED
@@ -551,6 +551,9 @@ struct ClientData {
551
551
  //! The file opener of the client context
552
552
  unique_ptr<FileOpener> file_opener;
553
553
 
554
+ //! The file search path
555
+ string file_search_path;
556
+
554
557
  public:
555
558
  DUCKDB_API static ClientData &Get(ClientContext &context);
556
559
  };
@@ -17235,6 +17238,31 @@ private:
17235
17238
 
17236
17239
 
17237
17240
 
17241
+ //===----------------------------------------------------------------------===//
17242
+ // DuckDB
17243
+ //
17244
+ // duckdb/common/file_opener.hpp
17245
+ //
17246
+ //
17247
+ //===----------------------------------------------------------------------===//
17248
+
17249
+
17250
+
17251
+
17252
+
17253
+ namespace duckdb {
17254
+
17255
+ class Value;
17256
+
17257
+ //! Abstract type that provide client-specific context to FileSystem.
17258
+ class FileOpener {
17259
+ public:
17260
+ virtual ~FileOpener() {};
17261
+
17262
+ virtual bool TryGetCurrentSetting(const string &key, Value &result) = 0;
17263
+ };
17264
+
17265
+ } // namespace duckdb
17238
17266
 
17239
17267
 
17240
17268
 
@@ -17283,8 +17311,9 @@ public:
17283
17311
 
17284
17312
  } // namespace duckdb
17285
17313
 
17286
- #include <string>
17314
+
17287
17315
  #include <io.h>
17316
+ #include <string>
17288
17317
 
17289
17318
  #ifdef __MINGW32__
17290
17319
  #include <sys/stat.h>
@@ -18126,15 +18155,6 @@ vector<string> LocalFileSystem::Glob(const string &path, FileOpener *opener) {
18126
18155
  if (path.empty()) {
18127
18156
  return vector<string>();
18128
18157
  }
18129
- // first check if the path has a glob at all
18130
- if (!HasGlob(path)) {
18131
- // no glob: return only the file (if it exists or is a pipe)
18132
- vector<string> result;
18133
- if (FileExists(path) || IsPipe(path)) {
18134
- result.push_back(path);
18135
- }
18136
- return result;
18137
- }
18138
18158
  // split up the path into separate chunks
18139
18159
  vector<string> splits;
18140
18160
  idx_t last_pos = 0;
@@ -18170,6 +18190,27 @@ vector<string> LocalFileSystem::Glob(const string &path, FileOpener *opener) {
18170
18190
  splits[0] = home_directory;
18171
18191
  }
18172
18192
  }
18193
+ // Check if the path has a glob at all
18194
+ if (!HasGlob(path)) {
18195
+ // no glob: return only the file (if it exists or is a pipe)
18196
+ vector<string> result;
18197
+ if (FileExists(path) || IsPipe(path)) {
18198
+ result.push_back(path);
18199
+ } else if (!absolute_path) {
18200
+ Value value;
18201
+ if (opener->TryGetCurrentSetting("file_search_path", value)) {
18202
+ auto search_paths_str = value.ToString();
18203
+ std::vector<std::string> search_paths = StringUtil::Split(search_paths_str, ',');
18204
+ for (const auto &search_path : search_paths) {
18205
+ auto joined_path = JoinPath(search_path, path);
18206
+ if (FileExists(joined_path) || IsPipe(joined_path)) {
18207
+ result.push_back(joined_path);
18208
+ }
18209
+ }
18210
+ }
18211
+ }
18212
+ return result;
18213
+ }
18173
18214
  vector<string> previous_directories;
18174
18215
  if (absolute_path) {
18175
18216
  // for absolute paths, we don't start by scanning the current directory
@@ -114584,32 +114625,8 @@ bool duckdb_value_is_null(duckdb_result *result, idx_t col, idx_t row) {
114584
114625
 
114585
114626
 
114586
114627
 
114587
- //===----------------------------------------------------------------------===//
114588
- // DuckDB
114589
- //
114590
- // duckdb/common/file_opener.hpp
114591
- //
114592
- //
114593
- //===----------------------------------------------------------------------===//
114594
-
114595
-
114596
-
114597
114628
 
114598
114629
 
114599
- namespace duckdb {
114600
-
114601
- class Value;
114602
-
114603
- //! Abstract type that provide client-specific context to FileSystem.
114604
- class FileOpener {
114605
- public:
114606
- virtual ~FileOpener() {};
114607
-
114608
- virtual bool TryGetCurrentSetting(const string &key, Value &result) = 0;
114609
- };
114610
-
114611
- } // namespace duckdb
114612
-
114613
114630
  namespace duckdb {
114614
114631
 
114615
114632
  class ClientContext;
@@ -116180,6 +116197,7 @@ RandomEngine &RandomEngine::Get(ClientContext &context) {
116180
116197
 
116181
116198
 
116182
116199
 
116200
+
116183
116201
  //===----------------------------------------------------------------------===//
116184
116202
  // DuckDB
116185
116203
  //
@@ -116343,6 +116361,14 @@ struct ExternalThreadsSetting {
116343
116361
  static Value GetSetting(ClientContext &context);
116344
116362
  };
116345
116363
 
116364
+ struct FileSearchPathSetting {
116365
+ static constexpr const char *Name = "file_search_path";
116366
+ static constexpr const char *Description = "A comma separated list of directories to search for input files";
116367
+ static constexpr const LogicalTypeId InputType = LogicalTypeId::VARCHAR;
116368
+ static void SetLocal(ClientContext &context, const Value &parameter);
116369
+ static Value GetSetting(ClientContext &context);
116370
+ };
116371
+
116346
116372
  struct ForceCompressionSetting {
116347
116373
  static constexpr const char *Name = "force_compression";
116348
116374
  static constexpr const char *Description = "DEBUG SETTING: forces a specific compression method to be used";
@@ -116512,6 +116538,7 @@ static ConfigurationOption internal_options[] = {DUCKDB_GLOBAL(AccessModeSetting
116512
116538
  DUCKDB_LOCAL(EnableProgressBarSetting),
116513
116539
  DUCKDB_LOCAL(ExplainOutputSetting),
116514
116540
  DUCKDB_GLOBAL(ExternalThreadsSetting),
116541
+ DUCKDB_LOCAL(FileSearchPathSetting),
116515
116542
  DUCKDB_GLOBAL(ForceCompressionSetting),
116516
116543
  DUCKDB_LOCAL(LogQueryPathSetting),
116517
116544
  DUCKDB_LOCAL(MaximumExpressionDepthSetting),
@@ -130089,6 +130116,20 @@ Value ExternalThreadsSetting::GetSetting(ClientContext &context) {
130089
130116
  return Value::BIGINT(config.external_threads);
130090
130117
  }
130091
130118
 
130119
+ //===--------------------------------------------------------------------===//
130120
+ // File Search Path
130121
+ //===--------------------------------------------------------------------===//
130122
+ void FileSearchPathSetting::SetLocal(ClientContext &context, const Value &input) {
130123
+ auto parameter = input.ToString();
130124
+ auto &client_data = ClientData::Get(context);
130125
+ client_data.file_search_path = parameter;
130126
+ }
130127
+
130128
+ Value FileSearchPathSetting::GetSetting(ClientContext &context) {
130129
+ auto &client_data = ClientData::Get(context);
130130
+ return Value(client_data.file_search_path);
130131
+ }
130132
+
130092
130133
  //===--------------------------------------------------------------------===//
130093
130134
  // Force Compression
130094
130135
  //===--------------------------------------------------------------------===//
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 "5d9d00b2a"
15
- #define DUCKDB_VERSION "v0.3.5-dev1323"
14
+ #define DUCKDB_SOURCE_ID "ddaebeaa2"
15
+ #define DUCKDB_VERSION "v0.3.5-dev1334"
16
16
  //===----------------------------------------------------------------------===//
17
17
  // DuckDB
18
18
  //