google-cloud-lib/src/main/java/com/streamsets/pipeline/stage/bigquery/lib/BigQueryDelegate.java
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;
  }
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;
  }
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.

If not, an unchecked exception will be thrown. This method is called when the resulting
container type should be a {@link Field.Type#LIST_MAP}

@param schema List of {@link com.google.cloud.bigquery.Field} representing the schema
at the current level of nesting. For example, if processing a
{@link LegacySQLTypeName#RECORD} or {@link StandardSQLTypeName#STRUCT}
this would only include the fields for that particular data structure and not the entire
result set.

@param values List of {@link FieldValue} representing the values to set in the generated
fields.
@return Specifically, a LinkedHashMap as the return value of this method is expected to be
used to create a
{@link Field.Type#LIST_MAP} field.
Converts a list of BigQuery fields to SDC Record fields . The provided parameters must have matching lengths .