private static Schema getActualRecord ( Schema inputSchema ) { if ( Type . RECORD . equals ( inputSchema . getType ( ) ) ) { return inputSchema ; } Preconditions . checkArgument ( Type . UNION . equals ( inputSchema . getType ( ) ) , "Nested schema is only support with either record or union type of null with record" ) ; Preconditions . checkArgument ( inputSchema . getTypes ( ) . size ( ) <= 2 , "For union type in nested record, it should only have NULL and Record type" ) ; for ( Schema inner : inputSchema . getTypes ( ) ) { if ( Type . NULL . equals ( inner . getType ( ) ) ) { continue ; } Preconditions . checkArgument ( Type . RECORD . equals ( inner . getType ( ) ) , "For union type in nested record, it should only have NULL and Record type" ) ; return inner ; } throw new IllegalArgumentException ( inputSchema + " is not supported." ) ; }
For the schema that is a UNION type with NULL and Record type it provides Records type .