BigQueryOutputConfiguration { public static Path getGcsOutputPath(Configuration conf) throws IOException { Job tempJob = new JobConfigurationAdapter(conf); Path outputPath = FileOutputFormat.getOutputPath(tempJob); if (outputPath == null) { throw new IOException("FileOutputFormat output path not set."); } FileSystem fs = outputPath.getFileSystem(conf); if (!"gs".equals(fs.getScheme())) { throw new IOException("Output FileSystem must be GCS ('gs' scheme)."); } return outputPath; }  @SuppressWarnings("rawtypes") static void configure(
      Configuration conf,
      String qualifiedOutputTableId,
      String outputTableSchemaJson,
      String outputGcsPath,
      BigQueryFileFormat outputFileFormat,
      Class<? extends FileOutputFormat> outputFormatClass); @SuppressWarnings("rawtypes") static void configure(
      Configuration conf,
      String qualifiedOutputTableId,
      BigQueryTableSchema outputTableSchema,
      String outputGcsPath,
      BigQueryFileFormat outputFileFormat,
      Class<? extends FileOutputFormat> outputFormatClass); @SuppressWarnings("rawtypes") static void configureWithAutoSchema(
      Configuration conf,
      String qualifiedOutputTableId,
      String outputGcsPath,
      BigQueryFileFormat outputFileFormat,
      Class<? extends FileOutputFormat> outputFormatClass); static void setKmsKeyName(Configuration conf, String kmsKeyName); static void validateConfiguration(Configuration conf); static boolean getCleanupTemporaryDataFlag(Configuration conf); static String getProjectId(Configuration conf); static String getJobProjectId(Configuration conf); static String getKmsKeyName(Configuration conf); static BigQueryFileFormat getFileFormat(Configuration conf); @SuppressWarnings("rawtypes") static FileOutputFormat getFileOutputFormat(Configuration conf); static Path getGcsOutputPath(Configuration conf); static String getCreateDisposition(Configuration conf); static String getWriteDisposition(Configuration conf); static final List<HadoopConfigurationProperty<?>> REQUIRED_PROPERTIES; }
@Test public void testGetGcsOutputPath() throws IOException { BigQueryOutputConfiguration.setFileOutputFormatOutputPath(conf, TEST_OUTPUT_PATH_STRING); Path result = BigQueryOutputConfiguration.getGcsOutputPath(conf); assertThat(result.toString()).isEqualTo(TEST_OUTPUT_PATH_STRING); }
@Test public void testGetGcsOutputPathMissing() throws IOException { assertThrows(IOException.class, () -> BigQueryOutputConfiguration.getGcsOutputPath(conf)); }