public static Schema partitionFieldSchema ( FieldPartitioner < ? , ? > fp , Schema schema ) { if ( fp instanceof IdentityFieldPartitioner ) { // copy the schema directly from the entity to preserve annotations return fieldSchema ( schema , fp . getSourceName ( ) ) ; } else { Class < ? > fieldType = getPartitionType ( fp , schema ) ; if ( fieldType == Integer . class ) { return Schema . create ( Schema . Type . INT ) ; } else if ( fieldType == Long . class ) { return Schema . create ( Schema . Type . LONG ) ; } else if ( fieldType == String . class ) { return Schema . create ( Schema . Type . STRING ) ; } else { throw new ValidationException ( "Cannot encode partition " + fp . getName ( ) + " with type " + fp . getSourceType ( ) ) ; } } }
Builds a Schema for the FieldPartitioner using the given Schema to determine types not fixed by the FieldPartitioner .