@@ -506,23 +506,21 @@ private void validateTimePartitioningColumn(String columnName, FailureCollector
506506
507507    boolean  isTimestamp  = logicalType  == LogicalType .TIMESTAMP_MICROS  || logicalType  == LogicalType .TIMESTAMP_MILLIS ;
508508    boolean  isDate  = logicalType  == LogicalType .DATE ;
509-     boolean  isTimestampOrDate  = isTimestamp  ||  isDate ;
510- 
511-     // If timePartitioningType is HOUR, then logicalType cannot be DATE Only TIMESTAMP_MICROS and TIMESTAMP_MILLIS 
512-     if  ( timePartitioningType  ==  TimePartitioning . Type . HOUR  && ! isTimestamp ) { 
513-        collector . addFailure ( 
514-                        String .format ("Partition column '%s' is of invalid type '%s'." ,
509+     boolean  isDateTime  = logicalType  ==  LogicalType . DATETIME ;
510+      boolean   isTimestampOrDateOrDateTime  =  isTimestamp  ||  isDate  ||  isDateTime ; 
511+     boolean   isTimestampOrDateTime  =  isTimestamp  ||  isDateTime ; 
512+     // TimePartitioningType  HOUR is supported by TIMESTAMP_MICROS, TIMESTAMP_MILLIS, DATETIME 
513+     if  ( timePartitioningType  ==  TimePartitioning . Type . HOUR  && ! isTimestampOrDateTime ) { 
514+       collector . addFailure ( String .format ("Partition column '%s' is of invalid type '%s'." ,
515515                              columnName , fieldSchema .getDisplayName ()),
516-                       "Partition column must be a timestamp." ).withConfigProperty (NAME_PARTITION_BY_FIELD )
517-               .withOutputSchemaField (columnName ).withInputSchemaField (columnName );
518- 
519-     // For any other timePartitioningType (DAY, MONTH, YEAR) logicalType can be DATE, TIMESTAMP_MICROS, TIMESTAMP_MILLIS 
520-     } else  if  (!isTimestampOrDate ) {
521-       collector .addFailure (
522-                       String .format ("Partition column '%s' is of invalid type '%s'." ,
516+                       "Partition column must be of type TIMESTAMP or DATETIME" )
517+         .withConfigProperty (NAME_PARTITION_BY_FIELD ).withOutputSchemaField (columnName ).withInputSchemaField (columnName );
518+     // TimePartitioningType (DAY, MONTH, YEAR) are supported by TIMESTAMP_MICROS, TIMESTAMP_MILLIS, DATE, DATETIME 
519+     } else  if  (!isTimestampOrDateOrDateTime ) {
520+       collector .addFailure (String .format ("Partition column '%s' is of invalid type '%s'." ,
523521                              columnName , fieldSchema .getDisplayName ()),
524-                       "Partition column must be a date  or timestamp."  ). withConfigProperty ( NAME_PARTITION_BY_FIELD )
525-                .withOutputSchemaField (columnName ).withInputSchemaField (columnName );
522+                       "Partition column must be of type TIMESTAMP, DATE  or DATETIME"  )
523+         . withConfigProperty ( NAME_PARTITION_BY_FIELD ) .withOutputSchemaField (columnName ).withInputSchemaField (columnName );
526524    }
527525  }
528526
0 commit comments