diff --git a/cmake/compiler_flags.cmake b/cmake/compiler_flags.cmake index b88e1eb2f..dd701bb69 100644 --- a/cmake/compiler_flags.cmake +++ b/cmake/compiler_flags.cmake @@ -95,6 +95,14 @@ set(GNU_FLAGS # suppressed warnings set(ASAN_FLAGS -U_FORTIFY_SOURCE -fsanitize=address -fsanitize-address-use-after-scope -fPIC) # } end Sanitizers +# Check if built with enterprise configuration +if(MYSQL_SERVER_SUFFIX STREQUAL "-enterprise") + message(STATUS "ColumnStore: Compiling with ENTERPRISE features enabled") + my_check_and_set_compiler_flag("-DCOLUMNSTORE_COMPILED_WITH_ENTERPRISE") +else() + message(STATUS "ColumnStore: Compiling with COMMUNITY features") +endif() + # configured by cmake/configureEngine.cmake { if(MASK_LONGDOUBLE) my_check_and_set_compiler_flag("-DMASK_LONGDOUBLE") diff --git a/dbcon/rbo/rulebased_optimizer.cpp b/dbcon/rbo/rulebased_optimizer.cpp index 11ef0f71a..81ab5fb45 100644 --- a/dbcon/rbo/rulebased_optimizer.cpp +++ b/dbcon/rbo/rulebased_optimizer.cpp @@ -76,6 +76,15 @@ bool optimizeCSEPWithRules(execplan::CalpontSelectExecutionPlan& root, const std return changed; } +bool isEnterprise() +{ +#ifdef COLUMNSTORE_COMPILED_WITH_ENTERPRISE + return true; +#else + return false; +#endif +} + // high level API call for optimizer bool optimizeCSEP(execplan::CalpontSelectExecutionPlan& root, optimizer::RBOptimizerContext& ctx, bool useUnstableOptimizer) @@ -83,8 +92,11 @@ bool optimizeCSEP(execplan::CalpontSelectExecutionPlan& root, optimizer::RBOptim std::vector rules; if (useUnstableOptimizer) { - optimizer::Rule parallelCES{"parallel_ces", optimizer::parallelCESFilter, optimizer::applyParallelCES}; - rules.push_back(parallelCES); + if (isEnterprise()) + { + optimizer::Rule parallelCES{"parallel_ces", optimizer::parallelCESFilter, optimizer::applyParallelCES}; + rules.push_back(parallelCES); + } optimizer::Rule rewriteDistinct{"rewrite_distinct", optimizer::rewriteDistinctFilter, optimizer::applyRewriteDistinct};