From 6f18727a4b5dae611283daa7a107fefe5c6c1ada Mon Sep 17 00:00:00 2001 From: dafreels Date: Wed, 27 Oct 2021 15:03:26 -0400 Subject: [PATCH] #267 Moved BigQuery dependency to dependencies.json as a runtime requirement --- metalus-gcp/pom.xml | 5 ----- metalus-gcp/src/main/resources/dependencies.json | 5 +++++ .../main/scala/com/acxiom/gcp/fs/GCSFileManager.scala | 9 ++++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/metalus-gcp/pom.xml b/metalus-gcp/pom.xml index deccf605..99188f5b 100644 --- a/metalus-gcp/pom.xml +++ b/metalus-gcp/pom.xml @@ -61,11 +61,6 @@ google-cloud-datastore 1.104.0 - - com.google.cloud.spark - spark-bigquery-with-dependencies_${scala.compat.version} - 0.21.1 - io.grpc grpc-core diff --git a/metalus-gcp/src/main/resources/dependencies.json b/metalus-gcp/src/main/resources/dependencies.json index 9a965d6a..da751c9c 100644 --- a/metalus-gcp/src/main/resources/dependencies.json +++ b/metalus-gcp/src/main/resources/dependencies.json @@ -6,6 +6,11 @@ "artifactId": "metalus-common_${scala.compat.version}-spark_${spark.compat.version}", "version": "${parent.version}" }, + { + "groupId": "com.google.cloud.spark", + "artifactId": "spark-bigquery-with-dependencies_${scala.compat.version}", + "version": "0.21.1" + }, { "groupId": "org.apache.spark", "artifactId": "spark-streaming_${scala.compat.version}", diff --git a/metalus-gcp/src/main/scala/com/acxiom/gcp/fs/GCSFileManager.scala b/metalus-gcp/src/main/scala/com/acxiom/gcp/fs/GCSFileManager.scala index 6f755ecb..a88f232b 100644 --- a/metalus-gcp/src/main/scala/com/acxiom/gcp/fs/GCSFileManager.scala +++ b/metalus-gcp/src/main/scala/com/acxiom/gcp/fs/GCSFileManager.scala @@ -1,15 +1,14 @@ package com.acxiom.gcp.fs -import java.io._ -import java.net.URI -import java.nio.channels.Channels - import com.acxiom.pipeline.fs.{FileInfo, FileManager} import com.google.auth.oauth2.GoogleCredentials import com.google.cloud.storage.{BlobId, BlobInfo, Storage, StorageOptions} import org.json4s.DefaultFormats import org.json4s.native.Serialization +import java.io._ +import java.net.URI +import java.nio.channels.Channels import scala.collection.JavaConverters._ object GCSFileManager { @@ -22,7 +21,7 @@ object GCSFileManager { def prepareGCSFilePath(path: String, bucket: Option[String] = None): String = { if (path.startsWith("/")) { path.substring(1) - } else if (path.startsWith(s"gs:")) { + } else if (path.startsWith("gs:")) { new URI(path).normalize().toString } else { path