twalthr commented on code in PR #28146:
URL: https://github.com/apache/flink/pull/28146#discussion_r3234393238
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/strategies/ToTimestampLtzTypeStrategy.java:
##########
@@ -66,19 +70,24 @@ public Optional<DataType> inferType(CallContext
callContext) {
}
break;
case 2:
- LogicalType secondType = argumentTypes.get(1).getLogicalType();
+ LogicalType secondType =
+
argumentTypes.get(PRECISION_OR_FORMAT_ARG).getLogicalType();
LogicalTypeRoot secondTypeRoot = secondType.getTypeRoot();
if (firstType.is(LogicalTypeFamily.NUMERIC)) {
if (secondTypeRoot != LogicalTypeRoot.INTEGER) {
throw new ValidationException(
"Unsupported argument type. "
+ "TO_TIMESTAMP_LTZ(<NUMERIC>,
<INTEGER>) requires the second argument to be <INTEGER>.");
}
- Optional<Integer> precisionOpt =
callContext.getArgumentValue(1, Integer.class);
- if (precisionOpt.isPresent()) {
- int precision = precisionOpt.get();
- validatePrecision(precision);
- outputPrecision = Math.max(precision,
DEFAULT_PRECISION);
+ if
(callContext.isArgumentLiteral(PRECISION_OR_FORMAT_ARG)) {
Review Comment:
The warning is a nice idea, but we should not log on these "little things"
given the size of logs a Flink JM/TM can produce. Type inference might be
executed multiple times during planning, it would spam the logs. Also the logs
end up in SQL gateway, far away from enduser. Thus, remain unnoticed. I you are
not strong on this, I would revert this part.
--
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]