test_class.declarator: mockBigquery
test_class.modifier: @Mock private
test_class.original_string: @Mock private Bigquery mockBigquery;
test_class.type: Bigquery
test_class.var_name: mockBigquery
test_class.declarator: mockBigqueryJobs
test_class.modifier: @Mock private
test_class.original_string: @Mock private Bigquery.Jobs mockBigqueryJobs;
test_class.type: Bigquery.Jobs
test_class.var_name: mockBigqueryJobs
test_class.declarator: mockBigqueryJobsGet
test_class.modifier: @Mock private
test_class.original_string: @Mock private Bigquery.Jobs.Get mockBigqueryJobsGet;
test_class.type: Bigquery.Jobs.Get
test_class.var_name: mockBigqueryJobsGet
test_class.declarator: mockBigqueryJobsInsert
test_class.modifier: @Mock private
test_class.original_string: @Mock private Bigquery.Jobs.Insert mockBigqueryJobsInsert;
test_class.type: Bigquery.Jobs.Insert
test_class.var_name: mockBigqueryJobsInsert
test_class.declarator: mockBigqueryTables
test_class.modifier: @Mock private
test_class.original_string: @Mock private Bigquery.Tables mockBigqueryTables;
test_class.type: Bigquery.Tables
test_class.var_name: mockBigqueryTables
test_class.declarator: mockBigqueryTablesGet
test_class.modifier: @Mock private
test_class.original_string: @Mock private Bigquery.Tables.Get mockBigqueryTablesGet;
test_class.type: Bigquery.Tables.Get
test_class.var_name: mockBigqueryTablesGet
test_class.declarator: mockErrorExtractor
test_class.modifier: @Mock private
test_class.original_string: @Mock private ApiErrorExtractor mockErrorExtractor;
test_class.type: ApiErrorExtractor
test_class.var_name: mockErrorExtractor
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: jobHandle
test_class.modifier: private
test_class.original_string: private Job jobHandle;
test_class.type: Job
test_class.var_name: jobHandle
test_class.declarator: fakeTable
test_class.modifier: private
test_class.original_string: private Table fakeTable;
test_class.type: Table
test_class.var_name: fakeTable
test_class.declarator: fakeTableSchema
test_class.modifier: private
test_class.original_string: private TableSchema fakeTableSchema;
test_class.type: TableSchema
test_class.var_name: fakeTableSchema
test_class.declarator: jobProjectId = "google.com:foo-project"
test_class.modifier: private
test_class.original_string: private String jobProjectId = "google.com:foo-project";
test_class.type: String
test_class.var_name: jobProjectId
test_class.declarator: kmsKeyName =
        "projects/google.com:foo-project/locations/us-west1/keyRings/ring-1/cryptoKeys/key-1"
test_class.modifier: private final
test_class.original_string: private final String kmsKeyName =
        "projects/google.com:foo-project/locations/us-west1/keyRings/ring-1/cryptoKeys/key-1";
test_class.type: String
test_class.var_name: kmsKeyName
test_class.declarator: tableRef
test_class.modifier: private
test_class.original_string: private TableReference tableRef;
test_class.type: TableReference
test_class.var_name: tableRef
test_class.declarator: projectId = "google.com:bar-project"
test_class.modifier: private
test_class.original_string: private String projectId = "google.com:bar-project";
test_class.type: String
test_class.var_name: projectId
test_class.declarator: datasetId = "test_dataset"
test_class.modifier: private
test_class.original_string: private String datasetId = "test_dataset";
test_class.type: String
test_class.var_name: datasetId
test_class.declarator: tableId = "test_table"
test_class.modifier: private
test_class.original_string: private String tableId = "test_table";
test_class.type: String
test_class.var_name: tableId
test_class.declarator: jobId = "bigquery-job-1234"
test_class.modifier: private
test_class.original_string: private String jobId = "bigquery-job-1234";
test_class.type: String
test_class.var_name: jobId
test_class.declarator: helper
test_class.modifier: private
test_class.original_string: private BigQueryHelper helper;
test_class.type: BigQueryHelper
test_class.var_name: helper
test_class.file: bigquery/src/test/java/com/google/cloud/hadoop/io/bigquery/BigQueryHelperTest.java
test_class.identifier: BigQueryHelperTest
test_case.body: @Test
    public void testTableExistsTrue() throws IOException {
      when(mockBigqueryTablesGet.execute()).thenReturn(fakeTable);
  
      boolean exists = helper.tableExists(tableRef);
  
      // Verify correct calls are made.
      verify(mockBigquery, times(1)).tables();
      verify(mockBigqueryTables, times(1)).get(eq(projectId), eq(datasetId), eq(tableId));
      verify(mockBigqueryTablesGet, times(1)).execute();
  
      assertThat(exists).isTrue();
    }
test_case.class_method_signature: BigQueryHelperTest.testTableExistsTrue()
test_case.full_signature: @Test public void testTableExistsTrue()
test_case.identifier: testTableExistsTrue
test_case.invocations: thenReturn when execute tableExists tables verify times get verify times eq eq eq execute verify times isTrue assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testTableExistsTrue()
focal_class.declarator: BIGQUERY_JOB_ID_PATTERN = "[a-zA-Z0-9_-]+"
focal_class.modifier: public static final
focal_class.original_string: public static final String BIGQUERY_JOB_ID_PATTERN = "[a-zA-Z0-9_-]+";
focal_class.type: String
focal_class.var_name: BIGQUERY_JOB_ID_PATTERN
focal_class.declarator: BIGQUERY_JOB_ID_MAX_LENGTH = 1024
focal_class.modifier: public static final
focal_class.original_string: public static final int BIGQUERY_JOB_ID_MAX_LENGTH = 1024;
focal_class.type: int
focal_class.var_name: BIGQUERY_JOB_ID_MAX_LENGTH
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: errorExtractor = ApiErrorExtractor.INSTANCE
focal_class.modifier: private
focal_class.original_string: private ApiErrorExtractor errorExtractor = ApiErrorExtractor.INSTANCE;
focal_class.type: ApiErrorExtractor
focal_class.var_name: errorExtractor
focal_class.declarator: service
focal_class.modifier: private
focal_class.original_string: private Bigquery service;
focal_class.type: Bigquery
focal_class.var_name: service
focal_class.file: bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/BigQueryHelper.java
focal_class.identifier: BigQueryHelper
focal_class.class_method_signature: BigQueryHelper.BigQueryHelper(Bigquery service)
focal_class.full_signature: public  BigQueryHelper(Bigquery service)
focal_class.identifier: BigQueryHelper
focal_class.modifiers: public
focal_class.parameters: (Bigquery service)
focal_class.signature:  BigQueryHelper(Bigquery service)
focal_class.class_method_signature: BigQueryHelper.getRawBigquery()
focal_class.full_signature: public Bigquery getRawBigquery()
focal_class.identifier: getRawBigquery
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Bigquery
focal_class.signature: Bigquery getRawBigquery()
focal_class.class_method_signature: BigQueryHelper.importFederatedFromGcs(
        String projectId,
        TableReference tableRef,
        @Nullable TableSchema schema,
        BigQueryFileFormat sourceFormat,
        List<String> gcsPaths)
focal_class.full_signature: public void importFederatedFromGcs(
        String projectId,
        TableReference tableRef,
        @Nullable TableSchema schema,
        BigQueryFileFormat sourceFormat,
        List<String> gcsPaths)
focal_class.identifier: importFederatedFromGcs
focal_class.modifiers: public
focal_class.parameters: (
        String projectId,
        TableReference tableRef,
        @Nullable TableSchema schema,
        BigQueryFileFormat sourceFormat,
        List<String> gcsPaths)
focal_class.return: void
focal_class.signature: void importFederatedFromGcs(
        String projectId,
        TableReference tableRef,
        @Nullable TableSchema schema,
        BigQueryFileFormat sourceFormat,
        List<String> gcsPaths)
focal_class.class_method_signature: BigQueryHelper.importFromGcs(
        String projectId,
        TableReference tableRef,
        @Nullable TableSchema schema,
        @Nullable TimePartitioning timePartitioning,
        @Nullable String kmsKeyName,
        BigQueryFileFormat sourceFormat,
        String createDisposition,
        String writeDisposition,
        List<String> gcsPaths,
        boolean awaitCompletion)
focal_class.full_signature: public void importFromGcs(
        String projectId,
        TableReference tableRef,
        @Nullable TableSchema schema,
        @Nullable TimePartitioning timePartitioning,
        @Nullable String kmsKeyName,
        BigQueryFileFormat sourceFormat,
        String createDisposition,
        String writeDisposition,
        List<String> gcsPaths,
        boolean awaitCompletion)
focal_class.identifier: importFromGcs
focal_class.modifiers: public
focal_class.parameters: (
        String projectId,
        TableReference tableRef,
        @Nullable TableSchema schema,
        @Nullable TimePartitioning timePartitioning,
        @Nullable String kmsKeyName,
        BigQueryFileFormat sourceFormat,
        String createDisposition,
        String writeDisposition,
        List<String> gcsPaths,
        boolean awaitCompletion)
focal_class.return: void
focal_class.signature: void importFromGcs(
        String projectId,
        TableReference tableRef,
        @Nullable TableSchema schema,
        @Nullable TimePartitioning timePartitioning,
        @Nullable String kmsKeyName,
        BigQueryFileFormat sourceFormat,
        String createDisposition,
        String writeDisposition,
        List<String> gcsPaths,
        boolean awaitCompletion)
focal_class.class_method_signature: BigQueryHelper.exportBigQueryToGcs(
        String projectId, TableReference tableRef, List<String> gcsPaths, boolean awaitCompletion)
focal_class.full_signature: public void exportBigQueryToGcs(
        String projectId, TableReference tableRef, List<String> gcsPaths, boolean awaitCompletion)
focal_class.identifier: exportBigQueryToGcs
focal_class.modifiers: public
focal_class.parameters: (
        String projectId, TableReference tableRef, List<String> gcsPaths, boolean awaitCompletion)
focal_class.return: void
focal_class.signature: void exportBigQueryToGcs(
        String projectId, TableReference tableRef, List<String> gcsPaths, boolean awaitCompletion)
focal_class.class_method_signature: BigQueryHelper.tableExists(TableReference tableRef)
focal_class.full_signature: public boolean tableExists(TableReference tableRef)
focal_class.identifier: tableExists
focal_class.modifiers: public
focal_class.parameters: (TableReference tableRef)
focal_class.return: boolean
focal_class.signature: boolean tableExists(TableReference tableRef)
focal_class.class_method_signature: BigQueryHelper.getTable(TableReference tableRef)
focal_class.full_signature: public Table getTable(TableReference tableRef)
focal_class.identifier: getTable
focal_class.modifiers: public
focal_class.parameters: (TableReference tableRef)
focal_class.return: Table
focal_class.signature: Table getTable(TableReference tableRef)
focal_class.class_method_signature: BigQueryHelper.createJobReference(
        String projectId, String jobIdPrefix, @Nullable String location)
focal_class.full_signature: public JobReference createJobReference(
        String projectId, String jobIdPrefix, @Nullable String location)
focal_class.identifier: createJobReference
focal_class.modifiers: public
focal_class.parameters: (
        String projectId, String jobIdPrefix, @Nullable String location)
focal_class.return: JobReference
focal_class.signature: JobReference createJobReference(
        String projectId, String jobIdPrefix, @Nullable String location)
focal_class.class_method_signature: BigQueryHelper.checkJobIdEquality(Job expected, Job actual)
focal_class.full_signature: public void checkJobIdEquality(Job expected, Job actual)
focal_class.identifier: checkJobIdEquality
focal_class.modifiers: public
focal_class.parameters: (Job expected, Job actual)
focal_class.return: void
focal_class.signature: void checkJobIdEquality(Job expected, Job actual)
focal_class.class_method_signature: BigQueryHelper.insertJobOrFetchDuplicate(String projectId, Job job)
focal_class.full_signature: public Job insertJobOrFetchDuplicate(String projectId, Job job)
focal_class.identifier: insertJobOrFetchDuplicate
focal_class.modifiers: public
focal_class.parameters: (String projectId, Job job)
focal_class.return: Job
focal_class.signature: Job insertJobOrFetchDuplicate(String projectId, Job job)
focal_class.class_method_signature: BigQueryHelper.setErrorExtractor(ApiErrorExtractor errorExtractor)
focal_class.full_signature: @VisibleForTesting void setErrorExtractor(ApiErrorExtractor errorExtractor)
focal_class.identifier: setErrorExtractor
focal_class.modifiers: @VisibleForTesting
focal_class.parameters: (ApiErrorExtractor errorExtractor)
focal_class.return: void
focal_class.signature: void setErrorExtractor(ApiErrorExtractor errorExtractor)
focal_method.body: public boolean tableExists(TableReference tableRef) throws IOException {
      try {
        Table fetchedTable =
            service
                .tables()
                .get(tableRef.getProjectId(), tableRef.getDatasetId(), tableRef.getTableId())
                .execute();
        logger.atFine().log(
            "Successfully fetched table '%s' for tableRef '%s'", fetchedTable, tableRef);
        return true;
      } catch (IOException ioe) {
        if (errorExtractor.itemNotFound(ioe)) {
          return false;
        }
        throw new IOException(
            String.format("Unhandled exception trying to get table '%s'", tableRef), ioe);
      }
    }
focal_method.class_method_signature: BigQueryHelper.tableExists(TableReference tableRef)
focal_method.full_signature: public boolean tableExists(TableReference tableRef)
focal_method.identifier: tableExists
focal_method.invocations: execute get tables getProjectId getDatasetId getTableId log atFine itemNotFound format
focal_method.modifiers: public
focal_method.parameters: (TableReference tableRef)
focal_method.return: boolean
focal_method.signature: boolean tableExists(TableReference tableRef)