# DaseX **Repository Path**: zhang_yuyun/dasex ## Basic Information - **Project Name**: DaseX - **Description**: OLAP数据库执行引擎 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2025-04-05 - **Last Updated**: 2025-04-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 编译环境: c++17 cmake-3.22 gcc/g++-10.3.1 项目依赖: jemalloc pthread libnuma arrow googletest jemalloc库编译安装: https://github.com/jemalloc/jemalloc/releases cd jemalloc-5.3.0/ yum install autoconf ./autogen.sh make -j8 make install libnuma库安装: dnf install numactl-devel 编译需要加上 -lnuma 标识 Arrow库编译安装: git clone https://github.com/apache/arrow.git cd arrow/cpp mkdir build cd build cmake -DARROW_COMPUTE=ON -DARROW_CSV=ON .. make -j16 make install GTest编译安装: 在https://gitee.com/caiwanli/googletest.git中下载对应tag tar -zxvf googletest-release-1.8.1.tar.gz cd googletest-release-1.8.1/ mkdir build cd build cmake .. make -j16 make install 项目使用: cd dasex mkdir build cd build cmake .. make -j8 编译产物(main)目前放置在./build ####运行 前面的参数用于打印jemalloc统计信息 MALLOC_CONF=stats_print:true ./DaseX_test 项目说明: 1.项目源码在src目录中, common:用于放置公共类和函数,例如,config和context; config:用于放置全局变量或者初始化配置信息; context:上下文信息,目前只有一个执行上下文,算子执行的信息都可以放在context中; function:用于放置算子处理用到的函数,例如,Filter中的函数表达式; operator:所有算子实现均放在该目录中,子目录对应具体算子实现,PhysicalOperator是所有算子的基类(physical_operator.hpp); agg: 聚合函数/Groupby filter:过滤算子/where join:连接算子 project:投影算子 scan:表扫描算子 pipeline:管道实现,包含所有pipeline相关功能类; execute:pipeline执行器 sche:任务调度系统; storage:底层存储,数据在内存中的抽象,采用Apache Arrow格式 util: 辅助类函数或者宏定义 2.测试代码在tests目录中 main.cpp固定写法,与GTest相关。测试用例实现在test.cpp中,可根据情况编写测试用例。 parser: sql解析,得到pg语法树,与pg格式一样,使用DuckDB parser FQA: 1.编译完成后,运行时出现找不到xx文件? 使用 ldd ./main 查看缺少的动态库,然后将对应的路径添加的 LD_LIBRARY_PATH 命令: export LD_LIBRARY_PATH=LD_LIBRARY_PATH:/xxx.so ,永久生效需要添加到 ~/.bashrc 中。 2.内存泄漏检查? valgrind --tool=memcheck --leak-check=full ./DB314_test 3.调试代码如何打印日志? 代码中统一使用spdlog::info来打印日志,格式如下所示: spdlog::info("[{} : {}] build执行时间: {}", __FILE__, __LINE__, Util::time_difference(start, end)); 前半部分固定格式,输出文件、日志所在位置,后半部分为需要打印的内容。 4. 执行指定测试用例 ./DaseX_Test --gtest_filter="Test.MyTest1" ./DaseX_Test --gtest_filter="TPCHTest.Q7SingleThreadTest" 5. 查看某个函数的执行时间 auto start = std::chrono::steady_clock::now(); build(lstate); auto end = std::chrono::steady_clock::now(); spdlog::info("[{} : {}] build执行时间: {}", __FILE__, __LINE__, Util::time_difference(start, end));