├── cpp └── src │ ├── cider │ ├── function │ │ ├── udf │ │ │ └── .gitkeep │ │ ├── scripts │ │ │ └── parse_ast.py │ │ ├── scalar │ │ │ └── ExtensionFunctionsTesting.hpp │ │ └── hash │ │ │ └── MurmurHash.h │ ├── exec │ │ ├── operator │ │ │ ├── join │ │ │ │ ├── .gitkeep │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── plan │ │ │ ├── lookup │ │ │ │ ├── internals │ │ │ │ │ ├── functions_rounding.yaml │ │ │ │ │ ├── type_variations.yaml │ │ │ │ │ ├── functions_aggregate_approx.yaml │ │ │ │ │ ├── functions_set.yaml │ │ │ │ │ ├── functions_aggregate_generic.yaml │ │ │ │ │ └── unknown.yaml │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── extensions │ │ │ │ │ └── presto │ │ │ │ │ └── presto_extension.yaml │ │ │ ├── parser │ │ │ │ ├── BaseContext.cpp │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── BaseContext.h │ │ │ │ └── Translator.h │ │ │ ├── substrait │ │ │ │ └── CMakeLists.txt │ │ │ ├── builder │ │ │ │ └── CMakeLists.txt │ │ │ ├── validator │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── nextgen │ │ │ ├── parsers │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Parser.h │ │ │ ├── transformer │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Transformer.h │ │ │ ├── jitlib │ │ │ │ ├── llvmjit │ │ │ │ │ └── LLVMJITTargets.h │ │ │ │ ├── base │ │ │ │ │ └── Options.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── JITLib.h │ │ │ ├── context │ │ │ │ └── CMakeLists.txt │ │ │ ├── utils │ │ │ │ ├── ReferenceCounter.h │ │ │ │ └── FunctorUtils.h │ │ │ ├── Nextgen.h │ │ │ └── operators │ │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ ├── module │ │ │ ├── CiderOptions.cpp │ │ │ └── CMakeLists.txt │ │ ├── processor │ │ │ ├── CMakeLists.txt │ │ │ ├── StatelessProcessor.h │ │ │ └── StatelessProcessor.cpp │ │ └── template │ │ │ ├── DynamicWatchdog.h │ │ │ └── TypePunning.h │ ├── tests │ │ ├── parquet_files │ │ │ ├── mixed_cols.parquet │ │ │ ├── varchar_single_col.parquet │ │ │ ├── bool_single_col.parquet │ │ │ └── char_single_col.parquet │ │ ├── nextgen │ │ │ ├── CMakeLists.txt │ │ │ ├── jitlib │ │ │ │ └── CMakeLists.txt │ │ │ └── functional │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── benchmark │ │ │ │ └── CMakeLists.txt │ │ ├── plan │ │ │ └── CMakeLists.txt │ │ ├── processor │ │ │ └── CMakeLists.txt │ │ ├── utils │ │ │ ├── CiderInt128.h │ │ │ └── CiderNextgenBenchmarkRunner.h │ │ ├── hashtable │ │ │ └── CMakeLists.txt │ │ ├── StringHeapTest.cpp │ │ └── CiderLogTest.cpp │ ├── common │ │ ├── contrib │ │ │ └── cityhash102 │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── COPYING │ │ ├── base │ │ │ ├── time.h │ │ │ └── StringRef.cpp │ │ ├── CMakeLists.txt │ │ └── hashtable │ │ │ └── HashTableAllocator.h │ ├── type │ │ ├── CMakeLists.txt │ │ ├── plan │ │ │ ├── CMakeLists.txt │ │ │ └── ColumnExpr.cpp │ │ └── data │ │ │ └── CiderTypes.h │ ├── util │ │ ├── filesystem │ │ │ ├── cider_path.h │ │ │ ├── cider_fs.h │ │ │ └── cider_path.cpp │ │ ├── cleanup_global_namespace.h │ │ ├── CMakeLists.txt │ │ └── DateConverters.h │ ├── include │ │ └── cider │ │ │ ├── CiderSupportPlatType.h │ │ │ └── CiderInterface.h │ └── examples │ │ └── CMakeLists.txt │ ├── cider-velox │ ├── test │ │ ├── planTransformerTest │ │ │ ├── utils │ │ │ │ ├── VeloxTypes.h │ │ │ │ ├── PlanTansformerTestUtil.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── VeloxPlanSequenceBuilder.h │ │ │ ├── CiderPlanTransformerIncludes.h │ │ │ └── PlanTranformerIncludes.h │ │ └── e-2-e │ │ │ └── presto │ │ │ ├── unused │ │ │ └── tpcds │ │ │ │ ├── 55.sql │ │ │ │ ├── 96.sql │ │ │ │ ├── 03.sql │ │ │ │ ├── 52.sql │ │ │ │ ├── 32.sql │ │ │ │ ├── 92.sql │ │ │ │ ├── 42.sql │ │ │ │ ├── 07.sql │ │ │ │ ├── 84.sql │ │ │ │ ├── 26.sql │ │ │ │ ├── 37.sql │ │ │ │ ├── 82.sql │ │ │ │ ├── 93.sql │ │ │ │ ├── 06.sql │ │ │ │ └── 01.sql │ │ │ └── queries │ │ │ └── tpch │ │ │ ├── q6.sql │ │ │ ├── q17.sql │ │ │ ├── q14.sql │ │ │ ├── q13.sql │ │ │ ├── q4.sql │ │ │ ├── q3.sql │ │ │ ├── q18.sql │ │ │ ├── q15.sql │ │ │ ├── q5.sql │ │ │ ├── q16.sql │ │ │ ├── q10.sql │ │ │ └── q1.sql │ ├── README.MD │ ├── src │ │ ├── substrait │ │ │ └── CMakeLists.txt │ │ ├── planTransformer │ │ │ ├── CMakeLists.txt │ │ │ ├── PlanPattern.cpp │ │ │ └── PlanPattern.h │ │ ├── ciderTransformer │ │ │ ├── CMakeLists.txt │ │ │ ├── CiderPlanTransformerOptions.h │ │ │ ├── CiderPlanTransformerFactory.h │ │ │ ├── CiderPlanTransformerOptions.cpp │ │ │ └── CiderPlanRewriter.h │ │ ├── CiderVeloxPluginCtx.h │ │ └── CMakeLists.txt │ └── benchmark │ │ ├── tpch │ │ └── CMakeLists.txt │ │ └── expression │ │ └── CMakeLists.txt │ └── compression │ ├── test │ └── CMakeLists.txt │ ├── benchmark │ └── BenchmarkMain.cpp │ └── common │ ├── CMakeLists.txt │ ├── qat │ └── CMakeLists.txt │ └── igzip │ └── CMakeLists.txt ├── ci ├── scripts │ ├── mixed_copyright_files.txt │ ├── copyright_files_excluded.txt │ ├── lint_exclusions.txt │ ├── lint_inclusions.txt │ ├── license.header.intel │ ├── license.header │ ├── license.header.mixed │ ├── test_with_arrow_format.sh │ ├── intel_copyright_files.txt │ └── prepare_source_code_cicd.sh └── docker │ ├── scripts-cider │ └── llvm-9-glibc-2.31-708430.patch │ └── build-image.sh ├── docs ├── images │ ├── BDTK-arch.PNG │ ├── ICL-class.png │ └── Personas.PNG ├── develop.rst ├── user │ ├── feature │ │ ├── math-func.rst │ │ ├── conversion-func.rst │ │ ├── time-func.rst │ │ ├── string-func.rst │ │ └── logic-cmp-op.rst │ ├── modules.rst │ ├── modules │ │ ├── jit-lib-module.rst │ │ ├── operators-module.rst │ │ └── hash-table-module.rst │ ├── feature-type.rst │ └── utils.rst ├── user.rst ├── index.rst ├── cider-sharing.rst └── scripts │ ├── make.bat │ └── Makefile ├── .github ├── config_files │ └── title_check.md ├── labeler_content.yaml ├── dependabot.yml ├── workflows │ ├── pr-title-checker.yml │ └── labeler.yaml └── labeler.yaml ├── .gitmodules ├── jvm ├── dev │ └── checkstyle │ │ └── checkstyle.license └── compression │ └── pom.xml ├── .clang-tidy ├── .clang-format └── SECURITY.md /cpp/src/cider/function/udf/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/operator/join/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ci/scripts/mixed_copyright_files.txt: -------------------------------------------------------------------------------- 1 | cpp/src/cider/common/* 2 | -------------------------------------------------------------------------------- /docs/images/BDTK-arch.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/BDTK/main/docs/images/BDTK-arch.PNG -------------------------------------------------------------------------------- /docs/images/ICL-class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/BDTK/main/docs/images/ICL-class.png -------------------------------------------------------------------------------- /docs/images/Personas.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/BDTK/main/docs/images/Personas.PNG -------------------------------------------------------------------------------- /ci/scripts/copyright_files_excluded.txt: -------------------------------------------------------------------------------- 1 | cpp/src/cider/common/contrib/* 2 | cpp/src/cider/function/scripts/* 3 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/parquet_files/mixed_cols.parquet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/BDTK/main/cpp/src/cider/tests/parquet_files/mixed_cols.parquet -------------------------------------------------------------------------------- /cpp/src/cider/tests/parquet_files/varchar_single_col.parquet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/BDTK/main/cpp/src/cider/tests/parquet_files/varchar_single_col.parquet -------------------------------------------------------------------------------- /docs/develop.rst: -------------------------------------------------------------------------------- 1 | Developer Guide 2 | =================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | develop/debugging 8 | develop/development-specification -------------------------------------------------------------------------------- /docs/user/feature/math-func.rst: -------------------------------------------------------------------------------- 1 | Mathematical Functions 2 | ======================== 3 | 4 | **mathematical operators** 5 | 6 | `support Mathematical Operators(+, -, *, /, %)` 7 | -------------------------------------------------------------------------------- /docs/user.rst: -------------------------------------------------------------------------------- 1 | User Guide 2 | =================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | 7 | user/quick-start 8 | user/modules 9 | user/feature-type 10 | user/utils -------------------------------------------------------------------------------- /.github/config_files/title_check.md: -------------------------------------------------------------------------------- 1 | Thanks for opening a pull request! 2 | 3 | Then could you also rename ***pull request title*** in the following format? 4 | 5 | [POAE${POAE_ID}-${ISSUES_ID}] ${detailed message} 6 | -------------------------------------------------------------------------------- /docs/user/feature/conversion-func.rst: -------------------------------------------------------------------------------- 1 | Conversion Functions 2 | ===================== 3 | 4 | **cast(expr as type)** 5 | 6 | Explicitly cast a value as a type. This can be used to cast a varchar to a numeric value type. 7 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/parquet_files/bool_single_col.parquet: -------------------------------------------------------------------------------- 1 | PAR1", 2 | 8 3 | ,5 duckdb_schema%col_bool 4 | &col_bool 5 | @D&<( 6 | &(DuckDBlPAR1 -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | ################################### 2 | Welcome to BDTK's documentation! 3 | ################################### 4 | 5 | .. toctree:: 6 | :maxdepth: 3 7 | 8 | cider-in-10-min 9 | user 10 | develop 11 | cider-sharing -------------------------------------------------------------------------------- /cpp/src/cider/tests/parquet_files/char_single_col.parquet: -------------------------------------------------------------------------------- 1 | PAR1Z\, 2 | -Hhello Tworldbdtkcider,5 duckdb_schema %col_char% 3 | & col_char 4 | |~&<worldbdtk(worldbdtk 5 | &(DuckDB|PAR1 -------------------------------------------------------------------------------- /docs/user/modules.rst: -------------------------------------------------------------------------------- 1 | Modules 2 | ======== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | modules/ICL-module 8 | modules/expr-eval-module 9 | modules/hash-table-module 10 | module/operators-module 11 | module/jit-lib-module 12 | 13 | -------------------------------------------------------------------------------- /cpp/src/cider/common/contrib/cityhash102/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(_cityhash src/city.cc include/citycrc.h include/city.h) 2 | 3 | target_include_directories(_cityhash SYSTEM BEFORE PUBLIC include) 4 | target_include_directories(_cityhash SYSTEM PRIVATE src) 5 | 6 | add_library(ch_contrib::cityhash ALIAS _cityhash) 7 | -------------------------------------------------------------------------------- /ci/scripts/lint_exclusions.txt: -------------------------------------------------------------------------------- 1 | */duckdb.cpp 2 | */duckdb.hpp 3 | */ThirdParty/* 4 | *Tests/DataMgr/* 5 | *src/substrait/proto/* 6 | *src/cider/type/plan/Analyzer.* 7 | *src/cider/exec/plan/parser/ParserNode* 8 | *src/cider/type/data/sqltypes.h 9 | */src/cider/type/data/InlineNullValues.h 10 | */src/cider/common/contrib/* -------------------------------------------------------------------------------- /docs/user/modules/jit-lib-module.rst: -------------------------------------------------------------------------------- 1 | JIT Lib Module Introduction 2 | ========================================== 3 | 4 | Module descritption 5 | ------------------------- 6 | 7 | JIT Lib module provides unified JIT interfaces like Value, Ptr, control flow and .etc to isolate operator logic and IR generation 8 | 9 | SDK API 10 | -------------------------- 11 | To be added. -------------------------------------------------------------------------------- /docs/user/feature-type.rst: -------------------------------------------------------------------------------- 1 | Supported features 2 | ===================== 3 | 4 | .. toctree:: 5 | :maxdepth: 1 6 | 7 | feature/data-type 8 | feature/agg-func 9 | feature/condition-expr 10 | feature/conversion-func 11 | feature/logic-cmp-op 12 | feature/math-func 13 | feature/string-func 14 | feature/time-func 15 | feature/syntax-support -------------------------------------------------------------------------------- /ci/scripts/lint_inclusions.txt: -------------------------------------------------------------------------------- 1 | cpp/src/cider/common/ 2 | cpp/src/cider/benchmarks/ 3 | cpp/src/cider/examples/ 4 | cpp/src/cider/exec/module/ 5 | cpp/src/cider/exec/nextgen/ 6 | cpp/src/cider/exec/plan/ 7 | cpp/src/cider/exec/plan/validator/ 8 | cpp/src/cider/exec/processor/ 9 | cpp/src/cider/include/ 10 | cpp/src/cider/tests/ 11 | cpp/src/cider/type/ 12 | cpp/src/cider-velox/ 13 | cpp/src/compression/ 14 | -------------------------------------------------------------------------------- /docs/user/feature/time-func.rst: -------------------------------------------------------------------------------- 1 | Time Functions 2 | ===================== 3 | **extract(unit from date)** 4 | 5 | returns one or more separate parts of a date or time in the specified unit. For example, this function can return the year, month, day, hour, or minute of a date or time. 6 | 7 | **time ± intervals** 8 | 9 | Adds an interval value of type unit to time type. Subtraction can be performed by using a negative value. -------------------------------------------------------------------------------- /docs/user/feature/string-func.rst: -------------------------------------------------------------------------------- 1 | String Functions 2 | ===================== 3 | 4 | **substr(string, start, length)** 5 | 6 | Returns a substring from string of length from the starting position start. 7 | 8 | String Function support in Cider 9 | ----------------------------------- 10 | Currently, Cider do not distinguish empty string and null string. 11 | 12 | Like function 13 | ^^^^^^^^^^^^^^^^^^^^ 14 | 15 | a. Acceptable wildcards: %, _, [] 16 | b. Unacceptable wildcards: `*`, [^], [!] 17 | c. Escape clause is not supported yet. 18 | -------------------------------------------------------------------------------- /docs/user/modules/operators-module.rst: -------------------------------------------------------------------------------- 1 | Operators Module Introduction 2 | ========================================== 3 | 4 | Module descritption 5 | ------------------------- 6 | 7 | BDTK implements typical SQL operators based on JitLib, provide a batch-at-a-time execution model. Each operator support “plug and play”, could easily integrated into other existing sql-engines. Operators BDTK target to supported includes: HashAggregation, HashJoin(HashBuild and HashProbe), etc. 8 | 9 | SDK API 10 | -------------------------- 11 | To be added. -------------------------------------------------------------------------------- /docs/user/modules/hash-table-module.rst: -------------------------------------------------------------------------------- 1 | Hash Table Module Introduction 2 | ========================================== 3 | 4 | Module descritption 5 | ------------------------- 6 | 7 | Hash table performance is critical to a SQL engine. Operators like hash join, hash aggregation count on an efficient hash table implementation. 8 | 9 | Hash table module will provide a bunch of hash table implementations, which are easy to use, leverage state of art hardware technology like AVX-512, will be optimized for query-specific scenarios. 10 | 11 | SDK API 12 | -------------------------- 13 | To be added. -------------------------------------------------------------------------------- /ci/docker/scripts-cider/llvm-9-glibc-2.31-708430.patch: -------------------------------------------------------------------------------- 1 | diff --git a/sanitizer_platform_limits_posix.cc.orig b/sanitizer_platform_limits_posix.cc 2 | index b7fa6e8..2c42ece 100644 3 | --- compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc.orig 4 | +++ compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc 5 | @@ -1128,7 +1128,7 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, cuid); 6 | CHECK_SIZE_AND_OFFSET(ipc_perm, cgid); 7 | #if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21) 8 | /* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */ 9 | -CHECK_SIZE_AND_OFFSET(ipc_perm, mode); 10 | +//CHECK_SIZE_AND_OFFSET(ipc_perm, mode); 11 | #endif 12 | 13 | CHECK_TYPE_SIZE(shmid_ds); 14 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/lookup/internals/functions_rounding.yaml: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | scalar_functions: 4 | - 5 | name: "ceil" 6 | description: > 7 | Rounding to the ceiling of the value `x`. 8 | impls: 9 | - args: 10 | - value: fp32 11 | name: "x" 12 | return: fp32 13 | - args: 14 | - value: fp64 15 | name: "x" 16 | return: fp64 17 | - 18 | name: "floor" 19 | description: > 20 | Rounding to the floor of the value `x`. 21 | impls: 22 | - args: 23 | - value: fp32 24 | name: "x" 25 | return: fp32 26 | - args: 27 | - value: fp64 28 | name: "x" 29 | return: fp64 30 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/lookup/internals/type_variations.yaml: -------------------------------------------------------------------------------- 1 | type_variations: 2 | - parent: string 3 | name: dict4 4 | description: a four-byte dictionary encoded string 5 | functions: INHERITS 6 | - parent: string 7 | name: bigoffset 8 | description: >- 9 | The arrow large string representation of strings, still restricted to the default string size defined in 10 | Substrait. 11 | functions: SEPARATE 12 | - parent: struct 13 | name: avro 14 | description: an avro encoded struct 15 | functions: SEPARATE 16 | - parent: struct 17 | name: cstruct 18 | description: a cstruct representation of the struct 19 | functions: SEPARATE 20 | - parent: struct 21 | name: dict2 22 | description: a 2-byte dictionary encoded string. 23 | functions: INHERITS 24 | -------------------------------------------------------------------------------- /docs/user/utils.rst: -------------------------------------------------------------------------------- 1 | ====== 2 | Utils 3 | ====== 4 | 5 | Sql2IR 6 | ----------------------------------- 7 | 8 | This tool can dump substrait plan json, llvm ir and cfg from a SQL. 9 | 10 | How to use 11 | ``````````` 12 | Sql2IR is under cider/tests/ directory. follow the debugging guide, build all the test binary, and the Sql2IR tool is built. 13 | 14 | you can find the usage by:: 15 | 16 | Sql2IR --help 17 | 18 | dump substrait plan from sql:: 19 | 20 | Sql2IR --sql "select sum(a*b) as res from A where a>10 and b<5" --create-ddl "create table A(a int, b int);" 21 | 22 | If you want dump the IR cfg, dump-ir-level should be set to 2:: 23 | 24 | Sql2IR --sql "select sum(a*b) as res from A where a>10 and b<5" --create-ddl "create table A(a int, b int);" --dump-ir-level=2 --gen-cfg=true 25 | 26 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/lookup/internals/functions_aggregate_approx.yaml: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | aggregate_functions: 4 | - name: "approx_count_distinct" 5 | description: >- 6 | Calculates the approximate number of rows that contain distinct values of the expression argument using 7 | HyperLogLog. This function provides an alternative to the COUNT (DISTINCT expression) function, which 8 | returns the exact number of rows that contain distinct values of an expression. APPROX_COUNT_DISTINCT 9 | processes large amounts of data significantly faster than COUNT, with negligible deviation from the exact 10 | result. 11 | impls: 12 | - args: 13 | - name: x 14 | value: any 15 | nullability: DECLARED_OUTPUT 16 | decomposable: MANY 17 | intermediate: binary 18 | return: i64 19 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/lookup/internals/functions_set.yaml: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | scalar_functions: 4 | - 5 | name: "index_in" 6 | description: > 7 | Checks the membership of a value in a list of values 8 | 9 | Returns the first 0-based index value of some input `T` if `T` is equal to 10 | any element in `List`. Returns `NULL` if not found. 11 | 12 | If `T` is `NULL`, returns `NULL`. 13 | 14 | If `T` is `NaN`: 15 | - Returns 0-based index of `NaN` in `List` (default) 16 | - Returns `NULL` (if `NAN_IS_NOT_NAN` is specified) 17 | impls: 18 | - args: 19 | - options: [ NAN_IS_NAN, NAN_IS_NOT_NAN ] 20 | required: false 21 | - name: x 22 | value: T 23 | - name: y 24 | value: List 25 | nullability: DECLARED_OUTPUT 26 | return: int64? 27 | -------------------------------------------------------------------------------- /docs/cider-sharing.rst: -------------------------------------------------------------------------------- 1 | ===================== 2 | Sharing 3 | ===================== 4 | 5 | Live Demo 6 | -------------------------------------- 7 | maybe a video... 8 | 9 | .. code-block:: c++ 10 | 11 | if __name__ == "__main__": 12 | sys.exit(main()) 13 | 14 | Design Doc 15 | ++++++++++++++++++++++ 16 | document... 17 | 18 | Performance Report 19 | ++++++++++++++++++++++ 20 | charts or images... 21 | 22 | External Link 23 | -------------------------------------- 24 | `Velox Documentation `_ 25 | 26 | Paper/ conference/ talk 27 | -------------------------------------- 28 | `Runtime Code Generation in Cloudera Impala `_ 29 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "thirdparty/substrait"] 2 | path = cpp/thirdparty/substrait 3 | url = https://github.com/substrait-io/substrait.git 4 | [submodule "thirdparty/velox"] 5 | path = cpp/thirdparty/velox 6 | url = https://github.com/Intel-bigdata/velox.git 7 | [submodule "thirdparty/rapidjson"] 8 | path = cpp/thirdparty/rapidjson 9 | url = https://github.com/Tencent/rapidjson.git 10 | [submodule "thirdparty/robin-hood-hashing"] 11 | path = cpp/thirdparty/robin-hood-hashing 12 | url = https://github.com/martinus/robin-hood-hashing.git 13 | [submodule "thirdparty/googletest"] 14 | path = cpp/thirdparty/googletest 15 | url = https://github.com/google/googletest.git 16 | [submodule "thirdparty/duckdb"] 17 | path = cpp/thirdparty/duckdb 18 | url = https://github.com/duckdb/duckdb.git 19 | [submodule "thirdparty/benchmark"] 20 | path = cpp/thirdparty/benchmark 21 | url = https://github.com/google/benchmark.git 22 | -------------------------------------------------------------------------------- /ci/scripts/license.header.intel: -------------------------------------------------------------------------------- 1 | Copyright(c) 2022-2023 Intel Corporation. 2 | 3 | Licensed to the Apache Software Foundation (ASF) under one 4 | or more contributor license agreements. See the NOTICE file 5 | distributed with this work for additional information 6 | regarding copyright ownership. The ASF licenses this file 7 | to you under the Apache License, Version 2.0 (the 8 | "License"); you may not use this file except in compliance 9 | with the License. You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, 14 | software distributed under the License is distributed on an 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | KIND, either express or implied. See the License for the 17 | specific language governing permissions and limitations 18 | under the License. 19 | 20 | 21 | -------------------------------------------------------------------------------- /cpp/src/cider/function/scripts/parse_ast.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | 3 | import sys 4 | import re 5 | 6 | if len(sys.argv) > 1: 7 | with open(sys.argv[1], "r") as f: 8 | for line in f: 9 | if "FunctionDecl" in line and "ExtensionFunctions" in line: 10 | line = re.sub("-FunctionDecl.*line:[0-9]+:[0-9]+", "", line).lstrip() 11 | if not line.startswith("| "): 12 | # .ast lines must start with `| `, see ExtensionFunctionSignatureParser.parse 13 | line = "| " + line 14 | print(line, end="") 15 | else: 16 | for line in sys.stdin: 17 | if "FunctionDecl" in line and "ExtensionFunctions" in line: 18 | line = re.sub("-FunctionDecl.*line:[0-9]+:[0-9]+", "", line).lstrip() 19 | if not line.startswith("| "): 20 | line = "| " + line 21 | print(line, end="") 22 | -------------------------------------------------------------------------------- /docs/scripts/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | %SPHINXBUILD% >NUL 2>NUL 14 | if errorlevel 9009 ( 15 | echo. 16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 17 | echo.installed, then set the SPHINXBUILD environment variable to point 18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 19 | echo.may add the Sphinx directory to PATH. 20 | echo. 21 | echo.If you don't have Sphinx installed, grab it from 22 | echo.https://www.sphinx-doc.org/ 23 | exit /b 1 24 | ) 25 | 26 | if "%1" == "" goto help 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /cpp/src/cider/type/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | add_subdirectory(plan) 20 | -------------------------------------------------------------------------------- /ci/scripts/license.header: -------------------------------------------------------------------------------- 1 | Copyright(c) 2022-2023 Intel Corporation. 2 | Copyright (c) OmniSci, Inc. and its affiliates. 3 | 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | 21 | 22 | -------------------------------------------------------------------------------- /ci/scripts/license.header.mixed: -------------------------------------------------------------------------------- 1 | Copyright(c) 2022-2023 Intel Corporation. 2 | Copyright (c) 2016-2022 ClickHouse, Inc. 3 | 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | 21 | 22 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/operator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | add_subdirectory(join) 21 | -------------------------------------------------------------------------------- /jvm/dev/checkstyle/checkstyle.license: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/nextgen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | add_subdirectory(jitlib) 21 | add_subdirectory(compiler) 22 | add_subdirectory(functional) 23 | -------------------------------------------------------------------------------- /docs/user/feature/logic-cmp-op.rst: -------------------------------------------------------------------------------- 1 | Logical and Comparsion ops 2 | ================================= 3 | 4 | **logical operators** 5 | 6 | support logical operators(and, or, not) 7 | 8 | 9 | **comparsion operators** 10 | 11 | support basic comparsion operators(<,>, <=, >=, =, <>, !=) 12 | 13 | **between (x) and (y)** 14 | 15 | The between operator tests if a value is within a specified range. 16 | 17 | **is null / is not null** 18 | 19 | is null and is not null operators test whether a value is null. Both operators work for all data types. 20 | 21 | 22 | **is distinct from / is not ditinct from** 23 | 24 | a null value is not considered distinct from NULL. When you are comparing values which may include NULL use these operators to guarantee either a TRUE or FALSE result. 25 | 26 | .. code-block:: sql 27 | 28 | SELECT NULL IS DISTINCT FROM NULL; -- false 29 | 30 | SELECT NULL IS NOT DISTINCT FROM NULL; -- true 31 | 32 | **like** 33 | 34 | The like operator is used to match a specified character pattern in a string. 35 | 36 | -------------------------------------------------------------------------------- /.clang-tidy: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | Checks: -*,readability-braces-around-statements,modernize-deprecated-headers,modernize-use-using,modernize-use-emplace,modernize-use-override 20 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/planTransformerTest/utils/VeloxTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "planTransformer/PlanNodeAddr.h" 25 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/parsers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(PARSERS_SOURCE ${CMAKE_CURRENT_LIST_DIR}/RelAlgEUParser.cpp) 21 | 22 | add_library(cider_parsers OBJECT ${PARSERS_SOURCE}) 23 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/transformer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | set(TRANSFORMER_SOURCE ${CMAKE_CURRENT_LIST_DIR}/Transformer.cpp) 20 | 21 | add_library(cider_transformer OBJECT ${TRANSFORMER_SOURCE}) 22 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/operator/join/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | set(HASHTABLE_SOURCE ${CMAKE_CURRENT_LIST_DIR}/CiderJoinHashTable.cpp) 20 | 21 | add_library(cider_hashtable_join STATIC ${HASHTABLE_SOURCE}) 22 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | add_subdirectory(module) 20 | add_subdirectory(plan) 21 | add_subdirectory(template) 22 | add_subdirectory(nextgen) 23 | add_subdirectory(operator) 24 | add_subdirectory(processor) 25 | -------------------------------------------------------------------------------- /cpp/src/compression/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | add_executable(icl_codec_test icl_codec_test.cpp) 21 | target_link_libraries(icl_codec_test gtest icl_codec) 22 | add_test(icl_codec_test icl_codec_test ${TEST_ARGS}) 23 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | BasedOnStyle: Chromium 20 | BinPackArguments: false 21 | BinPackParameters: false 22 | ColumnLimit: 90 23 | IndentWidth: 2 24 | BreakConstructorInitializers: BeforeComma 25 | IncludeBlocks: Preserve 26 | -------------------------------------------------------------------------------- /.github/labeler_content.yaml: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | # Add/remove 'bug' label if issue contains the words 'BUG'. 21 | 22 | bug: 23 | - '(BUG)' 24 | 25 | codeRefactor: 26 | - '(CODEREFACTOR)' 27 | 28 | infra: 29 | - '(INFRA)' 30 | 31 | 32 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/nextgen/jitlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | add_executable(JITLibTest JITLibTest.cpp) 21 | target_link_libraries(JITLibTest ${EXECUTE_TEST_LIBS}) 22 | add_test(JITLibTest ${EXECUTABLE_OUTPUT_PATH}/JITLibTest ${TEST_ARGS}) 23 | -------------------------------------------------------------------------------- /cpp/src/cider/util/filesystem/cider_path.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | namespace cider { 28 | std::string get_root_abs_path(); 29 | } 30 | -------------------------------------------------------------------------------- /ci/scripts/test_with_arrow_format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright(c) 2022-2023 Intel Corporation. 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BUILD_TYPE=${1:-'Debug'} 18 | TEST_ARGS='--use_cider_data_format' 19 | 20 | cd build-${BUILD_TYPE}/src/cider-velox/test 21 | filenames=$(ls -F | grep '*') 22 | 23 | start_time=`date +%s` 24 | for file in ${filenames};do 25 | { 26 | ./${file} ${TEST_ARGS} 27 | }& # muti thread 28 | done 29 | wait 30 | 31 | stop_time=`date +%s` 32 | echo "Test with Arrow format total time:`expr $stop_time - $start_time` s" 33 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/README.MD: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | This repo is target to be a JIT query engine plugin for Velox engine (and may support other query engine in the future). Currently, We use **OmnisciDB** as query codegen module, use **Substrait** as query plan protocol, use **Arrow C data interface** as data protocol. 4 | 5 | # Architecture overview 6 | 7 | To de added. 8 | 9 | # Contributing 10 | Before raising a PR, please run the following commands locally to make sure that your contribution follows the license and code style rules of this repo: 11 | * Please run `make header-fix-local` to fix license header 12 | * Please run `make format-fix-local` to fix code style 13 | 14 | Note: Please install the dependencies needed for PR check by running: `pip install regex black cmakelang` 15 | 16 | # License 17 | 18 | This repo is licensed under Apache 2.0 License. 19 | 20 | # Code style 21 | 22 | The code style has been defined in `.clang-format`. 23 | 24 | # Notice 25 | 26 | Scripts under script directory are copied from https://github.com/facebookincubator/velox. These scripts will check code style and license in order to keep consistency with velox. 27 | -------------------------------------------------------------------------------- /cpp/src/compression/benchmark/BenchmarkMain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #include "benchmark/benchmark.h" 23 | 24 | int main(int argc, char** argv) { 25 | benchmark::Initialize(&argc, argv); 26 | benchmark::RunSpecifiedBenchmarks(); 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /cpp/src/compression/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | # 21 | # common 22 | # 23 | 24 | if(ICL_WITH_QPL) 25 | add_subdirectory(qpl) 26 | endif() 27 | 28 | if(ICL_WITH_QAT) 29 | add_subdirectory(qat) 30 | endif() 31 | 32 | if(ICL_WITH_IGZIP) 33 | add_subdirectory(igzip) 34 | endif() 35 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/substrait/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(VELOX_SUBSTRAIT_CONVERTOR_SOURCES VeloxPlanFragmentToSubstraitPlan.cpp) 21 | add_library(velox_substrait_convertor ${VELOX_SUBSTRAIT_CONVERTOR_SOURCES}) 22 | target_link_libraries(velox_substrait_convertor velox_substrait_plan_converter) 23 | -------------------------------------------------------------------------------- /cpp/src/compression/common/qat/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | project(qat_common) 21 | 22 | set(QAT_COMMON_SOURCES qat_wrapper.c) 23 | 24 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") 25 | 26 | add_library(qat_common STATIC ${QAT_COMMON_SOURCES}) 27 | target_link_libraries(qat_common ${CMAKE_DL_LIBS}) 28 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/plan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | add_executable(CiderPlanValidatorTest CiderPlanValidatorTest.cpp) 21 | target_link_libraries(CiderPlanValidatorTest ${EXECUTE_TEST_LIBS}) 22 | add_test(CiderPlanValidatorTest 23 | ${EXECUTABLE_OUTPUT_PATH}/CiderPlanValidatorTest ${TEST_ARGS}) 24 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | version: 2 21 | updates: 22 | - package-ecosystem: "gitsubmodule" # See documentation for possible values 23 | directory: "/" # Location of package manifests 24 | schedule: 25 | interval: "daily" 26 | allow: 27 | - dependency-name: "thirdparty/velox" 28 | -------------------------------------------------------------------------------- /cpp/src/cider/include/cider/CiderSupportPlatType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #ifndef CIDER_CIDERSUPPORTPLATTYPE_H 23 | #define CIDER_CIDERSUPPORTPLATTYPE_H 24 | 25 | enum PlatformType { SubstraitPlatform, PrestoPlatform, SparkPlatform }; 26 | 27 | #endif // CIDER_CIDERSUPPORTPLATTYPE_H 28 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/module/CiderOptions.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #include 23 | 24 | DEFINE_bool(needs_error_check, false, "needs error check"); 25 | DEFINE_bool(dump_ir, false, "dump llvm ir"); 26 | DEFINE_bool(copy_elimination, true, "enable bare columns copy elimination"); 27 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/parser/BaseContext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | /** 23 | * @file BaseContext.h 24 | * @brief Base context element 25 | **/ 26 | 27 | #include "BaseContext.h" 28 | 29 | namespace generator { 30 | 31 | BaseContext::~BaseContext() {} 32 | 33 | } // namespace generator 34 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/planTransformerTest/CiderPlanTransformerIncludes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "PlanTranformerIncludes.h" 25 | #include "ciderTransformer/CiderPlanPatterns.h" 26 | #include "ciderTransformer/CiderPlanRewriter.h" 27 | #include "utils/CiderPlanRewriters.h" 28 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/substrait/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(CIDER_PLAN_SUBSTRAIT_SRCS SubstraitPlan.cpp) 21 | add_library(cider_plan_substrait_objlib OBJECT ${CIDER_PLAN_SUBSTRAIT_SRCS}) 22 | target_link_libraries(cider_plan_substrait_objlib substrait) 23 | list(APPEND LIB_CIDER_PLAN_DEPS $) 24 | -------------------------------------------------------------------------------- /cpp/src/cider/common/contrib/cityhash102/COPYING: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 Google, Inc. 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy 4 | // of this software and associated documentation files (the "Software"), to deal 5 | // in the Software without restriction, including without limitation the rights 6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | // copies of the Software, and to permit persons to whom the Software is 8 | // furnished to do so, subject to the following conditions: 9 | // 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // 13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | // THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /cpp/src/cider/util/cleanup_global_namespace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | #ifdef _WIN32 23 | 24 | #ifdef OPTIONAL 25 | #undef OPTIONAL 26 | #endif 27 | 28 | #ifdef ERROR 29 | #undef ERROR 30 | #endif 31 | 32 | #ifdef GetObject 33 | #undef GetObject 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /cpp/src/compression/common/igzip/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | # 21 | # IgzipCommon 22 | # 23 | 24 | project(igzip_common) 25 | 26 | set(IGZIP_COMMON_SOURCES igzip_wrapper.c) 27 | 28 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") 29 | 30 | add_library(igzip_common STATIC ${IGZIP_COMMON_SOURCES}) 31 | target_link_libraries(igzip_common ISAL::igzip) 32 | -------------------------------------------------------------------------------- /cpp/src/cider/include/cider/CiderInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #ifndef CIDER_CIDERINTERFACE_H 23 | #define CIDER_CIDERINTERFACE_H 24 | 25 | // user could include this file only instead of include below headers. 26 | #include "cider/CiderOptions.h" 27 | #include "cider/CiderTableSchema.h" 28 | 29 | #endif // CIDER_CIDERINTERFACE_H 30 | -------------------------------------------------------------------------------- /ci/scripts/intel_copyright_files.txt: -------------------------------------------------------------------------------- 1 | .github/* 2 | ci/* 3 | cpp/src/cider/benchmarks/* 4 | cpp/src/cider/examples/* 5 | cpp/src/cider/exec/module/* 6 | cpp/src/cider/include/* 7 | cpp/src/cider/tests/* 8 | cpp/src/cider-velox/* 9 | docs/* 10 | scripts/* 11 | *CMakeLists.txt 12 | *CiderAgg* 13 | *CiderRuntimeFunctions.h 14 | *CiderBitUtils.h 15 | *ArrowArrayBuilder.h 16 | *CiderParquetReader.* 17 | cpp/src/cider/exec/plan/builder/* 18 | cpp/src/cider/exec/plan/parser/*Utils* 19 | cpp/src/cider/exec/plan/parser/*Context* 20 | cpp/src/cider/exec/plan/parser/Plan* 21 | cpp/src/cider/exec/plan/parser/*Visitor* 22 | cpp/src/cider/exec/plan/parser/Substrait* 23 | cpp/src/cider/exec/plan/substrait/* 24 | cpp/src/cider/exec/plan/parser/ConverterHelper.* 25 | cpp/src/cider/exec/plan/validator/* 26 | cpp/src/cider/exec/nextgen/* 27 | cpp/src/cider/exec/processor/* 28 | cpp/src/cider/exec/operator/join/* 29 | cpp/src/cider/type/plan/*Expr.cpp 30 | cpp/src/cider/type/plan/ExprType.h 31 | cpp/src/cider/type/plan/InValues.cpp 32 | cpp/src/cider/exec/plan/lookup/FunctionLookupEngine.* 33 | cpp/src/cider/exec/plan/lookup/SubstraitFunctionCiderMappings.h 34 | cpp/src/cider/function/substrait/* 35 | Makefile 36 | cpp/src/compression/* 37 | cpp/src/cider/function/datetime/Cider* 38 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/lookup/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(CIDER_PLAN_FUNC_LOOKUP_SRCS FunctionLookupEngine.cpp) 21 | add_library(cider_plan_func_lookup_objlib OBJECT ${CIDER_PLAN_FUNC_LOOKUP_SRCS}) 22 | target_link_libraries(cider_plan_func_lookup_objlib SubstraitCpp::function) 23 | list(APPEND LIB_CIDER_PLAN_DEPS $) 24 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/processor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(PROCESSOR_SOURCE 21 | DefaultBatchProcessor.cpp StatelessProcessor.cpp StatefulProcessor.cpp 22 | JoinHandler.cpp DefaultJoinHashTableBuilder.cpp ExpressionEvaluator.cpp) 23 | 24 | add_library(cider_processor STATIC ${PROCESSOR_SOURCE}) 25 | target_link_libraries(cider_processor cider_plan nextgen) 26 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/builder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(CIDER_PLAN_EXPR_BUILDER_SRCS SubstraitExprBuilder.cpp) 21 | add_library(cider_plan_expr_builder_objlib OBJECT 22 | ${CIDER_PLAN_EXPR_BUILDER_SRCS}) 23 | target_link_libraries(cider_plan_expr_builder_objlib substrait) 24 | list(APPEND LIB_CIDER_PLAN_DEPS 25 | $) 26 | -------------------------------------------------------------------------------- /cpp/src/cider/common/base/time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) 2016-2022 ClickHouse, Inc. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | #if defined(OS_DARWIN) || defined(OS_SUNOS) 28 | #define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC 29 | #elif defined(OS_FREEBSD) 30 | #define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC_FAST 31 | #endif 32 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/validator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(CIDER_PLAN_VALIDATOR_SRCS CiderPlanValidator.cpp SingleNodeValidator.cpp) 21 | add_library(cider_plan_validator_objlib OBJECT ${CIDER_PLAN_VALIDATOR_SRCS}) 22 | target_link_libraries(cider_plan_validator_objlib substrait 23 | SubstraitCpp::function) 24 | list(APPEND LIB_CIDER_PLAN_DEPS $) 25 | -------------------------------------------------------------------------------- /cpp/src/cider/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | find_package(Protobuf REQUIRED) 21 | 22 | add_executable(ExpressionEvalExample ExpressionEvalExample.cpp) 23 | target_link_libraries(ExpressionEvalExample cider_static cider_function 24 | ${Protobuf_LIBRARIES} fmt::fmt) 25 | 26 | add_executable(CiderHashTableExample CiderHashTableExample.cpp) 27 | target_link_libraries(CiderHashTableExample cider_static) 28 | -------------------------------------------------------------------------------- /cpp/src/cider/type/plan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(cider_type_plan_source_files 21 | Analyzer.cpp 22 | Expr.cpp 23 | BinaryExpr.cpp 24 | UnaryExpr.cpp 25 | ColumnExpr.cpp 26 | ConstantExpr.cpp 27 | CaseExpr.cpp 28 | LikeExpr.cpp 29 | DateExpr.cpp 30 | StringOpExpr.cpp 31 | InValues.cpp 32 | FunctionExpr.cpp) 33 | add_library(cider_type_plan OBJECT ${cider_type_plan_source_files}) 34 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/planTransformer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(VELOX_PLAN_TRANSFORMER_SOURCES 21 | PlanNodeAddr.cpp 22 | PlanUtil.cpp 23 | PlanBranches.cpp 24 | PlanTransformer.cpp 25 | PlanPattern.cpp 26 | PlanRewriter.cpp 27 | SequencePlanPattern.cpp) 28 | 29 | add_library(velox_plan_transformer ${VELOX_PLAN_TRANSFORMER_SOURCES}) 30 | 31 | target_link_libraries(velox_plan_transformer velox_core) 32 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 19 | 20 | # Security Policy 21 | 22 | ## Report a Vulnerability 23 | 24 | Please report security issues or vulnerabilities to the [Intel® Security Center]. 25 | 26 | For more information on how Intel® works to resolve security issues, see 27 | [Vulnerability Handling Guidelines]. 28 | 29 | [Intel® Security Center]:https://www.intel.com/security 30 | 31 | [Vulnerability Handling Guidelines]:https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html 32 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/ciderTransformer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(CIDER_PLAN_TRANSFORMER_SOURCES 21 | CiderPlanPatterns.cpp CiderPlanUtil.cpp CiderPlanRewriter.cpp 22 | CiderPlanTransformerFactory.cpp CiderPlanTransformerOptions.cpp) 23 | 24 | add_library(cider_plan_transformer ${CIDER_PLAN_TRANSFORMER_SOURCES}) 25 | 26 | target_link_libraries(cider_plan_transformer velox_plan_transformer 27 | velox_substrait_convertor cider_static) 28 | -------------------------------------------------------------------------------- /cpp/src/cider/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # Copyright (c) 2016-2022 ClickHouse, Inc. 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | 21 | add_subdirectory(contrib) 22 | 23 | set(cider_hashtable_source_files interpreters/AggregationHashTable.cpp 24 | base/StringRef.cpp) 25 | 26 | add_library(cider_hashtable ${cider_hashtable_source_files}) 27 | 28 | target_link_libraries(cider_hashtable ch_contrib::cityhash) 29 | 30 | target_compile_options(cider_hashtable PRIVATE -msse4.2 -msse2) 31 | -------------------------------------------------------------------------------- /cpp/src/cider/common/base/StringRef.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) 2016-2022 ClickHouse, Inc. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #include 24 | 25 | #include "StringRef.h" 26 | 27 | namespace cider::hashtable { 28 | 29 | std::ostream& operator<<(std::ostream& os, const StringRef& str) { 30 | if (str.data) { 31 | os.write(str.data, str.size); 32 | } 33 | 34 | return os; 35 | } 36 | } // namespace cider::hashtable 37 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/ciderTransformer/CiderPlanTransformerOptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | DECLARE_bool(enable_flatten_dictionary_encoding); 26 | DECLARE_bool(left_deep_join_pattern); 27 | DECLARE_bool(compound_pattern); 28 | DECLARE_bool(filter_pattern); 29 | DECLARE_bool(project_pattern); 30 | DECLARE_bool(partial_agg_pattern); 31 | DECLARE_bool(top_n_pattern); 32 | DECLARE_bool(order_by_pattern); 33 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/jitlib/llvmjit/LLVMJITTargets.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #ifndef JITLIB_LLVMJIT_LLVMJITTARGETS_H 22 | #define JITLIB_LLVMJIT_LLVMJITTARGETS_H 23 | 24 | #include "cider/CiderOptions.h" 25 | 26 | namespace llvm { 27 | class TargetMachine; 28 | } 29 | 30 | namespace cider::jitlib { 31 | llvm::TargetMachine* buildTargetMachine(const CompilationOptions& co); 32 | } // namespace cider::jitlib 33 | 34 | #endif // JITLIB_LLVMJIT_LLVMJITTARGETS_H 35 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/benchmark/tpch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | add_executable(TpchInMemBenchmark TpchInMemBenchmark.cpp TpchInMemBuilder.cpp) 21 | target_link_libraries( 22 | TpchInMemBenchmark ${CIDER_BENCHMARKS_SUPPLEMENT_DEPENDENCIES} 23 | ${VELOX_BENCHMARKS_DEPENDENCIES}) 24 | 25 | add_executable(TpchFromFileBenchmark TpchFromFileBenchmark.cpp) 26 | target_link_libraries( 27 | TpchFromFileBenchmark ${CIDER_BENCHMARKS_SUPPLEMENT_DEPENDENCIES} 28 | ${VELOX_BENCHMARKS_DEPENDENCIES}) 29 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/55.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT i_brand_id brand_id, 20 | i_brand brand, 21 | sum(ss_ext_sales_price) ext_price 22 | FROM date_dim, 23 | store_sales, 24 | item 25 | WHERE d_date_sk = ss_sold_date_sk 26 | AND ss_item_sk = i_item_sk 27 | AND i_manager_id=28 28 | AND d_moy=11 29 | AND d_year=1999 30 | GROUP BY i_brand, 31 | i_brand_id 32 | ORDER BY ext_price DESC, 33 | i_brand_id 34 | LIMIT 100 ; 35 | 36 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/planTransformerTest/utils/PlanTansformerTestUtil.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | 27 | #include "VeloxTypes.h" 28 | 29 | namespace facebook::velox::plugin::plantransformer::test { 30 | class PlanTansformerTestUtil { 31 | public: 32 | static bool comparePlanSequence(VeloxPlanNodePtr first, VeloxPlanNodePtr second); 33 | }; 34 | } // namespace facebook::velox::plugin::plantransformer::test 35 | -------------------------------------------------------------------------------- /ci/scripts/prepare_source_code_cicd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright(c) 2022-2023 Intel Corporation. 3 | 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | 21 | 22 | PRESTO_LOCAL_PATH=/workspace/github-workspace/presto 23 | rm -rf ${PRESTO_LOCAL_PATH} 24 | PATCH_NAME=presto-bdtk-67b3bf.patch 25 | PATCH_PATH=$(pwd)/ci/scripts/${PATCH_NAME} 26 | PRESTO_BDTK_COMMIT_ID=67b3bf5251f81131328dbd183685fb50e5a7ac2c 27 | 28 | git clone https://github.com/prestodb/presto.git ${PRESTO_LOCAL_PATH} 29 | pushd ${PRESTO_LOCAL_PATH} 30 | git checkout -b cider ${PRESTO_BDTK_COMMIT_ID} 31 | git apply ${PATCH_PATH} 32 | popd 33 | 34 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/96.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT count(*) 20 | FROM store_sales , 21 | household_demographics, 22 | time_dim, 23 | store 24 | WHERE ss_sold_time_sk = time_dim.t_time_sk 25 | AND ss_hdemo_sk = household_demographics.hd_demo_sk 26 | AND ss_store_sk = s_store_sk 27 | AND time_dim.t_hour = 20 28 | AND time_dim.t_minute >= 30 29 | AND household_demographics.hd_dep_count = 7 30 | AND store.s_store_name = 'ese' 31 | ORDER BY count(*) 32 | LIMIT 100; 33 | 34 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/planTransformerTest/PlanTranformerIncludes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "utils/PlanTransformerTestBase.h" 25 | #include "utils/TestPlanRewriters.h" 26 | #include "utils/VeloxPlanSequenceBuilder.h" 27 | 28 | namespace facebook::velox::plugin::plantransformer::test { 29 | 30 | using VeloxPlanBuilder = 31 | facebook::velox::plugin::plantransformer::test::VeloxPlanSequenceBuilder; 32 | 33 | } // namespace facebook::velox::plugin::plantransformer::test 34 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/planTransformerTest/utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | add_library( 21 | velox_plan_transformer_test_utils 22 | FilterProjectSwapTransformer.cpp 23 | PlanTansformerTestUtil.cpp 24 | PlanTransformerTestBase.cpp 25 | InvalidPlanPatterns.h 26 | TestPlanRewriters.h 27 | VeloxTypes.h 28 | CiderPlanRewriters.cpp) 29 | 30 | target_link_libraries( 31 | velox_plan_transformer_test_utils 32 | velox_plan_transformer 33 | velox_type 34 | velox_exec 35 | gtest 36 | velox_plugin 37 | velox_core) 38 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q6.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Forecasting Revenue Change Query (Q6) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | select 24 | sum(extendedprice * discount) as revenue 25 | from 26 | lineitem 27 | where 28 | shipdate >= '1994-01-01' 29 | and shipdate < cast(date '1994-01-01' + interval '1' year as varchar) 30 | and discount between decimal '0.06' - decimal '0.01' and decimal '0.06' + decimal '0.01' 31 | and quantity < 24; 32 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/module/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(SRC_FILE CiderTypes.cpp CiderOptions.cpp) 21 | add_library(cider_module STATIC ${SRC_FILE}) 22 | target_link_libraries(cider_module ${GFLAGS_LIBRARIES}) 23 | 24 | # set_target_properties(cider PROPERTIES VERSION "${BDTK_FULL_SO_VERSION}" 25 | # SOVERSION "${BDTK_SO_VERSION}") 26 | 27 | # install( TARGETS cider DESTINATION "lib" COMPONENT "CIDER") install( FILES 28 | # CiderInterface.h CiderOptions.h CiderTableSchema.h CiderException.h 29 | # DESTINATION "Cider" COMPONENT "include") 30 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/context/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | set(CONTEXT_SOURCE 20 | ${CMAKE_CURRENT_LIST_DIR}/CodegenContext.cpp 21 | ${CMAKE_CURRENT_LIST_DIR}/RuntimeContext.cpp 22 | ${CMAKE_CURRENT_LIST_DIR}/Batch.cpp 23 | ${CMAKE_CURRENT_LIST_DIR}/Buffer.cpp 24 | ${CMAKE_CURRENT_LIST_DIR}/CiderSet.cpp 25 | ../../../exec/module/batch/CiderBatchUtils.cpp 26 | ../../../exec/module/batch/CiderArrowBufferHolder.cpp) 27 | 28 | add_library(cider_context OBJECT ${CONTEXT_SOURCE}) 29 | add_dependencies(cider_context substrait) 30 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/jitlib/base/Options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #ifndef JITLIB_BASE_OPTIONS_H 22 | #define JITLIB_BASE_OPTIONS_H 23 | 24 | namespace cider::jitlib { 25 | // compilation config info 26 | struct CompilationOptions { 27 | bool optimize_ir = true; 28 | bool aggressive_jit_compile = true; 29 | bool dump_ir = false; 30 | bool enable_vectorize = true; 31 | bool enable_avx2 = true; 32 | bool enable_avx512 = false; 33 | }; 34 | }; // namespace cider::jitlib 35 | 36 | #endif // JITLIB_BASE_OPTIONS_H 37 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/jitlib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | set(LLVMJIT_SOURCE 20 | ${CMAKE_CURRENT_LIST_DIR}/llvmjit/LLVMJITEngine.cpp 21 | ${CMAKE_CURRENT_LIST_DIR}/llvmjit/LLVMJITFunction.cpp 22 | ${CMAKE_CURRENT_LIST_DIR}/llvmjit/LLVMJITControlFlow.cpp 23 | ${CMAKE_CURRENT_LIST_DIR}/llvmjit/LLVMJITModule.cpp 24 | ${CMAKE_CURRENT_LIST_DIR}/llvmjit/LLVMJITTargets.cpp 25 | ${CMAKE_CURRENT_LIST_DIR}/llvmjit/LLVMJITValue.cpp) 26 | 27 | add_library(jitlib STATIC ${LLVMJIT_SOURCE}) 28 | target_link_libraries(jitlib ${llvm_libs} cider_util) 29 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q17.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Small-Quantity-Order Revenue Query (Q17) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | select 24 | sum(l.extendedprice) / 7.0 as avg_yearly 25 | from 26 | lineitem as l, 27 | part as p 28 | where 29 | p.partkey = l.partkey 30 | and p.brand = 'Brand#23' 31 | and p.container = 'MED BOX' 32 | and l.quantity < ( 33 | select 34 | 0.2 * avg(quantity) 35 | from 36 | lineitem 37 | where 38 | partkey = p.partkey 39 | ); 40 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/planTransformerTest/utils/VeloxPlanSequenceBuilder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "../../CiderPlanBuilder.h" 25 | #include "planTransformer/PlanNodeAddr.h" 26 | 27 | namespace facebook::velox::plugin::plantransformer::test { 28 | 29 | using facebook::velox::plugin::test::CiderPlanBuilder; 30 | 31 | class VeloxPlanSequenceBuilder : public CiderPlanBuilder { 32 | public: 33 | const VeloxPlanNodePtr& planNode(); 34 | }; 35 | 36 | } // namespace facebook::velox::plugin::plantransformer::test 37 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/jitlib/JITLib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #ifndef NEXTGEN_JITLIB_JITLIB_H 22 | #define NEXTGEN_JITLIB_JITLIB_H 23 | 24 | #include "exec/nextgen/jitlib/llvmjit/LLVMJITControlFlow.h" 25 | #include "exec/nextgen/jitlib/llvmjit/LLVMJITFunction.h" 26 | #include "exec/nextgen/jitlib/llvmjit/LLVMJITModule.h" 27 | #include "exec/nextgen/jitlib/llvmjit/LLVMJITValue.h" 28 | 29 | #include "exec/nextgen/jitlib/base/JITControlFlow.h" 30 | #include "exec/nextgen/jitlib/base/JITValueOperations.h" 31 | 32 | #endif // NEXTGEN_JITLIB_JITLIB_H 33 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/processor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | add_executable(CiderBatchProcessorTest CiderBatchProcessorTest.cpp) 21 | target_link_libraries(CiderBatchProcessorTest ${EXECUTE_TEST_LIBS}) 22 | add_test(CiderStatelessProcessorTest 23 | ${EXECUTABLE_OUTPUT_PATH}/CiderBatchProcessorTest) 24 | 25 | add_executable(HashJoinBatchProcessorTest HashJoinBatchProcessorTest.cpp) 26 | target_link_libraries(HashJoinBatchProcessorTest ${EXECUTE_TEST_LIBS}) 27 | add_test(CiderStatelessProcessorTest 28 | ${EXECUTABLE_OUTPUT_PATH}/HashJoinBatchProcessorTest) 29 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/template/DynamicWatchdog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #ifndef QUERYENGINE_DYNAMICWATCHDOG_H 24 | #define QUERYENGINE_DYNAMICWATCHDOG_H 25 | 26 | #include "type/data/funcannotations.h" 27 | 28 | #include 29 | 30 | enum DynamicWatchdogFlags { DW_DEADLINE = 0, DW_ABORT = -1, DW_RESET = -2 }; 31 | 32 | extern "C" RUNTIME_EXPORT uint64_t dynamic_watchdog_init(unsigned ms_budget); 33 | 34 | extern "C" RUNTIME_EXPORT bool dynamic_watchdog(); 35 | 36 | #endif // QUERYENGINE_DYNAMICWATCHDOG_H 37 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q14.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Promotion Effect Query (Q14) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | select 24 | 100.00 * sum(case 25 | when p.type like 'PROMO%' 26 | then l.extendedprice * (1 - l.discount) 27 | else 0 28 | end) / sum(l.extendedprice * (1 - l.discount)) as promo_revenue 29 | from 30 | lineitem as l, 31 | part as p 32 | where 33 | l.partkey = p.partkey 34 | and l.shipdate >= '1995-09-01' 35 | and l.shipdate < cast(date '1995-09-01' + interval '1' month as varchar); 36 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/parser/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(CIDER_PLAN_PARSER_SRCS 21 | ParserNode.cpp 22 | Translator.cpp 23 | SubstraitToAnalyzerExpr.cpp 24 | SubstraitToRelAlgExecutionUnit.cpp 25 | ConverterHelper.cpp 26 | BaseContext.cpp 27 | PlanContext.cpp 28 | VariableContext.cpp 29 | RelVisitor.cpp 30 | PlanRelVisitor.cpp) 31 | add_library(cider_plan_parser_objlib OBJECT ${CIDER_PLAN_PARSER_SRCS}) 32 | target_link_libraries(cider_plan_parser_objlib substrait SubstraitCpp::function) 33 | list(APPEND LIB_CIDER_PLAN_DEPS $) 34 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/03.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT dt.d_year, 20 | item.i_brand_id brand_id, 21 | item.i_brand brand, 22 | sum(ss_ext_sales_price) sum_agg 23 | FROM date_dim dt, 24 | store_sales, 25 | item 26 | WHERE dt.d_date_sk = store_sales.ss_sold_date_sk 27 | AND store_sales.ss_item_sk = item.i_item_sk 28 | AND item.i_manufact_id = 128 29 | AND dt.d_moy=11 30 | GROUP BY dt.d_year, 31 | item.i_brand, 32 | item.i_brand_id 33 | ORDER BY dt.d_year, 34 | sum_agg DESC, 35 | brand_id 36 | LIMIT 100; 37 | 38 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/template/TypePunning.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #ifndef QUERYENGINE_TYPEPUNNING_H 24 | #define QUERYENGINE_TYPEPUNNING_H 25 | 26 | #include "type/data/funcannotations.h" 27 | 28 | // Mark ptr as safe for type-punning operations. We need it whenever we want to 29 | // interpret a sequence of bytes as float / double through a reinterpret_cast. 30 | 31 | template 32 | FORCE_INLINE T __attribute__((__may_alias__)) * may_alias_ptr(T* ptr) { 33 | return ptr; 34 | } 35 | 36 | #endif // QUERYENGINE_TYPEPUNNING_H 37 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/planTransformer/PlanPattern.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #include "PlanPattern.h" 23 | 24 | namespace facebook::velox::plugin::plantransformer { 25 | std::pair PlanPattern::match( 26 | BranchSrcToTargetIterator& branchIte) const { 27 | std::pair result = matchFromSrc(branchIte); 28 | if (result.first) { 29 | if (!result.second.isValid()) { 30 | VELOX_UNSUPPORTED("Match result is invalid."); 31 | } 32 | } 33 | return result; 34 | } 35 | } // namespace facebook::velox::plugin::plantransformer 36 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q13.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Customer Distribution Query (Q13) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | select 24 | c_count, 25 | count(*) as custdist 26 | from 27 | ( 28 | select 29 | c.custkey, 30 | count(o.orderkey) 31 | from 32 | customer c left outer join orders o on 33 | c.custkey = o.custkey 34 | and o.comment not like '%special%requests%' 35 | group by 36 | c.custkey 37 | ) as c_orders (c_custkey, c_count) 38 | group by 39 | c_count 40 | order by 41 | custdist desc, 42 | c_count desc; 43 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/utils/ReferenceCounter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #ifndef NEXTGEN_REF_COUNTER_H 22 | #define NEXTGEN_REF_COUNTER_H 23 | 24 | #include 25 | 26 | namespace cider::exec::nextgen::utils { 27 | class ReferenceCounter { 28 | protected: 29 | ReferenceCounter() : ref_count_(0) {} 30 | 31 | virtual ~ReferenceCounter() = default; 32 | 33 | size_t getRefNum() { return ref_count_; } 34 | 35 | void addRef() { ++ref_count_; } 36 | 37 | void decRef() { --ref_count_; } 38 | 39 | size_t ref_count_; 40 | }; 41 | } // namespace cider::exec::nextgen::utils 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /cpp/src/cider/function/scalar/ExtensionFunctionsTesting.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #define CPU_DEVICE_CODE 0x637075 // 'cpu' in hex 24 | 25 | EXTENSION_NOINLINE 26 | int32_t ct_device_selection_udf_any(int32_t input) { 27 | return CPU_DEVICE_CODE; 28 | } 29 | 30 | EXTENSION_NOINLINE 31 | int32_t ct_device_selection_udf_cpu__cpu_(int32_t input) { 32 | return CPU_DEVICE_CODE; 33 | } 34 | 35 | EXTENSION_NOINLINE 36 | int32_t ct_device_selection_udf_both__cpu_(int32_t input) { 37 | return CPU_DEVICE_CODE; 38 | } 39 | 40 | #undef CPU_DEVICE_CODE 41 | -------------------------------------------------------------------------------- /cpp/src/cider/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | find_package(Parquet REQUIRED) 21 | find_package(Arrow REQUIRED) 22 | 23 | set(cider_util_source_files 24 | filesystem/cider_fs.cpp 25 | filesystem/cider_path.cpp 26 | Logger.cpp 27 | Datum.cpp 28 | StringTransform.cpp 29 | DateTimeParser.cpp 30 | misc.cpp) 31 | 32 | add_library(cider_util ${cider_util_source_files}) 33 | 34 | target_link_libraries(cider_util fmt glog) 35 | 36 | add_library(cider_parquet_reader CiderParquetReader.cpp) 37 | target_link_libraries(cider_parquet_reader cider_util arrow_shared 38 | parquet_shared dl) 39 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/benchmark/expression/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(EXPRESSION_TEST_LIBS ${CIDER_BENCHMARKS_SUPPLEMENT_DEPENDENCIES} 21 | ${VELOX_BENCHMARKS_DEPENDENCIES}) 22 | 23 | add_executable(ArithmeticAndComparison ArithmeticAndComparison.cpp) 24 | target_link_libraries(ArithmeticAndComparison ${EXPRESSION_TEST_LIBS}) 25 | 26 | add_executable(PipelineOperator PipelineOperator.cpp) 27 | target_link_libraries(PipelineOperator ${EXPRESSION_TEST_LIBS}) 28 | 29 | add_executable(StringFunctionBenchmark StringFunctionBenchmark.cpp) 30 | target_link_libraries(StringFunctionBenchmark ${EXPRESSION_TEST_LIBS}) 31 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/52.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT dt.d_year, 20 | item.i_brand_id brand_id, 21 | item.i_brand brand, 22 | sum(ss_ext_sales_price) ext_price 23 | FROM date_dim dt, 24 | store_sales, 25 | item 26 | WHERE dt.d_date_sk = store_sales.ss_sold_date_sk 27 | AND store_sales.ss_item_sk = item.i_item_sk 28 | AND item.i_manager_id = 1 29 | AND dt.d_moy=11 30 | AND dt.d_year=2000 31 | GROUP BY dt.d_year, 32 | item.i_brand, 33 | item.i_brand_id 34 | ORDER BY dt.d_year, 35 | ext_price DESC, 36 | brand_id 37 | LIMIT 100 ; 38 | 39 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/ciderTransformer/CiderPlanTransformerFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #pragma once 22 | 23 | #include "../planTransformer/PlanTransformer.h" 24 | #include "CiderPlanTransformerOptions.h" 25 | 26 | namespace facebook::velox::plugin::plantransformer { 27 | class CiderPlanTransformerFactory { 28 | public: 29 | CiderPlanTransformerFactory() {} 30 | std::shared_ptr getTransformer(VeloxPlanNodePtr root); 31 | void registerCiderPattern(); 32 | 33 | private: 34 | PlanTransformerFactory ciderTransformerFactory_; 35 | }; 36 | } // namespace facebook::velox::plugin::plantransformer 37 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/utils/CiderInt128.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #ifndef CIDER_CIDERDECIMAL128_H 23 | #define CIDER_CIDERDECIMAL128_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | class CiderInt128Utils { 30 | public: 31 | static std::string Int128ToString(__int128_t input); 32 | static std::string Decimal128ToString(__int128_t input, 33 | uint8_t precision, 34 | uint8_t scale); 35 | static double Decimal128ToDouble(__int128_t input, uint8_t precision, uint8_t scale); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q4.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Order Priority Checking Query (Q4) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | select 24 | o.orderkey, 25 | count(*) as order_count 26 | from 27 | orders as o 28 | where 29 | o.orderdate >= '1993-07-01' 30 | and o.orderdate < cast(date '1993-07-01' + interval '3' month as varchar) 31 | and exists ( 32 | select 33 | * 34 | from 35 | lineitem as l 36 | where 37 | l.orderkey = o.orderkey 38 | and l.commitdate < l.receiptdate 39 | ) 40 | group by 41 | o.orderkey 42 | limit 10; 43 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/Nextgen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #ifndef EXEC_NEXTGEN_NEXTGEN_H 22 | #define EXEC_NEXTGEN_NEXTGEN_H 23 | 24 | #include "exec/nextgen/context/RuntimeContext.h" 25 | #include "exec/nextgen/parsers/Parser.h" 26 | #include "exec/nextgen/transformer/Transformer.h" 27 | 28 | namespace cider::exec::nextgen { 29 | 30 | using QueryFunc = int32_t (*)(int8_t*, int8_t*); 31 | 32 | std::unique_ptr compile( 33 | RelAlgExecutionUnit& eu, 34 | const CodegenOptions& codegen_options = CodegenOptions{}); 35 | 36 | } // namespace cider::exec::nextgen 37 | 38 | #endif // EXEC_NEXTGEN_NEXTGEN_H 39 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/nextgen/functional/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | file(GLOB next_gen_test_files ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) 21 | foreach(next_gen_test_file ${next_gen_test_files}) 22 | string(REGEX MATCH "functional/.*" test_relative_path ${next_gen_test_file}) 23 | string(REGEX REPLACE "functional/" "" target_name ${test_relative_path}) 24 | string(REGEX REPLACE ".cpp" "" target_name ${target_name}) 25 | add_executable(${target_name} ${next_gen_test_file}) 26 | target_link_libraries(${target_name} ${EXECUTE_TEST_LIBS}) 27 | add_test(${target_name} ${EXECUTABLE_OUTPUT_PATH}/${target_name}) 28 | endforeach() 29 | 30 | add_subdirectory(benchmark) 31 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/parsers/Parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #ifndef NEXTGEN_PARSERS_PARSER_H 23 | #define NEXTGEN_PARSERS_PARSER_H 24 | 25 | #include "exec/nextgen/operators/OpNode.h" 26 | #include "exec/template/RelAlgExecutionUnit.h" 27 | 28 | namespace cider::exec::nextgen::parsers { 29 | 30 | /// \brief A parser convert from the plan fragment to an OpPipeline 31 | // source--> filter -->sink 32 | operators::OpPipeline toOpPipeline(RelAlgExecutionUnit& eu, 33 | context::CodegenContext& context); 34 | 35 | } // namespace cider::exec::nextgen::parsers 36 | 37 | #endif // NEXTGEN_PARSERS_PARSER_H 38 | -------------------------------------------------------------------------------- /cpp/src/cider/util/DateConverters.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | #include "function/datetime/ExtractFromTime.h" 27 | 28 | namespace DateConverters { 29 | 30 | inline int64_t get_epoch_days_from_seconds(const int64_t seconds) { 31 | return (seconds < 0 && seconds % kSecsPerDay != 0) ? (seconds / kSecsPerDay) - 1 32 | : seconds / kSecsPerDay; 33 | } 34 | 35 | inline int64_t get_epoch_seconds_from_days(const int64_t days) { 36 | return days * kSecsPerDay; 37 | } 38 | 39 | } // namespace DateConverters 40 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/processor/StatelessProcessor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #ifndef CIDER_STATELESS_PROCESSOR_H 23 | #define CIDER_STATELESS_PROCESSOR_H 24 | 25 | #include "exec/processor/DefaultBatchProcessor.h" 26 | 27 | namespace cider::exec::processor { 28 | 29 | class StatelessProcessor : public DefaultBatchProcessor { 30 | public: 31 | using DefaultBatchProcessor::DefaultBatchProcessor; 32 | 33 | void getResult(ArrowArray& array, ArrowSchema& schema) override; 34 | 35 | Type getProcessorType() const override { return Type::kStateless; }; 36 | }; 37 | 38 | } // namespace cider::exec::processor 39 | 40 | #endif // CIDER_STATELESS_PROCESSOR_H 41 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/32.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT sum(cs_ext_discount_amt) AS "excess discount amount" 20 | FROM catalog_sales , 21 | item , 22 | date_dim 23 | WHERE i_manufact_id = 977 24 | AND i_item_sk = cs_item_sk 25 | AND d_date BETWEEN '2000-01-27' AND cast('2000-04-26' AS date) 26 | AND d_date_sk = cs_sold_date_sk 27 | AND cs_ext_discount_amt > 28 | ( SELECT 1.3 * avg(cs_ext_discount_amt) 29 | FROM catalog_sales , 30 | date_dim 31 | WHERE cs_item_sk = i_item_sk 32 | AND d_date BETWEEN '2000-01-27' AND cast('2000-04-26' AS date) 33 | AND d_date_sk = cs_sold_date_sk ) 34 | LIMIT 100; 35 | 36 | -------------------------------------------------------------------------------- /.github/workflows/pr-title-checker.yml: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | name: "PR Title Checker" 21 | 22 | on: 23 | pull_request_target: 24 | types: 25 | - opened 26 | - edited 27 | - synchronize 28 | - labeled 29 | - unlabeled 30 | 31 | jobs: 32 | pr-title-check: 33 | runs-on: self-hosted 34 | 35 | steps: 36 | - uses: actions/checkout@v2 37 | 38 | - name: Check pr title 39 | uses: actions/github-script@v3 40 | with: 41 | github-token: ${{secrets.GITHUB_TOKEN}} 42 | script: | 43 | const script = require(`${{github.workspace}}/.github/config_files/title_check.js`) 44 | script({github, context}) 45 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q3.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Shipping Priority Query (Q3) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | select 24 | l.orderkey, 25 | sum(l.extendedprice * (1 - l.discount)) as revenue, 26 | o.orderdate, 27 | o.shippriority 28 | from 29 | customer as c, 30 | orders as o, 31 | lineitem as l 32 | where 33 | c.mktsegment = 'BUILDING' 34 | and c.custkey = o.custkey 35 | and l.orderkey = o.orderkey 36 | and o.orderdate < '1995-03-15' 37 | and l.shipdate > '1995-03-15' 38 | group by 39 | l.orderkey, 40 | o.orderdate, 41 | o.shippriority 42 | order by 43 | revenue desc, 44 | o.orderdate 45 | limit 10; 46 | -------------------------------------------------------------------------------- /cpp/src/cider/type/plan/ColumnExpr.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #include "type/plan/ColumnExpr.h" 22 | 23 | namespace Analyzer { 24 | using namespace cider::jitlib; 25 | 26 | void ColumnVar::initAutoVectorizeFlag() { 27 | auto_vectorizable_ = isVectorizableType(type_info.get_type()); 28 | } 29 | 30 | JITExprValue& ColumnVar::codegen(CodegenContext& context) { 31 | return get_expr_value(); 32 | } 33 | 34 | JITExprValue& OutputColumnVar::codegen(CodegenContext& context) { 35 | if (auto& expr_value = get_expr_value()) { 36 | return expr_value; 37 | } 38 | 39 | expr_var_ = col_->codegen(context); 40 | 41 | return get_expr_value(); 42 | } 43 | 44 | } // namespace Analyzer 45 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/transformer/Transformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #ifndef CIDER_EXEC_NEXTGEN_TRANSFORMER_H 23 | #define CIDER_EXEC_NEXTGEN_TRANSFORMER_H 24 | 25 | #include "exec/nextgen/operators/OpNode.h" 26 | 27 | namespace cider::exec::nextgen::transformer { 28 | /// \brief The Transformer class is responsible for transforming the OpPipeline to a 29 | /// translator 30 | class Transformer { 31 | public: 32 | static operators::TranslatorPtr toTranslator( 33 | operators::OpPipeline& pipeline, 34 | const CodegenOptions& co = CodegenOptions()); 35 | }; 36 | } // namespace cider::exec::nextgen::transformer 37 | 38 | #endif // CIDER_EXEC_NEXTGEN_TRANSFORMER_H 39 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/lookup/internals/functions_aggregate_generic.yaml: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | aggregate_functions: 4 | - name: "count" 5 | description: Count a set of values 6 | impls: 7 | - args: 8 | - name: overflow 9 | options: [SILENT, SATURATE, ERROR] 10 | required: false 11 | - name: x 12 | value: any 13 | nullability: DECLARED_OUTPUT 14 | decomposable: MANY 15 | intermediate: i64 16 | return: i64 17 | - name: "count" 18 | description: "Count a set of records (not field referenced)" 19 | impls: 20 | - args: 21 | - name: overflow 22 | options: [SILENT, SATURATE, ERROR] 23 | required: false 24 | nullability: DECLARED_OUTPUT 25 | decomposable: MANY 26 | intermediate: i64 27 | return: i64 28 | - name: "count" 29 | description: Count a set of values 30 | impls: 31 | - args: 32 | - name: overflow 33 | options: [SILENT, SATURATE, ERROR] 34 | required: false 35 | - name: x 36 | value: any 37 | nullability: DECLARED_OUTPUT 38 | decomposable: MANY 39 | intermediate: i64 40 | return: i32 41 | - name: "any_value" 42 | description: > 43 | Selects an arbitrary value from a group of values. 44 | 45 | If the input is empty, the function returns null. 46 | impls: 47 | - args: 48 | - name: x 49 | value: any 50 | nullability: DECLARED_OUTPUT 51 | return: any? 52 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/92.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT sum(ws_ext_discount_amt) AS "Excess Discount Amount" 20 | FROM web_sales, 21 | item, 22 | date_dim 23 | WHERE i_manufact_id = 350 24 | AND i_item_sk = ws_item_sk 25 | AND d_date BETWEEN '2000-01-27' AND cast('2000-04-26' AS date) 26 | AND d_date_sk = ws_sold_date_sk 27 | AND ws_ext_discount_amt > 28 | (SELECT 1.3 * avg(ws_ext_discount_amt) 29 | FROM web_sales, 30 | date_dim 31 | WHERE ws_item_sk = i_item_sk 32 | AND d_date BETWEEN '2000-01-27' AND cast('2000-04-26' AS date) 33 | AND d_date_sk = ws_sold_date_sk ) 34 | ORDER BY sum(ws_ext_discount_amt) 35 | LIMIT 100; 36 | 37 | -------------------------------------------------------------------------------- /cpp/src/cider/util/filesystem/cider_fs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | #include 27 | 28 | namespace cider { 29 | 30 | size_t file_size(const int fd); 31 | 32 | void* checked_mmap(const int fd, const size_t sz); 33 | 34 | void checked_munmap(void* addr, size_t length); 35 | 36 | int msync(void* addr, size_t length, bool async); 37 | 38 | int fsync(int fd); 39 | 40 | int open(const char* path, int flags, int mode); 41 | 42 | void close(const int fd); 43 | 44 | ::FILE* fopen(const char* filename, const char* mode); 45 | 46 | int get_page_size(); 47 | 48 | } // namespace cider 49 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/42.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT dt.d_year, 20 | item.i_category_id, 21 | item.i_category, 22 | sum(ss_ext_sales_price) 23 | FROM date_dim dt, 24 | store_sales, 25 | item 26 | WHERE dt.d_date_sk = store_sales.ss_sold_date_sk 27 | AND store_sales.ss_item_sk = item.i_item_sk 28 | AND item.i_manager_id = 1 29 | AND dt.d_moy=11 30 | AND dt.d_year=2000 31 | GROUP BY dt.d_year, 32 | item.i_category_id, 33 | item.i_category 34 | ORDER BY sum(ss_ext_sales_price) DESC,dt.d_year, 35 | item.i_category_id, 36 | item.i_category 37 | LIMIT 100 ; 38 | 39 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/nextgen/functional/benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) 21 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../utils) 22 | file(GLOB nextgen_benchmark_files ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) 23 | foreach(nextgen_benchmark_file ${nextgen_benchmark_files}) 24 | string(REGEX MATCH "benchmark/.*" test_relative_path 25 | ${nextgen_benchmark_file}) 26 | string(REGEX REPLACE "benchmark/" "" target_name ${test_relative_path}) 27 | string(REGEX REPLACE ".cpp" "" target_name ${target_name}) 28 | add_executable(${target_name} ${nextgen_benchmark_file}) 29 | target_link_libraries(${target_name} ${EXECUTE_TEST_LIBS}) 30 | endforeach() 31 | -------------------------------------------------------------------------------- /.github/labeler.yaml: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | API: 21 | - "cider/include/cider/**/*" 22 | 23 | cider: 24 | - "cider/examples/**/*" 25 | - "cider/include/**/*" 26 | - "cider/exec/**/*" 27 | - "cider/function/**/*" 28 | - "cider/type/**/*" 29 | - "cider/util/**/*" 30 | - "cider/CMakeLists.txt" 31 | 32 | velox_plugin: 33 | - "cider-velox/src/**/*" 34 | - "cider-velox/CMakeLists.txt" 35 | 36 | compression: 37 | - "compression/**/*" 38 | 39 | documentation: 40 | - "docs/**/*" 41 | - "**/**/*.MD" 42 | 43 | CICD: 44 | - "ci/**/*" 45 | - ".github/**/*" 46 | 47 | test: 48 | - "cider-velox/test/**/*" 49 | - "cider/tests/**/*" 50 | 51 | benchmark: 52 | - "cider-velox/benchmark/**/*" 53 | - "cider/benchmarks/**/*" 54 | 55 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/processor/StatelessProcessor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #include "exec/processor/StatelessProcessor.h" 23 | 24 | namespace cider::exec::processor { 25 | 26 | void StatelessProcessor::getResult(struct ArrowArray& array, struct ArrowSchema& schema) { 27 | if (!has_result_) { 28 | if (no_more_batch_) { 29 | // set state as finish if last batch has been processed and no more batch 30 | state_ = BatchProcessorState::kFinished; 31 | } 32 | array.length = 0; 33 | return; 34 | } 35 | 36 | has_result_ = false; 37 | 38 | auto output_batch = runtime_context_->getOutputBatch(); 39 | output_batch->move(schema, array); 40 | } 41 | 42 | } // namespace cider::exec::processor 43 | -------------------------------------------------------------------------------- /cpp/src/cider/function/hash/MurmurHash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #ifndef CIDER_FUNCTION_MURMURHASH_H 24 | #define CIDER_FUNCTION_MURMURHASH_H 25 | 26 | #include 27 | #include "type/data/funcannotations.h" 28 | 29 | extern "C" RUNTIME_EXPORT NEVER_INLINE RUNTIME_EXPORT uint32_t 30 | MurmurHash1(const void* key, int len, const uint32_t seed); 31 | 32 | extern "C" RUNTIME_EXPORT NEVER_INLINE RUNTIME_EXPORT uint64_t 33 | MurmurHash64A(const void* key, int len, uint64_t seed); 34 | 35 | extern "C" RUNTIME_EXPORT NEVER_INLINE RUNTIME_EXPORT uint32_t 36 | MurmurHash3(const void* key, int len, const uint32_t seed); 37 | 38 | #endif // CIDER_FUNCTION_MURMURHASH_H 39 | -------------------------------------------------------------------------------- /docs/scripts/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | # Minimal makefile for Sphinx documentation 21 | 22 | # You can set these variables from the command line, and also 23 | # from the environment for the first two. 24 | SPHINXOPTS ?= 25 | SPHINXBUILD ?= sphinx-build 26 | SOURCEDIR = source 27 | BUILDDIR = build 28 | 29 | # Put it first so that "make" without argument is like "make help". 30 | help: 31 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 32 | 33 | .PHONY: help Makefile 34 | 35 | # Catch-all target: route all unknown targets to Sphinx using the new 36 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 37 | %: Makefile 38 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 39 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/utils/FunctorUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | #ifndef NEXTGEN_UTILS_FUNCTORUTILS_H 22 | #define NEXTGEN_UTILS_FUNCTORUTILS_H 23 | 24 | #include 25 | 26 | namespace cider::exec::nextgen::utils { 27 | template 28 | struct RecursiveFunctor { 29 | template 30 | decltype(auto) operator()(Args&&... args) const { 31 | return func(*this, std::forward(args)...); 32 | } 33 | 34 | FuncT func; 35 | }; 36 | 37 | // Deduction guidance for usage likes RecursiveFunctor{[](){}}; 38 | template 39 | RecursiveFunctor(FuncT)->RecursiveFunctor; 40 | } // namespace cider::exec::nextgen::utils 41 | 42 | #endif // NEXTGEN_UTILS_FUNCTORUTILS_H 43 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/lookup/internals/unknown.yaml: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | types: 4 | - name: unknown 5 | scalar_functions: 6 | - name: "add" 7 | impls: 8 | - args: 9 | - value: unknown 10 | - value: unknown 11 | return: unknown 12 | - name: "subtract" 13 | impls: 14 | - args: 15 | - value: unknown 16 | - value: unknown 17 | return: unknown 18 | - name: "multiply" 19 | impls: 20 | - args: 21 | - value: unknown 22 | - value: unknown 23 | return: unknown 24 | - name: "divide" 25 | impls: 26 | - args: 27 | - value: unknown 28 | - value: unknown 29 | return: unknown 30 | - name: "modulus" 31 | impls: 32 | - args: 33 | - value: unknown 34 | - value: unknown 35 | return: unknown 36 | aggregate_functions: 37 | - name: "sum" 38 | impls: 39 | - args: 40 | - value: unknown 41 | intermediate: unknown 42 | return: unknown 43 | - name: "avg" 44 | impls: 45 | - args: 46 | - value: unknown 47 | intermediate: unknown 48 | return: unknown 49 | - name: "min" 50 | impls: 51 | - args: 52 | - value: unknown 53 | intermediate: unknown 54 | return: unknown 55 | - name: "max" 56 | impls: 57 | - args: 58 | - value: unknown 59 | intermediate: unknown 60 | return: unknown 61 | - name: "count" 62 | impls: 63 | - args: 64 | - value: unknown 65 | intermediate: unknown 66 | return: unknown 67 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/nextgen/operators/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | macro(add_opnode op_node_name) 21 | list(APPEND OPERATORS_SOURCE ${CMAKE_CURRENT_LIST_DIR}/${op_node_name}.cpp) 22 | endmacro(add_opnode) 23 | 24 | add_opnode(QueryFuncInitializer) 25 | add_opnode(FilterNode) 26 | add_opnode(ProjectNode) 27 | add_opnode(VectorizedFilterNode) 28 | add_opnode(VectorizedProjectNode) 29 | add_opnode(ColumnToRowNode) 30 | add_opnode(RowToColumnNode) 31 | add_opnode(AggregationNode) 32 | add_opnode(HashJoinNode) 33 | add_opnode(CrossJoinNode) 34 | add_opnode(LazyNode) 35 | add_opnode(StageNode) 36 | 37 | list(APPEND OPERATORS_SOURCE 38 | ${CMAKE_CURRENT_LIST_DIR}/extractor/AggExtractorBuilder.cpp) 39 | 40 | add_library(cider_operators OBJECT ${OPERATORS_SOURCE}) 41 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/hashtable/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | find_package(folly REQUIRED) 21 | 22 | set(CMAKE_CXX_FLAGS 23 | "${CMAKE_CXX_FLAGS} -mavx2 -mfma -mavx -mf16c -masm=intel -mlzcnt") 24 | 25 | set_and_check(FOLLY_INCLUDE_DIR /usr/local/include/folly) 26 | set_and_check(FOLLY_CMAKE_DIR /usr/local/lib/cmake/folly) 27 | if(NOT TARGET Folly::folly) 28 | include("${FOLLY_CMAKE_DIR}/folly-targets.cmake") 29 | endif() 30 | 31 | include_directories(${folly_INCLUDE_DIRS}) 32 | 33 | add_executable(CiderHashTableTest CiderHashTableTest.cpp) 34 | target_link_libraries(CiderHashTableTest ${EXECUTE_TEST_LIBS} 35 | ${FOLLY_LIBRARIES}) 36 | add_test(CiderHashTableTest ${EXECUTABLE_OUTPUT_PATH}/CiderHashTableTest 37 | ${TEST_ARGS}) 38 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/07.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT i_item_id, 20 | avg(ss_quantity) agg1, 21 | avg(ss_list_price) agg2, 22 | avg(ss_coupon_amt) agg3, 23 | avg(ss_sales_price) agg4 24 | FROM store_sales, 25 | customer_demographics, 26 | date_dim, 27 | item, 28 | promotion 29 | WHERE ss_sold_date_sk = d_date_sk 30 | AND ss_item_sk = i_item_sk 31 | AND ss_cdemo_sk = cd_demo_sk 32 | AND ss_promo_sk = p_promo_sk 33 | AND cd_gender = 'M' 34 | AND cd_marital_status = 'S' 35 | AND cd_education_status = 'College' 36 | AND (p_channel_email = 'N' 37 | OR p_channel_event = 'N') 38 | AND d_year = 2000 39 | GROUP BY i_item_id 40 | ORDER BY i_item_id 41 | LIMIT 100; 42 | 43 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/84.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT c_customer_id AS customer_id , 20 | concat(concat(coalesce(c_last_name, '') , ', '), coalesce(c_first_name, '')) AS customername 21 | FROM customer , 22 | customer_address , 23 | customer_demographics , 24 | household_demographics , 25 | income_band , 26 | store_returns 27 | WHERE ca_city = 'Edgewood' 28 | AND c_current_addr_sk = ca_address_sk 29 | AND ib_lower_bound >= 38128 30 | AND ib_upper_bound <= 38128 + 50000 31 | AND ib_income_band_sk = hd_income_band_sk 32 | AND cd_demo_sk = c_current_cdemo_sk 33 | AND hd_demo_sk = c_current_hdemo_sk 34 | AND sr_cdemo_sk = cd_demo_sk 35 | ORDER BY c_customer_id NULLS FIRST 36 | LIMIT 100; 37 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/parser/BaseContext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | /** 23 | * @file BaseContext.h 24 | * @brief Base context element 25 | **/ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | namespace generator { 32 | 33 | class RelVisitor; 34 | class GeneratorContext; 35 | 36 | enum ContextElementType { 37 | InputDescContextType, 38 | GroupbyContextType, 39 | JoinQualContextType, 40 | TargetContextType, 41 | FilterQualContextType 42 | }; 43 | 44 | class BaseContext { 45 | public: 46 | virtual ~BaseContext(); 47 | virtual void accept(std::shared_ptr rel_visitor_ptr) = 0; 48 | virtual void convert(std::shared_ptr ctx_ptr) = 0; 49 | }; 50 | 51 | } // namespace generator 52 | -------------------------------------------------------------------------------- /ci/docker/build-image.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright(c) 2022-2023 Intel Corporation. 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | 21 | # 22 | # build-image.sh - prepares a Docker image with -base to the Dockerfile 23 | 24 | set -e 25 | 26 | function usage { 27 | echo "Usage:" 28 | echo " build-image.sh " 29 | echo "where , for example, can be 'ubuntu-20.04', provided" \ 30 | "a Dockerfile named 'Dockerfile.ubuntu-20.04' exists in the" \ 31 | "current directory." 32 | } 33 | 34 | if [[ -z "$1" ]]; then 35 | usage 36 | exit 1 37 | fi 38 | 39 | if [[ ! -f "Dockerfile.$1" ]]; then 40 | echo "ERROR: wrong argument." 41 | usage 42 | exit 1 43 | fi 44 | 45 | docker build -t bdtk/$1 \ 46 | --build-arg http_proxy=$http_proxy \ 47 | --build-arg https_proxy=$https_proxy \ 48 | -f Dockerfile.$1 . 49 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/26.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT i_item_id, 20 | avg(cs_quantity) agg1, 21 | avg(cs_list_price) agg2, 22 | avg(cs_coupon_amt) agg3, 23 | avg(cs_sales_price) agg4 24 | FROM catalog_sales, 25 | customer_demographics, 26 | date_dim, 27 | item, 28 | promotion 29 | WHERE cs_sold_date_sk = d_date_sk 30 | AND cs_item_sk = i_item_sk 31 | AND cs_bill_cdemo_sk = cd_demo_sk 32 | AND cs_promo_sk = p_promo_sk 33 | AND cd_gender = 'M' 34 | AND cd_marital_status = 'S' 35 | AND cd_education_status = 'College' 36 | AND (p_channel_email = 'N' 37 | OR p_channel_event = 'N') 38 | AND d_year = 2000 39 | GROUP BY i_item_id 40 | ORDER BY i_item_id 41 | LIMIT 100; 42 | 43 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/37.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT i_item_id, 20 | i_item_desc, 21 | i_current_price 22 | FROM item, 23 | inventory, 24 | date_dim, 25 | catalog_sales 26 | WHERE i_current_price BETWEEN 68 AND 68 + 30 27 | AND inv_item_sk = i_item_sk 28 | AND d_date_sk=inv_date_sk 29 | AND d_date BETWEEN cast('2000-02-01' AS date) AND cast('2000-04-01' AS date) 30 | AND i_manufact_id IN (677, 31 | 940, 32 | 694, 33 | 808) 34 | AND inv_quantity_on_hand BETWEEN 100 AND 500 35 | AND cs_item_sk = i_item_sk 36 | GROUP BY i_item_id, 37 | i_item_desc, 38 | i_current_price 39 | ORDER BY i_item_id 40 | LIMIT 100; 41 | 42 | -------------------------------------------------------------------------------- /cpp/src/cider/common/hashtable/HashTableAllocator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) 2016-2022 ClickHouse, Inc. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | /** 28 | * We are going to use the entire memory we allocated when resizing a hash 29 | * table, so it makes sense to pre-fault the pages so that page faults don't 30 | * interrupt the resize loop. Set the allocator parameter accordingly. 31 | */ 32 | using HashTableAllocator = CiderDefaultAllocator; 33 | 34 | // TODO(Deegue): will implement more allocator later 35 | // template 36 | // using HashTableAllocatorWithStackMemory = AllocatorWithStackMemory; 38 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/82.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | SELECT i_item_id , 21 | i_item_desc , 22 | i_current_price 23 | FROM item, 24 | inventory, 25 | date_dim, 26 | store_sales 27 | WHERE i_current_price BETWEEN 62 AND 62+30 28 | AND inv_item_sk = i_item_sk 29 | AND d_date_sk=inv_date_sk 30 | AND d_date BETWEEN cast('2000-05-25' AS date) AND cast('2000-07-24' AS date) 31 | AND i_manufact_id IN (129, 32 | 270, 33 | 821, 34 | 423) 35 | AND inv_quantity_on_hand BETWEEN 100 AND 500 36 | AND ss_item_sk = i_item_sk 37 | GROUP BY i_item_id, 38 | i_item_desc, 39 | i_current_price 40 | ORDER BY i_item_id 41 | LIMIT 100; 42 | 43 | -------------------------------------------------------------------------------- /cpp/src/cider/type/data/CiderTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | /* `../` is required for UDFCompiler */ 30 | // #include "cider/CiderException.h" 31 | // #include "InlineNullValues.h" 32 | #include "funcannotations.h" 33 | 34 | #define EXTENSION_INLINE extern "C" RUNTIME_EXPORT ALWAYS_INLINE 35 | #define EXTENSION_NOINLINE extern "C" RUNTIME_EXPORT NEVER_INLINE 36 | #define TEMPLATE_INLINE ALWAYS_INLINE 37 | #define TEMPLATE_NOINLINE NEVER_INLINE 38 | 39 | EXTENSION_NOINLINE int8_t* allocate_varlen_buffer(int64_t element_count, 40 | int64_t element_size); 41 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | set(CIDER_LIB_PLAN_DEPS) 21 | 22 | add_subdirectory(parser) 23 | add_subdirectory(lookup) 24 | add_subdirectory(builder) 25 | add_subdirectory(validator) 26 | add_subdirectory(substrait) 27 | 28 | add_library( 29 | cider_plan STATIC 30 | $ 31 | $ 32 | $ 33 | $ 34 | $) 35 | add_dependencies(substrait SubstraitCpp::function) 36 | 37 | target_link_libraries( 38 | cider_plan 39 | cider_util 40 | substrait 41 | SubstraitCpp::function 42 | SubstraitCpp::type 43 | SubstraitCpp::common 44 | yaml-cpp) 45 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/lookup/extensions/presto/presto_extension.yaml: -------------------------------------------------------------------------------- 1 | %YAML 1.2 2 | --- 3 | scalar_functions: 4 | - 5 | name: "between__3" 6 | description: >- 7 | Whether the `expression` is greater than or equal to `low` and less than or equal to `high`. 8 | 9 | `expression` BETWEEN `low` AND `high` 10 | 11 | If `low`, `high`, or `expression` are `null`, `null` is returned. 12 | impls: 13 | - args: 14 | - value: any1 15 | name: expression 16 | description: The expression to test for in the range defined by `low` and `high`. 17 | - value: any1 18 | name: low 19 | description: The value to check if greater than or equal to. 20 | - value: any1 21 | name: high 22 | description: The value to check if less than or equal to. 23 | return: BOOLEAN 24 | - 25 | name: "between" 26 | description: >- 27 | Whether the `expression` is greater than or equal to `low` and less than or equal to `high`. 28 | 29 | `expression` BETWEEN `low` AND `high` 30 | 31 | If `low`, `high`, or `expression` are `null`, `null` is returned. 32 | impls: 33 | - args: 34 | - value: any1 35 | name: expression 36 | description: The expression to test for in the range defined by `low` and `high`. 37 | - value: any1 38 | name: low 39 | description: The value to check if greater than or equal to. 40 | - value: any1 41 | name: high 42 | description: The value to check if less than or equal to. 43 | return: BOOLEAN 44 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/ciderTransformer/CiderPlanTransformerOptions.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #include "CiderPlanTransformerOptions.h" 23 | 24 | DEFINE_bool(enable_flatten_dictionary_encoding, 25 | false, 26 | "Enable flatten dictionary encoding to flat encoding"); 27 | DEFINE_bool(left_deep_join_pattern, false, "Enable LeftDeepJoinPattern "); 28 | DEFINE_bool(compound_pattern, false, "Enable CompoundPattern "); 29 | DEFINE_bool(filter_pattern, true, "Enable FilterPattern "); 30 | DEFINE_bool(project_pattern, true, "Enable ProjectPattern "); 31 | DEFINE_bool(partial_agg_pattern, false, "Enable PartialAggPattern "); 32 | DEFINE_bool(top_n_pattern, false, "Enable TopNPattern "); 33 | DEFINE_bool(order_by_pattern, false, "Enable OrderByPattern "); 34 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/ciderTransformer/CiderPlanRewriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "planTransformer/PlanRewriter.h" 25 | 26 | namespace facebook::velox::plugin::plantransformer { 27 | // replace velox plan fragment to CiderPlanNode 28 | class CiderPlanRewriter : public PlanRewriter { 29 | std::pair rewritePlanSectionWithSingleSource( 30 | const VeloxNodeAddrPlanSection& planSection, 31 | const VeloxPlanNodeAddr& source) const override; 32 | 33 | std::pair rewritePlanSectionWithMultiSources( 34 | const VeloxNodeAddrPlanSection& planSection, 35 | const VeloxPlanNodeAddrList& srcList) const override; 36 | }; 37 | } // namespace facebook::velox::plugin::plantransformer 38 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/StringHeapTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #include 23 | #include 24 | #include "exec/nextgen/context/StringHeap.h" 25 | #include "util/Logger.h" 26 | 27 | TEST(StringHeapTest, addString) { 28 | StringHeap heap; 29 | const char* str1 = "abcdef"; 30 | heap.addString(str1, 6); 31 | EXPECT_EQ(heap.getNum(), 1); 32 | auto str = heap.emptyString(10); 33 | EXPECT_EQ(heap.getNum(), 2); 34 | heap.destroy(); 35 | EXPECT_EQ(heap.getNum(), 0); 36 | } 37 | 38 | int main(int argc, char** argv) { 39 | testing::InitGoogleTest(&argc, argv); 40 | 41 | int err{0}; 42 | try { 43 | err = RUN_ALL_TESTS(); 44 | } catch (const std::exception& e) { 45 | // LOG(ERROR) << e.what(); 46 | } 47 | 48 | return err; 49 | } 50 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q18.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Large Volume Customer Query (Q18) 21 | -- Function Query Definition 22 | -- Approved February 1998 23 | select 24 | c.name, 25 | c.custkey, 26 | o.orderkey, 27 | o.orderdate, 28 | o.totalprice, 29 | sum(l.quantity) 30 | from 31 | customer as c, 32 | orders as o, 33 | lineitem as l 34 | where 35 | o.orderkey in ( 36 | select 37 | orderkey 38 | from 39 | lineitem 40 | group by 41 | orderkey 42 | having 43 | sum(quantity) > 300 44 | ) 45 | and c.custkey = o.custkey 46 | and o.orderkey = l.orderkey 47 | group by 48 | c.name, 49 | c.custkey, 50 | o.orderkey, 51 | o.orderdate, 52 | o.totalprice 53 | order by 54 | o.totalprice desc, 55 | o.orderdate 56 | limit 100; 57 | -------------------------------------------------------------------------------- /jvm/compression/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 26 | 4.0.0 27 | 28 | 29 | com.intel.bdtk 30 | bdtk-java-root 31 | 1.0.0-SNAPSHOT 32 | 33 | 34 | Intel Codec Library 35 | bdtk-icl 36 | 37 | pom 38 | 39 | 40 | common 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q15.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Top Supplier Query (Q15) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | 24 | with revenue as ( 25 | select 26 | suppkey as supplier_no, 27 | sum(extendedprice * (1 - discount)) as total_revenue 28 | from 29 | lineitem 30 | where 31 | shipdate >= '1996-01-01' 32 | and shipdate < cast(date '1996-01-01' + interval '3' month as varchar) 33 | group by suppkey 34 | ) 35 | 36 | select 37 | su.suppkey, 38 | su.name, 39 | su.address, 40 | su.phone, 41 | total_revenue 42 | from 43 | supplier as su, 44 | revenue 45 | where 46 | su.suppkey = supplier_no 47 | and total_revenue = ( 48 | select 49 | max(total_revenue) 50 | from 51 | revenue 52 | ) 53 | order by 54 | su.suppkey; 55 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q5.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Local Supplier Volume Query (Q5) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | select 24 | n.name, 25 | sum(l.extendedprice * (1 - l.discount)) as revenue 26 | from 27 | customer as c, 28 | orders as o, 29 | lineitem as l, 30 | supplier as s, 31 | nation as n, 32 | region as r 33 | where 34 | c.custkey = o.custkey 35 | and l.orderkey = o.orderkey 36 | and l.suppkey = s.suppkey 37 | and c.nationkey = s.nationkey 38 | and s.nationkey = n.nationkey 39 | and n.regionkey = r.regionkey 40 | and r.name = 'ASIA' 41 | and o.orderdate >= '1994-01-01' 42 | and o.orderdate < cast(date '1994-01-01' + interval '1' year as varchar) 43 | group by 44 | n.name 45 | order by 46 | revenue desc; 47 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/93.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT ss_customer_sk, 20 | sum(act_sales) sumsales 21 | FROM 22 | (SELECT ss_item_sk, 23 | ss_ticket_number, 24 | ss_customer_sk, 25 | CASE 26 | WHEN sr_return_quantity IS NOT NULL THEN (ss_quantity-sr_return_quantity)*ss_sales_price 27 | ELSE (ss_quantity*ss_sales_price) 28 | END act_sales 29 | FROM store_sales 30 | LEFT OUTER JOIN store_returns ON (sr_item_sk = ss_item_sk 31 | AND sr_ticket_number = ss_ticket_number) ,reason 32 | WHERE sr_reason_sk = r_reason_sk 33 | AND r_reason_desc = 'reason 28') t 34 | GROUP BY ss_customer_sk 35 | ORDER BY sumsales NULLS FIRST, 36 | ss_customer_sk NULLS FIRST 37 | LIMIT 100; 38 | 39 | -------------------------------------------------------------------------------- /.github/workflows/labeler.yaml: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | name: "Issue Labeler" 21 | on: 22 | pull_request_target: 23 | types: 24 | - opened 25 | - edited 26 | 27 | jobs: 28 | add_label: 29 | permissions: 30 | contents: read 31 | pull-requests: write 32 | runs-on: self-hosted 33 | steps: 34 | - uses: actions/labeler@v4.0.0 35 | with: 36 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 37 | configuration-path: .github/labeler.yaml 38 | sync-labels: true 39 | 40 | add_label_content: 41 | runs-on: self-hosted 42 | steps: 43 | - uses: github/issue-labeler@v2.5 44 | with: 45 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 46 | configuration-path: .github/labeler_content.yaml 47 | enable-versioned-regex: 0 48 | include-title: 1 49 | 50 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q16.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Parts/Supplier Relationship Query (Q16) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | select 24 | p.brand, 25 | p.type, 26 | p.size, 27 | count(distinct ps.suppkey) as supplier_cnt 28 | from 29 | partsupp as ps, 30 | part as p 31 | where 32 | p.partkey = ps.partkey 33 | and p.brand <> 'Brand#45' 34 | and p.type not like 'MEDIUM POLISHED%' 35 | and p.size in (49, 14, 23, 45, 19, 3, 36, 9) 36 | and ps.suppkey not in ( 37 | select 38 | suppkey 39 | from 40 | supplier 41 | where 42 | comment like '%Customer%Complaints%' 43 | ) 44 | group by 45 | p.brand, 46 | p.type, 47 | p.size 48 | order by 49 | supplier_cnt desc, 50 | p.brand, 51 | p.type, 52 | p.size; 53 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/utils/CiderNextgenBenchmarkRunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #ifndef CIDER_TESTS_UTILS_NEXTGEN_BENCHMARK_RUNNER_H_ 23 | #define CIDER_TESTS_UTILS_NEXTGEN_BENCHMARK_RUNNER_H_ 24 | 25 | #include "CiderNextgenQueryRunner.h" 26 | 27 | namespace cider::test::util { 28 | class CiderNextgenBenchmarkRunner : public CiderNextgenQueryRunner { 29 | public: 30 | void runQueryOneBatch(const std::string& file_or_sql, 31 | const struct ArrowArray& input_array, 32 | const struct ArrowSchema& input_schema, 33 | struct ArrowArray& output_array, 34 | struct ArrowSchema& output_schema, 35 | const CodegenOptions& codegen_options = {}) override; 36 | }; 37 | } // namespace cider::test::util 38 | #endif 39 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/06.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | SELECT a.ca_state state, 20 | count(*) cnt 21 | FROM customer_address a , 22 | customer c , 23 | store_sales s , 24 | date_dim d , 25 | item i 26 | WHERE a.ca_address_sk = c.c_current_addr_sk 27 | AND c.c_customer_sk = s.ss_customer_sk 28 | AND s.ss_sold_date_sk = d.d_date_sk 29 | AND s.ss_item_sk = i.i_item_sk 30 | AND d.d_month_seq = 31 | (SELECT DISTINCT (d_month_seq) 32 | FROM date_dim 33 | WHERE d_year = 2001 34 | AND d_moy = 1 ) 35 | AND i.i_current_price > 1.2 * 36 | (SELECT avg(j.i_current_price) 37 | FROM item j 38 | WHERE j.i_category = i.i_category) 39 | GROUP BY a.ca_state 40 | HAVING count(*) >= 10 41 | ORDER BY cnt NULLS FIRST, 42 | a.ca_state NULLS FIRST 43 | LIMIT 100; 44 | 45 | -------------------------------------------------------------------------------- /cpp/src/cider/exec/plan/parser/Translator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | /** 24 | * @file Translator.h 25 | * @brief 26 | **/ 27 | #ifndef TRANSLATOR_H 28 | #define TRANSLATOR_H 29 | 30 | #include 31 | #include 32 | #include "type/plan/Analyzer.h" 33 | 34 | // Migrated from RelAlgTranslator.h 35 | struct QualsConjunctiveForm { 36 | const std::list> simple_quals; 37 | const std::list> quals; 38 | }; 39 | 40 | QualsConjunctiveForm qual_to_conjunctive_form( 41 | const std::shared_ptr qual_expr); 42 | 43 | std::vector> qual_to_disjunctive_form( 44 | const std::shared_ptr& qual_expr); 45 | 46 | #endif // TRANSLATOR_H 47 | -------------------------------------------------------------------------------- /cpp/src/cider/util/filesystem/cider_path.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * Copyright (c) OmniSci, Inc. and its affiliates. 4 | * 5 | * Licensed to the Apache Software Foundation (ASF) under one 6 | * or more contributor license agreements. See the NOTICE file 7 | * distributed with this work for additional information 8 | * regarding copyright ownership. The ASF licenses this file 9 | * to you under the Apache License, Version 2.0 (the 10 | * "License"); you may not use this file except in compliance 11 | * with the License. You may obtain a copy of the License at 12 | * 13 | * http://www.apache.org/licenses/LICENSE-2.0 14 | * 15 | * Unless required by applicable law or agreed to in writing, 16 | * software distributed under the License is distributed on an 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | * KIND, either express or implied. See the License for the 19 | * specific language governing permissions and limitations 20 | * under the License. 21 | */ 22 | 23 | #include "util/filesystem/cider_path.h" 24 | #include 25 | #include 26 | #include 27 | #include "util/Logger.h" 28 | 29 | namespace cider { 30 | 31 | std::string get_root_abs_path() { 32 | char abs_exe_path[PATH_MAX] = {0}; 33 | auto path_len = readlink("/proc/self/exe", abs_exe_path, sizeof(abs_exe_path)); 34 | CHECK_GT(path_len, 0); 35 | CHECK_LT(static_cast(path_len), sizeof(abs_exe_path)); 36 | std::filesystem::path abs_exe_dir(std::string(abs_exe_path, path_len)); 37 | abs_exe_dir.remove_filename(); 38 | const auto mapd_root = abs_exe_dir.parent_path().parent_path(); 39 | return mapd_root.string(); 40 | } 41 | 42 | } // namespace cider 43 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/CiderVeloxPluginCtx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #pragma once 23 | #include "ciderTransformer/CiderPlanTransformerFactory.h" 24 | #include "planTransformer/PlanTransformer.h" 25 | #include "velox/core/PlanNode.h" 26 | 27 | namespace facebook::velox::plugin { 28 | 29 | using VeloxPlanNodePtr = std::shared_ptr; 30 | 31 | class CiderVeloxPluginCtx { 32 | public: 33 | static void init(); 34 | static void init(const std::string& conf_path); 35 | static VeloxPlanNodePtr transformVeloxPlan(VeloxPlanNodePtr originalPlan); 36 | 37 | private: 38 | static void registerTranslator(); 39 | static void registerVeloxExtensionFunction(); 40 | inline static plantransformer::CiderPlanTransformerFactory ciderTransformerFactory_; 41 | }; 42 | 43 | } // namespace facebook::velox::plugin 44 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/unused/tpcds/01.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | WITH customer_total_return AS 20 | (SELECT sr_customer_sk AS ctr_customer_sk, 21 | sr_store_sk AS ctr_store_sk, 22 | sum(sr_return_amt) AS ctr_total_return 23 | FROM store_returns, 24 | date_dim 25 | WHERE sr_returned_date_sk = d_date_sk 26 | AND d_year = 2000 27 | GROUP BY sr_customer_sk, 28 | sr_store_sk) 29 | SELECT c_customer_id 30 | FROM customer_total_return ctr1, 31 | store, 32 | customer 33 | WHERE ctr1.ctr_total_return > 34 | (SELECT avg(ctr_total_return)*1.2 35 | FROM customer_total_return ctr2 36 | WHERE ctr1.ctr_store_sk = ctr2.ctr_store_sk) 37 | AND s_store_sk = ctr1.ctr_store_sk 38 | AND s_state = 'TN' 39 | AND ctr1.ctr_customer_sk = c_customer_sk 40 | ORDER BY c_customer_id 41 | LIMIT 100; 42 | 43 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/planTransformer/PlanPattern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "PlanBranches.h" 25 | #include "PlanNodeAddr.h" 26 | 27 | namespace facebook::velox::plugin::plantransformer { 28 | // PlanPattern is the API of the pattern match - rewrite framework. 29 | // The user of the framework need provide implementation of the interface 30 | // and register it to PlanTransformer. 31 | class PlanPattern { 32 | public: 33 | PlanPattern() {} 34 | ~PlanPattern() {} 35 | 36 | std::pair match( 37 | BranchSrcToTargetIterator& branchIte) const; 38 | 39 | // matchFromSrc from source to target. 40 | virtual std::pair matchFromSrc( 41 | BranchSrcToTargetIterator& branchIte) const = 0; 42 | }; 43 | } // namespace facebook::velox::plugin::plantransformer 44 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q10.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Returned Item Reporting Query (Q10) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | select 24 | c.custkey, 25 | c.name, 26 | sum(l.extendedprice * (1 - l.discount)) as revenue, 27 | c.acctbal, 28 | n.name, 29 | c.address, 30 | c.phone, 31 | c.comment 32 | from 33 | customer as c, 34 | orders as o, 35 | lineitem as l, 36 | nation as n 37 | where 38 | c.custkey = o.custkey 39 | and l.orderkey = o.orderkey 40 | and o.orderdate >= '1993-10-01' 41 | and o.orderdate < cast(date '1993-10-01' + interval '3' month as varchar) 42 | and l.returnflag = 'R' 43 | and c.nationkey = n.nationkey 44 | group by 45 | c.custkey, 46 | c.name, 47 | c.acctbal, 48 | c.phone, 49 | n.name, 50 | c.address, 51 | c.comment 52 | order by 53 | revenue desc 54 | limit 20; 55 | -------------------------------------------------------------------------------- /cpp/src/cider/tests/CiderLogTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright(c) 2022-2023 Intel Corporation. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | #include 23 | #include 24 | #include "cider/CiderException.h" 25 | #include "util/Logger.h" 26 | 27 | class CiderLogTest : public ::testing::Test {}; 28 | 29 | TEST_F(CiderLogTest, log) { 30 | LOG(INFO) << "INFO log"; 31 | LOG(WARNING) << "WARNING log"; 32 | LOG(ERROR) << "ERROR log"; 33 | // EXPECT_THROW({ LOG(FATAL) << "FATAL log"; }, CheckFatalException); 34 | } 35 | 36 | /* 37 | * Run the CiderLogTest test file alone, for example: ./CiderLogTest 38 | * Or run CiderLogTest with parameters, for example: ./CiderLogTest --log-directory 39 | * bdtk_log --log-file-name bdtk_log 40 | */ 41 | int main(int argc, char** argv) { 42 | testing::InitGoogleTest(&argc, argv); 43 | gflags::ParseCommandLineFlags(&argc, &argv, true); 44 | return RUN_ALL_TESTS(); 45 | } 46 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/test/e-2-e/presto/queries/tpch/q1.sql: -------------------------------------------------------------------------------- 1 | -- Copyright(c) 2022-2023 Intel Corporation. 2 | -- 3 | -- Licensed to the Apache Software Foundation (ASF) under one 4 | -- or more contributor license agreements. See the NOTICE file 5 | -- distributed with this work for additional information 6 | -- regarding copyright ownership. The ASF licenses this file 7 | -- to you under the Apache License, Version 2.0 (the 8 | -- "License"); you may not use this file except in compliance 9 | -- with the License. You may obtain a copy of the License at 10 | -- 11 | -- http://www.apache.org/licenses/LICENSE-2.0 12 | -- 13 | -- Unless required by applicable law or agreed to in writing, 14 | -- software distributed under the License is distributed on an 15 | -- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | -- KIND, either express or implied. See the License for the 17 | -- specific language governing permissions and limitations 18 | -- under the License. 19 | 20 | -- TPC-H/TPC-R Pricing Summary Report Query (Q1) 21 | -- Functional Query Definition 22 | -- Approved February 1998 23 | -- Fixed shipdate predicate as DWRF doesn't support DATE types 24 | select 25 | returnflag, 26 | linestatus, 27 | sum(quantity) as sum_qty, 28 | sum(extendedprice) as sum_base_price, 29 | sum(extendedprice * (1 - discount)) as sum_disc_price, 30 | sum(extendedprice * (1 - discount) * (1 + tax)) as sum_charge, 31 | avg(quantity) as avg_qty, 32 | avg(extendedprice) as avg_price, 33 | avg(discount) as avg_disc, 34 | count(*) as count_order 35 | from 36 | lineitem 37 | where 38 | shipdate >= cast(date '1998-12-01' - interval '90' day as varchar) 39 | and shipdate <= '1998-12-01' 40 | group by 41 | returnflag, 42 | linestatus 43 | order by 44 | returnflag, 45 | linestatus; 46 | -------------------------------------------------------------------------------- /cpp/src/cider-velox/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright(c) 2022-2023 Intel Corporation. 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | 20 | add_subdirectory(substrait) 21 | add_subdirectory(planTransformer) 22 | add_subdirectory(ciderTransformer) 23 | 24 | set(VELOX_PLUGIN_SOURCES 25 | CiderPlanNode.cpp ArrowConvertorUtils.cpp CiderVeloxPluginCtx.cpp 26 | CiderPipelineOperator.cpp CiderHashJoinBuild.cpp CiderCrossJoinBuild.cpp) 27 | 28 | add_library(velox_plugin ${VELOX_PLUGIN_SOURCES}) 29 | 30 | target_link_libraries(velox_plugin velox_substrait_convertor cider_static 31 | velox_plan_transformer velox_exec ${GLOG}) 32 | 33 | # install headers 34 | set(VELOX_PLUGIN_HEADERS CiderPlanNode.h CiderPlanNodeTranslator.h 35 | VeloxPlanToCiderExecutionUnit.h) 36 | install(FILES ${VELOX_PLUGIN_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") 37 | 38 | # install so 39 | install(TARGETS velox_plugin LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) 40 | --------------------------------------------------------------------------------