test_class.declarator: mockBigQuery
test_class.modifier: private
test_class.original_string: private Bigquery mockBigQuery;
test_class.type: Bigquery
test_class.var_name: mockBigQuery
test_class.declarator: mockProgressable
test_class.modifier: private
test_class.original_string: private Progressable mockProgressable;
test_class.type: Progressable
test_class.var_name: mockProgressable
test_class.declarator: projectId = "Test"
test_class.modifier: private
test_class.original_string: private String projectId = "Test";
test_class.type: String
test_class.var_name: projectId
test_class.declarator: jobReference
test_class.modifier: private
test_class.original_string: private JobReference jobReference;
test_class.type: JobReference
test_class.var_name: jobReference
test_class.declarator: mockBigQueryJobs
test_class.modifier: private
test_class.original_string: private Bigquery.Jobs mockBigQueryJobs;
test_class.type: Bigquery.Jobs
test_class.var_name: mockBigQueryJobs
test_class.declarator: mockJobsGet
test_class.modifier: private
test_class.original_string: private Bigquery.Jobs.Get mockJobsGet;
test_class.type: Bigquery.Jobs.Get
test_class.var_name: mockJobsGet
test_class.declarator: jobStatus
test_class.modifier: private
test_class.original_string: private JobStatus jobStatus;
test_class.type: JobStatus
test_class.var_name: jobStatus
test_class.declarator: notDoneJobStatus
test_class.modifier: private
test_class.original_string: private JobStatus notDoneJobStatus;
test_class.type: JobStatus
test_class.var_name: notDoneJobStatus
test_class.declarator: job
test_class.modifier: private
test_class.original_string: private Job job;
test_class.type: Job
test_class.var_name: job
test_class.declarator: notDoneJob
test_class.modifier: private
test_class.original_string: private Job notDoneJob;
test_class.type: Job
test_class.var_name: notDoneJob
test_class.file: bigquery/src/test/java/com/google/cloud/hadoop/io/bigquery/BigQueryUtilsTest.java
test_class.identifier: BigQueryUtilsTest
test_case.body: @Test
    public void testGetSchemaFromStringWithTopLevelNonJsonObject() {
      // Bad schema, missing 'type' in the second entry.
      String fields =
          "[{'name': 'MyName', 'type': 'STRING'},"
          + "foo,"
          + "{'name': 'Number', 'type': 'INTEGER', 'mode': 'sample'}]";
      assertThrows(IllegalArgumentException.class, () -> BigQueryUtils.getSchemaFromString(fields));
    }
test_case.class_method_signature: BigQueryUtilsTest.testGetSchemaFromStringWithTopLevelNonJsonObject()
test_case.full_signature: @Test public void testGetSchemaFromStringWithTopLevelNonJsonObject()
test_case.identifier: testGetSchemaFromStringWithTopLevelNonJsonObject
test_case.invocations: assertThrows getSchemaFromString
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetSchemaFromStringWithTopLevelNonJsonObject()
focal_class.declarator: logger = GoogleLogger.forEnclosingClass()
focal_class.modifier: private static final
focal_class.original_string: private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();
focal_class.type: GoogleLogger
focal_class.var_name: logger
focal_class.declarator: POLL_WAIT_INITIAL_MILLIS =
        (int) TimeUnit.MILLISECONDS.convert(10, TimeUnit.SECONDS)
focal_class.modifier: public static final
focal_class.original_string: public static final int POLL_WAIT_INITIAL_MILLIS =
        (int) TimeUnit.MILLISECONDS.convert(10, TimeUnit.SECONDS);
focal_class.type: int
focal_class.var_name: POLL_WAIT_INITIAL_MILLIS
focal_class.declarator: POLL_WAIT_INTERVAL_MAX_MILLIS =
        (int) TimeUnit.MILLISECONDS.convert(180, TimeUnit.SECONDS)
focal_class.modifier: public static final
focal_class.original_string: public static final int POLL_WAIT_INTERVAL_MAX_MILLIS =
        (int) TimeUnit.MILLISECONDS.convert(180, TimeUnit.SECONDS);
focal_class.type: int
focal_class.var_name: POLL_WAIT_INTERVAL_MAX_MILLIS
focal_class.declarator: POLL_WAIT_MAX_ELAPSED_MILLIS =
        (int) TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS)
focal_class.modifier: public static final
focal_class.original_string: public static final int POLL_WAIT_MAX_ELAPSED_MILLIS =
        (int) TimeUnit.MILLISECONDS.convert(1, TimeUnit.DAYS);
focal_class.type: int
focal_class.var_name: POLL_WAIT_MAX_ELAPSED_MILLIS
focal_class.file: bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryUtils.java
focal_class.identifier: BigQueryUtils
focal_class.class_method_signature: BigQueryUtils.waitForJobCompletion(
        Bigquery bigquery, String projectId, JobReference jobReference, Progressable progressable)
focal_class.full_signature: public static void waitForJobCompletion(
        Bigquery bigquery, String projectId, JobReference jobReference, Progressable progressable)
focal_class.identifier: waitForJobCompletion
focal_class.modifiers: public static
focal_class.parameters: (
        Bigquery bigquery, String projectId, JobReference jobReference, Progressable progressable)
focal_class.return: void
focal_class.signature: void waitForJobCompletion(
        Bigquery bigquery, String projectId, JobReference jobReference, Progressable progressable)
focal_class.class_method_signature: BigQueryUtils.getSchemaFromString(String fields)
focal_class.full_signature: public static List<TableFieldSchema> getSchemaFromString(String fields)
focal_class.identifier: getSchemaFromString
focal_class.modifiers: public static
focal_class.parameters: (String fields)
focal_class.return: List<TableFieldSchema>
focal_class.signature: List<TableFieldSchema> getSchemaFromString(String fields)
focal_method.body: public static List<TableFieldSchema> getSchemaFromString(String fields) {
      logger.atFine().log("getSchemaFromString('%s')", fields);
  
      // Parse the output schema for Json from fields.
      JsonParser jsonParser = new JsonParser();
      JsonArray json = jsonParser.parse(fields).getAsJsonArray();
      List<TableFieldSchema> fieldsList = new ArrayList<>();
  
      // For each item in the list of fields.
      for (JsonElement jsonElement : json) {
        checkArgument(
            jsonElement.isJsonObject(), "Expected JsonObject for element, got '%s'.", jsonElement);
        JsonObject jsonObject = jsonElement.getAsJsonObject();
  
        // Set the name and type.
        checkArgument(
            jsonObject.get("name") != null,
            "Expected non-null entry for key 'name' in JsonObject '%s'", jsonObject);
        checkArgument(
            jsonObject.get("type") != null,
            "Expected non-null entry for key 'type' in JsonObject '%s'", jsonObject);
        TableFieldSchema fieldDef = new TableFieldSchema();
        fieldDef.setName(jsonObject.get("name").getAsString());
        fieldDef.setType(jsonObject.get("type").getAsString());
  
        // If mode is not null, set mode.
        if (jsonObject.get("mode") != null) {
          fieldDef.setMode(jsonObject.get("mode").getAsString());
        }
  
        // If the type is RECORD set the fields.
        if (jsonObject.get("type").getAsString().equals("RECORD")) {
          checkArgument(
              jsonObject.get("fields") != null,
              "Expected non-null entry for key 'fields' in JsonObject of type RECORD: '%s'",
              jsonObject);
          fieldDef.setFields(getSchemaFromString(jsonObject.get("fields").toString()));
        }
  
        fieldsList.add(fieldDef);
      }
      // Return list of TableFieldSchema.
      return fieldsList;
    }
focal_method.class_method_signature: BigQueryUtils.getSchemaFromString(String fields)
focal_method.full_signature: public static List<TableFieldSchema> getSchemaFromString(String fields)
focal_method.identifier: getSchemaFromString
focal_method.invocations: log atFine getAsJsonArray parse checkArgument isJsonObject getAsJsonObject checkArgument get checkArgument get setName getAsString get setType getAsString get get setMode getAsString get equals getAsString get checkArgument get setFields getSchemaFromString toString get add
focal_method.modifiers: public static
focal_method.parameters: (String fields)
focal_method.return: List<TableFieldSchema>
focal_method.signature: List<TableFieldSchema> getSchemaFromString(String fields)