Open m-iancu opened 4 years ago
Also confirmed that the limit is actually pushed down to docdb not filtered in CQL layer. Here is the request proto
request_id: 8448924902569571506
schema_version: 0
hash_code: 4624
hashed_column_values {
value {
int32_value: 1
}
}
selected_exprs {
column_id: 1
}
selected_exprs {
column_id: 2
}
selected_exprs {
column_id: 0
}
limit: 1
return_paging_state: false
distinct: false
remote_endpoint {
host: "0.0.0.0"
port: 0
}
max_hash_code: 4624
column_refs {
ids: 0
ids: 1
ids: 2
}
query_id: 4453507968
rsrow_desc {
rscol_descs {
name: "h"
ql_type {
main: INT32
}
}
rscol_descs {
name: "r"
ql_type {
main: INT32
}
}
rscol_descs {
name: "v"
ql_type {
main: INT32
}
}
}
is_forward_scan: true
is_aggregate: false
Note limit 1
row above. Also checked that the iterator stops after 1
row as expected.
Jira Link: DB-4683
Repro
Set up a table.
Insert some rows.
Test explain plan for sequential scan.
Test explain plan for index scan.
^ Limit component missing.
Actual select works as expected.
This is an
EXPLAIN
issue only.Possible cause.
The function
AnalysisResultToPB
inpt_select.cc
should inspect thechild_select
instead of (or in addition to) the top level select when checking for a limit_clause (and possibly aggregate).