Skip to content

Commit

Permalink
Make s/userAgent/USER_AGENT/g to Java constant names
Browse files Browse the repository at this point in the history
  • Loading branch information
odeke-em committed Sep 23, 2023
1 parent b1a3249 commit ef0d989
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public SpannerPartitionReaderFactory() {}
@Override
public PartitionReader<ColumnarBatch> createColumnarReader(InputPartition partition) {
// Unsupported!
throw new RuntimeException("createColumnarReader not supported");
throw new RuntimeException("columnar reads are not supported the Spark Spanner Connector");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> properties) {
String connUriPrefix = "cloudspanner:";
String emulatorHost = properties.get("emulatorHost");
Expand All @@ -74,14 +77,11 @@ public static Connection connectionFromProperties(Map<String, String> 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<String, String> 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) {
Expand Down

0 comments on commit ef0d989

Please sign in to comment.