Repository navigation
Support timechart command with Calcite - #3993
Conversation
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
aabad00 to
4544e80
Compare
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
|
|
||
| // Handle no by field case | ||
| if (node.getByField() == null) { | ||
| String valueFunctionName = getValueFunctionName(node.getAggregateFunction()); |
There was a problem hiding this comment.
sql/ppl/src/main/java/org/opensearch/sql/ppl/parser/AstBuilder.java
Lines 612 to 617 in 98c1b6a
For stats command, the name is generated directly from the query text when building AST. Maybe we should do similar thing in visitTimechartCommand.
|
|
||
| @Test | ||
| public void testExplainWithTimechart() throws IOException { | ||
| var result = explainQueryToString("source=events | timechart span=1m avg(cpu_usage) by host"); |
There was a problem hiding this comment.
// Use zero-filling for count aggregations, standard result for others
Please add explain test case for count aggregation as it gets a totally different plan actually.
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
| // First rename the timestamp field (2nd to last) to @timestamp | ||
| List<String> fieldNames = context.relBuilder.peek().getRowType().getFieldNames(); | ||
| List<String> renamedFields = new ArrayList<>(fieldNames); | ||
| renamedFields.set(fieldNames.size() - 2, "@timestamp"); |
There was a problem hiding this comment.
The reason why we find that there is flip for group by keys is because of the registry mechanism for aggregate key in Calcite.
It's actually not flip but appending new expressions(i.e. span(...) here) to the original expressions. So although we constructed group by expr to be [spanExpr, byField], but got [byField, spanExpr] in the end.
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
Signed-off-by: Selina Song <[email protected]>
qianheng-aws
left a comment
There was a problem hiding this comment.
The functionality of this PR LGTM. Thanks for your contribution! @selsong
|
The backport to To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/sql/backport-2.19-dev 2.19-dev
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.19-dev
# Create a new branch
git switch --create backport/backport-3993-to-2.19-dev
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e2678a13fc9a6acc7bfced322e3cc2156a8dec91
# Push it to GitHub
git push --set-upstream origin backport/backport-3993-to-2.19-dev
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.19-devThen, create a pull request where the |
* WIP: Support timechart grammar / AST Signed-off-by: Selina Song <[email protected]> * WIP: Support span=unit in timechart Signed-off-by: Selina Song <[email protected]> * Return correct column format after span=unit Signed-off-by: Selina Song <[email protected]> * sort by @timestamp, group by aggregate function Signed-off-by: Selina Song <[email protected]> * WIP: pivot table by field Signed-off-by: Selina Song <[email protected]> * Correct pivot format for by field Signed-off-by: Selina Song <[email protected]> * Fix aggregation composite bucket limit Signed-off-by: Selina Song <[email protected]> * Add timechart.rst doc and PPLQueryAnonymizer test Signed-off-by: Selina Song <[email protected]> * Add ExplainIT for timechart Signed-off-by: Selina Song <[email protected]> * Restore reverse ExplainIT Signed-off-by: Selina Song <[email protected]> * Update explainIT timechart Signed-off-by: Selina Song <[email protected]> * spotlessApply formatting Signed-off-by: Selina Song <[email protected]> * format IT Signed-off-by: Selina Song <[email protected]> * Add limit parameter Signed-off-by: Selina Song <[email protected]> * Add limit=0 means no limit, show all values, no other Signed-off-by: Selina Song <[email protected]> * Add useother parameter Signed-off-by: Selina Song <[email protected]> * clean up format, fix column order Signed-off-by: Selina Song <[email protected]> * add test for formatter Signed-off-by: Selina Song <[email protected]> * Increase test coverage for formatter Signed-off-by: Selina Song <[email protected]> * Rename bin option expression, modify constructor Signed-off-by: Selina Song <[email protected]> * Make test data smaller, update IT, rst Signed-off-by: Selina Song <[email protected]> * add explain output to IT Signed-off-by: Selina Song <[email protected]> * Add limitation to rst, format, comment Signed-off-by: Selina Song <[email protected]> * Add test coverage formatter Signed-off-by: Selina Song <[email protected]> * Refactor formatter for clarity Signed-off-by: Selina Song <[email protected]> * fix NPE Signed-off-by: Selina Song <[email protected]> * add import Signed-off-by: Selina Song <[email protected]> * update mapping to match smaller dataset Signed-off-by: Selina Song <[email protected]> * update explainIT Signed-off-by: Selina Song <[email protected]> * Fix explainIT, improve code structure Signed-off-by: Selina Song <[email protected]> * spotless Signed-off-by: Selina Song <[email protected]> * Support diff position parameters, count default 0 not null, update doc rst Signed-off-by: Selina Song <[email protected]> * fix count aggr type int Signed-off-by: Selina Song <[email protected]> * rename @timestamp column Signed-off-by: Selina Song <[email protected]> * move parameter extraction to PPLService Signed-off-by: Selina Song <[email protected]> * clean up PPLService Signed-off-by: Selina Song <[email protected]> * fix count type test, doc rst format Signed-off-by: Selina Song <[email protected]> * add test coverage Signed-off-by: Selina Song <[email protected]> * WIP: SQL query with limit useother Signed-off-by: Selina Song <[email protected]> * revert QueryService Signed-off-by: Selina Song <[email protected]> * add limit useother to SQL query Signed-off-by: Selina Song <[email protected]> * SQL query working, WIP column rename Signed-off-by: Selina Song <[email protected]> * use loadIndex in IT Signed-off-by: Selina Song <[email protected]> * Rename fields to match, update doc Signed-off-by: Selina Song <[email protected]> * revert QueryResult Signed-off-by: Selina Song <[email protected]> * revert gradle build Signed-off-by: Selina Song <[email protected]> * fix format Signed-off-by: Selina Song <[email protected]> * Add count fill zero, update toSQL tests, doc Signed-off-by: Selina Song <[email protected]> * fix nits Signed-off-by: Selina Song <[email protected]> * Fix rename aggregation only no by field Signed-off-by: Selina Song <[email protected]> * Update SQL test Signed-off-by: Selina Song <[email protected]> * revert OS Exec Engine edits Signed-off-by: Selina Song <[email protected]> * correct OS Exec Engine revert to 5ec9603 Signed-off-by: Selina Song <[email protected]> * restore OS Exec Engine Signed-off-by: Selina Song <[email protected]> * update QueryAnonymizer Test to reflect default Signed-off-by: Selina Song <[email protected]> * WIP: Add null=1, Other fill zero wip Signed-off-by: Selina Song <[email protected]> * Add doctest and update ExplainIT Signed-off-by: Selina Song <[email protected]> * Replace detectFieldIndices function Signed-off-by: Selina Song <[email protected]> * update explainIT Signed-off-by: Selina Song <[email protected]> * Fix Other in zero fill case Signed-off-by: Selina Song <[email protected]> * Fix OTHER in zero fill case Signed-off-by: Selina Song <[email protected]> * spotless format Signed-off-by: Selina Song <[email protected]> * update doc with null example Signed-off-by: Selina Song <[email protected]> * null not included in limit calc Signed-off-by: Selina Song <[email protected]> * update SQL test Signed-off-by: Selina Song <[email protected]> * update SQL test format Signed-off-by: Selina Song <[email protected]> * Update ExplainIT with count Signed-off-by: Selina Song <[email protected]> * remove unused code Signed-off-by: Selina Song <[email protected]> * Fix SQL tests nullable Signed-off-by: Selina Song <[email protected]> * spotless format Signed-off-by: Selina Song <[email protected]> --------- Signed-off-by: Selina Song <[email protected]> Signed-off-by: Selina Song <[email protected]> Co-authored-by: Selina Song <[email protected]> (cherry picked from commit e2678a1)
* WIP: Support timechart grammar / AST Signed-off-by: Selina Song <[email protected]> * WIP: Support span=unit in timechart Signed-off-by: Selina Song <[email protected]> * Return correct column format after span=unit Signed-off-by: Selina Song <[email protected]> * sort by @timestamp, group by aggregate function Signed-off-by: Selina Song <[email protected]> * WIP: pivot table by field Signed-off-by: Selina Song <[email protected]> * Correct pivot format for by field Signed-off-by: Selina Song <[email protected]> * Fix aggregation composite bucket limit Signed-off-by: Selina Song <[email protected]> * Add timechart.rst doc and PPLQueryAnonymizer test Signed-off-by: Selina Song <[email protected]> * Add ExplainIT for timechart Signed-off-by: Selina Song <[email protected]> * Restore reverse ExplainIT Signed-off-by: Selina Song <[email protected]> * Update explainIT timechart Signed-off-by: Selina Song <[email protected]> * spotlessApply formatting Signed-off-by: Selina Song <[email protected]> * format IT Signed-off-by: Selina Song <[email protected]> * Add limit parameter Signed-off-by: Selina Song <[email protected]> * Add limit=0 means no limit, show all values, no other Signed-off-by: Selina Song <[email protected]> * Add useother parameter Signed-off-by: Selina Song <[email protected]> * clean up format, fix column order Signed-off-by: Selina Song <[email protected]> * add test for formatter Signed-off-by: Selina Song <[email protected]> * Increase test coverage for formatter Signed-off-by: Selina Song <[email protected]> * Rename bin option expression, modify constructor Signed-off-by: Selina Song <[email protected]> * Make test data smaller, update IT, rst Signed-off-by: Selina Song <[email protected]> * add explain output to IT Signed-off-by: Selina Song <[email protected]> * Add limitation to rst, format, comment Signed-off-by: Selina Song <[email protected]> * Add test coverage formatter Signed-off-by: Selina Song <[email protected]> * Refactor formatter for clarity Signed-off-by: Selina Song <[email protected]> * fix NPE Signed-off-by: Selina Song <[email protected]> * add import Signed-off-by: Selina Song <[email protected]> * update mapping to match smaller dataset Signed-off-by: Selina Song <[email protected]> * update explainIT Signed-off-by: Selina Song <[email protected]> * Fix explainIT, improve code structure Signed-off-by: Selina Song <[email protected]> * spotless Signed-off-by: Selina Song <[email protected]> * Support diff position parameters, count default 0 not null, update doc rst Signed-off-by: Selina Song <[email protected]> * fix count aggr type int Signed-off-by: Selina Song <[email protected]> * rename @timestamp column Signed-off-by: Selina Song <[email protected]> * move parameter extraction to PPLService Signed-off-by: Selina Song <[email protected]> * clean up PPLService Signed-off-by: Selina Song <[email protected]> * fix count type test, doc rst format Signed-off-by: Selina Song <[email protected]> * add test coverage Signed-off-by: Selina Song <[email protected]> * WIP: SQL query with limit useother Signed-off-by: Selina Song <[email protected]> * revert QueryService Signed-off-by: Selina Song <[email protected]> * add limit useother to SQL query Signed-off-by: Selina Song <[email protected]> * SQL query working, WIP column rename Signed-off-by: Selina Song <[email protected]> * use loadIndex in IT Signed-off-by: Selina Song <[email protected]> * Rename fields to match, update doc Signed-off-by: Selina Song <[email protected]> * revert QueryResult Signed-off-by: Selina Song <[email protected]> * revert gradle build Signed-off-by: Selina Song <[email protected]> * fix format Signed-off-by: Selina Song <[email protected]> * Add count fill zero, update toSQL tests, doc Signed-off-by: Selina Song <[email protected]> * fix nits Signed-off-by: Selina Song <[email protected]> * Fix rename aggregation only no by field Signed-off-by: Selina Song <[email protected]> * Update SQL test Signed-off-by: Selina Song <[email protected]> * revert OS Exec Engine edits Signed-off-by: Selina Song <[email protected]> * correct OS Exec Engine revert to 5ec9603 Signed-off-by: Selina Song <[email protected]> * restore OS Exec Engine Signed-off-by: Selina Song <[email protected]> * update QueryAnonymizer Test to reflect default Signed-off-by: Selina Song <[email protected]> * WIP: Add null=1, Other fill zero wip Signed-off-by: Selina Song <[email protected]> * Add doctest and update ExplainIT Signed-off-by: Selina Song <[email protected]> * Replace detectFieldIndices function Signed-off-by: Selina Song <[email protected]> * update explainIT Signed-off-by: Selina Song <[email protected]> * Fix Other in zero fill case Signed-off-by: Selina Song <[email protected]> * Fix OTHER in zero fill case Signed-off-by: Selina Song <[email protected]> * spotless format Signed-off-by: Selina Song <[email protected]> * update doc with null example Signed-off-by: Selina Song <[email protected]> * null not included in limit calc Signed-off-by: Selina Song <[email protected]> * update SQL test Signed-off-by: Selina Song <[email protected]> * update SQL test format Signed-off-by: Selina Song <[email protected]> * Update ExplainIT with count Signed-off-by: Selina Song <[email protected]> * remove unused code Signed-off-by: Selina Song <[email protected]> * Fix SQL tests nullable Signed-off-by: Selina Song <[email protected]> * spotless format Signed-off-by: Selina Song <[email protected]> --------- Signed-off-by: Selina Song <[email protected]> Signed-off-by: Selina Song <[email protected]> Co-authored-by: Selina Song <[email protected]> (cherry picked from commit e2678a1)
* WIP: Support timechart grammar / AST Signed-off-by: Selina Song <[email protected]> * WIP: Support span=unit in timechart Signed-off-by: Selina Song <[email protected]> * Return correct column format after span=unit Signed-off-by: Selina Song <[email protected]> * sort by @timestamp, group by aggregate function Signed-off-by: Selina Song <[email protected]> * WIP: pivot table by field Signed-off-by: Selina Song <[email protected]> * Correct pivot format for by field Signed-off-by: Selina Song <[email protected]> * Fix aggregation composite bucket limit Signed-off-by: Selina Song <[email protected]> * Add timechart.rst doc and PPLQueryAnonymizer test Signed-off-by: Selina Song <[email protected]> * Add ExplainIT for timechart Signed-off-by: Selina Song <[email protected]> * Restore reverse ExplainIT Signed-off-by: Selina Song <[email protected]> * Update explainIT timechart Signed-off-by: Selina Song <[email protected]> * spotlessApply formatting Signed-off-by: Selina Song <[email protected]> * format IT Signed-off-by: Selina Song <[email protected]> * Add limit parameter Signed-off-by: Selina Song <[email protected]> * Add limit=0 means no limit, show all values, no other Signed-off-by: Selina Song <[email protected]> * Add useother parameter Signed-off-by: Selina Song <[email protected]> * clean up format, fix column order Signed-off-by: Selina Song <[email protected]> * add test for formatter Signed-off-by: Selina Song <[email protected]> * Increase test coverage for formatter Signed-off-by: Selina Song <[email protected]> * Rename bin option expression, modify constructor Signed-off-by: Selina Song <[email protected]> * Make test data smaller, update IT, rst Signed-off-by: Selina Song <[email protected]> * add explain output to IT Signed-off-by: Selina Song <[email protected]> * Add limitation to rst, format, comment Signed-off-by: Selina Song <[email protected]> * Add test coverage formatter Signed-off-by: Selina Song <[email protected]> * Refactor formatter for clarity Signed-off-by: Selina Song <[email protected]> * fix NPE Signed-off-by: Selina Song <[email protected]> * add import Signed-off-by: Selina Song <[email protected]> * update mapping to match smaller dataset Signed-off-by: Selina Song <[email protected]> * update explainIT Signed-off-by: Selina Song <[email protected]> * Fix explainIT, improve code structure Signed-off-by: Selina Song <[email protected]> * spotless Signed-off-by: Selina Song <[email protected]> * Support diff position parameters, count default 0 not null, update doc rst Signed-off-by: Selina Song <[email protected]> * fix count aggr type int Signed-off-by: Selina Song <[email protected]> * rename @timestamp column Signed-off-by: Selina Song <[email protected]> * move parameter extraction to PPLService Signed-off-by: Selina Song <[email protected]> * clean up PPLService Signed-off-by: Selina Song <[email protected]> * fix count type test, doc rst format Signed-off-by: Selina Song <[email protected]> * add test coverage Signed-off-by: Selina Song <[email protected]> * WIP: SQL query with limit useother Signed-off-by: Selina Song <[email protected]> * revert QueryService Signed-off-by: Selina Song <[email protected]> * add limit useother to SQL query Signed-off-by: Selina Song <[email protected]> * SQL query working, WIP column rename Signed-off-by: Selina Song <[email protected]> * use loadIndex in IT Signed-off-by: Selina Song <[email protected]> * Rename fields to match, update doc Signed-off-by: Selina Song <[email protected]> * revert QueryResult Signed-off-by: Selina Song <[email protected]> * revert gradle build Signed-off-by: Selina Song <[email protected]> * fix format Signed-off-by: Selina Song <[email protected]> * Add count fill zero, update toSQL tests, doc Signed-off-by: Selina Song <[email protected]> * fix nits Signed-off-by: Selina Song <[email protected]> * Fix rename aggregation only no by field Signed-off-by: Selina Song <[email protected]> * Update SQL test Signed-off-by: Selina Song <[email protected]> * revert OS Exec Engine edits Signed-off-by: Selina Song <[email protected]> * correct OS Exec Engine revert to 5ec9603 Signed-off-by: Selina Song <[email protected]> * restore OS Exec Engine Signed-off-by: Selina Song <[email protected]> * update QueryAnonymizer Test to reflect default Signed-off-by: Selina Song <[email protected]> * WIP: Add null=1, Other fill zero wip Signed-off-by: Selina Song <[email protected]> * Add doctest and update ExplainIT Signed-off-by: Selina Song <[email protected]> * Replace detectFieldIndices function Signed-off-by: Selina Song <[email protected]> * update explainIT Signed-off-by: Selina Song <[email protected]> * Fix Other in zero fill case Signed-off-by: Selina Song <[email protected]> * Fix OTHER in zero fill case Signed-off-by: Selina Song <[email protected]> * spotless format Signed-off-by: Selina Song <[email protected]> * update doc with null example Signed-off-by: Selina Song <[email protected]> * null not included in limit calc Signed-off-by: Selina Song <[email protected]> * update SQL test Signed-off-by: Selina Song <[email protected]> * update SQL test format Signed-off-by: Selina Song <[email protected]> * Update ExplainIT with count Signed-off-by: Selina Song <[email protected]> * remove unused code Signed-off-by: Selina Song <[email protected]> * Fix SQL tests nullable Signed-off-by: Selina Song <[email protected]> * spotless format Signed-off-by: Selina Song <[email protected]> --------- Signed-off-by: Selina Song <[email protected]> Signed-off-by: Selina Song <[email protected]> Co-authored-by: Selina Song <[email protected]> (cherry picked from commit e2678a1)
…4232) * Support timechart command with Calcite (#3993) * WIP: Support timechart grammar / AST Signed-off-by: Selina Song <[email protected]> * WIP: Support span=unit in timechart Signed-off-by: Selina Song <[email protected]> * Return correct column format after span=unit Signed-off-by: Selina Song <[email protected]> * sort by @timestamp, group by aggregate function Signed-off-by: Selina Song <[email protected]> * WIP: pivot table by field Signed-off-by: Selina Song <[email protected]> * Correct pivot format for by field Signed-off-by: Selina Song <[email protected]> * Fix aggregation composite bucket limit Signed-off-by: Selina Song <[email protected]> * Add timechart.rst doc and PPLQueryAnonymizer test Signed-off-by: Selina Song <[email protected]> * Add ExplainIT for timechart Signed-off-by: Selina Song <[email protected]> * Restore reverse ExplainIT Signed-off-by: Selina Song <[email protected]> * Update explainIT timechart Signed-off-by: Selina Song <[email protected]> * spotlessApply formatting Signed-off-by: Selina Song <[email protected]> * format IT Signed-off-by: Selina Song <[email protected]> * Add limit parameter Signed-off-by: Selina Song <[email protected]> * Add limit=0 means no limit, show all values, no other Signed-off-by: Selina Song <[email protected]> * Add useother parameter Signed-off-by: Selina Song <[email protected]> * clean up format, fix column order Signed-off-by: Selina Song <[email protected]> * add test for formatter Signed-off-by: Selina Song <[email protected]> * Increase test coverage for formatter Signed-off-by: Selina Song <[email protected]> * Rename bin option expression, modify constructor Signed-off-by: Selina Song <[email protected]> * Make test data smaller, update IT, rst Signed-off-by: Selina Song <[email protected]> * add explain output to IT Signed-off-by: Selina Song <[email protected]> * Add limitation to rst, format, comment Signed-off-by: Selina Song <[email protected]> * Add test coverage formatter Signed-off-by: Selina Song <[email protected]> * Refactor formatter for clarity Signed-off-by: Selina Song <[email protected]> * fix NPE Signed-off-by: Selina Song <[email protected]> * add import Signed-off-by: Selina Song <[email protected]> * update mapping to match smaller dataset Signed-off-by: Selina Song <[email protected]> * update explainIT Signed-off-by: Selina Song <[email protected]> * Fix explainIT, improve code structure Signed-off-by: Selina Song <[email protected]> * spotless Signed-off-by: Selina Song <[email protected]> * Support diff position parameters, count default 0 not null, update doc rst Signed-off-by: Selina Song <[email protected]> * fix count aggr type int Signed-off-by: Selina Song <[email protected]> * rename @timestamp column Signed-off-by: Selina Song <[email protected]> * move parameter extraction to PPLService Signed-off-by: Selina Song <[email protected]> * clean up PPLService Signed-off-by: Selina Song <[email protected]> * fix count type test, doc rst format Signed-off-by: Selina Song <[email protected]> * add test coverage Signed-off-by: Selina Song <[email protected]> * WIP: SQL query with limit useother Signed-off-by: Selina Song <[email protected]> * revert QueryService Signed-off-by: Selina Song <[email protected]> * add limit useother to SQL query Signed-off-by: Selina Song <[email protected]> * SQL query working, WIP column rename Signed-off-by: Selina Song <[email protected]> * use loadIndex in IT Signed-off-by: Selina Song <[email protected]> * Rename fields to match, update doc Signed-off-by: Selina Song <[email protected]> * revert QueryResult Signed-off-by: Selina Song <[email protected]> * revert gradle build Signed-off-by: Selina Song <[email protected]> * fix format Signed-off-by: Selina Song <[email protected]> * Add count fill zero, update toSQL tests, doc Signed-off-by: Selina Song <[email protected]> * fix nits Signed-off-by: Selina Song <[email protected]> * Fix rename aggregation only no by field Signed-off-by: Selina Song <[email protected]> * Update SQL test Signed-off-by: Selina Song <[email protected]> * revert OS Exec Engine edits Signed-off-by: Selina Song <[email protected]> * correct OS Exec Engine revert to 5ec9603 Signed-off-by: Selina Song <[email protected]> * restore OS Exec Engine Signed-off-by: Selina Song <[email protected]> * update QueryAnonymizer Test to reflect default Signed-off-by: Selina Song <[email protected]> * WIP: Add null=1, Other fill zero wip Signed-off-by: Selina Song <[email protected]> * Add doctest and update ExplainIT Signed-off-by: Selina Song <[email protected]> * Replace detectFieldIndices function Signed-off-by: Selina Song <[email protected]> * update explainIT Signed-off-by: Selina Song <[email protected]> * Fix Other in zero fill case Signed-off-by: Selina Song <[email protected]> * Fix OTHER in zero fill case Signed-off-by: Selina Song <[email protected]> * spotless format Signed-off-by: Selina Song <[email protected]> * update doc with null example Signed-off-by: Selina Song <[email protected]> * null not included in limit calc Signed-off-by: Selina Song <[email protected]> * update SQL test Signed-off-by: Selina Song <[email protected]> * update SQL test format Signed-off-by: Selina Song <[email protected]> * Update ExplainIT with count Signed-off-by: Selina Song <[email protected]> * remove unused code Signed-off-by: Selina Song <[email protected]> * Fix SQL tests nullable Signed-off-by: Selina Song <[email protected]> * spotless format Signed-off-by: Selina Song <[email protected]> --------- Signed-off-by: Selina Song <[email protected]> Signed-off-by: Selina Song <[email protected]> Co-authored-by: Selina Song <[email protected]> (cherry picked from commit e2678a1) * restore parser Signed-off-by: Selina Song <[email protected]> --------- Signed-off-by: Selina Song <[email protected]> Signed-off-by: Selina Song <[email protected]> Co-authored-by: Selina Song <[email protected]>
Description
Implement timechart in PPL to accept aggregation
spanlogic and aggregation functions. This includes support for parameters such asspan,limit,useother, a single aggregation function, by field. This does not include pivot formatting.Time Binning
Limitations: (to be resolved in follow up PR)
binsparameter and other bin options are not supported since thebincommand is not implemented yet.Related Issues
Resolves #3965
1. single aggregation function
Query:
Result:
Logical Plan:
Physical Plan:
2. aggregation with by field
Query:
Result:
Logical Plan:
Physical Plan:
3.
spanparameterQuery:
Result:
Logical Plan:
Physical Plan:
4. Default
limit= 10 anduseother= trueFor by fields with more than 10 values, timechart will automatically group the extra values into an OTHER field.
Query:
Result:
Logical Plan:
Physical Plan:
5.
limitparameterQuery:
Lowest sum of aggregation function results are grouped into the OTHER column so only top 3 hosts by avg(response_time) are shown, displayed in their original order.
Result:
Logical Plan:
Physical Plan:
6.
useotherparameterQuery:
Accepts useother=t, f, true, or false. Default limit of 10 is applied since no limit is specified, but OTHER column is omitted since useother is set to false.
Result:
Logical Plan:
Physical Plan:
Performance with Big5 Testing
(span=1h, 1m, 1s, avg metrics.size, count by cloud.region)
(span=1h, 1m, 1s and count by cloud.region)
(includes spans 1s, 1m, 1h count queries)
Head 10: 64 ms
Head 100: 75 ms
Head 1 000: 113 ms
Head 10 000: Avg = 628 ms (p90 ≈ 630 ms)
For both queries:
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.