Skip to content

Commit 7f96d00

Browse files
committed
Initial import
0 parents  commit 7f96d00

File tree

158 files changed

+19026
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+19026
-0
lines changed

.clang-format

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 4
3+
ColumnLimit: 200
4+
AllowShortFunctionsOnASingleLine: Empty
5+
IndentCaseLabels: true
6+
NamespaceIndentation: All
7+
IncludeCategories:
8+
- Regex: '<.*>'
9+
Priority: -1
10+
- Regex: '.*'
11+
Priority: 0
12+
DerivePointerAlignment: false
13+
PointerAlignment: Left
14+
AllowAllArgumentsOnNextLine: true
15+
SpaceAfterTemplateKeyword: false
16+
SpaceBeforeCtorInitializerColon: false

.eslintrc.base.json

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint", "prettier", "react"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended",
8+
"plugin:prettier/recommended",
9+
"plugin:react/recommended"
10+
],
11+
"env": {
12+
"browser": true,
13+
"node": true
14+
},
15+
"rules": {
16+
"prettier/prettier": "warn",
17+
"@typescript-eslint/no-explicit-any": "off",
18+
"@typescript-eslint/ban-types": "warn",
19+
"@typescript-eslint/prefer-for-of": "off",
20+
"@typescript-eslint/no-for-in-array": "error",
21+
"@typescript-eslint/no-empty-function": "off",
22+
"@typescript-eslint/no-require-imports": "error",
23+
"@typescript-eslint/no-non-null-assertion": "off",
24+
"no-unused-vars": "off",
25+
"@typescript-eslint/no-unused-vars": [
26+
"error",
27+
{
28+
"vars": "all",
29+
"args": "none"
30+
}
31+
],
32+
"@typescript-eslint/no-shadow": "error",
33+
"@typescript-eslint/no-namespace": "error",
34+
"linebreak-style": ["error", "unix"],
35+
"no-irregular-whitespace": ["error", { "skipComments": true }],
36+
"no-alert": "error",
37+
"prefer-const": "error",
38+
"no-return-assign": "error",
39+
"no-useless-call": "error",
40+
"no-useless-concat": "error"
41+
},
42+
"settings": {
43+
"react": {
44+
"pragma": "React",
45+
"fragment": "Fragment",
46+
"version": "detect"
47+
}
48+
},
49+
"parserOptions": {
50+
"extraFileExtensions": [".cjs"]
51+
}
52+
}

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/perf.data*
2+
/.cache
3+
/.ccache
4+
.tmp
5+
/.flatc
6+
/.testfile*
7+
/artifacts
8+
/reports
9+
/packages/reports
10+
/build
11+
/.ccls-cache
12+
/.emscripten_cache
13+
.DS_Store
14+
compile_commands.json
15+
16+
/target
17+
18+
# Miscellaneous
19+
.DS_Store
20+
/node_modules
21+
.vscode
22+
!.vscode/settings.json
23+
data/tpch/**/*.parquet

.gitmodules

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[submodule "submodules/duckdb"]
2+
path = submodules/duckdb
3+
url = https://github.com/duckdb/duckdb
4+
[submodule "submodules/arrow"]
5+
path = submodules/arrow
6+
url = https://github.com/apache/arrow
7+
shallow = true
8+
[submodule "submodules/gflags"]
9+
path = submodules/gflags
10+
url = https://github.com/gflags/gflags.git
11+
shallow = true
12+
[submodule "submodules/benchmark"]
13+
path = submodules/benchmark
14+
url = https://github.com/google/benchmark
15+
shallow = true
16+
[submodule "submodules/googletest"]
17+
path = submodules/googletest
18+
url = https://github.com/google/googletest
19+
shallow = true
20+
[submodule "submodules/spdlog"]
21+
path = submodules/spdlog
22+
url = https://github.com/gabime/spdlog
23+
shallow = true
24+
[submodule "submodules/rapidjson"]
25+
path = submodules/rapidjson
26+
url = https://github.com/Tencent/rapidjson
27+
shallow = true

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
submodules
2+
dist

.prettierrc

Whitespace-only changes.

Makefile

+234
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
.DEFAULT_GOAL := duckdb
2+
3+
# ---------------------------------------------------------------------------
4+
# Config
5+
6+
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
7+
8+
UID=${shell id -u}
9+
GID=${shell id -g}
10+
11+
LIB_SOURCE_DIR="${ROOT_DIR}/lib"
12+
LIB_DEBUG_DIR="${ROOT_DIR}/lib/build/Debug"
13+
LIB_RELEASE_DIR="${ROOT_DIR}/lib/build/Release"
14+
LIB_RELWITHDEBINFO_DIR="${ROOT_DIR}/lib/build/RelWithDebInfo"
15+
DUCKDB_WASM_DIR="${ROOT_DIR}/packages/duckdb/src/wasm"
16+
17+
CI_IMAGE_NAMESPACE="duckdb"
18+
CI_IMAGE_NAME="wasm-ci"
19+
CI_IMAGE_TAG="$(shell cat ./actions/image/TAG)"
20+
CI_IMAGE_FULLY_QUALIFIED="${CI_IMAGE_NAMESPACE}/${CI_IMAGE_NAME}:${CI_IMAGE_TAG}"
21+
CACHE_DIRS=${ROOT_DIR}/.ccache/ ${ROOT_DIR}/.emscripten_cache/
22+
IN_IMAGE_MOUNTS=-v${ROOT_DIR}:${ROOT_DIR} -v${ROOT_DIR}/.emscripten_cache/:/mnt/emscripten_cache/ -v${ROOT_DIR}/.ccache/:/mnt/ccache/
23+
IN_IMAGE_ENV=-e CCACHE_DIR=/mnt/ccache -e CCACHE_BASEDIR=${ROOT_DIR}/lib/ -e EM_CACHE=/mnt/emscripten_cache/
24+
EXEC_ENVIRONMENT?=docker run -it --rm ${IN_IMAGE_MOUNTS} ${IN_IMAGE_ENV} "${CI_IMAGE_FULLY_QUALIFIED}"
25+
26+
CORES=$(shell grep -c ^processor /proc/cpuinfo 2>/dev/null || sysctl -n hw.ncpu)
27+
28+
# ---------------------------------------------------------------------------
29+
# Formatting
30+
31+
# Format all source files
32+
.PHONY: format
33+
format:
34+
${ROOT_DIR}/scripts/format.sh
35+
36+
.PHONY: check_format
37+
check_format:
38+
${ROOT_DIR}/scripts/format.sh check
39+
40+
# ---------------------------------------------------------------------------
41+
# Building
42+
43+
# Compile the core in debug mode
44+
.PHONY: lib
45+
lib:
46+
mkdir -p ${LIB_DEBUG_DIR}
47+
cmake -S ${LIB_SOURCE_DIR} -B ${LIB_DEBUG_DIR} \
48+
-GNinja \
49+
-DCMAKE_BUILD_TYPE=Debug \
50+
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
51+
ninja -C ${LIB_DEBUG_DIR}
52+
53+
# Compile the core in release mode
54+
.PHONY: lib_relwithdebinfo
55+
lib_relwithdebinfo:
56+
mkdir -p ${LIB_RELWITHDEBINFO_DIR}
57+
cmake -S ${LIB_SOURCE_DIR} -B ${LIB_RELWITHDEBINFO_DIR} \
58+
-GNinja \
59+
-DCMAKE_BUILD_TYPE=RelWithDebInfo
60+
ninja -C ${LIB_RELWITHDEBINFO_DIR}
61+
62+
# Compile the core in release mode
63+
.PHONY: lib_release
64+
lib_release:
65+
mkdir -p ${LIB_RELEASE_DIR}
66+
cmake -S ${LIB_SOURCE_DIR} -B ${LIB_RELEASE_DIR} \
67+
-GNinja \
68+
-DCMAKE_BUILD_TYPE=Release
69+
ninja -C ${LIB_RELEASE_DIR}
70+
71+
# Perf the library
72+
.PHONY: lib_perf
73+
lib_perf: lib_relwithdebinfo
74+
perf record --call-graph dwarf ${LIB_RELWITHDEBINFO_DIR}/tester --source_dir ${LIB_SOURCE_DIR} --gtest_filter=*CSV*ParseTest
75+
hotspot ./perf.data
76+
77+
# Test the core library
78+
.PHONY: lib_tests
79+
lib_tests: lib
80+
${LIB_DEBUG_DIR}/tester --source_dir ${LIB_SOURCE_DIR} --gtest_filter=*
81+
82+
# Debug the core library
83+
.PHONY: lib_tests
84+
lib_tests_lldb: lib
85+
lldb ${LIB_DEBUG_DIR}/tester -- --source_dir ${LIB_SOURCE_DIR} --gtest_filter=*
86+
87+
# Debug the core library
88+
.PHONY: lib_tests
89+
lib_tests_gdb: lib
90+
gdb --args ${LIB_DEBUG_DIR}/tester --source_dir ${LIB_SOURCE_DIR} --gtest_filter=*
91+
92+
# Test the core library
93+
.PHONY: lib_tests_relwithdebinfo
94+
lib_tests_relwithdebinfo: lib_relwithdebinfo
95+
${LIB_RELWITHDEBINFO_DIR}/tester --source_dir ${LIB_SOURCE_DIR}
96+
97+
# Test the core library
98+
.PHONY: lib_tests_relwithdebinfo_lldb
99+
lib_tests_relwithdebinfo_lldb: lib_relwithdebinfo
100+
lldb ${LIB_RELWITHDEBINFO_DIR}/tester -- --source_dir ${LIB_SOURCE_DIR}
101+
102+
# Debug the library
103+
.PHONY: lib_debug
104+
lib_debug: lib
105+
lldb --args ${LIB_DEBUG_DIR}/tester ${LIB_SOURCE_DIR}
106+
107+
# Make sure we can access the wasm caches
108+
wasm_caches:
109+
mkdir -p ${ROOT_DIR}/.ccache ${ROOT_DIR}/.emscripten_cache
110+
chown -R $(id -u):$(id -g) ${ROOT_DIR}/.ccache ${ROOT_DIR}/.emscripten_cache
111+
112+
# Build the wasm module with debug info
113+
.PHONY: wasm
114+
wasm: wasm_caches
115+
mkdir -p ${CACHE_DIRS}
116+
${EXEC_ENVIRONMENT} ${ROOT_DIR}/scripts/wasm_build_lib.sh Fast
117+
118+
# Build the wasm modules with all debug info
119+
.PHONY: wasm_debug
120+
wasm_debug: wasm_caches
121+
mkdir -p ${CACHE_DIRS}
122+
${EXEC_ENVIRONMENT} ${ROOT_DIR}/scripts/wasm_build_lib.sh Debug
123+
124+
# Build the wasm modules
125+
.PHONY: wasm_release
126+
wasm_release: wasm_caches
127+
mkdir -p ${CACHE_DIRS}
128+
${EXEC_ENVIRONMENT} ${ROOT_DIR}/scripts/wasm_build_lib.sh Release
129+
130+
# Build the duckdb library
131+
.PHONY: duckdb
132+
duckdb:
133+
yarn workspace @duckdb/duckdb-wasm build
134+
135+
# Build the duckdb docs
136+
.PHONY: duckdb_docs
137+
duckdb_docs:
138+
yarn workspace @duckdb/duckdb-wasm docs
139+
140+
# Run the duckdb javascript tests
141+
.PHONY: duckdb_tests
142+
duckdb_tests: duckdb
143+
yarn workspace @duckdb/duckdb-wasm test
144+
145+
# Run the duckdb javascript tests in browser
146+
.PHONY: duckdb_tests_browser
147+
duckdb_tests_browser: duckdb
148+
yarn workspace @duckdb/duckdb-wasm test:browser
149+
150+
# Run the duckdb javascript tests in browser
151+
.PHONY: duckdb_tests_browser
152+
duckdb_tests_debug: duckdb
153+
yarn workspace @duckdb/duckdb-wasm test:browser:dbg
154+
155+
# Run the duckdb javascript tests on nodejs
156+
.PHONY: duckdb_tests_node
157+
duckdb_tests_node: duckdb
158+
yarn workspace @duckdb/duckdb-wasm test:node
159+
160+
# C++ formatting
161+
.PHONY: clang_format
162+
clang_format:
163+
python3 ./scripts/run_clang_format.py \
164+
--exclude ./lib/build \
165+
--exclude ./lib/third_party \
166+
-r ./lib/
167+
168+
# JS formatting
169+
.PHONY: eslint
170+
eslint:
171+
yarn workspace @duckdb/duckdb-wasm run lint
172+
173+
# Install all yarn packages
174+
.PHONY: yarn_install
175+
yarn_install:
176+
yarn
177+
178+
# ---------------------------------------------------------------------------
179+
# Environment
180+
181+
# Generate the compile commands for the language server
182+
.PHONY: compile_commands
183+
compile_commands:
184+
mkdir -p ${LIB_DEBUG_DIR}
185+
cmake -S ${LIB_SOURCE_DIR} -B ${LIB_DEBUG_DIR} \
186+
-GNinja \
187+
-DCMAKE_BUILD_TYPE=Debug \
188+
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
189+
ln -sf ${LIB_DEBUG_DIR}/compile_commands.json ${LIB_SOURCE_DIR}/compile_commands.json
190+
191+
# Clean the repository
192+
.PHONY: clean
193+
clean:
194+
git clean -xfd
195+
git submodule foreach --recursive git clean -xfd
196+
git submodule update --init --recursive
197+
198+
# Build the docker dev image
199+
.PHONY: docker_ci_image
200+
docker_ci_image:
201+
tar -cvf - ./actions/image/Dockerfile | docker build \
202+
--platform linux/amd64 \
203+
-t ${CI_IMAGE_FULLY_QUALIFIED} \
204+
-f ./actions/image/Dockerfile \
205+
--build-arg UID=${UID} \
206+
--build-arg GID=${GID} \
207+
-
208+
209+
# Build infrastructure and packages required for development
210+
.PHONY: bootstrap
211+
bootstrap:
212+
git submodule update --init --recursive
213+
make docker_ci_image yarn_install
214+
make wasm
215+
make duckdb
216+
217+
# Run all js tests
218+
.PHONY: jstests
219+
jstests:
220+
make duckdb_tests
221+
222+
# ---------------------------------------------------------------------------
223+
# Data
224+
225+
# Package the uni schema data
226+
UNI_SCHEMA_DIR="${ROOT_DIR}/data/uni"
227+
UNI_SCHEMA_OUT="${UNI_SCHEMA_DIR}/out"
228+
UNI_SCHEMA_PKG="${UNI_SCHEMA_DIR}/target/release/pkg_uni"
229+
.PHONY: pkg_uni_schema
230+
pkg_uni:
231+
cargo +nightly build --manifest-path="${UNI_SCHEMA_DIR}/Cargo.toml" --release
232+
mkdir -p ${UNI_SCHEMA_OUT}
233+
${UNI_SCHEMA_PKG} ${UNI_SCHEMA_OUT}
234+
cd ${UNI_SCHEMA_OUT} && rm -f ./all.zip && zip ./all.zip ./*.parquet

0 commit comments

Comments
 (0)