diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f15fa11..30a8979 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -13,10 +13,10 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- - name: Set up JDK 11
+ - name: Set up JDK 8
uses: actions/setup-java@v4
with:
- java-version: '11'
+ java-version: '8'
distribution: 'temurin'
cache: maven
- name: Get hyperd version
diff --git a/.gitignore b/.gitignore
index d467b07..c6616c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,4 @@ src/main/resources/config/config.properties
*.iml
pom.xml.bak
+.codegenie
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 84ed9da..9708a25 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,12 +3,12 @@
4.0.0
com.salesforce.datacloud
jdbc
- 0.21.0-SNAPSHOT
+ 0.22.0-SNAPSHOT
jar
Salesforce Data Cloud JDBC Driver
Salesforce Data Cloud JDBC Driver
- 18.0.0
+ 17.0.0
3.26.3
1.25.0
3.17.0
@@ -16,25 +16,26 @@
3.5.0
1.68.1
0.13.0
+ 33.2.1-jre
0.0.20746.reac9bd2d
${project.build.directory}/hyper
2.18.0
0.8.12
- 11
+ 1.8
0.12.6
5.11.3
1.18.34
{java.version}
{java.version}
- 5.14.1
+ 4.11.0
4.12.0
UTF-8
UTF-8
3.25.5
com.salesforce.datacloud.jdbc.internal.shaded
1.7.32
- 2.43.0
+ 2.30.0
@@ -52,13 +53,6 @@
pom
import
-
- org.apache.arrow
- arrow-bom
- ${arrow.version}
- pom
- import
-
org.junit
junit-bom
@@ -73,6 +67,11 @@
pom
import
+
+ com.google.guava
+ guava-bom
+ ${guava.version}
+
@@ -81,6 +80,11 @@
jackson-databind
${jackson.version}
+
+ com.google.guava
+ guava
+ ${guava.version}
+
com.google.protobuf
protobuf-java
@@ -120,6 +124,7 @@
org.apache.arrow
arrow-vector
+ ${arrow.version}
org.apache.calcite.avatica
@@ -157,6 +162,7 @@
org.apache.arrow
arrow-memory-netty
+ ${arrow.version}
runtime
@@ -199,7 +205,7 @@
org.mockito
- mockito-core
+ mockito-inline
test
@@ -207,6 +213,12 @@
mockito-junit-jupiter
test
+
+ org.slf4j
+ slf4j-simple
+ ${slf4j.version}
+ test
+
@@ -494,15 +506,12 @@
-
src/main/java/**/*.java
src/test/java/**/*.java
- 2.39.0
-
- true
+ 1.1.0
@@ -568,7 +577,7 @@
com.github.ekryd.sortpom
sortpom-maven-plugin
- 3.4.1
+ 3.0.1
${project.build.sourceEncoding}
custom_1
diff --git a/src/main/java/com/salesforce/datacloud/jdbc/auth/AuthenticationSettings.java b/src/main/java/com/salesforce/datacloud/jdbc/auth/AuthenticationSettings.java
index 6d70aac..e5adcec 100644
--- a/src/main/java/com/salesforce/datacloud/jdbc/auth/AuthenticationSettings.java
+++ b/src/main/java/com/salesforce/datacloud/jdbc/auth/AuthenticationSettings.java
@@ -19,6 +19,7 @@
import static com.salesforce.datacloud.jdbc.util.PropertiesExtensions.optional;
import static com.salesforce.datacloud.jdbc.util.PropertiesExtensions.required;
+import com.google.common.collect.ImmutableSet;
import com.salesforce.datacloud.jdbc.config.DriverVersion;
import com.salesforce.datacloud.jdbc.exception.DataCloudJDBCException;
import com.salesforce.datacloud.jdbc.util.PropertiesExtensions;
@@ -84,7 +85,7 @@ private static void checkHasAllRequired(Properties properties) throws SQLExcepti
}
val missing = Keys.REQUIRED_KEYS.stream()
- .filter(k -> optional(properties, k).isEmpty())
+ .filter(k -> !optional(properties, k).isPresent())
.collect(Collectors.joining(", ", Messages.PROPERTIES_REQUIRED, ""));
throw new DataCloudJDBCException(missing, "28000", new IllegalArgumentException(missing));
@@ -136,15 +137,15 @@ protected static class Keys {
static final String USER_AGENT = "User-Agent";
static final String REFRESH_TOKEN = "refreshToken";
- static final Set REQUIRED_KEYS = Set.of(LOGIN_URL, CLIENT_ID, CLIENT_SECRET);
+ static final Set REQUIRED_KEYS = ImmutableSet.of(LOGIN_URL, CLIENT_ID, CLIENT_SECRET);
- static final Set OPTIONAL_KEYS = Set.of(DATASPACE, USER_AGENT, MAX_RETRIES);
+ static final Set OPTIONAL_KEYS = ImmutableSet.of(DATASPACE, USER_AGENT, MAX_RETRIES);
- static final Set PASSWORD_KEYS = Set.of(USER_NAME, PASSWORD);
+ static final Set PASSWORD_KEYS = ImmutableSet.of(USER_NAME, PASSWORD);
- static final Set PRIVATE_KEY_KEYS = Set.of(USER_NAME, PRIVATE_KEY);
+ static final Set PRIVATE_KEY_KEYS = ImmutableSet.of(USER_NAME, PRIVATE_KEY);
- static final Set REFRESH_TOKEN_KEYS = Set.of(REFRESH_TOKEN);
+ static final Set REFRESH_TOKEN_KEYS = ImmutableSet.of(REFRESH_TOKEN);
static final Set ALL = Stream.of(
REQUIRED_KEYS, OPTIONAL_KEYS, PASSWORD_KEYS, PRIVATE_KEY_KEYS, REFRESH_TOKEN_KEYS)
diff --git a/src/main/java/com/salesforce/datacloud/jdbc/config/KeywordResources.java b/src/main/java/com/salesforce/datacloud/jdbc/config/KeywordResources.java
index 2218c3c..eb4331d 100644
--- a/src/main/java/com/salesforce/datacloud/jdbc/config/KeywordResources.java
+++ b/src/main/java/com/salesforce/datacloud/jdbc/config/KeywordResources.java
@@ -15,6 +15,7 @@
*/
package com.salesforce.datacloud.jdbc.config;
+import com.google.common.collect.ImmutableSet;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.Getter;
@@ -24,32 +25,6 @@
@UtilityClass
public class KeywordResources {
- // spotless:off
- public static final Set SQL_2003_KEYWORDS = Set.of("ADD","ALL","ALLOCATE","ALTER","AND","ANY","ARE","ARRAY",
- "AS","ASENSITIVE","ASYMMETRIC","AT","ATOMIC","AUTHORIZATION","BEGIN","BETWEEN","BIGINT","BINARY","BLOB",
- "BOOLEAN","BOTH","BY","CALL","CALLED","CASCADED","CASE","CAST","CHAR","CHARACTER","CHECK","CLOB","CLOSE",
- "COLLATE","COLUMN","COMMIT","CONDITION","CONNECT","CONSTRAINT","CONTINUE","CORRESPONDING","CREATE","CROSS",
- "CUBE","CURRENT","CURRENT_DATE","CURRENT_DEFAULT_TRANSFORM_GROUP","CURRENT_PATH","CURRENT_ROLE",
- "CURRENT_TIME","CURRENT_TIMESTAMP","CURRENT_TRANSFORM_GROUP_FOR_TYPE","CURRENT_USER","CURSOR","CYCLE",
- "DATE","DAY","DEALLOCATE","DEC","DECIMAL","DECLARE","DEFAULT","DELETE","DEREF","DESCRIBE","DETERMINISTIC",
- "DISCONNECT","DISTINCT","DO","DOUBLE","DROP","DYNAMIC","EACH","ELEMENT","ELSE","ELSEIF","END","ESCAPE",
- "EXCEPT","EXEC","EXECUTE","EXISTS","EXIT","EXTERNAL","FALSE","FETCH","FILTER","FLOAT","FOR","FOREIGN",
- "FREE","FROM","FULL","FUNCTION","GET","GLOBAL","GRANT","GROUP","GROUPING","HANDLER","HAVING","HOLD","HOUR",
- "IDENTITY","IF","IMMEDIATE","IN","INDICATOR","INNER","INOUT","INPUT","INSENSITIVE","INSERT","INT","INTEGER",
- "INTERSECT","INTERVAL","INTO","IS","ITERATE","JOIN","LANGUAGE","LARGE","LATERAL","LEADING","LEAVE","LEFT",
- "LIKE","LOCAL","LOCALTIME","LOCALTIMESTAMP","LOOP","MATCH","MEMBER","MERGE","METHOD","MINUTE","MODIFIES",
- "MODULE","MONTH","MULTISET","NATIONAL","NATURAL","NCHAR","NCLOB","NEW","NO","NONE","NOT","NULL","NUMERIC",
- "OF","OLD","ON","ONLY","OPEN","OR","ORDER","OUT","OUTER","OUTPUT","OVER","OVERLAPS","PARAMETER","PARTITION",
- "PRECISION","PREPARE","PROCEDURE","RANGE","READS","REAL","RECURSIVE","REF","REFERENCES","REFERENCING",
- "RELEASE","REPEAT","RESIGNAL","RESULT","RETURN","RETURNS","REVOKE","RIGHT","ROLLBACK","ROLLUP","ROW","ROWS",
- "SAVEPOINT","SCOPE","SCROLL","SEARCH","SECOND","SELECT","SENSITIVE","SESSION_USER","SET","SIGNAL","SIMILAR",
- "SMALLINT","SOME","SPECIFIC","SPECIFICTYPE","SQL","SQLEXCEPTION","SQLSTATE","SQLWARNING","START","STATIC",
- "SUBMULTISET","SYMMETRIC","SYSTEM","SYSTEM_USER","TABLE","TABLESAMPLE","THEN","TIME","TIMESTAMP",
- "TIMEZONE_HOUR","TIMEZONE_MINUTE","TO","TRAILING","TRANSLATION","TREAT","TRIGGER","TRUE","UNDO","UNION",
- "UNIQUE","UNKNOWN","UNNEST","UNTIL","UPDATE","USER","USING","VALUE","VALUES","VARCHAR","VARYING","WHEN",
- "WHENEVER","WHERE","WHILE","WINDOW","WITH","WITHIN","WITHOUT","YEAR");
- // spotless:on
-
@Getter(lazy = true)
private final String sqlKeywords = loadSqlKeywords();
@@ -59,8 +34,256 @@ private static String loadSqlKeywords() {
.map(String::toUpperCase)
.distinct()
.filter(keyword -> !SQL_2003_KEYWORDS.contains(keyword))
- .sorted()
- .collect(Collectors.toList());
- return String.join(",", difference);
+ .sorted();
+
+ return difference.collect(Collectors.joining(","));
}
+
+ public static final Set SQL_2003_KEYWORDS = ImmutableSet.of(
+ "ADD",
+ "ALL",
+ "ALLOCATE",
+ "ALTER",
+ "AND",
+ "ANY",
+ "ARE",
+ "ARRAY",
+ "AS",
+ "ASENSITIVE",
+ "ASYMMETRIC",
+ "AT",
+ "ATOMIC",
+ "AUTHORIZATION",
+ "BEGIN",
+ "BETWEEN",
+ "BIGINT",
+ "BINARY",
+ "BLOB",
+ "BOOLEAN",
+ "BOTH",
+ "BY",
+ "CALL",
+ "CALLED",
+ "CASCADED",
+ "CASE",
+ "CAST",
+ "CHAR",
+ "CHARACTER",
+ "CHECK",
+ "CLOB",
+ "CLOSE",
+ "COLLATE",
+ "COLUMN",
+ "COMMIT",
+ "CONDITION",
+ "CONNECT",
+ "CONSTRAINT",
+ "CONTINUE",
+ "CORRESPONDING",
+ "CREATE",
+ "CROSS",
+ "CUBE",
+ "CURRENT",
+ "CURRENT_DATE",
+ "CURRENT_DEFAULT_TRANSFORM_GROUP",
+ "CURRENT_PATH",
+ "CURRENT_ROLE",
+ "CURRENT_TIME",
+ "CURRENT_TIMESTAMP",
+ "CURRENT_TRANSFORM_GROUP_FOR_TYPE",
+ "CURRENT_USER",
+ "CURSOR",
+ "CYCLE",
+ "DATE",
+ "DAY",
+ "DEALLOCATE",
+ "DEC",
+ "DECIMAL",
+ "DECLARE",
+ "DEFAULT",
+ "DELETE",
+ "DEREF",
+ "DESCRIBE",
+ "DETERMINISTIC",
+ "DISCONNECT",
+ "DISTINCT",
+ "DO",
+ "DOUBLE",
+ "DROP",
+ "DYNAMIC",
+ "EACH",
+ "ELEMENT",
+ "ELSE",
+ "ELSEIF",
+ "END",
+ "ESCAPE",
+ "EXCEPT",
+ "EXEC",
+ "EXECUTE",
+ "EXISTS",
+ "EXIT",
+ "EXTERNAL",
+ "FALSE",
+ "FETCH",
+ "FILTER",
+ "FLOAT",
+ "FOR",
+ "FOREIGN",
+ "FREE",
+ "FROM",
+ "FULL",
+ "FUNCTION",
+ "GET",
+ "GLOBAL",
+ "GRANT",
+ "GROUP",
+ "GROUPING",
+ "HANDLER",
+ "HAVING",
+ "HOLD",
+ "HOUR",
+ "IDENTITY",
+ "IF",
+ "IMMEDIATE",
+ "IN",
+ "INDICATOR",
+ "INNER",
+ "INOUT",
+ "INPUT",
+ "INSENSITIVE",
+ "INSERT",
+ "INT",
+ "INTEGER",
+ "INTERSECT",
+ "INTERVAL",
+ "INTO",
+ "IS",
+ "ITERATE",
+ "JOIN",
+ "LANGUAGE",
+ "LARGE",
+ "LATERAL",
+ "LEADING",
+ "LEAVE",
+ "LEFT",
+ "LIKE",
+ "LOCAL",
+ "LOCALTIME",
+ "LOCALTIMESTAMP",
+ "LOOP",
+ "MATCH",
+ "MEMBER",
+ "MERGE",
+ "METHOD",
+ "MINUTE",
+ "MODIFIES",
+ "MODULE",
+ "MONTH",
+ "MULTISET",
+ "NATIONAL",
+ "NATURAL",
+ "NCHAR",
+ "NCLOB",
+ "NEW",
+ "NO",
+ "NONE",
+ "NOT",
+ "NULL",
+ "NUMERIC",
+ "OF",
+ "OLD",
+ "ON",
+ "ONLY",
+ "OPEN",
+ "OR",
+ "ORDER",
+ "OUT",
+ "OUTER",
+ "OUTPUT",
+ "OVER",
+ "OVERLAPS",
+ "PARAMETER",
+ "PARTITION",
+ "PRECISION",
+ "PREPARE",
+ "PROCEDURE",
+ "RANGE",
+ "READS",
+ "REAL",
+ "RECURSIVE",
+ "REF",
+ "REFERENCES",
+ "REFERENCING",
+ "RELEASE",
+ "REPEAT",
+ "RESIGNAL",
+ "RESULT",
+ "RETURN",
+ "RETURNS",
+ "REVOKE",
+ "RIGHT",
+ "ROLLBACK",
+ "ROLLUP",
+ "ROW",
+ "ROWS",
+ "SAVEPOINT",
+ "SCOPE",
+ "SCROLL",
+ "SEARCH",
+ "SECOND",
+ "SELECT",
+ "SENSITIVE",
+ "SESSION_USER",
+ "SET",
+ "SIGNAL",
+ "SIMILAR",
+ "SMALLINT",
+ "SOME",
+ "SPECIFIC",
+ "SPECIFICTYPE",
+ "SQL",
+ "SQLEXCEPTION",
+ "SQLSTATE",
+ "SQLWARNING",
+ "START",
+ "STATIC",
+ "SUBMULTISET",
+ "SYMMETRIC",
+ "SYSTEM",
+ "SYSTEM_USER",
+ "TABLE",
+ "TABLESAMPLE",
+ "THEN",
+ "TIME",
+ "TIMESTAMP",
+ "TIMEZONE_HOUR",
+ "TIMEZONE_MINUTE",
+ "TO",
+ "TRAILING",
+ "TRANSLATION",
+ "TREAT",
+ "TRIGGER",
+ "TRUE",
+ "UNDO",
+ "UNION",
+ "UNIQUE",
+ "UNKNOWN",
+ "UNNEST",
+ "UNTIL",
+ "UPDATE",
+ "USER",
+ "USING",
+ "VALUE",
+ "VALUES",
+ "VARCHAR",
+ "VARYING",
+ "WHEN",
+ "WHENEVER",
+ "WHERE",
+ "WHILE",
+ "WINDOW",
+ "WITH",
+ "WITHIN",
+ "WITHOUT",
+ "YEAR");
}
diff --git a/src/main/java/com/salesforce/datacloud/jdbc/config/ResourceReader.java b/src/main/java/com/salesforce/datacloud/jdbc/config/ResourceReader.java
index 0974a78..72e141e 100644
--- a/src/main/java/com/salesforce/datacloud/jdbc/config/ResourceReader.java
+++ b/src/main/java/com/salesforce/datacloud/jdbc/config/ResourceReader.java
@@ -15,6 +15,7 @@
*/
package com.salesforce.datacloud.jdbc.config;
+import com.google.common.io.ByteStreams;
import com.salesforce.datacloud.jdbc.exception.DataCloudJDBCException;
import com.salesforce.datacloud.jdbc.util.SqlErrorCodes;
import java.io.IOException;
@@ -36,7 +37,7 @@
public class ResourceReader {
public static String readResourceAsString(@NonNull String path) {
val result = new AtomicReference();
- withResourceAsStream(path, in -> result.set(new String(in.readAllBytes(), StandardCharsets.UTF_8)));
+ withResourceAsStream(path, in -> result.set(new String(ByteStreams.toByteArray(in), StandardCharsets.UTF_8)));
return result.get();
}
diff --git a/src/main/java/com/salesforce/datacloud/jdbc/core/DataCloudConnection.java b/src/main/java/com/salesforce/datacloud/jdbc/core/DataCloudConnection.java
index 972cce6..9b45eb5 100644
--- a/src/main/java/com/salesforce/datacloud/jdbc/core/DataCloudConnection.java
+++ b/src/main/java/com/salesforce/datacloud/jdbc/core/DataCloudConnection.java
@@ -32,6 +32,7 @@
import com.salesforce.datacloud.jdbc.interceptor.MaxMetadataSizeHeaderInterceptor;
import com.salesforce.datacloud.jdbc.interceptor.TracingHeadersInterceptor;
import com.salesforce.datacloud.jdbc.util.Messages;
+import com.salesforce.datacloud.jdbc.util.StringCompatibility;
import io.grpc.ClientInterceptor;
import io.grpc.ManagedChannelBuilder;
import java.net.URI;
@@ -109,9 +110,7 @@ public static DataCloudConnection fromTokenSupplier(
/** This flow is not supported by the JDBC Driver Manager, only use it if you know what you're doing. */
public static DataCloudConnection fromTokenSupplier(
- AuthorizationHeaderInterceptor authInterceptor,
- @NonNull ManagedChannelBuilder> builder,
- Properties properties)
+ AuthorizationHeaderInterceptor authInterceptor, ManagedChannelBuilder> builder, Properties properties)
throws SQLException {
val interceptors = getClientInterceptors(authInterceptor, properties);
val executor = HyperGrpcClientExecutor.of(builder.intercept(interceptors), properties);
@@ -137,7 +136,7 @@ static List getClientInterceptors(
}
public static DataCloudConnection of(String url, Properties properties) throws SQLException {
- var serviceRootUrl = getServiceRootUrl(url);
+ val serviceRootUrl = getServiceRootUrl(url);
properties.put(LOGIN_URL, serviceRootUrl);
addClientUsernameIfRequired(properties);
@@ -451,7 +450,7 @@ static String getServiceRootUrl(String url) throws SQLException {
val noTrailingSlash = StringUtils.removeEnd(serviceRootUrl, "/");
val host = StringUtils.removeStart(noTrailingSlash, "//");
- return host.isBlank() ? host : createURI(host).toString();
+ return StringCompatibility.isBlank(host) ? host : createURI(host).toString();
}
private static URI createURI(String host) throws SQLException {
diff --git a/src/main/java/com/salesforce/datacloud/jdbc/core/DataCloudPreparedStatement.java b/src/main/java/com/salesforce/datacloud/jdbc/core/DataCloudPreparedStatement.java
index ae3349a..7e64967 100644
--- a/src/main/java/com/salesforce/datacloud/jdbc/core/DataCloudPreparedStatement.java
+++ b/src/main/java/com/salesforce/datacloud/jdbc/core/DataCloudPreparedStatement.java
@@ -20,6 +20,8 @@
import static com.salesforce.datacloud.jdbc.util.DateTimeUtils.getUTCTimestampFromTimestampAndCalendar;
import static com.salesforce.datacloud.jdbc.util.PropertiesExtensions.optional;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
import com.google.protobuf.ByteString;
import com.salesforce.datacloud.jdbc.exception.DataCloudJDBCException;
import com.salesforce.datacloud.jdbc.util.ArrowUtils;
@@ -445,16 +447,16 @@ final class TypeHandlers {
public static final TypeHandler TIME_HANDLER = (ps, idx, value) -> ps.setTime(idx, (Time) value);
public static final TypeHandler TIMESTAMP_HANDLER = (ps, idx, value) -> ps.setTimestamp(idx, (Timestamp) value);
public static final TypeHandler BOOLEAN_HANDLER = (ps, idx, value) -> ps.setBoolean(idx, (Boolean) value);
- static final Map, TypeHandler> typeHandlerMap = Map.ofEntries(
- Map.entry(String.class, STRING_HANDLER),
- Map.entry(BigDecimal.class, BIGDECIMAL_HANDLER),
- Map.entry(Short.class, SHORT_HANDLER),
- Map.entry(Integer.class, INTEGER_HANDLER),
- Map.entry(Long.class, LONG_HANDLER),
- Map.entry(Float.class, FLOAT_HANDLER),
- Map.entry(Double.class, DOUBLE_HANDLER),
- Map.entry(Date.class, DATE_HANDLER),
- Map.entry(Time.class, TIME_HANDLER),
- Map.entry(Timestamp.class, TIMESTAMP_HANDLER),
- Map.entry(Boolean.class, BOOLEAN_HANDLER));
+ static final Map, TypeHandler> typeHandlerMap = ImmutableMap.ofEntries(
+ Maps.immutableEntry(String.class, STRING_HANDLER),
+ Maps.immutableEntry(BigDecimal.class, BIGDECIMAL_HANDLER),
+ Maps.immutableEntry(Short.class, SHORT_HANDLER),
+ Maps.immutableEntry(Integer.class, INTEGER_HANDLER),
+ Maps.immutableEntry(Long.class, LONG_HANDLER),
+ Maps.immutableEntry(Float.class, FLOAT_HANDLER),
+ Maps.immutableEntry(Double.class, DOUBLE_HANDLER),
+ Maps.immutableEntry(Date.class, DATE_HANDLER),
+ Maps.immutableEntry(Time.class, TIME_HANDLER),
+ Maps.immutableEntry(Timestamp.class, TIMESTAMP_HANDLER),
+ Maps.immutableEntry(Boolean.class, BOOLEAN_HANDLER));
}
diff --git a/src/main/java/com/salesforce/datacloud/jdbc/core/HyperGrpcClientExecutor.java b/src/main/java/com/salesforce/datacloud/jdbc/core/HyperGrpcClientExecutor.java
index 15d0bcc..36467ad 100644
--- a/src/main/java/com/salesforce/datacloud/jdbc/core/HyperGrpcClientExecutor.java
+++ b/src/main/java/com/salesforce/datacloud/jdbc/core/HyperGrpcClientExecutor.java
@@ -15,6 +15,8 @@
*/
package com.salesforce.datacloud.jdbc.core;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
import com.salesforce.datacloud.jdbc.config.DriverVersion;
import com.salesforce.datacloud.jdbc.interceptor.QueryIdHeaderInterceptor;
import com.salesforce.datacloud.jdbc.util.PropertiesExtensions;
@@ -86,12 +88,12 @@ public static HyperGrpcClientExecutor of(@NonNull ManagedChannelBuilder> build
}
private static Map retryPolicy(int maxRetryAttempts) {
- return Map.of(
+ return ImmutableMap.of(
"methodConfig",
- List.of(Map.of(
- "name", List.of(Collections.EMPTY_MAP),
+ ImmutableList.of(ImmutableMap.of(
+ "name", ImmutableList.of(Collections.EMPTY_MAP),
"retryPolicy",
- Map.of(
+ ImmutableMap.of(
"maxAttempts",
String.valueOf(maxRetryAttempts),
"initialBackoff",
@@ -101,7 +103,7 @@ private static Map retryPolicy(int maxRetryAttempts) {
"backoffMultiplier",
2.0,
"retryableStatusCodes",
- List.of("UNAVAILABLE")))));
+ ImmutableList.of("UNAVAILABLE")))));
}
public static HyperGrpcClientExecutor of(
@@ -188,13 +190,13 @@ private Iterator execute(String sql, QueryParam.TransferMo
private final HyperServiceGrpc.HyperServiceBlockingStub stub = lazyStub();
private HyperServiceGrpc.HyperServiceBlockingStub lazyStub() {
- var result = HyperServiceGrpc.newBlockingStub(channel);
+ HyperServiceGrpc.HyperServiceBlockingStub result = HyperServiceGrpc.newBlockingStub(channel);
log.info("Stub will execute query. deadline={}", queryTimeout > 0 ? Duration.ofSeconds(queryTimeout) : "none");
if (interceptors != null && !interceptors.isEmpty()) {
log.info("Registering additional interceptors. count={}", interceptors.size());
- result = result.withInterceptors(interceptors.toArray(ClientInterceptor[]::new));
+ result = result.withInterceptors(interceptors.toArray(new ClientInterceptor[0]));
}
if (queryTimeout > 0) {
diff --git a/src/main/java/com/salesforce/datacloud/jdbc/core/MetadataResultSet.java b/src/main/java/com/salesforce/datacloud/jdbc/core/MetadataResultSet.java
index ed5b966..31ff233 100644
--- a/src/main/java/com/salesforce/datacloud/jdbc/core/MetadataResultSet.java
+++ b/src/main/java/com/salesforce/datacloud/jdbc/core/MetadataResultSet.java
@@ -15,11 +15,12 @@
*/
package com.salesforce.datacloud.jdbc.core;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
import com.salesforce.datacloud.jdbc.exception.DataCloudJDBCException;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.List;
-import java.util.Map;
import java.util.TimeZone;
import lombok.experimental.UtilityClass;
import lombok.val;
@@ -32,7 +33,8 @@
@UtilityClass
public class MetadataResultSet {
public static AvaticaResultSet of() throws SQLException {
- val signature = new Meta.Signature(List.of(), null, List.of(), Map.of(), null, Meta.StatementType.SELECT);
+ val signature = new Meta.Signature(
+ ImmutableList.of(), null, ImmutableList.of(), ImmutableMap.of(), null, Meta.StatementType.SELECT);
return of(
null,
new QueryState(),
@@ -40,7 +42,7 @@ public static AvaticaResultSet of() throws SQLException {
new AvaticaResultSetMetaData(null, null, signature),
TimeZone.getDefault(),
null,
- List.of());
+ ImmutableList.of());
}
public static AvaticaResultSet of(
diff --git a/src/main/java/com/salesforce/datacloud/jdbc/core/QueryDBMetadata.java b/src/main/java/com/salesforce/datacloud/jdbc/core/QueryDBMetadata.java
index bc137df..ef5936b 100644
--- a/src/main/java/com/salesforce/datacloud/jdbc/core/QueryDBMetadata.java
+++ b/src/main/java/com/salesforce/datacloud/jdbc/core/QueryDBMetadata.java
@@ -15,19 +15,20 @@
*/
package com.salesforce.datacloud.jdbc.core;
+import com.google.common.collect.ImmutableList;
import com.salesforce.datacloud.jdbc.util.Constants;
import java.sql.Types;
import java.util.List;
public enum QueryDBMetadata {
- GET_TABLE_TYPES(List.of("TABLE_TYPE"), List.of(Constants.TEXT), List.of(Types.VARCHAR)),
- GET_CATALOGS(List.of("TABLE_CAT"), List.of(Constants.TEXT), List.of(Types.VARCHAR)),
+ GET_TABLE_TYPES(ImmutableList.of("TABLE_TYPE"), ImmutableList.of(Constants.TEXT), ImmutableList.of(Types.VARCHAR)),
+ GET_CATALOGS(ImmutableList.of("TABLE_CAT"), ImmutableList.of(Constants.TEXT), ImmutableList.of(Types.VARCHAR)),
GET_SCHEMAS(
- List.of("TABLE_SCHEM", "TABLE_CATALOG"),
- List.of(Constants.TEXT, Constants.TEXT),
- List.of(Types.VARCHAR, Types.VARCHAR)),
+ ImmutableList.of("TABLE_SCHEM", "TABLE_CATALOG"),
+ ImmutableList.of(Constants.TEXT, Constants.TEXT),
+ ImmutableList.of(Types.VARCHAR, Types.VARCHAR)),
GET_TABLES(
- List.of(
+ ImmutableList.of(
"TABLE_CAT",
"TABLE_SCHEM",
"TABLE_NAME",
@@ -38,7 +39,7 @@ public enum QueryDBMetadata {
"TYPE_NAME",
"SELF_REFERENCING_COL_NAME",
"REF_GENERATION"),
- List.of(
+ ImmutableList.of(
Constants.TEXT,
Constants.TEXT,
Constants.TEXT,
@@ -49,7 +50,7 @@ public enum QueryDBMetadata {
Constants.TEXT,
Constants.TEXT,
Constants.TEXT),
- List.of(
+ ImmutableList.of(
Types.VARCHAR,
Types.VARCHAR,
Types.VARCHAR,
@@ -61,7 +62,7 @@ public enum QueryDBMetadata {
Types.VARCHAR,
Types.VARCHAR)),
GET_COLUMNS(
- List.of(
+ ImmutableList.of(
"TABLE_CAT",
"TABLE_SCHEM",
"TABLE_NAME",
@@ -86,7 +87,7 @@ public enum QueryDBMetadata {
"SOURCE_DATA_TYPE",
"IS_AUTOINCREMENT",
"IS_GENERATEDCOLUMN"),
- List.of(
+ ImmutableList.of(
Constants.TEXT,
Constants.TEXT,
Constants.TEXT,
@@ -111,7 +112,7 @@ public enum QueryDBMetadata {
Constants.SHORT,
Constants.TEXT,
Constants.TEXT),
- List.of(
+ ImmutableList.of(
Types.VARCHAR,
Types.VARCHAR,
Types.VARCHAR,
diff --git a/src/main/java/com/salesforce/datacloud/jdbc/core/QueryMetadataUtil.java b/src/main/java/com/salesforce/datacloud/jdbc/core/QueryMetadataUtil.java
index df67b9a..6557d0f 100644
--- a/src/main/java/com/salesforce/datacloud/jdbc/core/QueryMetadataUtil.java
+++ b/src/main/java/com/salesforce/datacloud/jdbc/core/QueryMetadataUtil.java
@@ -15,8 +15,10 @@
*/
package com.salesforce.datacloud.jdbc.core;
-import static java.util.Map.entry;
+import static com.google.common.collect.Maps.immutableEntry;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
import com.salesforce.datacloud.jdbc.auth.OAuthToken;
import com.salesforce.datacloud.jdbc.auth.TokenProcessor;
import com.salesforce.datacloud.jdbc.config.QueryResources;
@@ -85,23 +87,23 @@ class QueryMetadataUtil {
private static final int AUTO_INCREMENT_INDEX = 22;
private static final int GENERATED_COLUMN_INDEX = 23;
- private static final Map dbTypeToSql = Map.ofEntries(
- Map.entry("int2", SqlType.SMALLINT.toString()),
- Map.entry("int4", SqlType.INTEGER.toString()),
- Map.entry("oid", SqlType.BIGINT.toString()),
- Map.entry("int8", SqlType.BIGINT.toString()),
- Map.entry("float", SqlType.DOUBLE.toString()),
- Map.entry("float4", SqlType.REAL.toString()),
- Map.entry("float8", SqlType.DOUBLE.toString()),
- Map.entry("bool", SqlType.BOOLEAN.toString()),
- Map.entry("char", SqlType.CHAR.toString()),
- Map.entry("text", SqlType.VARCHAR.toString()),
- Map.entry("date", SqlType.DATE.toString()),
- Map.entry("time", SqlType.TIME.toString()),
- Map.entry("timetz", SqlType.TIME.toString()),
- Map.entry("timestamp", SqlType.TIMESTAMP.toString()),
- Map.entry("timestamptz", SqlType.TIMESTAMP.toString()),
- Map.entry("array", SqlType.ARRAY.toString()));
+ private static final Map dbTypeToSql = ImmutableMap.ofEntries(
+ immutableEntry("int2", SqlType.SMALLINT.toString()),
+ immutableEntry("int4", SqlType.INTEGER.toString()),
+ immutableEntry("oid", SqlType.BIGINT.toString()),
+ immutableEntry("int8", SqlType.BIGINT.toString()),
+ immutableEntry("float", SqlType.DOUBLE.toString()),
+ immutableEntry("float4", SqlType.REAL.toString()),
+ immutableEntry("float8", SqlType.DOUBLE.toString()),
+ immutableEntry("bool", SqlType.BOOLEAN.toString()),
+ immutableEntry("char", SqlType.CHAR.toString()),
+ immutableEntry("text", SqlType.VARCHAR.toString()),
+ immutableEntry("date", SqlType.DATE.toString()),
+ immutableEntry("time", SqlType.TIME.toString()),
+ immutableEntry("timetz", SqlType.TIME.toString()),
+ immutableEntry("timestamp", SqlType.TIMESTAMP.toString()),
+ immutableEntry("timestamptz", SqlType.TIMESTAMP.toString()),
+ immutableEntry("array", SqlType.ARRAY.toString()));
public static ResultSet createTableResultSet(
String schemaPattern, String tableNamePattern, String[] types, DataCloudStatement dataCloudStatement)
@@ -357,7 +359,7 @@ public static ResultSet createCatalogsResultSet(Optional tokenPr
throws SQLException {
val tenantId = tokenProcessor.get().getDataCloudToken().getTenantId();
val dataspaceName = tokenProcessor.get().getSettings().getDataspace();
- List