diff --git a/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/ColumnMapping.java b/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/ColumnMapping.java
index 7c498105885a..d7de0a54dd76 100644
--- a/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/ColumnMapping.java
+++ b/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/ColumnMapping.java
@@ -92,6 +92,15 @@ public static ColumnMapping objectMapping(
return new ColumnMapping(trinoType, readFunction, writeFunction, predicatePushdownController);
}
+ public static ColumnMapping mapping(
+ Type trinoType,
+ ReadFunction readFunction,
+ WriteFunction writeFunction,
+ PredicatePushdownController predicatePushdownController)
+ {
+ return new ColumnMapping(trinoType, readFunction, writeFunction, predicatePushdownController);
+ }
+
private final Type type;
private final ReadFunction readFunction;
private final WriteFunction writeFunction;
diff --git a/plugin/trino-redshift/pom.xml b/plugin/trino-redshift/pom.xml
index 9336da7cb9ad..a4a8d639c3d5 100644
--- a/plugin/trino-redshift/pom.xml
+++ b/plugin/trino-redshift/pom.xml
@@ -21,7 +21,7 @@
com.amazon.redshift
redshift-jdbc42
- 2.1.0.24
+ 2.1.0.25
diff --git a/plugin/trino-singlestore/pom.xml b/plugin/trino-singlestore/pom.xml
index bbe324840b30..ff8d3a74d8eb 100644
--- a/plugin/trino-singlestore/pom.xml
+++ b/plugin/trino-singlestore/pom.xml
@@ -31,7 +31,7 @@
com.singlestore
singlestore-jdbc-client
- 1.2.0
+ 1.2.1
diff --git a/plugin/trino-singlestore/src/main/java/io/trino/plugin/singlestore/SingleStoreClient.java b/plugin/trino-singlestore/src/main/java/io/trino/plugin/singlestore/SingleStoreClient.java
index 2f2afd7884cb..cb780aadfc64 100644
--- a/plugin/trino-singlestore/src/main/java/io/trino/plugin/singlestore/SingleStoreClient.java
+++ b/plugin/trino-singlestore/src/main/java/io/trino/plugin/singlestore/SingleStoreClient.java
@@ -15,6 +15,7 @@
import com.google.common.collect.ImmutableSet;
import com.google.inject.Inject;
+import io.airlift.slice.Slice;
import io.trino.plugin.base.expression.ConnectorExpressionRewriter;
import io.trino.plugin.base.mapping.IdentifierMapping;
import io.trino.plugin.jdbc.BaseJdbcClient;
@@ -31,6 +32,7 @@
import io.trino.plugin.jdbc.PreparedQuery;
import io.trino.plugin.jdbc.QueryBuilder;
import io.trino.plugin.jdbc.RemoteTableName;
+import io.trino.plugin.jdbc.SliceReadFunction;
import io.trino.plugin.jdbc.WriteMapping;
import io.trino.plugin.jdbc.expression.JdbcConnectorExpressionRewriterBuilder;
import io.trino.plugin.jdbc.expression.ParameterizedExpression;
@@ -308,7 +310,7 @@ public Optional toColumnMapping(ConnectorSession session, Connect
return Optional.of(defaultCharColumnMapping(typeHandle.getRequiredColumnSize(), false));
case Types.VARCHAR:
case Types.LONGVARCHAR:
- return Optional.of(defaultVarcharColumnMapping(typeHandle.getRequiredColumnSize(), false));
+ return Optional.of(checkNullUsingBytes(defaultVarcharColumnMapping(typeHandle.getRequiredColumnSize(), false)));
case Types.DECIMAL:
int precision = typeHandle.getRequiredColumnSize();
int decimalDigits = typeHandle.getRequiredDecimalDigits();
@@ -323,7 +325,7 @@ public Optional toColumnMapping(ConnectorSession session, Connect
case Types.BINARY:
case Types.VARBINARY:
case Types.LONGVARBINARY:
- return Optional.of(varbinaryColumnMapping());
+ return Optional.of(checkNullUsingBytes(varbinaryColumnMapping()));
case Types.DATE:
return Optional.of(ColumnMapping.longMapping(
DATE,
@@ -347,6 +349,32 @@ public Optional toColumnMapping(ConnectorSession session, Connect
return Optional.empty();
}
+ private static ColumnMapping checkNullUsingBytes(ColumnMapping mapping)
+ {
+ if (mapping.getReadFunction() instanceof SliceReadFunction sliceReadFunction) {
+ SliceReadFunction wrapper = new SliceReadFunction() {
+ @Override
+ public Slice readSlice(ResultSet resultSet, int columnIndex)
+ throws SQLException
+ {
+ return sliceReadFunction.readSlice(resultSet, columnIndex);
+ }
+
+ @Override
+ public boolean isNull(ResultSet resultSet, int columnIndex)
+ throws SQLException
+ {
+ // Singlestore driver 1.2.1 will throw an exception if blob backed columns are read using getObject()
+ resultSet.getBytes(columnIndex);
+ return resultSet.wasNull();
+ }
+ };
+
+ return ColumnMapping.mapping(mapping.getType(), wrapper, mapping.getWriteFunction(), mapping.getPredicatePushdownController());
+ }
+ return mapping;
+ }
+
private static int getTimePrecision(int timeColumnSize)
{
if (timeColumnSize == ZERO_PRECISION_TIME_COLUMN_SIZE) {
diff --git a/pom.xml b/pom.xml
index 1bacdbe11f86..c95675409131 100644
--- a/pom.xml
+++ b/pom.xml
@@ -178,14 +178,14 @@
4.13.1
14.0.2
1.11.3
- 1.12.636
+ 1.12.638
4.17.0
7.5.1
87
1.21
1.0.8
2.23.0
- 10.5.0
+ 10.6.0
1.43.3
1.4.3
5.14.0
@@ -218,7 +218,7 @@
com.google.cloud
libraries-bom
- 26.29.0
+ 26.30.0
pom
import
@@ -298,7 +298,7 @@
software.amazon.awssdk
bom
- 2.23.2
+ 2.23.4
pom
import