This is an automated email from the ASF dual-hosted git repository.
huajianlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 1cd3d9d7028 [fix](Nereids) fix `Is Cached` is not Yes in Profile when
enable_sql_cache=true (#42032)
1cd3d9d7028 is described below
commit 1cd3d9d7028cc5b95e1e1cf6baaecd4c9ec9043e
Author: 924060929 <[email protected]>
AuthorDate: Fri Oct 18 15:48:06 2024 +0800
[fix](Nereids) fix `Is Cached` is not Yes in Profile when
enable_sql_cache=true (#42032)
fix `Is Cached` is not Yes in Profile when enable_sql_cache=true,
introduced by #33262
---
.../java/org/apache/doris/qe/StmtExecutor.java | 8 +++++
.../cache/parse_sql_from_sql_cache.groovy | 36 ++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index 52245dfd765..16600536aac 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -1804,6 +1804,14 @@ public class StmtExecutor {
return;
}
+ if (parsedStmt instanceof LogicalPlanAdapter) {
+ LogicalPlanAdapter logicalPlanAdapter = (LogicalPlanAdapter)
parsedStmt;
+ LogicalPlan logicalPlan = logicalPlanAdapter.getLogicalPlan();
+ if (logicalPlan instanceof
org.apache.doris.nereids.trees.plans.algebra.SqlCache) {
+ isCached = true;
+ }
+ }
+
// handle selects that fe can do without be, so we can make sql tools
happy, especially the setup step.
// TODO FE not support doris field type conversion to arrow field type.
if (!context.getConnectType().equals(ConnectType.ARROW_FLIGHT_SQL)
diff --git
a/regression-test/suites/nereids_p0/cache/parse_sql_from_sql_cache.groovy
b/regression-test/suites/nereids_p0/cache/parse_sql_from_sql_cache.groovy
index 82848736936..6aeeeed0ead 100644
--- a/regression-test/suites/nereids_p0/cache/parse_sql_from_sql_cache.groovy
+++ b/regression-test/suites/nereids_p0/cache/parse_sql_from_sql_cache.groovy
@@ -784,6 +784,42 @@ suite("parse_sql_from_sql_cache") {
sql "select /*+SET_VAR(disable_nereids_rules='')*/ /*comment1*/ *
from test_use_plan_cache22 order by 1, 2"
assertHasCache "select /*+SET_VAR(disable_nereids_rules='')*/
/*comment2*/ * from test_use_plan_cache22 order by 1, 2"
+ }),
+ extraThread("is_cache_profile", {
+ createTestTable "test_use_plan_cache23"
+
+ // after partition changed 10s, the sql cache can be used
+ sleep(10000)
+
+ sql "set enable_nereids_planner=true"
+ sql "set enable_fallback_to_original_planner=false"
+ sql "set enable_sql_cache=true"
+
+ int randomInt = Math.random() * 2000000000
+ sql "select ${randomInt} from test_use_plan_cache23"
+ profile("sql_cache_23_${randomInt}") {
+ run {
+ sql "/* sql_cache_23_${randomInt} */ select ${randomInt}
from test_use_plan_cache23"
+ }
+
+ check { profileString, exception ->
+ log.info(profileString)
+ assertTrue(profileString.contains("Is Cached: Yes"))
+ }
+ }
+
+ randomInt = Math.random() * 2000000000
+ sql "select * from (select $randomInt as id)a"
+ profile("sql_cache_23_${randomInt}_2") {
+ run {
+ sql "/* sql_cache_23_${randomInt}_2 */ select * from
(select $randomInt as id)a"
+ }
+
+ check { profileString, exception ->
+ log.info(profileString)
+ assertTrue(profileString.contains("Is Cached: Yes"))
+ }
+ }
})
).get()
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]