BigQueryConfiguration { public static String getTemporaryPathRoot(Configuration conf, @Nullable JobID jobId) throws IOException { String pathRoot = conf.get(BigQueryConfiguration.TEMP_GCS_PATH.getKey()); if (Strings.isNullOrEmpty(pathRoot)) { checkNotNull(jobId, "jobId is required if '%s' is not set", TEMP_GCS_PATH.getKey()); logger.atInfo().log( "Fetching key '%s' since '%s' isn't set explicitly.", GCS_BUCKET.getKey(), TEMP_GCS_PATH.getKey()); String gcsBucket = conf.get(GCS_BUCKET.getKey()); if (Strings.isNullOrEmpty(gcsBucket)) { throw new IOException( "Must supply a value for configuration setting: " + GCS_BUCKET.getKey()); } pathRoot = String.format("gs: } logger.atInfo().log("Using working path: '%s'", pathRoot); Path workingPath = new Path(pathRoot); FileSystem fs = workingPath.getFileSystem(conf); Preconditions.checkState("gs".equals(fs.getScheme()), "Export FS must be GCS ('gs' scheme)."); return pathRoot; }  static void configureBigQueryInput(
      Configuration config,
      String projectId,
      String datasetId,
      String tableId); static void configureBigQueryInput(
      Configuration config, String fullyQualifiedInputTableId); static void configureBigQueryOutput(
      Configuration config,
      String projectId,
      String datasetId,
      String tableId,
      String tableSchema); static void configureBigQueryOutput(
      Configuration config, String fullyQualifiedOutputTableId, String tableSchema); static String getTemporaryPathRoot(Configuration conf, @Nullable JobID jobId); static final String BIGQUERY_CONFIG_PREFIX; static final HadoopConfigurationProperty<String> BQ_ROOT_URL; static final HadoopConfigurationProperty<String> PROJECT_ID; static final HadoopConfigurationProperty<String> INPUT_PROJECT_ID; static final HadoopConfigurationProperty<String> INPUT_DATASET_ID; static final HadoopConfigurationProperty<String> INPUT_TABLE_ID; static final HadoopConfigurationProperty<String> TEMP_GCS_PATH; static final HadoopConfigurationProperty<String> GCS_BUCKET; static final HadoopConfigurationProperty<Boolean> DELETE_EXPORT_FILES_FROM_GCS; static final HadoopConfigurationProperty<Integer> DYNAMIC_FILE_LIST_RECORD_READER_POLL_INTERVAL_MS; static final HadoopConfigurationProperty<Integer> DYNAMIC_FILE_LIST_RECORD_READER_POLL_MAX_ATTEMPTS; static final List<HadoopConfigurationProperty<?>> MANDATORY_CONFIG_PROPERTIES_INPUT; static final HadoopConfigurationProperty<String> OUTPUT_PROJECT_ID; static final HadoopConfigurationProperty<String> OUTPUT_DATASET_ID; static final HadoopConfigurationProperty<String> OUTPUT_TABLE_ID; static final HadoopConfigurationProperty<String> OUTPUT_TABLE_SCHEMA; static final HadoopConfigurationProperty<String> OUTPUT_TABLE_PARTITIONING; static final HadoopConfigurationProperty<String> OUTPUT_TABLE_KMS_KEY_NAME; static final HadoopConfigurationProperty<String> OUTPUT_TABLE_WRITE_DISPOSITION; static final HadoopConfigurationProperty<String> OUTPUT_TABLE_CREATE_DISPOSITION; static final HadoopConfigurationProperty<String> OUTPUT_FILE_FORMAT; static final HadoopConfigurationProperty<Class<?>> OUTPUT_FORMAT_CLASS; static final HadoopConfigurationProperty<Boolean> OUTPUT_CLEANUP_TEMP; static final HadoopConfigurationProperty<Integer> OUTPUT_WRITE_BUFFER_SIZE; static final HadoopConfigurationProperty<String> DATA_LOCATION; static final HadoopConfigurationProperty<String> SQL_FILTER; static final HadoopConfigurationProperty<String> SELECTED_FIELDS; static final HadoopConfigurationProperty<Double> SKEW_LIMIT; }
@Test public void testGetTemporaryPathRootSpecific() throws IOException { conf.set(BigQueryConfiguration.TEMP_GCS_PATH.getKey(), GCS_TEMP_PATH); assertThat(BigQueryConfiguration.getTemporaryPathRoot(conf, mockJobID)) .isEqualTo(GCS_TEMP_PATH); }
@Test public void testGetTemporaryPathRootDefault() throws IOException { conf.set(BigQueryConfiguration.GCS_BUCKET.getKey(), GCS_BUCKET); when(mockJobID.toString()).thenReturn("test_job_id"); checkNotNull(BigQueryConfiguration.getTemporaryPathRoot(conf, mockJobID)); }