parquet-column/src/main/java/org/apache/parquet/filter2/predicate/ValidTypeMap.java
public static <T extends Comparable<T>> void assertTypeValid(Column<T> foundColumn, PrimitiveTypeName primitiveType) {
    Class<T> foundColumnType = foundColumn.getColumnType();
    ColumnPath columnPath = foundColumn.getColumnPath();

    Set<PrimitiveTypeName> validTypeDescriptors = classToParquetType.get(foundColumnType);

    if (validTypeDescriptors == null) {
      StringBuilder message = new StringBuilder();
      message
          .append("Column ")
          .append(columnPath.toDotString())
          .append(" was declared as type: ")
          .append(foundColumnType.getName())
          .append(" which is not supported in FilterPredicates.");

      Set<Class<?>> supportedTypes = parquetTypeToClass.get(primitiveType);
      if (supportedTypes != null) {
        message
          .append(" Supported types for this column are: ")
          .append(supportedTypes);
      } else {
        message.append(" There are no supported types for columns of " + primitiveType);
      }
      throw new IllegalArgumentException(message.toString());
    }

    if (!validTypeDescriptors.contains(primitiveType)) {
      StringBuilder message = new StringBuilder();
      message
          .append("FilterPredicate column: ")
          .append(columnPath.toDotString())
          .append("'s declared type (")
          .append(foundColumnType.getName())
          .append(") does not match the schema found in file metadata. Column ")
          .append(columnPath.toDotString())
          .append(" is of type: ")
          .append(primitiveType)
          .append("\nValid types for this column are: ")
          .append(parquetTypeToClass.get(primitiveType));
      throw new IllegalArgumentException(message.toString());
    }
  }
public static <T extends Comparable<T>> void assertTypeValid(Column<T> foundColumn, PrimitiveTypeName primitiveType) {
    Class<T> foundColumnType = foundColumn.getColumnType();
    ColumnPath columnPath = foundColumn.getColumnPath();

    Set<PrimitiveTypeName> validTypeDescriptors = classToParquetType.get(foundColumnType);

    if (validTypeDescriptors == null) {
      StringBuilder message = new StringBuilder();
      message
          .append("Column ")
          .append(columnPath.toDotString())
          .append(" was declared as type: ")
          .append(foundColumnType.getName())
          .append(" which is not supported in FilterPredicates.");

      Set<Class<?>> supportedTypes = parquetTypeToClass.get(primitiveType);
      if (supportedTypes != null) {
        message
          .append(" Supported types for this column are: ")
          .append(supportedTypes);
      } else {
        message.append(" There are no supported types for columns of " + primitiveType);
      }
      throw new IllegalArgumentException(message.toString());
    }

    if (!validTypeDescriptors.contains(primitiveType)) {
      StringBuilder message = new StringBuilder();
      message
          .append("FilterPredicate column: ")
          .append(columnPath.toDotString())
          .append("'s declared type (")
          .append(foundColumnType.getName())
          .append(") does not match the schema found in file metadata. Column ")
          .append(columnPath.toDotString())
          .append(" is of type: ")
          .append(primitiveType)
          .append("\nValid types for this column are: ")
          .append(parquetTypeToClass.get(primitiveType));
      throw new IllegalArgumentException(message.toString());
    }
  }
public static < T extends Comparable < T > > void assertTypeValid ( Column < T > foundColumn , PrimitiveTypeName primitiveType ) { Class < T > foundColumnType = foundColumn . getColumnType ( ) ; ColumnPath columnPath = foundColumn . getColumnPath ( ) ; Set < PrimitiveTypeName > validTypeDescriptors = classToParquetType . get ( foundColumnType ) ; if ( validTypeDescriptors == null ) { StringBuilder message = new StringBuilder ( ) ; message . append ( "Column " ) . append ( columnPath . toDotString ( ) ) . append ( " was declared as type: " ) . append ( foundColumnType . getName ( ) ) . append ( " which is not supported in FilterPredicates." ) ; Set < Class < ? > > supportedTypes = parquetTypeToClass . get ( primitiveType ) ; if ( supportedTypes != null ) { message . append ( " Supported types for this column are: " ) . append ( supportedTypes ) ; } else { message . append ( " There are no supported types for columns of " + primitiveType ) ; } throw new IllegalArgumentException ( message . toString ( ) ) ; } if ( ! validTypeDescriptors . contains ( primitiveType ) ) { StringBuilder message = new StringBuilder ( ) ; message . append ( "FilterPredicate column: " ) . append ( columnPath . toDotString ( ) ) . append ( "'s declared type (" ) . append ( foundColumnType . getName ( ) ) . append ( ") does not match the schema found in file metadata. Column " ) . append ( columnPath . toDotString ( ) ) . append ( " is of type: " ) . append ( primitiveType ) . append ( "\nValid types for this column are: " ) . append ( parquetTypeToClass . get ( primitiveType ) ) ; throw new IllegalArgumentException ( message . toString ( ) ) ; } }
Asserts that foundColumn was declared as a type that is compatible with the type for this column found
in the schema of the parquet file.

@throws java.lang.IllegalArgumentException if the types do not align

@param foundColumn the column as declared by the user
@param primitiveType the primitive type according to the schema
@param <T> the java Type of values in the column, must be Comparable
Asserts that foundColumn was declared as a type that is compatible with the type for this column found in the schema of the parquet file .