Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9a41cb4
WIP: Make poc implementation for chart command
yuancu Oct 15, 2025
0408424
Support param useother and otherstr
yuancu Oct 16, 2025
851f536
Support usenull and nullstr (when both row split and col split present)
yuancu Oct 17, 2025
70d4722
Append a final aggregation to merge OTHER categories
yuancu Oct 20, 2025
9253e67
Handle common agg functions for OTHER category for timechart
yuancu Oct 17, 2025
19af837
Fix timechart IT
yuancu Oct 17, 2025
6c5df2e
Sort earliest results with asc order
yuancu Oct 21, 2025
b07c3c4
Support non-string fields as column split
yuancu Oct 22, 2025
269d4e2
Fix min/earliest order & fix non-accumulative agg for chart
yuancu Oct 23, 2025
cf4c9de
Hint non-null in aggregateWithTrimming
yuancu Oct 23, 2025
9b7a891
Add integration tests for chart command
yuancu Oct 23, 2025
8617309
Add unit tests
yuancu Oct 23, 2025
3c4c13a
Add doc for chart command
yuancu Oct 23, 2025
5de82dd
Prompt users that multiple agg is not supported
yuancu Oct 24, 2025
d3858cc
Add explain ITs
yuancu Oct 24, 2025
8f4d6d4
Remove unimplemented support for multiple aggregations in chart command
yuancu Oct 24, 2025
b14a764
Add unit tests for chart command
yuancu Oct 28, 2025
7126c82
Remove irrelevant yaml test
yuancu Oct 29, 2025
7d294c7
Tweak chart.rst
yuancu Oct 29, 2025
9bfb577
Swap the order of chart output to ensure metrics come last
yuancu Oct 29, 2025
2c8d632
Filter rows without col split when calculate grand total
yuancu Oct 29, 2025
1fe81b3
Chores: tweak code order
yuancu Oct 29, 2025
d7949ef
Add anonymize test to chart command
yuancu Oct 29, 2025
154cbc4
Merge remote-tracking branch 'origin/main' into issues/399
yuancu Oct 31, 2025
7bef202
Change grammart from limit=top 10 to limit=top10
yuancu Oct 31, 2025
9da3bd2
Update chart doc
yuancu Oct 31, 2025
05aff73
Merge remote-tracking branch 'origin/main' into issues/399
yuancu Nov 4, 2025
befede1
Rename __row_number__ for chart to _row_number_chart_
yuancu Nov 4, 2025
2bc738c
Sort by row and col splits on top of chart results
yuancu Nov 4, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
import org.opensearch.sql.ast.tree.Append;
import org.opensearch.sql.ast.tree.AppendCol;
import org.opensearch.sql.ast.tree.Bin;
import org.opensearch.sql.ast.tree.Chart;
import org.opensearch.sql.ast.tree.CloseCursor;
import org.opensearch.sql.ast.tree.Dedupe;
import org.opensearch.sql.ast.tree.Eval;
Expand Down Expand Up @@ -769,6 +770,11 @@ public LogicalPlan visitSpath(SPath node, AnalysisContext context) {
throw getOnlyForCalciteException("Spath");
}

@Override
public LogicalPlan visitChart(Chart node, AnalysisContext context) {
throw getOnlyForCalciteException("Chart");
}

@Override
public LogicalPlan visitTimechart(Timechart node, AnalysisContext context) {
throw getOnlyForCalciteException("Timechart");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.opensearch.sql.ast.tree.Append;
import org.opensearch.sql.ast.tree.AppendCol;
import org.opensearch.sql.ast.tree.Bin;
import org.opensearch.sql.ast.tree.Chart;
import org.opensearch.sql.ast.tree.CloseCursor;
import org.opensearch.sql.ast.tree.Dedupe;
import org.opensearch.sql.ast.tree.Eval;
Expand Down Expand Up @@ -275,6 +276,10 @@ public T visitReverse(Reverse node, C context) {
return visitChildren(node, context);
}

public T visitChart(Chart node, C context) {
return visitChildren(node, context);
}

public T visitTimechart(Timechart node, C context) {
return visitChildren(node, context);
}
Expand Down
55 changes: 55 additions & 0 deletions core/src/main/java/org/opensearch/sql/ast/tree/Chart.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.sql.ast.tree;

import com.google.common.collect.ImmutableList;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import org.opensearch.sql.ast.AbstractNodeVisitor;
import org.opensearch.sql.ast.dsl.AstDSL;
import org.opensearch.sql.ast.expression.Argument;
import org.opensearch.sql.ast.expression.Literal;
import org.opensearch.sql.ast.expression.UnresolvedExpression;

/** AST node represent chart command. */
@Getter
@ToString
@EqualsAndHashCode(callSuper = false)
@AllArgsConstructor
@lombok.Builder(toBuilder = true)
public class Chart extends UnresolvedPlan {
public static final Literal DEFAULT_USE_OTHER = Literal.TRUE;
public static final Literal DEFAULT_OTHER_STR = AstDSL.stringLiteral("OTHER");
public static final Literal DEFAULT_LIMIT = AstDSL.intLiteral(10);
public static final Literal DEFAULT_USE_NULL = Literal.TRUE;
public static final Literal DEFAULT_NULL_STR = AstDSL.stringLiteral("NULL");
public static final Literal DEFAULT_TOP = Literal.TRUE;

private UnresolvedPlan child;
private UnresolvedExpression rowSplit;
private UnresolvedExpression columnSplit;
private UnresolvedExpression aggregationFunction;
private List<Argument> arguments;

@Override
public UnresolvedPlan attach(UnresolvedPlan child) {
this.child = child;
return this;
}

@Override
public List<UnresolvedPlan> getChild() {
return this.child == null ? ImmutableList.of() : ImmutableList.of(this.child);
}

@Override
public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) {
return nodeVisitor.visitChart(this, context);
}
}
Loading
Loading