private Class<?> getColumnType(JSONObject field) throws GPUdbException {

    Class<?> columnType = null;

    // The Avro "type" element might be an array if the type is nullable
    if (field.get("type") instanceof JSONArray) {
      JSONArray columnTypes = field.getJSONArray("type");
      for (int j = 0; j < columnTypes.length(); j++) {
        String ct = (String) columnTypes.get(j);
        if (!ct.equals("null")) {
          columnType = getClassForType(ct);
          break;
        }
      }
    } else {
      columnType = getClassForType(field.getString("type"));
    }
    if (columnType == null) {
      throw new GPUdbException("Error getting column type for field: " + field.toString());
    }
    return columnType;
  }
private Class<?> getColumnType(JSONObject field) throws GPUdbException {

    Class<?> columnType = null;

    
    if (field.get("type") instanceof JSONArray) {
      JSONArray columnTypes = field.getJSONArray("type");
      for (int j = 0; j < columnTypes.length(); j++) {
        String ct = (String) columnTypes.get(j);
        if (!ct.equals("null")) {
          columnType = getClassForType(ct);
          break;
        }
      }
    } else {
      columnType = getClassForType(field.getString("type"));
    }
    if (columnType == null) {
      throw new GPUdbException("Error getting column type for field: " + field.toString());
    }
    return columnType;
  }
private Class < ? > getColumnType ( JSONObject field ) throws GPUdbException { Class < ? > columnType = null ; // The Avro "type" element might be an array if the type is nullable if ( field . get ( "type" ) instanceof JSONArray ) { JSONArray columnTypes = field . getJSONArray ( "type" ) ; for ( int j = 0 ; j < columnTypes . length ( ) ; j ++ ) { String ct = ( String ) columnTypes . get ( j ) ; if ( ! ct . equals ( "null" ) ) { columnType = getClassForType ( ct ) ; break ; } } } else { columnType = getClassForType ( field . getString ( "type" ) ) ; } if ( columnType == null ) { throw new GPUdbException ( "Error getting column type for field: " + field . toString ( ) ) ; } return columnType ; }
Get the Class for the column type
Get the Class for the column type