diff --git a/spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/SpannerPartitionReaderFactory.java b/spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/SpannerPartitionReaderFactory.java index 4f5c4b9c..c317d90d 100644 --- a/spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/SpannerPartitionReaderFactory.java +++ b/spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/SpannerPartitionReaderFactory.java @@ -30,7 +30,7 @@ public SpannerPartitionReaderFactory() {} @Override public PartitionReader createColumnarReader(InputPartition partition) { // Unsupported! - throw new RuntimeException("createColumnarReader not supported"); + throw new RuntimeException("columnar reads are not supported the Spark Spanner Connector"); } @Override diff --git a/spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/SpannerUtils.java b/spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/SpannerUtils.java index 1800ee82..8e255a35 100644 --- a/spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/SpannerUtils.java +++ b/spark-3.1-spanner-lib/src/main/java/com/google/cloud/spark/spanner/SpannerUtils.java @@ -51,6 +51,9 @@ public class SpannerUtils { public static Long SECOND_TO_DAYS = 60 * 60 * 24L; + // TODO: Infer the UserAgent's version from the library version dynamically. + private static String USER_AGENT = "spark-spanner/v0.0.1"; + public static Connection connectionFromProperties(Map properties) { String connUriPrefix = "cloudspanner:"; String emulatorHost = properties.get("emulatorHost"); @@ -74,14 +77,11 @@ public static Connection connectionFromProperties(Map properties return opts.getConnection(); } - // TODO: Infer the UserAgent's version from the library version dynamically. - private static String userAgent = "spark-spanner/v0.0.1"; - public static BatchClientWithCloser batchClientFromProperties(Map properties) { SpannerOptions.Builder builder = SpannerOptions.newBuilder() .setProjectId(properties.get("projectId")) - .setHeaderProvider(FixedHeaderProvider.create("user-agent", userAgent)); + .setHeaderProvider(FixedHeaderProvider.create("user-agent", USER_AGENT)); String emulatorHost = properties.get("emulatorHost"); if (emulatorHost != null) {