Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datasetlocation option incompatibility #20

Open
gboyega1 opened this issue Jul 22, 2022 · 2 comments
Open

Datasetlocation option incompatibility #20

gboyega1 opened this issue Jul 22, 2022 · 2 comments

Comments

@gboyega1
Copy link

gboyega1 commented Jul 22, 2022

bigquery_defaults( billingProjectId = "<your_billing_project_id>", gcsBucket = "<your_gcs_bucket>", datasetLocation = "US", serviceAccountKeyFile = "<your_service_account_key_file>", type = "direct" )

Dataset locations in bigquery bar those in US multi-region have the syntax 'continent-direction', e.g europe-east1. Upon supplying this value to bigquey_defaults, it causes an error when creating the table that's passed through cloud storage as the '-' character
cannot be used as part of table name in bigquery. Are there any plans to rectify this?

@spoltier
Copy link
Member

@gboyega1 thank you for reporting this issue. Can you provide the output you're seeing when executing this call ? It may help knowing at what level the error occurs.

@gboyega1
Copy link
Author

gboyega1 commented Jul 27, 2022

Hi @spoltier, I've been able to reproduce the error. Please note that it was done via the following:

Google Dataproc (1.3-Debian 10)
Spark bigquery connector (version 0.17.0)
sparklyr (spark version: 2.3.4, hadoop version:2.7) which matches the version installed on Google Dataproc

spark_connect(master = "yarn", scala_version = "2.11", config = spark_config())

bqdefs <- bigquery_defaults(billingProjectId = "xxx",
                            gcsBucket = "xxx",
                            datasetLocation = "europe-west2",
                            serviceAccountKeyFile = "/xxx/xxx/xxx/xxx.json")
spark_read_bigquery(sc = sc,
                    name = "xxx",
                    datasetId = "xxx",
                    tableId = "xxx")

Below was the error received as output:

Error: shadegoogle.cloud.bigquery.BigQueryException: Invalid dataset ID "spark_staging_europe-west2". Dataset IDs must be alphanumeric (plus underscores) and must be at most 1024 characters long.
	at shadegoogle.cloud.bigquery.spi.v2.HttpBigQueryRpc.translate(HttpBigQueryRpc.java:100)
	at shadegoogle.cloud.bigquery.spi.v2.HttpBigQueryRpc.create(HttpBigQueryRpc.java:152)
	at shadegoogle.cloud.bigquery.BigQueryImpl$1.call(BigQueryImpl.java:166)
	at shadegoogle.cloud.bigquery.BigQueryImpl$1.call(BigQueryImpl.java:163)
	at shadegoogle.api.gax.retrying.DirectRetryingExecutor.submit(DirectRetryingExecutor.java:105)
	at shadegoogle.cloud.RetryHelper.run(RetryHelper.java:76)
	at shadegoogle.cloud.RetryHelper.runWithRetries(RetryHelper.java:50)
	at shadegoogle.cloud.bigquery.BigQueryImpl.create(BigQueryImpl.java:162)
	at com.miraisolutions.spark.bigquery.client.BigQueryClient$$anonfun$getOrCreateDataset$1.apply(BigQueryClient.scala:110)
	at com.miraisolutions.spark.bigquery.client.BigQueryClient$$anonfun$getOrCreateDataset$1.apply(BigQueryClient.scala:104)
	at scala.Option.getOrElse(Option.scala:121)
	at com.miraisolutions.spark.bigquery.client.BigQueryClient.getOrCreateDataset(BigQueryClient.scala:104)
	at com.miraisolutions.spark.bigquery.client.BigQueryClient.getOrCreateStagingDataset(BigQueryClient.scala:121)
	at com.miraisolutions.spark.bigquery.client.BigQueryClient.createTemporaryTableReference(BigQueryClient.scala:142)
	at com.miraisolutions.spark.bigquery.client.BigQueryClient.executeQuery(BigQueryClient.scala:198)
	at com.miraisolutions.spark.bigquery.BigQueryTableRelation.buildScan(BigQueryTableRelation.scala:65)
	at org.apache.spark.sql.execution.datasources.DataSourceStrategy$$anonfun$10.apply(DataSourceStrategy.scala:293)
	at org.apache.spark.sql.execution.datasources.DataSourceStrategy$$anonfun$10.apply(DataSourceStrategy.scala:293)
	at org.apache.spark.sql.execution.datasources.DataSourceStrategy$$anonfun$pruneFilterProject$1.apply(DataSourceStrategy.scala:338)
	at org.apache.spark.sql.execution.datasources.DataSourceStrategy$$anonfun$pruneFilterProject$1.apply(DataSourceStrategy.scala:337)
	at org.apache.spark.sql.execution.datasources.DataSourceStrategy.pruneFilterProjectRaw(DataSourceStrategy.scala:393)
	at org.apache.spark.sql.execution.datasources.DataSourceStrategy.pruneFilterProject(DataSourceStrategy.scala:333)
	at org.apache.spark.sql.execution.datasources.DataSourceStrategy.apply(DataSourceStrategy.scala:289)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$1.apply(QueryPlanner.scala:63)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$1.apply(QueryPlanner.scala:63)
	at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
	at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
	at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:439)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:78)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:75)
	at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
	at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
	at scala.collection.Iterator$class.foreach(Iterator.scala:893)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
	at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
	at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1336)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:75)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:67)
	at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
	at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:78)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:75)
	at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
	at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
	at scala.collection.Iterator$class.foreach(Iterator.scala:893)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
	at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
	at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1336)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:75)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:67)
	at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
	at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:78)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:75)
	at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
	at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
	at scala.collection.Iterator$class.foreach(Iterator.scala:893)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
	at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
	at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1336)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:75)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:67)
	at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
	at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:78)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2$$anonfun$apply$2.apply(QueryPlanner.scala:75)
	at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
	at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:157)
	at scala.collection.Iterator$class.foreach(Iterator.scala:893)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
	at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:157)
	at scala.collection.AbstractIterator.foldLeft(Iterator.scala:1336)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:75)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner$$anonfun$2.apply(QueryPlanner.scala:67)
	at scala.collection.Iterator$$anon$12.nextCur(Iterator.scala:434)
	at scala.collection.Iterator$$anon$12.hasNext(Iterator.scala:440)
	at org.apache.spark.sql.catalyst.planning.QueryPlanner.plan(QueryPlanner.scala:93)
	at org.apache.spark.sql.execution.QueryExecution.sparkPlan$lzycompute(QueryExecution.scala:72)
	at org.apache.spark.sql.execution.QueryExecution.sparkPlan(QueryExecution.scala:68)
	at org.apache.spark.sql.execution.QueryExecution.executedPlan$lzycompute(QueryExecution.scala:77)
	at org.apache.spark.sql.execution.QueryExecution.executedPlan(QueryExecution.scala:77)
	at org.apache.spark.sql.Dataset.withAction(Dataset.scala:3260)
	at org.apache.spark.sql.Dataset.collect(Dataset.scala:2733)
	at sparklyr.Utils$.collect(utils.scala:24)
	at sparklyr.Utils.collect(utils.scala)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccesso

I was also wondering if there are any plans to update the package as it doesn't work for newer versions of Dataproc and Spark. Functionality is limited to spark 2.3, Dataproc 1.5 and scala 2.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants