libenchao commented on code in PR #2847: URL: https://github.com/apache/calcite/pull/2847#discussion_r1040282037
########## core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercionImpl.java: ########## @@ -104,14 +104,15 @@ public TypeCoercionImpl(RelDataTypeFactory typeFactory, SqlValidator validator) updateInferredColumnType(scope1, query, columnIndex, targetType); return true; case VALUES: + boolean coerceValues = true; for (SqlNode rowConstructor : ((SqlCall) query).getOperandList()) { if (!coerceOperandType(scope, (SqlCall) rowConstructor, columnIndex, targetType)) { - return false; + coerceValues = false; } } updateInferredColumnType( requireNonNull(scope, "scope"), query, columnIndex, targetType); - return true; + return coerceValues; Review Comment: Then IMO, the return value is totally wrong now, it should be ```java boolean coerceValues = false; for (SqlNode rowConstructor : ((SqlCall) query).getOperandList()) { if (coerceOperandType(scope, (SqlCall) rowConstructor, columnIndex, targetType)) { coerceValues = true; } } if (coerceValues) { updateInferredColumnType( requireNonNull(scope, "scope"), query, columnIndex, targetType); } return coerceValues; ``` And the same logic should also be aligned in other similar methods, WDYT? -- 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: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org