Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1744,6 +1744,14 @@ private void handleQueryStmt() throws Exception {
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,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()
}