public LinkedHashMap < String , Field > fieldsToMap ( // NOSONAR List < com . google . cloud . bigquery . Field > schema , List < FieldValue > values ) { checkState ( schema . size ( ) == values . size ( ) , "Schema '{}' and Values '{}' sizes do not match." , schema . size ( ) , values . size ( ) ) ; LinkedHashMap < String , Field > root = new LinkedHashMap <> ( ) ; for ( int i = 0 ; i < values . size ( ) ; i ++ ) { FieldValue value = values . get ( i ) ; com . google . cloud . bigquery . Field field = schema . get ( i ) ; if ( value . getAttribute ( ) . equals ( FieldValue . Attribute . PRIMITIVE ) ) { root . put ( field . getName ( ) , fromPrimitiveField ( field , value ) ) ; } else if ( value . getAttribute ( ) . equals ( FieldValue . Attribute . RECORD ) ) { root . put ( field . getName ( ) , Field . create ( fieldsToMap ( field . getSubFields ( ) , value . getRecordValue ( ) ) ) ) ; } else if ( value . getAttribute ( ) . equals ( FieldValue . Attribute . REPEATED ) ) { root . put ( field . getName ( ) , Field . create ( fromRepeatedField ( field , value . getRepeatedValue ( ) ) ) ) ; } } return root ; }
Converts a list of BigQuery fields to SDC Record fields . The provided parameters must have matching lengths .