Thanks Chamikara for response!

I got the issue and it was related with
META-INF/services/org.apache.beam.sdk.io.FileSystemRegistrar of my jar.

Here are details:

For batch load of BigQuery, it creates intermediate temporary files.  As my
META-INF/services/org.apache.beam.sdk.io.FileSystemRegistrar was having
only one entry for local file systems
*org.apache.beam.sdk.io.LocalFileSystemRegistrar*, It could not able to
identify Google Storage scheme (gs://) from
org.apache.beam.sdk.io.FileSystems.getFileSystemInternal and was returning
path of local file system (for spark executor, its application cache path).

After adding entry of
'org.apache.beam.sdk.extensions.gcp.storage.GcsFileSystemRegistrar' to
META-INF/services/org.apache.beam.sdk.io.FileSystemRegistrar file, It
started recognising GS:// scheme and solved the problem.

Thank You,
Shrikant Bang.

On Tue, Apr 16, 2019 at 10:34 PM Chamikara Jayalath <[email protected]>
wrote:

> I haven't tried BigQueryIO with Spark runner but this connector has been
> significantly updated since Beam 2.4.0. Can you try with latest Beam and
> also specify a GCS location with withCustomGcsTempLocation() parameter ?
>
> https://github.com/apache/beam/blob/master/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java#L1828
>
> Thanks,
> Cham
>
> On Tue, Apr 16, 2019 at 7:18 AM shrikant bang <
> [email protected]> wrote:
>
>> Hi Team,
>>
>> I am trying to run an example code where my Source and Sink both are
>> BigQuery.  I am using Beam SDK 2.4.0 with Spark 2.3.2.
>>
>> Here is typical flow of my example :  read_bigquery => (map+shuffle) =>
>> write_bigquery.
>>
>> However, I am getting issue as Spark writes intermediate cache
>> to yarn.nodemanager.local-dirs and BigQuery Write APIs expects source URI
>> as GCS.
>>
>>  Caused by: java.io.IOException: Unable to insert job:
>> beam_load_example_job_id_00001_00000-0, aborting after 9 .
>> at
>> org.apache.beam.sdk.io.gcp.bigquery.BigQueryServicesImpl$JobServiceImpl.startJob(BigQueryServicesImpl.java:232)
>> at
>> org.apache.beam.sdk.io.gcp.bigquery.BigQueryServicesImpl$JobServiceImpl.startJob(BigQueryServicesImpl.java:203)
>> at
>> org.apache.beam.sdk.io.gcp.bigquery.BigQueryServicesImpl$JobServiceImpl.startLoadJob(BigQueryServicesImpl.java:143)
>> at
>> org.apache.beam.sdk.io.gcp.bigquery.WriteTables.load(WriteTables.java:262)
>> at
>> org.apache.beam.sdk.io.gcp.bigquery.WriteTables.access$600(WriteTables.java:79)
>> at
>> org.apache.beam.sdk.io.gcp.bigquery.WriteTables$WriteTablesDoFn.processElement(WriteTables.java:157)
>> Caused by:
>> com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad
>> Request
>> {
>>   "code" : 400,
>>   "errors" : [ {
>>     "domain" : "global",
>>     "message" : "Source URI must be a Google Cloud Storage location:
>> /mnt/hadoop/yarn/nm-local-dir/usercache/testuser/appcache/application_1553066291184_0001/container_1553066291184_0001_01_000004/gs:/dev-bucket/temp/BigQueryWriteTemp/beam_load_example_test_path1",
>>     "reason" : "invalid"
>>   } ],
>>   "message" : "Source URI must be a Google Cloud Storage location:
>> /mnt/hadoop/yarn/nm-local-dir/usercache/testuser/appcache/application_1553066291184_0001/container_1553066291184_0001_01_000004/gs:/dev-bucket/temp/BigQueryWriteTemp/beam_load_example_test_path2"
>> }
>>
>> Am I missing anything with Pipeline configurations? I am passing
>> gcpTempLocation and tempLocation ( gs://dev-bucket/temp ) as parameters.
>>
>> Please suggest.
>>
>> Thank You,
>> Shrikant Bang
>>
>>
>>
>>

Reply via email to