bigquery-emulator icon indicating copy to clipboard operation
bigquery-emulator copied to clipboard

CopyConfiguration does not work.

Open yeilho opened this issue 1 year ago • 2 comments

What happened?

Job creation fails for copy tables. Here is the code that I wrote to do some testings and it fails with configuration information.

    try {
      CopyJobConfiguration configuration =
          CopyJobConfiguration.newBuilder(targetTableId, sourceTableId)
              .setCreateDisposition(JobInfo.CreateDisposition.CREATE_IF_NEEDED)
              .build();

      Job job = bigquery.create(JobInfo.of(configuration));

Here is the error message:

com.google.cloud.bigquery.BigQueryException: unspecified job configuration query
	at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.translate(HttpBigQueryRpc.java:114)
	at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.create(HttpBigQueryRpc.java:219)

Although CopyJobConfiguraiton does not require query, it seems it's checking for query and fails. I looked up code and I don't find any code that handles copy job config so I am assuming it's not implemented.

What did you expect to happen?

I expected that the copy creation job succeeds.

How can we reproduce it (as minimally and precisely as possible)?

Create copy job such as following:

    try {
      CopyJobConfiguration configuration =
          CopyJobConfiguration.newBuilder(targetTableId, sourceTableId)
              .setCreateDisposition(JobInfo.CreateDisposition.CREATE_IF_NEEDED)
              .build();

      Job job = bigquery.create(JobInfo.of(configuration));

Anything else we need to know?

No response

yeilho avatar Sep 02 '24 23:09 yeilho

https://github.com/goccy/bigquery-emulator/blob/main/server/handler.go#L1377 is where it handles configuration and it does not seem to consider copy job.

yeilho avatar Sep 03 '24 01:09 yeilho

Support for the copy configuration handler has been implemented and released in the Recidiviz fork of the emulator https://github.com/Recidiviz/bigquery-emulator/releases/tag/v0.6.6-recidiviz.0

ohaibbq avatar Nov 08 '25 18:11 ohaibbq