lbug 0.12.3-dev.2 → 0.12.3-dev.20
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/README.md +2 -6
- package/lbug-source/.github/workflows/ci-workflow.yml +9 -2
- package/lbug-source/CMakeLists.txt +15 -6
- package/lbug-source/Makefile +1 -2
- package/lbug-source/README.md +2 -6
- package/lbug-source/benchmark/serializer.py +24 -3
- package/lbug-source/dataset/demo-db/csv/copy.cypher +4 -4
- package/lbug-source/dataset/demo-db/graph-std/demo_indices_follows.parquet +0 -0
- package/lbug-source/dataset/demo-db/graph-std/demo_indices_livesin.parquet +0 -0
- package/lbug-source/dataset/demo-db/graph-std/demo_indptr_follows.parquet +0 -0
- package/lbug-source/dataset/demo-db/graph-std/demo_indptr_livesin.parquet +0 -0
- package/lbug-source/dataset/demo-db/graph-std/demo_mapping_city.parquet +0 -0
- package/lbug-source/dataset/demo-db/graph-std/demo_mapping_user.parquet +0 -0
- package/lbug-source/dataset/demo-db/graph-std/demo_metadata.parquet +0 -0
- package/lbug-source/dataset/demo-db/graph-std/demo_nodes_city.parquet +0 -0
- package/lbug-source/dataset/demo-db/graph-std/demo_nodes_user.parquet +0 -0
- package/lbug-source/dataset/demo-db/graph-std/schema.cypher +4 -0
- package/lbug-source/dataset/demo-db/parquet/copy.cypher +4 -4
- package/lbug-source/extension/httpfs/test/test_files/http.test +1 -0
- package/lbug-source/scripts/antlr4/Cypher.g4 +1 -1
- package/lbug-source/scripts/antlr4/hash.md5 +1 -1
- package/lbug-source/scripts/generate_binary_demo.sh +1 -1
- package/lbug-source/src/antlr4/Cypher.g4 +1 -1
- package/lbug-source/src/binder/bind/bind_ddl.cpp +23 -13
- package/lbug-source/src/catalog/catalog.cpp +5 -4
- package/lbug-source/src/catalog/catalog_entry/node_table_catalog_entry.cpp +8 -1
- package/lbug-source/src/catalog/catalog_entry/rel_group_catalog_entry.cpp +7 -0
- package/lbug-source/src/function/function_collection.cpp +2 -1
- package/lbug-source/src/function/table/CMakeLists.txt +1 -0
- package/lbug-source/src/function/table/disk_size_info.cpp +322 -0
- package/lbug-source/src/include/binder/ddl/bound_create_table_info.h +10 -6
- package/lbug-source/src/include/catalog/catalog_entry/node_table_catalog_entry.h +5 -3
- package/lbug-source/src/include/catalog/catalog_entry/rel_group_catalog_entry.h +4 -2
- package/lbug-source/src/include/common/constants.h +1 -0
- package/lbug-source/src/include/function/table/simple_table_function.h +6 -0
- package/lbug-source/src/include/optimizer/count_rel_table_optimizer.h +49 -0
- package/lbug-source/src/include/optimizer/logical_operator_visitor.h +6 -0
- package/lbug-source/src/include/parser/ddl/create_table_info.h +3 -1
- package/lbug-source/src/include/planner/operator/logical_operator.h +1 -0
- package/lbug-source/src/include/planner/operator/scan/logical_count_rel_table.h +84 -0
- package/lbug-source/src/include/processor/operator/physical_operator.h +1 -0
- package/lbug-source/src/include/processor/operator/scan/count_rel_table.h +62 -0
- package/lbug-source/src/include/processor/operator/scan/scan_node_table.h +2 -2
- package/lbug-source/src/include/processor/plan_mapper.h +2 -0
- package/lbug-source/src/include/storage/storage_manager.h +1 -0
- package/lbug-source/src/include/storage/storage_version_info.h +1 -7
- package/lbug-source/src/include/storage/table/node_table.h +6 -1
- package/lbug-source/src/include/storage/table/parquet_node_table.h +103 -0
- package/lbug-source/src/include/storage/table/parquet_rel_table.h +91 -0
- package/lbug-source/src/include/storage/table/rel_table.h +2 -2
- package/lbug-source/src/include/transaction/transaction.h +2 -0
- package/lbug-source/src/main/query_result/materialized_query_result.cpp +2 -2
- package/lbug-source/src/optimizer/CMakeLists.txt +1 -0
- package/lbug-source/src/optimizer/count_rel_table_optimizer.cpp +217 -0
- package/lbug-source/src/optimizer/logical_operator_visitor.cpp +6 -0
- package/lbug-source/src/optimizer/optimizer.cpp +6 -0
- package/lbug-source/src/parser/transform/transform_ddl.cpp +6 -1
- package/lbug-source/src/planner/operator/logical_operator.cpp +2 -0
- package/lbug-source/src/planner/operator/scan/CMakeLists.txt +1 -0
- package/lbug-source/src/planner/operator/scan/logical_count_rel_table.cpp +24 -0
- package/lbug-source/src/processor/map/CMakeLists.txt +1 -0
- package/lbug-source/src/processor/map/map_count_rel_table.cpp +55 -0
- package/lbug-source/src/processor/map/plan_mapper.cpp +3 -0
- package/lbug-source/src/processor/operator/persistent/reader/parquet/parquet_reader.cpp +4 -0
- package/lbug-source/src/processor/operator/physical_operator.cpp +2 -0
- package/lbug-source/src/processor/operator/scan/CMakeLists.txt +1 -0
- package/lbug-source/src/processor/operator/scan/count_rel_table.cpp +137 -0
- package/lbug-source/src/processor/operator/scan/scan_multi_rel_tables.cpp +24 -2
- package/lbug-source/src/processor/operator/scan/scan_node_table.cpp +44 -8
- package/lbug-source/src/processor/operator/scan/scan_rel_table.cpp +12 -2
- package/lbug-source/src/storage/storage_manager.cpp +37 -6
- package/lbug-source/src/storage/table/CMakeLists.txt +2 -0
- package/lbug-source/src/storage/table/parquet_node_table.cpp +338 -0
- package/lbug-source/src/storage/table/parquet_rel_table.cpp +388 -0
- package/lbug-source/test/api/api_test.cpp +18 -0
- package/lbug-source/test/common/string_format.cpp +9 -1
- package/lbug-source/test/copy/copy_test.cpp +4 -4
- package/lbug-source/test/graph_test/CMakeLists.txt +1 -1
- package/lbug-source/test/include/test_runner/test_group.h +11 -1
- package/lbug-source/test/optimizer/optimizer_test.cpp +46 -0
- package/lbug-source/test/runner/e2e_test.cpp +7 -1
- package/lbug-source/test/test_files/demo_db/demo_db_graph_std.test +77 -0
- package/lbug-source/test/test_helper/CMakeLists.txt +1 -1
- package/lbug-source/test/test_helper/test_helper.cpp +33 -1
- package/lbug-source/test/test_runner/CMakeLists.txt +1 -1
- package/lbug-source/test/test_runner/insert_by_row.cpp +6 -8
- package/lbug-source/test/test_runner/multi_copy_split.cpp +2 -4
- package/lbug-source/test/test_runner/test_parser.cpp +3 -0
- package/lbug-source/test/transaction/checkpoint_test.cpp +1 -1
- package/lbug-source/test/transaction/transaction_test.cpp +19 -15
- package/lbug-source/third_party/antlr4_cypher/cypher_parser.cpp +2761 -2701
- package/lbug-source/third_party/antlr4_cypher/include/cypher_parser.h +2 -0
- package/lbug-source/tools/benchmark/count_rel_table.benchmark +5 -0
- package/lbug-source/tools/shell/embedded_shell.cpp +78 -3
- package/lbug-source/tools/shell/include/embedded_shell.h +2 -0
- package/lbug-source/tools/shell/linenoise.cpp +3 -3
- package/lbug-source/tools/shell/test/test_helper.py +1 -1
- package/lbug-source/tools/shell/test/test_shell_basics.py +12 -0
- package/lbug-source/tools/shell/test/test_shell_commands.py +19 -0
- package/package.json +1 -1
- package/prebuilt/lbugjs-darwin-arm64.node +0 -0
- package/prebuilt/lbugjs-linux-arm64.node +0 -0
- package/prebuilt/lbugjs-linux-x64.node +0 -0
- package/prebuilt/lbugjs-win32-x64.node +0 -0
package/README.md
CHANGED
|
@@ -38,17 +38,13 @@ The database was formerly known as [Kuzu](https://github.com/kuzudb/kuzu).
|
|
|
38
38
|
|
|
39
39
|
## Installation
|
|
40
40
|
|
|
41
|
-
> [!WARNING]
|
|
42
|
-
> Many of these binary installation methods are not functional yet. We need to work through package names, availability and convention issues.
|
|
43
|
-
> For now, use the build from source method.
|
|
44
|
-
|
|
45
41
|
| Language | Installation |
|
|
46
42
|
| -------- |------------------------------------------------------------------------|
|
|
47
43
|
| Python | `pip install real_ladybug` |
|
|
48
44
|
| NodeJS | `npm install lbug` |
|
|
49
45
|
| Rust | `cargo add lbug` |
|
|
50
|
-
| Go | `go get github.com/lbugdb/go-
|
|
51
|
-
| Swift | [lbug-swift](https://github.com/lbugdb/
|
|
46
|
+
| Go | `go get github.com/lbugdb/go-ladybug` |
|
|
47
|
+
| Swift | [lbug-swift](https://github.com/lbugdb/swift-ladybug) |
|
|
52
48
|
| Java | [Maven Central](https://central.sonatype.com/artifact/com.ladybugdb/lbug) |
|
|
53
49
|
| C/C++ | [precompiled binaries](https://github.com/LadybugDB/ladybug/releases/latest) |
|
|
54
50
|
| CLI | [precompiled binaries](https://github.com/LadybugDB/ladybug/releases/latest) |
|
|
@@ -1152,6 +1152,9 @@ jobs:
|
|
|
1152
1152
|
name: minimal test
|
|
1153
1153
|
runs-on: ubuntu-latest
|
|
1154
1154
|
needs: [ sanity-checks ]
|
|
1155
|
+
env:
|
|
1156
|
+
GEN: Ninja
|
|
1157
|
+
USE_STD_FORMAT: 1
|
|
1155
1158
|
steps:
|
|
1156
1159
|
- uses: actions/checkout@v4
|
|
1157
1160
|
|
|
@@ -1159,12 +1162,14 @@ jobs:
|
|
|
1159
1162
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
1160
1163
|
with:
|
|
1161
1164
|
key: minimal-test-${{ runner.os }}
|
|
1165
|
+
max-size: 2G
|
|
1166
|
+
restore-keys: minimal-test-
|
|
1162
1167
|
|
|
1163
1168
|
- name: Build
|
|
1164
|
-
run: make
|
|
1169
|
+
run: make relwithdebinfo
|
|
1165
1170
|
|
|
1166
1171
|
- name: Generate datasets
|
|
1167
|
-
run: bash scripts/generate_binary_demo.sh
|
|
1172
|
+
run: bash scripts/generate_binary_demo.sh --lbug-shell-mode relwithdebinfo
|
|
1168
1173
|
|
|
1169
1174
|
- name: Install uv
|
|
1170
1175
|
run: pip3 install uv
|
|
@@ -1210,6 +1215,8 @@ jobs:
|
|
|
1210
1215
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
1211
1216
|
with:
|
|
1212
1217
|
key: minimal-extension-test-${{ runner.os }}
|
|
1218
|
+
max-size: 2G
|
|
1219
|
+
restore-keys: minimal-extension-test-
|
|
1213
1220
|
|
|
1214
1221
|
- name: Update PostgreSQL host
|
|
1215
1222
|
working-directory: extension/postgres/test/test_files
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
cmake_minimum_required(VERSION 3.15)
|
|
2
2
|
|
|
3
|
-
project(Lbug VERSION 0.12.3.
|
|
3
|
+
project(Lbug VERSION 0.12.3.20 LANGUAGES CXX C)
|
|
4
4
|
|
|
5
5
|
option(SINGLE_THREADED "Single-threaded mode" FALSE)
|
|
6
6
|
if(SINGLE_THREADED)
|
|
@@ -14,15 +14,26 @@ endif()
|
|
|
14
14
|
|
|
15
15
|
set(CMAKE_CXX_STANDARD 20)
|
|
16
16
|
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
|
17
|
-
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
18
|
-
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
|
19
17
|
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
|
20
18
|
set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE)
|
|
21
19
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
22
|
-
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
23
20
|
# On Linux, symbols in executables are not accessible by loaded shared libraries (e.g. via dlopen(3)). However, we need to export public symbols in executables so that extensions can access public symbols. This enables that behaviour.
|
|
24
21
|
set(CMAKE_ENABLE_EXPORTS TRUE)
|
|
25
22
|
|
|
23
|
+
# When building tests, we need all symbols visible so tests can link to the shared library
|
|
24
|
+
# instead of static linking (which bloats binary sizes significantly)
|
|
25
|
+
option(BUILD_TESTS "Build C++ tests." FALSE)
|
|
26
|
+
option(BUILD_EXTENSION_TESTS "Build C++ extension tests." FALSE)
|
|
27
|
+
if(BUILD_TESTS OR BUILD_EXTENSION_TESTS)
|
|
28
|
+
set(CMAKE_CXX_VISIBILITY_PRESET default)
|
|
29
|
+
set(CMAKE_C_VISIBILITY_PRESET default)
|
|
30
|
+
set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF)
|
|
31
|
+
else()
|
|
32
|
+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
|
33
|
+
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
|
34
|
+
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
|
35
|
+
endif()
|
|
36
|
+
|
|
26
37
|
option(ENABLE_WERROR "Treat all warnings as errors" FALSE)
|
|
27
38
|
if(ENABLE_WERROR)
|
|
28
39
|
if (CMAKE_VERSION VERSION_GREATER "3.24.0" OR CMAKE_VERSION VERSION_EQUAL "3.24.0")
|
|
@@ -302,8 +313,6 @@ option(BUILD_NODEJS "Build NodeJS API." FALSE)
|
|
|
302
313
|
option(BUILD_PYTHON "Build Python API." FALSE)
|
|
303
314
|
option(BUILD_SHELL "Build Interactive Shell" TRUE)
|
|
304
315
|
option(BUILD_SINGLE_FILE_HEADER "Build single file header. Requires Python >= 3.9." TRUE)
|
|
305
|
-
option(BUILD_TESTS "Build C++ tests." FALSE)
|
|
306
|
-
option(BUILD_EXTENSION_TESTS "Build C++ extension tests." FALSE)
|
|
307
316
|
option(BUILD_LBUG "Build Lbug." TRUE)
|
|
308
317
|
option(ENABLE_BACKTRACES "Enable backtrace printing for exceptions and segfaults" FALSE)
|
|
309
318
|
option(USE_STD_FORMAT "Use std::format instead of a custom formatter." FALSE)
|
package/lbug-source/Makefile
CHANGED
|
@@ -294,9 +294,8 @@ extension-release:
|
|
|
294
294
|
-DBUILD_LBUG=FALSE \
|
|
295
295
|
)
|
|
296
296
|
|
|
297
|
-
# pytest expects a `Release` build path.
|
|
298
297
|
shell-test:
|
|
299
|
-
$(call run-cmake-
|
|
298
|
+
$(call run-cmake-relwithdebinfo, \
|
|
300
299
|
-DBUILD_SHELL=TRUE \
|
|
301
300
|
)
|
|
302
301
|
$(MAKE) -C tools/shell/test test
|
package/lbug-source/README.md
CHANGED
|
@@ -38,17 +38,13 @@ The database was formerly known as [Kuzu](https://github.com/kuzudb/kuzu).
|
|
|
38
38
|
|
|
39
39
|
## Installation
|
|
40
40
|
|
|
41
|
-
> [!WARNING]
|
|
42
|
-
> Many of these binary installation methods are not functional yet. We need to work through package names, availability and convention issues.
|
|
43
|
-
> For now, use the build from source method.
|
|
44
|
-
|
|
45
41
|
| Language | Installation |
|
|
46
42
|
| -------- |------------------------------------------------------------------------|
|
|
47
43
|
| Python | `pip install real_ladybug` |
|
|
48
44
|
| NodeJS | `npm install lbug` |
|
|
49
45
|
| Rust | `cargo add lbug` |
|
|
50
|
-
| Go | `go get github.com/lbugdb/go-
|
|
51
|
-
| Swift | [lbug-swift](https://github.com/lbugdb/
|
|
46
|
+
| Go | `go get github.com/lbugdb/go-ladybug` |
|
|
47
|
+
| Swift | [lbug-swift](https://github.com/lbugdb/swift-ladybug) |
|
|
52
48
|
| Java | [Maven Central](https://central.sonatype.com/artifact/com.ladybugdb/lbug) |
|
|
53
49
|
| C/C++ | [precompiled binaries](https://github.com/LadybugDB/ladybug/releases/latest) |
|
|
54
50
|
| CLI | [precompiled binaries](https://github.com/LadybugDB/ladybug/releases/latest) |
|
|
@@ -39,7 +39,17 @@ def serialize(lbug_exec_path, dataset_name, dataset_path, serialized_graph_path,
|
|
|
39
39
|
with open(os.path.join(dataset_path, 'schema.cypher'), 'r') as f:
|
|
40
40
|
serialize_queries += f.readlines()
|
|
41
41
|
with open(os.path.join(dataset_path, 'copy.cypher'), 'r') as f:
|
|
42
|
-
|
|
42
|
+
copy_lines = f.readlines()
|
|
43
|
+
# Fix relative paths in copy.cypher
|
|
44
|
+
for line in copy_lines:
|
|
45
|
+
# Replace quoted paths with absolute paths
|
|
46
|
+
def replace_path(match):
|
|
47
|
+
path = match.group(1)
|
|
48
|
+
if not os.path.isabs(path):
|
|
49
|
+
return '"' + os.path.join(dataset_path, path) + '"'
|
|
50
|
+
return match.group(0)
|
|
51
|
+
fixed_line = re.sub(r'"([^"]*)"', replace_path, line)
|
|
52
|
+
serialize_queries.append(fixed_line.strip())
|
|
43
53
|
else:
|
|
44
54
|
with open(os.path.join(base_dir, 'serialize.cypher'), 'r') as f:
|
|
45
55
|
serialize_queries += f.readlines()
|
|
@@ -95,17 +105,28 @@ if __name__ == '__main__':
|
|
|
95
105
|
parser.add_argument("--single-thread",
|
|
96
106
|
help="If true, copy single threaded, which makes the results more reproducible",
|
|
97
107
|
action="store_true")
|
|
108
|
+
parser.add_argument("--lbug-shell-mode",
|
|
109
|
+
help="debug, release or relwithdebinfo",
|
|
110
|
+
default="release")
|
|
111
|
+
default_mode = "release"
|
|
98
112
|
if sys.platform == "win32":
|
|
99
113
|
default_lbug_exec_path = os.path.join(
|
|
100
|
-
base_dir, '..', 'build',
|
|
114
|
+
base_dir, '..', 'build', default_mode, 'tools', 'shell', 'lbug_shell')
|
|
101
115
|
else:
|
|
102
116
|
default_lbug_exec_path = os.path.join(
|
|
103
|
-
base_dir, '..', 'build',
|
|
117
|
+
base_dir, '..', 'build', default_mode, 'tools', 'shell', 'lbug')
|
|
104
118
|
parser.add_argument("--lbug-shell",
|
|
105
119
|
help="Path of the lbug shell executable. Defaults to the path as built in the default release build directory",
|
|
106
120
|
default=default_lbug_exec_path)
|
|
107
121
|
args = parser.parse_args()
|
|
108
122
|
|
|
123
|
+
if args.lbug_shell == default_lbug_exec_path:
|
|
124
|
+
mode = args.lbug_shell_mode
|
|
125
|
+
if sys.platform == "win32":
|
|
126
|
+
args.lbug_shell = os.path.join(base_dir, '..', 'build', mode, 'tools', 'shell', 'lbug_shell')
|
|
127
|
+
else:
|
|
128
|
+
args.lbug_shell = os.path.join(base_dir, '..', 'build', mode, 'tools', 'shell', 'lbug')
|
|
129
|
+
|
|
109
130
|
try:
|
|
110
131
|
serialize(args.lbug_shell, args.dataset_name, args.dataset_path, args.serialized_graph_path,
|
|
111
132
|
args.benchmark_copy_log_dir, args.single_thread)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
COPY User From "
|
|
2
|
-
COPY City FROM "
|
|
3
|
-
COPY Follows FROM "
|
|
4
|
-
COPY LivesIn FROM "
|
|
1
|
+
COPY User From "user.csv"
|
|
2
|
+
COPY City FROM "city.csv"
|
|
3
|
+
COPY Follows FROM "follows.csv"
|
|
4
|
+
COPY LivesIn FROM "lives-in.csv"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
CREATE NODE TABLE city(id INT32, name STRING, population INT64, PRIMARY KEY(id)) WITH (storage = 'dataset/demo-db/graph-std/demo');
|
|
2
|
+
CREATE NODE TABLE user(id INT32, name STRING, age INT64, PRIMARY KEY(id)) WITH (storage = 'dataset/demo-db/graph-std/demo');
|
|
3
|
+
CREATE REL TABLE follows(FROM user TO user, since INT32) WITH (storage = 'dataset/demo-db/graph-std/demo');
|
|
4
|
+
CREATE REL TABLE livesin(FROM user TO city) WITH (storage = 'dataset/demo-db/graph-std/demo');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
COPY User From "
|
|
2
|
-
COPY City FROM "
|
|
3
|
-
COPY Follows FROM "
|
|
4
|
-
COPY LivesIn FROM "
|
|
1
|
+
COPY User From "user.parquet";
|
|
2
|
+
COPY City FROM "city.parquet";
|
|
3
|
+
COPY Follows FROM "follows.parquet";
|
|
4
|
+
COPY LivesIn FROM "lives-in.parquet";
|
|
@@ -342,7 +342,7 @@ kU_IfNotExists
|
|
|
342
342
|
: IF SP NOT SP EXISTS ;
|
|
343
343
|
|
|
344
344
|
kU_CreateNodeTable
|
|
345
|
-
: CREATE SP NODE SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName ( SP? '(' SP? kU_PropertyDefinitions SP? ( ',' SP? kU_CreateNodeConstraint )? SP? ')' | SP AS SP oC_Query ) ;
|
|
345
|
+
: CREATE SP NODE SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName ( SP? '(' SP? kU_PropertyDefinitions SP? ( ',' SP? kU_CreateNodeConstraint )? SP? ')' | SP AS SP oC_Query ) ( SP WITH SP? '(' SP? kU_Options SP? ')')? ;
|
|
346
346
|
|
|
347
347
|
kU_CreateRelTable
|
|
348
348
|
: CREATE SP REL SP TABLE ( SP GROUP )? ( SP kU_IfNotExists )? SP oC_SchemaName
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
52606d4848c2f224b8e480fec2923081
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
CD=`dirname "$0"`
|
|
4
4
|
DATASET_DIR=$CD/../dataset
|
|
5
|
-
python3 $CD/../benchmark/serializer.py DemoDB $DATASET_DIR/demo-db/parquet $DATASET_DIR/binary-demo --single-thread
|
|
5
|
+
python3 $CD/../benchmark/serializer.py DemoDB $DATASET_DIR/demo-db/parquet $DATASET_DIR/binary-demo --single-thread $*
|
|
@@ -95,7 +95,7 @@ kU_IfNotExists
|
|
|
95
95
|
: IF SP NOT SP EXISTS ;
|
|
96
96
|
|
|
97
97
|
kU_CreateNodeTable
|
|
98
|
-
: CREATE SP NODE SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName ( SP? '(' SP? kU_PropertyDefinitions SP? ( ',' SP? kU_CreateNodeConstraint )? SP? ')' | SP AS SP oC_Query ) ;
|
|
98
|
+
: CREATE SP NODE SP TABLE SP (kU_IfNotExists SP)? oC_SchemaName ( SP? '(' SP? kU_PropertyDefinitions SP? ( ',' SP? kU_CreateNodeConstraint )? SP? ')' | SP AS SP oC_Query ) ( SP WITH SP? '(' SP? kU_Options SP? ')')? ;
|
|
99
99
|
|
|
100
100
|
kU_CreateRelTable
|
|
101
101
|
: CREATE SP REL SP TABLE ( SP GROUP )? ( SP kU_IfNotExists )? SP oC_SchemaName
|
|
@@ -136,16 +136,6 @@ BoundCreateTableInfo Binder::bindCreateTableInfo(const CreateTableInfo* info) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
BoundCreateTableInfo Binder::bindCreateNodeTableInfo(const CreateTableInfo* info) {
|
|
140
|
-
auto propertyDefinitions = bindPropertyDefinitions(info->propertyDefinitions, info->tableName);
|
|
141
|
-
auto& extraInfo = info->extraInfo->constCast<ExtraCreateNodeTableInfo>();
|
|
142
|
-
validatePrimaryKey(extraInfo.pKName, propertyDefinitions);
|
|
143
|
-
auto boundExtraInfo = std::make_unique<BoundExtraCreateNodeTableInfo>(extraInfo.pKName,
|
|
144
|
-
std::move(propertyDefinitions));
|
|
145
|
-
return BoundCreateTableInfo(CatalogEntryType::NODE_TABLE_ENTRY, info->tableName,
|
|
146
|
-
info->onConflict, std::move(boundExtraInfo), clientContext->useInternalCatalogEntry());
|
|
147
|
-
}
|
|
148
|
-
|
|
149
139
|
void Binder::validateNodeTableType(const TableCatalogEntry* entry) {
|
|
150
140
|
if (entry->getType() != CatalogEntryType::NODE_TABLE_ENTRY) {
|
|
151
141
|
throw BinderException(stringFormat("{} is not of type NODE.", entry->getName()));
|
|
@@ -168,6 +158,13 @@ void Binder::validateColumnExistence(const TableCatalogEntry* entry,
|
|
|
168
158
|
}
|
|
169
159
|
}
|
|
170
160
|
|
|
161
|
+
static std::string getStorage(const case_insensitive_map_t<Value>& options) {
|
|
162
|
+
if (options.contains(TableOptionConstants::REL_STORAGE_OPTION)) {
|
|
163
|
+
return options.at(TableOptionConstants::REL_STORAGE_OPTION).toString();
|
|
164
|
+
}
|
|
165
|
+
return "";
|
|
166
|
+
}
|
|
167
|
+
|
|
171
168
|
static ExtendDirection getStorageDirection(const case_insensitive_map_t<Value>& options) {
|
|
172
169
|
if (options.contains(TableOptionConstants::REL_STORAGE_DIRECTION_OPTION)) {
|
|
173
170
|
return ExtendDirectionUtil::fromString(
|
|
@@ -176,6 +173,18 @@ static ExtendDirection getStorageDirection(const case_insensitive_map_t<Value>&
|
|
|
176
173
|
return DEFAULT_EXTEND_DIRECTION;
|
|
177
174
|
}
|
|
178
175
|
|
|
176
|
+
BoundCreateTableInfo Binder::bindCreateNodeTableInfo(const CreateTableInfo* info) {
|
|
177
|
+
auto propertyDefinitions = bindPropertyDefinitions(info->propertyDefinitions, info->tableName);
|
|
178
|
+
auto& extraInfo = info->extraInfo->constCast<ExtraCreateNodeTableInfo>();
|
|
179
|
+
validatePrimaryKey(extraInfo.pKName, propertyDefinitions);
|
|
180
|
+
auto boundOptions = bindParsingOptions(extraInfo.options);
|
|
181
|
+
auto storage = getStorage(boundOptions);
|
|
182
|
+
auto boundExtraInfo = std::make_unique<BoundExtraCreateNodeTableInfo>(extraInfo.pKName,
|
|
183
|
+
std::move(propertyDefinitions), std::move(storage));
|
|
184
|
+
return BoundCreateTableInfo(CatalogEntryType::NODE_TABLE_ENTRY, info->tableName,
|
|
185
|
+
info->onConflict, std::move(boundExtraInfo), clientContext->useInternalCatalogEntry());
|
|
186
|
+
}
|
|
187
|
+
|
|
179
188
|
std::vector<PropertyDefinition> Binder::bindRelPropertyDefinitions(const CreateTableInfo& info) {
|
|
180
189
|
std::vector<PropertyDefinition> propertyDefinitions;
|
|
181
190
|
propertyDefinitions.emplace_back(
|
|
@@ -193,6 +202,7 @@ BoundCreateTableInfo Binder::bindCreateRelTableGroupInfo(const CreateTableInfo*
|
|
|
193
202
|
auto dstMultiplicity = RelMultiplicityUtils::getBwd(extraInfo.relMultiplicity);
|
|
194
203
|
auto boundOptions = bindParsingOptions(extraInfo.options);
|
|
195
204
|
auto storageDirection = getStorageDirection(boundOptions);
|
|
205
|
+
auto storage = getStorage(boundOptions);
|
|
196
206
|
// Bind from to pairs
|
|
197
207
|
node_table_id_pair_set_t nodePairsSet;
|
|
198
208
|
std::vector<NodeTableIDPair> nodePairs;
|
|
@@ -209,9 +219,9 @@ BoundCreateTableInfo Binder::bindCreateRelTableGroupInfo(const CreateTableInfo*
|
|
|
209
219
|
nodePairsSet.insert(pair);
|
|
210
220
|
nodePairs.emplace_back(pair);
|
|
211
221
|
}
|
|
212
|
-
auto boundExtraInfo =
|
|
213
|
-
std::
|
|
214
|
-
|
|
222
|
+
auto boundExtraInfo = std::make_unique<BoundExtraCreateRelTableGroupInfo>(
|
|
223
|
+
std::move(propertyDefinitions), srcMultiplicity, dstMultiplicity, storageDirection,
|
|
224
|
+
std::move(nodePairs), std::move(storage));
|
|
215
225
|
return BoundCreateTableInfo(CatalogEntryType::REL_GROUP_ENTRY, info->tableName,
|
|
216
226
|
info->onConflict, std::move(boundExtraInfo), clientContext->useInternalCatalogEntry());
|
|
217
227
|
}
|
|
@@ -190,9 +190,9 @@ CatalogEntry* Catalog::createRelGroupEntry(Transaction* transaction,
|
|
|
190
190
|
for (auto& nodePair : extraInfo->nodePairs) {
|
|
191
191
|
relTableInfos.emplace_back(nodePair, tables->getNextOID());
|
|
192
192
|
}
|
|
193
|
-
auto relGroupEntry =
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
auto relGroupEntry = std::make_unique<RelGroupCatalogEntry>(info.tableName,
|
|
194
|
+
extraInfo->srcMultiplicity, extraInfo->dstMultiplicity, extraInfo->storageDirection,
|
|
195
|
+
std::move(relTableInfos), extraInfo->storage);
|
|
196
196
|
for (auto& definition : extraInfo->propertyDefinitions) {
|
|
197
197
|
relGroupEntry->addProperty(definition);
|
|
198
198
|
}
|
|
@@ -541,7 +541,8 @@ CatalogEntry* Catalog::createTableEntry(Transaction* transaction,
|
|
|
541
541
|
CatalogEntry* Catalog::createNodeTableEntry(Transaction* transaction,
|
|
542
542
|
const BoundCreateTableInfo& info) {
|
|
543
543
|
const auto extraInfo = info.extraInfo->constPtrCast<BoundExtraCreateNodeTableInfo>();
|
|
544
|
-
auto entry = std::make_unique<NodeTableCatalogEntry>(info.tableName, extraInfo->primaryKeyName
|
|
544
|
+
auto entry = std::make_unique<NodeTableCatalogEntry>(info.tableName, extraInfo->primaryKeyName,
|
|
545
|
+
extraInfo->storage);
|
|
545
546
|
for (auto& definition : extraInfo->propertyDefinitions) {
|
|
546
547
|
entry->addProperty(definition);
|
|
547
548
|
}
|
|
@@ -21,16 +21,22 @@ void NodeTableCatalogEntry::serialize(common::Serializer& serializer) const {
|
|
|
21
21
|
TableCatalogEntry::serialize(serializer);
|
|
22
22
|
serializer.writeDebuggingInfo("primaryKeyName");
|
|
23
23
|
serializer.write(primaryKeyName);
|
|
24
|
+
serializer.writeDebuggingInfo("storage");
|
|
25
|
+
serializer.write(storage);
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
std::unique_ptr<NodeTableCatalogEntry> NodeTableCatalogEntry::deserialize(
|
|
27
29
|
common::Deserializer& deserializer) {
|
|
28
30
|
std::string debuggingInfo;
|
|
29
31
|
std::string primaryKeyName;
|
|
32
|
+
std::string storage;
|
|
30
33
|
deserializer.validateDebuggingInfo(debuggingInfo, "primaryKeyName");
|
|
31
34
|
deserializer.deserializeValue(primaryKeyName);
|
|
35
|
+
deserializer.validateDebuggingInfo(debuggingInfo, "storage");
|
|
36
|
+
deserializer.deserializeValue(storage);
|
|
32
37
|
auto nodeTableEntry = std::make_unique<NodeTableCatalogEntry>();
|
|
33
38
|
nodeTableEntry->primaryKeyName = primaryKeyName;
|
|
39
|
+
nodeTableEntry->storage = storage;
|
|
34
40
|
return nodeTableEntry;
|
|
35
41
|
}
|
|
36
42
|
|
|
@@ -42,6 +48,7 @@ std::string NodeTableCatalogEntry::toCypher(const ToCypherInfo& /*info*/) const
|
|
|
42
48
|
std::unique_ptr<TableCatalogEntry> NodeTableCatalogEntry::copy() const {
|
|
43
49
|
auto other = std::make_unique<NodeTableCatalogEntry>();
|
|
44
50
|
other->primaryKeyName = primaryKeyName;
|
|
51
|
+
other->storage = storage;
|
|
45
52
|
other->copyFrom(*this);
|
|
46
53
|
return other;
|
|
47
54
|
}
|
|
@@ -49,7 +56,7 @@ std::unique_ptr<TableCatalogEntry> NodeTableCatalogEntry::copy() const {
|
|
|
49
56
|
std::unique_ptr<BoundExtraCreateCatalogEntryInfo> NodeTableCatalogEntry::getBoundExtraCreateInfo(
|
|
50
57
|
transaction::Transaction*) const {
|
|
51
58
|
return std::make_unique<BoundExtraCreateNodeTableInfo>(primaryKeyName,
|
|
52
|
-
copyVector(getProperties()));
|
|
59
|
+
copyVector(getProperties()), storage);
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
} // namespace catalog
|
|
@@ -95,6 +95,8 @@ void RelGroupCatalogEntry::serialize(Serializer& serializer) const {
|
|
|
95
95
|
serializer.serializeValue(dstMultiplicity);
|
|
96
96
|
serializer.writeDebuggingInfo("storageDirection");
|
|
97
97
|
serializer.serializeValue(storageDirection);
|
|
98
|
+
serializer.writeDebuggingInfo("storage");
|
|
99
|
+
serializer.serializeValue(storage);
|
|
98
100
|
serializer.writeDebuggingInfo("relTableInfos");
|
|
99
101
|
serializer.serializeVector(relTableInfos);
|
|
100
102
|
}
|
|
@@ -105,6 +107,7 @@ std::unique_ptr<RelGroupCatalogEntry> RelGroupCatalogEntry::deserialize(
|
|
|
105
107
|
auto srcMultiplicity = RelMultiplicity::MANY;
|
|
106
108
|
auto dstMultiplicity = RelMultiplicity::MANY;
|
|
107
109
|
auto storageDirection = ExtendDirection::BOTH;
|
|
110
|
+
std::string storage;
|
|
108
111
|
std::vector<RelTableCatalogInfo> relTableInfos;
|
|
109
112
|
deserializer.validateDebuggingInfo(debuggingInfo, "srcMultiplicity");
|
|
110
113
|
deserializer.deserializeValue(srcMultiplicity);
|
|
@@ -112,12 +115,15 @@ std::unique_ptr<RelGroupCatalogEntry> RelGroupCatalogEntry::deserialize(
|
|
|
112
115
|
deserializer.deserializeValue(dstMultiplicity);
|
|
113
116
|
deserializer.validateDebuggingInfo(debuggingInfo, "storageDirection");
|
|
114
117
|
deserializer.deserializeValue(storageDirection);
|
|
118
|
+
deserializer.validateDebuggingInfo(debuggingInfo, "storage");
|
|
119
|
+
deserializer.deserializeValue(storage);
|
|
115
120
|
deserializer.validateDebuggingInfo(debuggingInfo, "relTableInfos");
|
|
116
121
|
deserializer.deserializeVector(relTableInfos);
|
|
117
122
|
auto relGroupEntry = std::make_unique<RelGroupCatalogEntry>();
|
|
118
123
|
relGroupEntry->srcMultiplicity = srcMultiplicity;
|
|
119
124
|
relGroupEntry->dstMultiplicity = dstMultiplicity;
|
|
120
125
|
relGroupEntry->storageDirection = storageDirection;
|
|
126
|
+
relGroupEntry->storage = storage;
|
|
121
127
|
relGroupEntry->relTableInfos = relTableInfos;
|
|
122
128
|
return relGroupEntry;
|
|
123
129
|
}
|
|
@@ -167,6 +173,7 @@ std::unique_ptr<TableCatalogEntry> RelGroupCatalogEntry::copy() const {
|
|
|
167
173
|
other->srcMultiplicity = srcMultiplicity;
|
|
168
174
|
other->dstMultiplicity = dstMultiplicity;
|
|
169
175
|
other->storageDirection = storageDirection;
|
|
176
|
+
other->storage = storage;
|
|
170
177
|
other->relTableInfos = relTableInfos;
|
|
171
178
|
other->copyFrom(*this);
|
|
172
179
|
return other;
|
|
@@ -228,7 +228,8 @@ FunctionCollection* FunctionCollection::getFunctions() {
|
|
|
228
228
|
TABLE_FUNCTION(StatsInfoFunction), TABLE_FUNCTION(StorageInfoFunction),
|
|
229
229
|
TABLE_FUNCTION(ShowAttachedDatabasesFunction), TABLE_FUNCTION(ShowSequencesFunction),
|
|
230
230
|
TABLE_FUNCTION(ShowFunctionsFunction), TABLE_FUNCTION(BMInfoFunction),
|
|
231
|
-
TABLE_FUNCTION(FileInfoFunction), TABLE_FUNCTION(
|
|
231
|
+
TABLE_FUNCTION(FileInfoFunction), TABLE_FUNCTION(DiskSizeInfoFunction),
|
|
232
|
+
TABLE_FUNCTION(ShowLoadedExtensionsFunction),
|
|
232
233
|
TABLE_FUNCTION(ShowOfficialExtensionsFunction), TABLE_FUNCTION(ShowIndexesFunction),
|
|
233
234
|
TABLE_FUNCTION(ShowProjectedGraphsFunction), TABLE_FUNCTION(ProjectedGraphInfoFunction),
|
|
234
235
|
TABLE_FUNCTION(ShowMacrosFunction),
|