提交 24e8b873 编写于 作者: S serge@jkiss.org

#6025 Presto: array data type resolution fix

上级 1cf9cb97
......@@ -875,7 +875,7 @@
icon="icons/presto_icon.png"
iconBig="icons/presto_icon_big.png"
class="com.facebook.presto.jdbc.PrestoDriver"
sampleURL="jdbc:presto://{host}:{port}/{database}"
sampleURL="jdbc:presto://{host}:{port}[/{database}]"
defaultPort="8080"
description="Facebook Presto (prestodb) JDBC driver"
webURL="https://prestodb.io/"
......@@ -892,7 +892,7 @@
icon="icons/presto_icon.png"
iconBig="icons/presto_icon_big.png"
class="io.prestosql.jdbc.PrestoDriver"
sampleURL="jdbc:presto://{host}:{port}/{database}"
sampleURL="jdbc:presto://{host}:{port}[/{database}]"
defaultPort="8080"
description="Presto (prestosql) JDBC driver"
webURL="https://prestosql.io/"
......
......@@ -221,7 +221,11 @@ public class JDBCCollection implements DBDCollection, DBDValueCloneable {
try {
if (array != null) {
String baseTypeName = array.getBaseTypeName();
elementType = dataSource.resolveDataType(monitor, baseTypeName);
if (baseTypeName != null) {
// Strip type name [Presto, #6025]
baseTypeName = SQLUtils.stripColumnTypeModifiers(baseTypeName);
elementType = dataSource.resolveDataType(monitor, baseTypeName);
}
}
} catch (Exception e) {
throw new DBCException("Error resolving data type", e);
......
......@@ -1035,11 +1035,11 @@ public final class SQLUtils {
public static String stripColumnTypeModifiers(String type) {
int startPos = type.indexOf("(");
if (startPos != -1) {
int endPos = type.indexOf(")", startPos + 1);
int endPos = type.lastIndexOf(")");
if (endPos != -1) {
return type.substring(0, startPos).trim() + " " + type.substring(endPos + 1).trim();
return type.substring(0, startPos);
}
}
return null;
return type;
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册