google-cloud-lib/src/main/java/com/streamsets/pipeline/stage/bigquery/destination/BigQueryTarget.java
private Map<String, Object> convertToRowObjectFromRecord(Record record) throws OnRecordErrorException {
    Field rootField = record.get();
    Map<String, Object> rowObject = new LinkedHashMap<>();
    if (rootField.getType().isOneOf(Field.Type.MAP, Field.Type.LIST_MAP)) {
      Map<String, Field> fieldMap = rootField.getValueAsMap();
      for (Map.Entry<String, Field> fieldEntry : fieldMap.entrySet()) {
        Field field = fieldEntry.getValue();
        //Skip null value fields
        if (field.getValue() != null){
          try {
            rowObject.put(fieldEntry.getKey(), getValueFromField("/" + fieldEntry.getKey(), field));
          } catch (IllegalArgumentException e) {
            throw new OnRecordErrorException(record, Errors.BIGQUERY_13, e.getMessage());
          }
        }
      }
    } else {
      throw new OnRecordErrorException(record,  Errors.BIGQUERY_16);
    }
    return rowObject;
  }
private Map<String, Object> convertToRowObjectFromRecord(Record record) throws OnRecordErrorException {
    Field rootField = record.get();
    Map<String, Object> rowObject = new LinkedHashMap<>();
    if (rootField.getType().isOneOf(Field.Type.MAP, Field.Type.LIST_MAP)) {
      Map<String, Field> fieldMap = rootField.getValueAsMap();
      for (Map.Entry<String, Field> fieldEntry : fieldMap.entrySet()) {
        Field field = fieldEntry.getValue();
        //Skip null value fields
        if (field.getValue() != null){
          try {
            rowObject.put(fieldEntry.getKey(), getValueFromField("/" + fieldEntry.getKey(), field));
          } catch (IllegalArgumentException e) {
            throw new OnRecordErrorException(record, Errors.BIGQUERY_13, e.getMessage());
          }
        }
      }
    } else {
      throw new OnRecordErrorException(record,  Errors.BIGQUERY_16);
    }
    return rowObject;
  }
private Map < String , Object > convertToRowObjectFromRecord ( Record record ) throws OnRecordErrorException { Field rootField = record . get ( ) ; Map < String , Object > rowObject = new LinkedHashMap <> ( ) ; if ( rootField . getType ( ) . isOneOf ( Field . Type . MAP , Field . Type . LIST_MAP ) ) { Map < String , Field > fieldMap = rootField . getValueAsMap ( ) ; for ( Map . Entry < String , Field > fieldEntry : fieldMap . entrySet ( ) ) { Field field = fieldEntry . getValue ( ) ; //Skip null value fields if ( field . getValue ( ) != null ) { try { rowObject . put ( fieldEntry . getKey ( ) , getValueFromField ( "/" + fieldEntry . getKey ( ) , field ) ) ; } catch ( IllegalArgumentException e ) { throw new OnRecordErrorException ( record , Errors . BIGQUERY_13 , e . getMessage ( ) ) ; } } } } else { throw new OnRecordErrorException ( record , Errors . BIGQUERY_16 ) ; } return rowObject ; }
Convert the root field to a java map object implicitly mapping each field to the column (only non nested objects)
@param record record to be converted
@return Java row representation for the record
Convert the root field to a java map object implicitly mapping each field to the column ( only non nested objects )