Zhimin Wu created KYLIN-5832:
--------------------------------
Summary: Add API to determine whether the query hits the index
Key: KYLIN-5832
URL: https://issues.apache.org/jira/browse/KYLIN-5832
Project: Kylin
Issue Type: Improvement
Components: Others
Reporter: Zhimin Wu
Assignee: Zhimin Wu
Fix For: 5.0.0
Add a new API to determine if a query hits an index. This API has the following
functions.
# Determine whether the model is hit or not.
# Determine if there is data in the segment.
API : {{POST [http://host:port/kylin/api/query/detection]}}
{{}}
||*Param*||*Datatype*||Required||
|project|string|True|
|sql
|string|
True
|
|limit|int|False|
|offset|int|False|
Sample
{code:java}
curl --location 'http://host:port/kylin/api/query/detection' \
--header 'Accept: application/vnd.apache.kylin-v4-public+json' \
--header 'Accept-Language: cn' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '{
"project": "project_ch",
"sql": "SELECT LO_PARTKEY, SUM(LO_REVENUE) AS TOTAL_REVENUE\nFROM
SSB.P_LINEORDER\nWHERE LO_ORDERDATE between '\''19920101'\'' AND
'\''19970803'\'' \ngroup by LO_PARTKEY\norder by SUM(LO_REVENUE) DESC\nLIMIT
500"
}' {code}
Response
||*Param*||*Datatype*||
|code|string|
|data|object|
|is_exception|boolean|
|exception_message|string|
|query_id|string|
|is_push_down
|boolean|
|is_post_aggregation
|boolean|
|is_table_index
|boolean|
|is_base_index
|boolean|
|is_cache|boolean|
|is_constants|boolean|
|realizations
|object[]|
|model_id|string|
|model_alias|string|
|layout_id|int|
|index_type|string|
|partial_match_model|boolean|
|valid|boolean|
|is_table_index
|boolean|
|is_base_index
|boolean|
Sample
{code:java}
{
"code": "000",
"data": {
"is_exception": false,
"exception_message": null,
"query_id": "0ef8d8f2-c234-8211-f841-5b3db61ba217",
"is_push_down": false,
"is_post_aggregation": true,
"is_table_index": false,
"is_base_index": true,
"is_cache": false,
"is_constants": false,
"realizations": [
{
"model_id": "aa7d0eab-6f72-3b02-019f-9f2fc84a0ecb",
"model_alias": "AUTO_MODEL_P_LINEORDER_1",
"layout_id": 1,
"index_type": "Agg Index",
"partial_match_model": false,
"valid": true,
"is_table_index": false,
"is_base_index": true
}
]
},
"msg": ""
} {code}
{{}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)