class BigQueryOutputConfiguration {

  static Optional<BigQueryTableSchema> getTableSchema(Configuration conf) throws IOException {
    String fieldsJson = OUTPUT_TABLE_SCHEMA.get(conf, conf::get);
    if (!Strings.isNullOrEmpty(fieldsJson)) {
      try {
        TableSchema tableSchema = BigQueryTableHelper.createTableSchemaFromFields(fieldsJson);
        return Optional.of(BigQueryTableSchema.wrap(tableSchema));
      } catch (IOException e) {
        throw new IOException("Unable to parse key '" + OUTPUT_TABLE_SCHEMA.getKey() + "'.", e);
      }
    }
    return Optional.empty();
  }

}