wenlong88 commented on a change in pull request #17666:
URL: https://github.com/apache/flink/pull/17666#discussion_r749836168



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/sql/SqlWindowTableFunction.java
##########
@@ -275,16 +277,25 @@ boolean checkTableAndDescriptorOperands(SqlCallBinding 
callBinding, int descript
             SqlNameMatcher matcher = 
validator.getCatalogReader().nameMatcher();
             for (RelDataTypeField field : type.getFieldList()) {
                 if (matcher.matches(field.getName(), columnName)) {
-                    if (FlinkTypeFactory.isTimeIndicatorType(field.getType())) 
{
+                    RelDataType fieldType = field.getType();
+                    if (FlinkTypeFactory.isTimeIndicatorType(fieldType)) {
                         return Optional.empty();
                     } else {
-                        ValidationException exception =
-                                new ValidationException(
-                                        String.format(
-                                                "The window function %s 
requires the timecol is a time attribute type, but is %s.",
-                                                
callBinding.getOperator().getAllowedSignatures(),
-                                                field.getType()));
-                        return Optional.of(exception);
+                        LogicalType timeAttributeType = 
FlinkTypeFactory.toLogicalType(fieldType);
+                        if (!canBeTimeAttributeType(timeAttributeType)) {
+                            ValidationException exception =
+                                    new ValidationException(
+                                            String.format(
+                                                    "The window function %s 
requires the timecol is a time attribute type.\n"
+                                                            + "The supported 
time indicator type are TIMESTAMP and TIMESTAMP_LTZ, but is %s.",

Review comment:
       the error message may be not so explicit, when a user use window by date 
in stream, this error would throw and then if he change the type to timestamp, 
another error would throw at StreamPhysicalWindowTableFunctionRule.
   
   can we point out explicitly that for batch supported type is XXX, and for 
streaming supported type is XXX. 




-- 
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]


Reply via email to