@ Override public void checkOutputSpecs ( JobContext job ) throws FileAlreadyExistsException , IOException { Configuration conf = job . getConfiguration ( ) ; // Validate the output configuration. BigQueryOutputConfiguration . validateConfiguration ( conf ) ; // Get the output path. Path outputPath = BigQueryOutputConfiguration . getGcsOutputPath ( conf ) ; logger . atInfo ( ) . log ( "Using output path '%s'." , outputPath ) ; // Error if the output path already exists. FileSystem outputFileSystem = outputPath . getFileSystem ( conf ) ; if ( outputFileSystem . exists ( outputPath ) ) { throw new IOException ( "The output path '" + outputPath + "' already exists." ) ; } // Error if compression is set as there's mixed support in BigQuery. if ( FileOutputFormat . getCompressOutput ( job ) ) { throw new IOException ( "Compression isn't supported for this OutputFormat." ) ; } // Error if unable to create a BigQuery helper. try { new BigQueryFactory ( ) . getBigQueryHelper ( conf ) ; } catch ( GeneralSecurityException gse ) { throw new IOException ( "Failed to create BigQuery client" , gse ) ; } // Let delegate process its checks. getDelegate ( conf ) . checkOutputSpecs ( job ) ; }
Checks to make sure the configuration is valid the output path doesn t already exist and that a connection to BigQuery can be established .