From ad8d673636642b17007a06979339c86099bac104 Mon Sep 17 00:00:00 2001 From: shannon data ai Date: Sun, 29 Dec 2024 21:40:37 +0800 Subject: [PATCH] feat(shannon): selective-offload-est-query-cost --- storage/rapid_engine/handler/ha_shannon_rapid.cc | 5 ++--- storage/rapid_engine/utils/utils.cpp | 4 ++++ storage/rapid_engine/utils/utils.h | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/storage/rapid_engine/handler/ha_shannon_rapid.cc b/storage/rapid_engine/handler/ha_shannon_rapid.cc index 39875732d..1f87d6693 100644 --- a/storage/rapid_engine/handler/ha_shannon_rapid.cc +++ b/storage/rapid_engine/handler/ha_shannon_rapid.cc @@ -571,9 +571,7 @@ static bool RapidPrepareEstimateQueryCosts(THD *thd, LEX *lex) { if (thd->variables.use_secondary_engine == SECONDARY_ENGINE_OFF) { SetSecondaryEngineOffloadFailedReason(thd, "use_secondary_engine set to off."); return true; - } - - else if (thd->variables.use_secondary_engine == SECONDARY_ENGINE_FORCED) + } else if (thd->variables.use_secondary_engine == SECONDARY_ENGINE_FORCED) return false; // gets the shannon statement context from thd, which stores in SecondaryEnginePrePrepareHook. @@ -599,6 +597,7 @@ static bool RapidPrepareEstimateQueryCosts(THD *thd, LEX *lex) { } // 3: checks dict encoding projection, and varlen project size, etc. + if (ShannonBase::Utils::Util::check_dict_encoding_projection(thd)) return true; return false; } diff --git a/storage/rapid_engine/utils/utils.cpp b/storage/rapid_engine/utils/utils.cpp index ecd298119..f9ceeb808 100644 --- a/storage/rapid_engine/utils/utils.cpp +++ b/storage/rapid_engine/utils/utils.cpp @@ -311,5 +311,9 @@ bool Util::dynamic_feature_normalization(THD *thd) { return false; } +// check whether the dictionary encoding projection is supported or not. +// returns true if supported to innodb, otherwise, false to secondary engine. +bool Util::check_dict_encoding_projection(THD *thd) { return false; } + } // namespace Utils } // namespace ShannonBase \ No newline at end of file diff --git a/storage/rapid_engine/utils/utils.h b/storage/rapid_engine/utils/utils.h index ba6d00be1..0cb102606 100644 --- a/storage/rapid_engine/utils/utils.h +++ b/storage/rapid_engine/utils/utils.h @@ -117,6 +117,8 @@ class Util { static bool decision_tree_classifier(THD *thd); static bool dynamic_feature_normalization(THD *thd); + + static bool check_dict_encoding_projection(THD *thd); }; } // namespace Utils