BigQueryConfiguration { public static void configureBigQueryOutput( Configuration config, String projectId, String datasetId, String tableId, String tableSchema) throws IOException { Preconditions.checkArgument( !Strings.isNullOrEmpty(datasetId), "datasetId must not be null or empty."); Preconditions.checkArgument( !Strings.isNullOrEmpty(tableId), "tableId must not be null or empty."); Preconditions.checkArgument( !Strings.isNullOrEmpty(tableSchema), "tableSchema must not be null or empty."); if (!Strings.isNullOrEmpty(projectId)) { logger.atInfo().log("Using specified project-id '%s' for output", projectId); config.set(OUTPUT_PROJECT_ID.getKey(), projectId); if (Strings.isNullOrEmpty(PROJECT_ID.get(config, config::get))) { logger.atWarning().log( "No job-level projectId specified in '%s', using '%s' for it.", PROJECT_ID.getKey(), projectId); config.set(PROJECT_ID.getKey(), projectId); } } else { String defaultProjectId = getMandatoryConfig(config, PROJECT_ID); logger.atInfo().log( "Using default project-id '%s' since none specified for output.", defaultProjectId); config.set(OUTPUT_PROJECT_ID.getKey(), defaultProjectId); } config.set(OUTPUT_DATASET_ID.getKey(), datasetId); config.set(OUTPUT_TABLE_ID.getKey(), tableId); config.set(OUTPUT_TABLE_SCHEMA.getKey(), tableSchema); }  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 testConfigureBigQueryOutput() throws IOException { BigQueryConfiguration.configureBigQueryOutput( conf, OUTPUT_PROJECT_ID, OUTPUT_DATASET_ID, OUTPUT_TABLE_ID, OUTPUT_TABLE_SCHEMA); assertThat(BigQueryConfiguration.OUTPUT_PROJECT_ID.get(conf, conf::get)) .isEqualTo(OUTPUT_PROJECT_ID); assertThat(BigQueryConfiguration.OUTPUT_DATASET_ID.get(conf, conf::get)) .isEqualTo(OUTPUT_DATASET_ID); assertThat(BigQueryConfiguration.OUTPUT_TABLE_ID.get(conf, conf::get)) .isEqualTo(OUTPUT_TABLE_ID); assertThat(BigQueryConfiguration.OUTPUT_TABLE_SCHEMA.get(conf, conf::get)) .isEqualTo(OUTPUT_TABLE_SCHEMA); assertThat(BigQueryConfiguration.PROJECT_ID.get(conf, conf::get)).isEqualTo(OUTPUT_PROJECT_ID); }