Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Sort field push down #848

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add integ-test
penghuo committed Nov 23, 2020
commit b1373771762c3f775b893840bb102f5b5593931b
Original file line number Diff line number Diff line change
@@ -76,6 +76,23 @@ public void testFilterAndAggPushDownExplain() throws Exception {
);
}

@Test
public void testSortPushDownExplain() throws Exception {
String expected = loadFromFile("expectedOutput/ppl/explain_filter_agg_push.json");

String actual = explainQueryToString(
"source=elasticsearch-sql_test_index_account"
+ "| sort age "
+ "| where age > 30");
assertJsonEquals(
expected,
explainQueryToString(
"source=elasticsearch-sql_test_index_account"
+ "| sort age "
+ "| where age > 30")
);
}

String loadFromFile(String filename) throws Exception {
URI uri = Resources.getResource(filename).toURI();
return new String(Files.readAllBytes(Paths.get(uri)));
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"root": {
"name": "ProjectOperator",
"description": {
"fields": "[account_number, firstname, address, balance, gender, city, employer, state, age, email, lastname]"
},
"children": [
{
"name": "ElasticsearchIndexScan",
"description": {
"request": "ElasticsearchQueryRequest(indexName\u003delasticsearch-sql_test_index_account, sourceBuilder\u003d{\"from\":0,\"size\":200,\"timeout\":\"1m\",\"query\":{\"range\":{\"age\":{\"from\":30,\"to\":null,\"include_lower\":false,\"include_upper\":true,\"boost\":1.0}}},\"sort\":[{\"age\":{\"order\":\"asc\",\"missing\":\"_first\"}}]}, searchDone\u003dfalse)"
},
"children": []
}
]
}
}