zabetak commented on a change in pull request #1283: [CALCITE-3153] Improve
testing in TpcdsTest using assertEqual instead of printing results
URL: https://github.com/apache/calcite/pull/1283#discussion_r298568442
##########
File path: plus/src/test/java/org/apache/calcite/adapter/tpcds/TpcdsTest.java
##########
@@ -379,7 +380,23 @@ protected void foo(CalciteAssert.AssertThat with, String
tableName,
builder.avg(false, "AGG4", builder.field("SS_SALES_PRICE")))
.sortLimit(0, 100, builder.field("I_ITEM_ID"),
builder.field("S_STATE"))
.build();
- System.out.println(RelOptUtil.toString(root));
+ String actualResult = RelOptUtil.toString(root);
+ String expectResult = ""
+ + "LogicalSort(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC],
fetch=[100])\n"
+ + " LogicalAggregate(group=[{84, 90}], AGG1=[AVG($10)],
AGG2=[AVG($12)], AGG3=[AVG($19)], AGG4=[AVG($13)])\n"
+ + " LogicalFilter(condition=[AND(=($0, $32), =($2, $89), =($7,
$60), =($4, $23), =($24, 'M'), =($25, 'S'), =($26, 'HIGH SCHOOL'), =($38,
1998), IN($84, ARRAY('CA', 'OR', 'WA', 'TX', 'OK', 'MD')))])\n"
+ + " LogicalJoin(condition=[true], joinType=[inner])\n"
+ + " LogicalTableScan(table=[[TPCDS, STORE_SALES]])\n"
+ + " LogicalJoin(condition=[true], joinType=[inner])\n"
+ + " LogicalTableScan(table=[[TPCDS,
CUSTOMER_DEMOGRAPHICS]])\n"
+ + " LogicalJoin(condition=[true], joinType=[inner])\n"
+ + " LogicalTableScan(table=[[TPCDS, DATE_DIM]])\n"
+ + " LogicalJoin(condition=[true], joinType=[inner])\n"
+ + " LogicalTableScan(table=[[TPCDS, STORE]])\n"
+ + " LogicalTableScan(table=[[TPCDS, ITEM]])\n";
+
+ Assert.assertEquals("Query27 of TPCDS should be equal to the expect
result",
+ actualResult, expectResult);
Review comment:
I would suggest to use the same mechanism for comparing plans that is used
in `RelBuilderTest`. Moreover the assertion above is not written in the correct
order:
`Assert.assertEquals("Query27 of TPCDS should be equal to the expect result",
expectResult, actualResult);`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services