LakshSingla commented on code in PR #16800:
URL: https://github.com/apache/druid/pull/16800#discussion_r1760765548
##########
sql/src/test/java/org/apache/druid/sql/calcite/BaseCalciteQueryTest.java:
##########
@@ -982,13 +983,40 @@ void validate(int row, int column, ValueType type, Object
expectedCell, Object r
mismatchMessage(row, column),
(Float) expectedCell,
(Float) resultCell,
- ASSERTION_EPSILON);
+ ASSERTION_EPSILON
+ );
} else if (expectedCell instanceof Double) {
assertEquals(
mismatchMessage(row, column),
(Double) expectedCell,
(Double) resultCell,
- ASSERTION_EPSILON);
+ ASSERTION_EPSILON
+ );
+ } else if (expectedCell instanceof Object[] || expectedCell instanceof
List) {
+ final Object[] expectedCellCasted;
+ if (expectedCell instanceof Object[]) {
+ expectedCellCasted = (Object[]) expectedCell;
+ } else {
+ expectedCellCasted = ExprEval.coerceListToArray((List) resultCell,
true).rhs;
+ }
Review Comment:
> if it can be Object[] or a List can't it be some other type
It's expected to be an `Object[]`. I have added the coercion since the
selectors aren't implemented uniformly and some older written expressions can
return lists. It can be other types (like Long[]) but I don't think its
necessary to cover those cases unless encountered since that isn't the desired
behavior.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]