vlsi commented on a change in pull request #2224:
URL: https://github.com/apache/calcite/pull/2224#discussion_r507516757
##########
File path: core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
##########
@@ -2199,13 +2199,49 @@ public static boolean equal(
RelDataType type2,
Litmus litmus) {
if (!areRowTypesEqual(type1, type2, false)) {
- return litmus.fail("Type mismatch:\n{}:\n{}\n{}:\n{}",
+ return litmus.fail("Type mismatch:\n{}:\n{}\n{}:\n{}\ndifference:\n{}",
desc1, type1.getFullTypeString(),
- desc2, type2.getFullTypeString());
+ desc2, type2.getFullTypeString(),
+ getFullTypeDifferenceString(type1, type2));
}
return litmus.succeed();
}
+ public static String getFullTypeDifferenceString(RelDataType other,
+ RelDataType another) {
+ if (other == another) {
+ return "";
+ }
+
+ if (other.getFieldCount() != another.getFieldCount()) {
+ return "Type mismatch: the field size is not equal,"
+ + " one is " + other.getFieldCount()
+ + ", another one is " + another.getFieldCount();
Review comment:
Please, remove that.
The field count says nothing, and it would be a nightmare to debug errors
saying `"one is 5, another one is 6"`
Please incorporate that into "extra field" / "field removed" message.
----------------------------------------------------------------
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]