duckdb 0.6.2-dev604.0 → 0.6.2-dev646.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/Makefile CHANGED
@@ -1,15 +1,15 @@
1
1
  all: build
2
2
 
3
- src/duckdb.cpp:
3
+ src/duckdb/src/include/duckdb.hpp:
4
4
  ./configure
5
5
 
6
6
  ./node_modules:
7
7
  npm install --build-from-source
8
8
 
9
- build: ./node_modules src/duckdb.cpp
9
+ build: ./node_modules src/duckdb/src/include/duckdb.hpp
10
10
  ./node_modules/.bin/node-pre-gyp build -j max --loglevel=silent
11
11
 
12
- debug: ./node_modules src/duckdb.cpp
12
+ debug: ./node_modules src/duckdb/src/include/duckdb.hpp
13
13
  ./node_modules/.bin/node-pre-gyp build -j max --debug --verbose
14
14
 
15
15
  clean:
@@ -17,9 +17,12 @@ clean:
17
17
  rm -rf lib/binding/
18
18
  rm -f test/support/big.db-journal
19
19
  rm -rf ./node_modules/
20
- rm -rf src/duckdb.*
21
- rm -rf src/parquet-amalgamation.*
20
+ rm -rf src/duckdb/
21
+ rm -f binding.gyp
22
22
 
23
+ complete_build:
24
+ ./configure
25
+ npm install
23
26
 
24
27
  test:
25
28
  npm test
package/binding.gyp CHANGED
@@ -1,90 +1,116 @@
1
1
  {
2
2
  "targets": [
3
3
  {
4
- "target_name": "<(module_name)",
4
+ "target_name": "<(module_name)",
5
5
  "sources": [
6
- "src/duckdb_node.cpp",
7
- "src/database.cpp",
8
- "src/data_chunk.cpp",
9
- "src/connection.cpp",
10
- "src/statement.cpp",
11
- "src/utils.cpp",
12
- "src/parquet-amalgamation.cpp",
13
- "src/duckdb.cpp" # comment this out to build against existing lib
14
- ],
6
+ "src/duckdb_node.cpp",
7
+ "src/database.cpp",
8
+ "src/data_chunk.cpp",
9
+ "src/connection.cpp",
10
+ "src/statement.cpp",
11
+ "src/utils.cpp"
12
+ ],
15
13
  "include_dirs": [
16
- "<!@(node -p \"require('node-addon-api').include\")"
17
- ],
18
- 'defines': [
19
- 'NAPI_DISABLE_CPP_EXCEPTIONS=1',
20
- "NAPI_VERSION=5"
21
- ],
14
+ "<!@(node -p \"require('node-addon-api').include\")",
15
+ "/home/runner/work/duckdb/duckdb/scripts/../src/include",
16
+ "/home/runner/work/duckdb/duckdb/scripts/..",
17
+ "/home/runner/work/duckdb/duckdb/scripts/../third_party/utf8proc/include",
18
+ "/home/runner/work/duckdb/duckdb/scripts/../extension/parquet/include",
19
+ "/home/runner/work/duckdb/duckdb/scripts/../extension/icu/include",
20
+ "/home/runner/work/duckdb/duckdb/scripts/../extension/json/include"
21
+ ],
22
+ "defines": [
23
+ "NAPI_DISABLE_CPP_EXCEPTIONS=1",
24
+ "NAPI_VERSION=5",
25
+ "BUILD_PARQUET_EXTENSION",
26
+ "BUILD_ICU_EXTENSION",
27
+ "BUILD_JSON_EXTENSION"
28
+ ],
22
29
  "cflags_cc": [
23
- "-frtti",
24
- "-fexceptions",
25
- "-Wno-redundant-move",
26
- ],
30
+ "-frtti",
31
+ "-fexceptions",
32
+ "-Wno-redundant-move"
33
+ ],
27
34
  "cflags_cc!": [
28
- "-fno-rrti",
29
- "-fno-exceptions",
30
- ],
35
+ "-fno-rrti",
36
+ "-fno-exceptions"
37
+ ],
31
38
  "cflags": [
32
- "-frtti",
33
- "-fexceptions",
34
- "-Wno-redundant-move",
35
- ],
39
+ "-frtti",
40
+ "-fexceptions",
41
+ "-Wno-redundant-move"
42
+ ],
36
43
  "cflags!": [
37
- "-fno-rrti",
38
- "-fno-exceptions",
39
- ],
44
+ "-fno-rrti",
45
+ "-fno-exceptions"
46
+ ],
40
47
  "xcode_settings": {
41
- "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
42
- "GCC_ENABLE_CPP_RTTI": "YES",
43
- "CLANG_CXX_LIBRARY": "libc++",
44
- "MACOSX_DEPLOYMENT_TARGET": "10.15",
45
- 'CLANG_CXX_LANGUAGE_STANDARD':'c++11',
46
- 'OTHER_CFLAGS' : ['-fexceptions', '-frtti', '-Wno-redundant-move']
47
-
48
- },
48
+ "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
49
+ "GCC_ENABLE_CPP_RTTI": "YES",
50
+ "CLANG_CXX_LIBRARY": "libc++",
51
+ "MACOSX_DEPLOYMENT_TARGET": "10.15",
52
+ "CLANG_CXX_LANGUAGE_STANDARD": "c++11",
53
+ "OTHER_CFLAGS": [
54
+ "-fexceptions",
55
+ "-frtti",
56
+ "-Wno-redundant-move"
57
+ ]
58
+ },
49
59
  "msvs_settings": {
50
60
  "VCCLCompilerTool": {
51
- "ExceptionHandling": 1,
61
+ "ExceptionHandling": 1,
52
62
  "AdditionalOptions": [
53
63
  "/bigobj"
54
64
  ]
55
65
  }
56
- },
66
+ },
57
67
  "conditions": [
58
68
  [
59
- 'OS=="win"',
69
+ "OS==\"win\"",
60
70
  {
61
71
  "defines": [
62
72
  "DUCKDB_BUILD_LIBRARY"
63
73
  ]
64
- },
65
- ], # OS=="win"
66
- ], # conditions
67
- # uncomment this to build against existing lib
68
- # "libraries": [
69
- # "/Users/hannes/source/duckdb/build/release/src/libduckdb_static.a",
70
- # "/Users/hannes/source/duckdb/build/release/third_party/fmt/libduckdb_fmt.a",
71
- # "/Users/hannes/source/duckdb/build/release/third_party/libpg_query/libduckdb_pg_query.a",
72
- # "/Users/hannes/source/duckdb/build/release/third_party/utf8proc/libduckdb_utf8proc.a",
73
- # "/Users/hannes/source/duckdb/build/release/third_party/re2/libduckdb_re2.a"
74
- # ]
75
- },
74
+ }
75
+ ]
76
+ ],
77
+ "libraries": [
78
+ "/home/runner/work/duckdb/duckdb/build/release/src/libduckdb_static.a",
79
+ "/home/runner/work/duckdb/duckdb/build/release/extension/parquet/libparquet_extension.a",
80
+ "/home/runner/work/duckdb/duckdb/build/release/extension/icu/libicu_extension.a",
81
+ "/home/runner/work/duckdb/duckdb/build/release/extension/json/libjson_extension.a",
82
+ "/home/runner/work/duckdb/duckdb/build/release/third_party/fsst/libduckdb_fsst.a",
83
+ "/home/runner/work/duckdb/duckdb/build/release/third_party/fmt/libduckdb_fmt.a",
84
+ "/home/runner/work/duckdb/duckdb/build/release/third_party/libpg_query/libduckdb_pg_query.a",
85
+ "/home/runner/work/duckdb/duckdb/build/release/third_party/re2/libduckdb_re2.a",
86
+ "/home/runner/work/duckdb/duckdb/build/release/third_party/miniz/libduckdb_miniz.a",
87
+ "/home/runner/work/duckdb/duckdb/build/release/third_party/utf8proc/libduckdb_utf8proc.a",
88
+ "/home/runner/work/duckdb/duckdb/build/release/third_party/hyperloglog/libduckdb_hyperloglog.a",
89
+ "/home/runner/work/duckdb/duckdb/build/release/third_party/fastpforlib/libduckdb_fastpforlib.a",
90
+ "/home/runner/work/duckdb/duckdb/build/release/third_party/mbedtls/libduckdb_mbedtls.a",
91
+ "/home/runner/work/duckdb/duckdb/build/release/extension/jemalloc/libjemalloc_extension.a",
92
+ "/home/runner/work/duckdb/duckdb/build/release/extension/parquet/libparquet_extension.a",
93
+ "/home/runner/work/duckdb/duckdb/build/release/extension/icu/libicu_extension.a",
94
+ "/home/runner/work/duckdb/duckdb/build/release/extension/tpch/libtpch_extension.a",
95
+ "/home/runner/work/duckdb/duckdb/build/release/extension/httpfs/libhttpfs_extension.a",
96
+ "/home/runner/work/duckdb/duckdb/build/release/extension/visualizer/libvisualizer_extension.a",
97
+ "/home/runner/work/duckdb/duckdb/build/release/extension/json/libjson_extension.a"
98
+ ]
99
+ },
76
100
  {
77
- "target_name": "action_after_build",
78
- "type": "none",
101
+ "target_name": "action_after_build",
102
+ "type": "none",
79
103
  "dependencies": [
80
104
  "<(module_name)"
81
- ],
105
+ ],
82
106
  "copies": [
83
107
  {
84
- "files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
108
+ "files": [
109
+ "<(PRODUCT_DIR)/<(module_name).node"
110
+ ],
85
111
  "destination": "<(module_path)"
86
112
  }
87
113
  ]
88
114
  }
89
115
  ]
90
- }
116
+ }
package/binding.gyp.in ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "targets": [
3
+ {
4
+ "target_name": "<(module_name)",
5
+ "sources": [
6
+ "src/duckdb_node.cpp",
7
+ "src/database.cpp",
8
+ "src/data_chunk.cpp",
9
+ "src/connection.cpp",
10
+ "src/statement.cpp",
11
+ "src/utils.cpp",
12
+ "${SOURCE_FILES}"
13
+ ],
14
+ "include_dirs": [
15
+ "<!@(node -p \"require('node-addon-api').include\")",
16
+ "${INCLUDE_FILES}"
17
+ ],
18
+ "defines": [
19
+ "NAPI_DISABLE_CPP_EXCEPTIONS=1",
20
+ "NAPI_VERSION=5",
21
+ "${DEFINES}"
22
+ ],
23
+ "cflags_cc": [
24
+ "-frtti",
25
+ "-fexceptions",
26
+ "-Wno-redundant-move"
27
+ ],
28
+ "cflags_cc!": [
29
+ "-fno-rrti",
30
+ "-fno-exceptions"
31
+ ],
32
+ "cflags": [
33
+ "-frtti",
34
+ "-fexceptions",
35
+ "-Wno-redundant-move",
36
+ "${CFLAGS}"
37
+ ],
38
+ "cflags!": [
39
+ "-fno-rrti",
40
+ "-fno-exceptions"
41
+ ],
42
+ "xcode_settings": {
43
+ "GCC_ENABLE_CPP_EXCEPTIONS": "YES",
44
+ "GCC_ENABLE_CPP_RTTI": "YES",
45
+ "CLANG_CXX_LIBRARY": "libc++",
46
+ "MACOSX_DEPLOYMENT_TARGET": "10.15",
47
+ "CLANG_CXX_LANGUAGE_STANDARD": "c++11",
48
+ "OTHER_CFLAGS" : ["-fexceptions", "-frtti", "-Wno-redundant-move"]
49
+
50
+ },
51
+ "msvs_settings": {
52
+ "VCCLCompilerTool": {
53
+ "ExceptionHandling": 1,
54
+ "AdditionalOptions": [
55
+ "/bigobj",
56
+ "${WINDOWS_OPTIONS}"
57
+ ]
58
+ }
59
+ },
60
+ "conditions": [
61
+ [
62
+ "OS==\"win\"",
63
+ {
64
+ "defines": [
65
+ "DUCKDB_BUILD_LIBRARY"
66
+ ]
67
+ }
68
+ ]
69
+ ],
70
+ "libraries": [
71
+ "${LIBRARY_FILES}"
72
+ ]
73
+ },
74
+ {
75
+ "target_name": "action_after_build",
76
+ "type": "none",
77
+ "dependencies": [
78
+ "<(module_name)"
79
+ ],
80
+ "copies": [
81
+ {
82
+ "files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
83
+ "destination": "<(module_path)"
84
+ }
85
+ ]
86
+ }
87
+ ]
88
+ }
package/configure CHANGED
@@ -5,10 +5,4 @@ set -x
5
5
 
6
6
  cd `dirname $0`
7
7
 
8
- if [ ! -f "../../scripts/amalgamation.py" ]; then
9
- echo "Could not find the amalgamation build script"
10
- exit 1
11
- fi
12
-
13
- (cd ../.. && python3 scripts/amalgamation.py --extended --source=tools/nodejs/src/duckdb.cpp --header=tools/nodejs/src/duckdb.hpp)
14
- (cd ../.. && python3 scripts/parquet_amalgamation.py && cp src/amalgamation/parquet-amalgamation* tools/nodejs/src/)
8
+ python3 configure.py
package/configure.py ADDED
@@ -0,0 +1,126 @@
1
+ import os
2
+ import sys
3
+ import json
4
+ import pickle
5
+
6
+ # list of extensions to bundle
7
+ extensions = ['parquet', 'icu', 'json']
8
+
9
+ # path to target
10
+ basedir = os.getcwd()
11
+ target_dir = os.path.join(basedir, 'src', 'duckdb')
12
+ gyp_in = os.path.join(basedir, 'binding.gyp.in')
13
+ gyp_out = os.path.join(basedir, 'binding.gyp')
14
+ cache_file = os.path.join(basedir, 'filelist.cache')
15
+
16
+ # path to package_build.py
17
+ os.chdir(os.path.join('..', '..'))
18
+ scripts_dir = 'scripts'
19
+
20
+ sys.path.append(scripts_dir)
21
+ import package_build
22
+
23
+ defines = ['BUILD_{}_EXTENSION'.format(ext.upper()) for ext in extensions]
24
+
25
+ if 'DUCKDB_NODE_BUILD_CACHE' in os.environ and os.path.isfile(cache_file):
26
+ with open(cache_file, 'rb') as f:
27
+ cache = pickle.load(f)
28
+ source_list = cache['source_list']
29
+ include_list = cache['include_list']
30
+ libraries = cache['libraries']
31
+ windows_options = cache['windows_options']
32
+ cflags = cache['cflags']
33
+ elif 'DUCKDB_NODE_BINDIR' in os.environ:
34
+ def find_library_path(libdir, libname):
35
+ flist = os.listdir(libdir)
36
+ for fname in flist:
37
+ fpath = os.path.join(libdir, fname)
38
+ if os.path.isfile(fpath) and package_build.file_is_lib(fname, libname):
39
+ return fpath
40
+ raise Exception(f"Failed to find library {libname} in {libdir}")
41
+ # existing build
42
+ existing_duckdb_dir = os.environ['DUCKDB_NODE_BINDIR']
43
+ cflags = os.environ['DUCKDB_NODE_CFLAGS']
44
+ libraries = os.environ['DUCKDB_NODE_LIBS'].split(' ')
45
+
46
+ include_directories = [os.path.join('..', '..', include) for include in package_build.third_party_includes()]
47
+ include_list = package_build.includes(extensions)
48
+
49
+ result_libraries = package_build.get_libraries(existing_duckdb_dir, libraries, extensions)
50
+ libraries = []
51
+ for (libdir, libname) in result_libraries:
52
+ if libdir is None:
53
+ continue
54
+ libraries.append(find_library_path(libdir, libname))
55
+
56
+ source_list = []
57
+ cflags = []
58
+ windows_options = []
59
+ if os.name == 'nt':
60
+ windows_options = [x for x in os.environ['DUCKDB_NODE_CFLAGS'].split(' ') if x.startswith('/')]
61
+ else:
62
+ if '-g' in os.environ['DUCKDB_NODE_CFLAGS']:
63
+ cflags += ['-g']
64
+ if '-O0' in os.environ['DUCKDB_NODE_CFLAGS']:
65
+ cflags += ['-O0']
66
+
67
+ if 'DUCKDB_NODE_BUILD_CACHE' in os.environ:
68
+ cache = {
69
+ 'source_list': source_list,
70
+ 'include_list': include_list,
71
+ 'libraries': libraries,
72
+ 'cflags': cflags,
73
+ 'windows_options': windows_options
74
+ }
75
+ with open(cache_file, 'wb+') as f:
76
+ pickle.dump(cache, f)
77
+ else:
78
+ # fresh build - copy over all of the files
79
+ (source_list, include_list, original_sources) = package_build.build_package(target_dir, extensions, False)
80
+
81
+ # # the list of all source files (.cpp files) that have been copied into the `duckdb_source_copy` directory
82
+ # print(source_list)
83
+ # # the list of all include files
84
+ # print(include_list)
85
+ source_list = [os.path.relpath(x, basedir) if os.path.isabs(x) else os.path.join('src', x) for x in source_list]
86
+ include_list = [os.path.join('src', 'duckdb', x) for x in include_list]
87
+ libraries = []
88
+ windows_options = []
89
+ cflags = []
90
+
91
+ def sanitize_path(x):
92
+ return x.replace('\\', '/')
93
+
94
+ source_list = [sanitize_path(x) for x in source_list]
95
+ include_list = [sanitize_path(x) for x in include_list]
96
+ libraries = [sanitize_path(x) for x in libraries]
97
+
98
+ with open(gyp_in, 'r') as f:
99
+ input_json = json.load(f)
100
+
101
+ def replace_entries(node, replacement_map):
102
+ if type(node) == type([]):
103
+ for key in replacement_map.keys():
104
+ if key in node:
105
+ node.remove(key)
106
+ node += replacement_map[key]
107
+ for entry in node:
108
+ if type(entry) == type([]) or type(entry) == type({}):
109
+ replace_entries(entry, replacement_map)
110
+ if type(node) == type({}):
111
+ for key in node.keys():
112
+ replace_entries(node[key], replacement_map)
113
+
114
+
115
+ replacement_map = {}
116
+ replacement_map['${SOURCE_FILES}'] = source_list
117
+ replacement_map['${INCLUDE_FILES}'] = include_list
118
+ replacement_map['${DEFINES}'] = defines
119
+ replacement_map['${LIBRARY_FILES}'] = libraries
120
+ replacement_map['${CFLAGS}'] = cflags
121
+ replacement_map['${WINDOWS_OPTIONS}'] = windows_options
122
+
123
+ replace_entries(input_json, replacement_map)
124
+
125
+ with open(gyp_out, 'w+') as f:
126
+ json.dump(input_json, f, indent=4, separators=(", ", ": "))
package/filelist.cache ADDED
Binary file
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-dev604.0",
5
+ "version": "0.6.2-dev646.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -1,7 +1,9 @@
1
1
  #include "duckdb.hpp"
2
2
  #include "duckdb_node.hpp"
3
3
  #include "napi.h"
4
-
4
+ #include "duckdb/parser/parser.hpp"
5
+ #include "duckdb/parser/parsed_data/drop_info.hpp"
6
+ #include "duckdb/parser/expression/cast_expression.hpp"
5
7
  #include <iostream>
6
8
  #include <thread>
7
9
 
@@ -242,6 +244,7 @@ struct RegisterUdfTask : public Task {
242
244
  // here we can do only DuckDB stuff because we do not have a functioning env
243
245
 
244
246
  // Flatten all args to simplify udfs
247
+ bool all_constant = args.AllConstant();
245
248
  args.Flatten();
246
249
 
247
250
  JSArgs jsargs;
@@ -257,6 +260,9 @@ struct RegisterUdfTask : public Task {
257
260
  if (jsargs.error) {
258
261
  jsargs.error.Throw();
259
262
  }
263
+ if (all_constant) {
264
+ result.SetVectorType(duckdb::VectorType::CONSTANT_VECTOR);
265
+ }
260
266
  };
261
267
 
262
268
  auto expr = duckdb::Parser::ParseExpressionList(duckdb::StringUtil::Format("asdf::%s", return_type_name));
package/src/database.cpp CHANGED
@@ -1,6 +1,6 @@
1
1
  #include "duckdb_node.hpp"
2
+ #include "duckdb/storage/buffer_manager.hpp"
2
3
  #include "napi.h"
3
- #include "parquet-amalgamation.hpp"
4
4
 
5
5
  namespace node_duckdb {
6
6
 
@@ -56,8 +56,6 @@ struct OpenTask : public Task {
56
56
  void DoWork() override {
57
57
  try {
58
58
  Get<Database>().database = duckdb::make_unique<duckdb::DuckDB>(filename, &duckdb_config);
59
- duckdb::ParquetExtension extension;
60
- extension.Load(*Get<Database>().database);
61
59
  success = true;
62
60
 
63
61
  } catch (const duckdb::Exception &ex) {