Open
Description
Description
In the following query, the first SORT first_name | LIMIT 100
are redundant:
FROM employees
| KEEP first_name
| SORT first_name
| LIMIT 100
| SORT first_name
| LIMIT 10
If we run this query with profile: true
we see that the final plan has two TopNOperator
s, meaning the first TopN was not removed by PruneRedundantOrderBy
:
"drivers": [
...
{
"description": "final",
...
"operators": [
...
{
"operator": "TopNOperator[count=0/100, elementTypes=[BYTES_REF], encoders=[UTF8TopNEncoder], sortOrders=[SortOrder[channel=0, asc=true, nullsFirst=false]]]",
"status": {
"occupied_rows": 0,
"ram_bytes_used": 680,
"ram_used": "680b",
"pages_received": 1,
"pages_emitted": 1,
"rows_received": 100,
"rows_emitted": 100
}
},
{
"operator": "TopNOperator[count=0/10, elementTypes=[BYTES_REF], encoders=[UTF8TopNEncoder], sortOrders=[SortOrder[channel=0, asc=true, nullsFirst=false]]]",
"status": {
"occupied_rows": 0,
"ram_bytes_used": 320,
"ram_used": "320b",
"pages_received": 1,
"pages_emitted": 1,
"rows_received": 100,
"rows_emitted": 10
}
},
...
]