Skip to content

Commit 9e873ee

Browse files
authored
[Issue pixelsdb#471] implement the C++ reader for pixels. (pixelsdb#473)
1 parent 635c7e5 commit 9e873ee

20 files changed

+924
-399
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package-info.java
2020
*.sql
2121
*.log
2222
*.txt
23+
!*/CMakeLists.txt
2324
*.csv
2425
resources/*.xml
2526
*.so

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "cpp/pixels-reader"]
2+
path = cpp/pixels-reader
3+
url = https://github.com/yuly16/pixels-reader-cxx
4+
[submodule "cpp/duckdb"]
5+
path = cpp/duckdb
6+
url = https://github.com/yuly16/duckdb

cpp/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build/
2+
plot
3+
.idea
4+
.vscode

cpp/CMakeLists.txt

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
cmake_minimum_required(VERSION 2.8.12)
2+
3+
# Set extension name here
4+
set(TARGET_NAME pixels)
5+
6+
set(EXTENSION_NAME ${TARGET_NAME}_extension)
7+
project(${TARGET_NAME})
8+
include_directories(include)
9+
10+
set(EXTENSION_SOURCES
11+
pixels_extension.cpp
12+
PixelsScanFunction.cpp
13+
)
14+
add_library(${EXTENSION_NAME} STATIC ${EXTENSION_SOURCES})
15+
16+
17+
include_directories(pixels-reader/pixels-common/include)
18+
include_directories(pixels-reader/pixels-core/include)
19+
include_directories(${CMAKE_CURRENT_BINARY_DIR}/pixels-reader)
20+
21+
add_subdirectory(pixels-reader)
22+
23+
24+
target_link_libraries(
25+
${EXTENSION_NAME}
26+
pixels-common
27+
pixels-core
28+
)
29+
30+
set(PARAMETERS "-warnings")
31+
build_loadable_extension(${TARGET_NAME} ${PARAMETERS} ${EXTENSION_SOURCES})
32+
33+
install(
34+
TARGETS ${EXTENSION_NAME} pixels-core pixels-common
35+
EXPORT "${DUCKDB_EXPORT_SET}"
36+
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
37+
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")

cpp/Makefile

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,49 @@
1-
all: PixelsCacheReader
1+
.PHONY: all clean debug release pull update
22

3-
PixelsCacheReader: PixelsCacheReader.cc MemoryMappedFile
4-
$(CXX) -shared -fPIC $@.cc -o lib_pixels.so -I/usr/lib/jvm/java-1.8.0-openjdk-amd64/include/ -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux/
3+
all: release
54

6-
MemoryMappedFile:
7-
$(CXX) -c $@.cc
5+
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
6+
PROJ_DIR := $(dir $(MKFILE_PATH))
7+
8+
OSX_BUILD_UNIVERSAL_FLAG=
9+
ifeq (${OSX_BUILD_UNIVERSAL}, 1)
10+
OSX_BUILD_UNIVERSAL_FLAG=-DOSX_BUILD_UNIVERSAL=1
11+
endif
12+
ifeq (${STATIC_LIBCPP}, 1)
13+
STATIC_LIBCPP=-DSTATIC_LIBCPP=TRUE
14+
endif
15+
16+
ifeq ($(GEN),ninja)
17+
GENERATOR=-G "Ninja"
18+
FORCE_COLOR=-DFORCE_COLORED_OUTPUT=1
19+
endif
20+
21+
BUILD_FLAGS=-DEXTENSION_STATIC_BUILD=1 -DBUILD_TPCH_EXTENSION=1 -DBUILD_BENCHMARKS=1 -DBUILD_PARQUET_EXTENSION=1 ${OSX_BUILD_UNIVERSAL_FLAG} ${STATIC_LIBCPP}
22+
23+
CLIENT_FLAGS :=
24+
25+
# These flags will make DuckDB build the extension
26+
EXTENSION_FLAGS=-DDUCKDB_OOT_EXTENSION_NAMES="pixels" -DDUCKDB_OOT_EXTENSION_PIXELS_PATH="$(PROJ_DIR)" -DDUCKDB_OOT_EXTENSION_PIXELS_SHOULD_LINK="TRUE" -DDUCKDB_OOT_EXTENSION_PIXELS_INCLUDE_PATH="$(PROJ_DIR)include"
27+
28+
pull:
29+
git submodule init
30+
git submodule update --recursive --remote
31+
32+
update:
33+
git submodule update --remote --merge
834

935
clean:
10-
rm -rf ./lib_pixels.so ./*.o
36+
rm -rf build
37+
rm -rf testext
38+
cd duckdb && make clean
39+
40+
# Main build
41+
debug:
42+
mkdir -p build/debug && \
43+
cmake $(GENERATOR) $(FORCE_COLOR) $(EXTENSION_FLAGS) ${CLIENT_FLAGS} -DEXTENSION_STATIC_BUILD=1 -DCMAKE_BUILD_TYPE=Debug ${BUILD_FLAGS} -S ./duckdb/ -B build/debug && \
44+
cmake --build build/debug --config Debug
45+
46+
release:
47+
mkdir -p build/release && \
48+
cmake $(GENERATOR) $(FORCE_COLOR) $(EXTENSION_FLAGS) ${CLIENT_FLAGS} -DEXTENSION_STATIC_BUILD=1 -DCMAKE_BUILD_TYPE=Release ${BUILD_FLAGS} -S ./duckdb/ -B build/release && \
49+
cmake --build build/release --config Release

cpp/MemoryMappedFile.cc

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)