Skip to content

Commit a1d982d

Browse files
committed
Fix ast expression builder test
Signed-off-by: Yuanchun Shen <[email protected]>
1 parent 1570c9e commit a1d982d

File tree

1 file changed

+11
-33
lines changed

1 file changed

+11
-33
lines changed

ppl/src/test/java/org/opensearch/sql/ppl/parser/AstExpressionBuilderTest.java

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,9 +1405,7 @@ public void testTimechartSpanParameter() {
14051405
intLiteral(30),
14061406
SpanUnit.m)))
14071407
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1408-
.arguments(
1409-
exprList(
1410-
argument("limit", intLiteral(10)), argument("useother", booleanLiteral(true))))
1408+
.arguments(exprList(argument("spanliteral", stringLiteral("30m"))))
14111409
.build());
14121410
}
14131411

@@ -1425,9 +1423,7 @@ public void testTimechartLimitParameter() {
14251423
intLiteral(1),
14261424
SpanUnit.m)))
14271425
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1428-
.arguments(
1429-
exprList(
1430-
argument("limit", intLiteral(100)), argument("useother", booleanLiteral(true))))
1426+
.arguments(exprList(argument("limit", intLiteral(100))))
14311427
.build());
14321428
}
14331429

@@ -1452,9 +1448,7 @@ public void testTimechartUseOtherWithBooleanLiteral() {
14521448
intLiteral(1),
14531449
SpanUnit.m)))
14541450
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1455-
.arguments(
1456-
exprList(
1457-
argument("limit", intLiteral(10)), argument("useother", booleanLiteral(true))))
1451+
.arguments(exprList(argument("useother", booleanLiteral(true))))
14581452
.build());
14591453

14601454
assertEqual(
@@ -1469,9 +1463,7 @@ public void testTimechartUseOtherWithBooleanLiteral() {
14691463
intLiteral(1),
14701464
SpanUnit.m)))
14711465
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1472-
.arguments(
1473-
exprList(
1474-
argument("limit", intLiteral(10)), argument("useother", booleanLiteral(false))))
1466+
.arguments(exprList(argument("useother", booleanLiteral(false))))
14751467
.build());
14761468
}
14771469

@@ -1489,9 +1481,7 @@ public void testTimechartUseOtherWithIdentifier() {
14891481
intLiteral(1),
14901482
SpanUnit.m)))
14911483
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1492-
.arguments(
1493-
exprList(
1494-
argument("limit", intLiteral(10)), argument("useother", booleanLiteral(true))))
1484+
.arguments(exprList(argument("useother", booleanLiteral(true))))
14951485
.build());
14961486

14971487
assertEqual(
@@ -1506,9 +1496,7 @@ public void testTimechartUseOtherWithIdentifier() {
15061496
intLiteral(1),
15071497
SpanUnit.m)))
15081498
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1509-
.arguments(
1510-
exprList(
1511-
argument("limit", intLiteral(10)), argument("useother", booleanLiteral(false))))
1499+
.arguments(exprList(argument("useother", booleanLiteral(false))))
15121500
.build());
15131501

15141502
assertEqual(
@@ -1523,9 +1511,7 @@ public void testTimechartUseOtherWithIdentifier() {
15231511
intLiteral(1),
15241512
SpanUnit.m)))
15251513
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1526-
.arguments(
1527-
exprList(
1528-
argument("limit", intLiteral(10)), argument("useother", booleanLiteral(true))))
1514+
.arguments(exprList(argument("useother", booleanLiteral(true))))
15291515
.build());
15301516

15311517
assertEqual(
@@ -1540,9 +1526,7 @@ public void testTimechartUseOtherWithIdentifier() {
15401526
intLiteral(1),
15411527
SpanUnit.m)))
15421528
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1543-
.arguments(
1544-
exprList(
1545-
argument("limit", intLiteral(10)), argument("useother", booleanLiteral(false))))
1529+
.arguments(exprList(argument("useother", booleanLiteral(false))))
15461530
.build());
15471531
}
15481532

@@ -1616,9 +1600,7 @@ public void testVisitSpanLiteral() {
16161600
intLiteral(1),
16171601
SpanUnit.H)))
16181602
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1619-
.arguments(
1620-
exprList(
1621-
argument("limit", intLiteral(10)), argument("useother", booleanLiteral(true))))
1603+
.arguments(exprList(argument("spanliteral", stringLiteral("1h"))))
16221604
.build());
16231605

16241606
// Test span literal with decimal value and minute unit
@@ -1634,9 +1616,7 @@ public void testVisitSpanLiteral() {
16341616
intLiteral(2),
16351617
SpanUnit.m)))
16361618
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1637-
.arguments(
1638-
exprList(
1639-
argument("limit", intLiteral(10)), argument("useother", booleanLiteral(true))))
1619+
.arguments(exprList(argument("spanliteral", stringLiteral("2m"))))
16401620
.build());
16411621

16421622
// Test span literal without unit (should use NONE unit)
@@ -1652,9 +1632,7 @@ public void testVisitSpanLiteral() {
16521632
intLiteral(10),
16531633
SpanUnit.NONE)))
16541634
.aggregationFunction(alias("count()", aggregate("count", allFields())))
1655-
.arguments(
1656-
exprList(
1657-
argument("limit", intLiteral(10)), argument("useother", booleanLiteral(true))))
1635+
.arguments(exprList(argument("spanliteral", intLiteral(10))))
16581636
.build());
16591637
}
16601638

0 commit comments

Comments
 (0)