This is an automated email from the ASF dual-hosted git repository. kharekartik pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push: new 60d34daf17 Multiple JDBC Driver fixes to support Jetbrains Intellij/Datagrip database tooling (#11814) 60d34daf17 is described below commit 60d34daf17f72b32a193a221756d5b72168c6e00 Author: Tim Veil <3260845+timv...@users.noreply.github.com> AuthorDate: Tue Oct 24 00:45:02 2023 -0400 Multiple JDBC Driver fixes to support Jetbrains Intellij/Datagrip database tooling (#11814) * fix for #11813; * removed empty line based on review --- .../pinot/client/PinotConnectionMetaData.java | 12 +++++++---- .../pinot/client/PinotPreparedStatement.java | 2 +- .../pinot/client/base/AbstractBaseConnection.java | 24 ++++++++++++---------- .../pinot/client/base/AbstractBaseStatement.java | 8 ++++---- .../controller/PinotControllerTransport.java | 2 +- 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotConnectionMetaData.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotConnectionMetaData.java index 30f13d2b0c..94e680f9ca 100644 --- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotConnectionMetaData.java +++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotConnectionMetaData.java @@ -150,30 +150,34 @@ public class PinotConnectionMetaData extends AbstractBaseConnectionMetaData { public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { + if (tableNamePattern != null && tableNamePattern.equals("%")) { + LOGGER.warn("driver does not support pattern [{}] for table name", tableNamePattern); + return PinotResultSet.empty(); + } + SchemaResponse schemaResponse = _controllerTransport.getTableSchema(tableNamePattern, _controllerURL); PinotMeta pinotMeta = new PinotMeta(); pinotMeta.setColumnNames(TABLE_SCHEMA_COLUMNS); pinotMeta.setColumnDataTypes(TABLE_SCHEMA_COLUMNS_DTYPES); - String tableName = schemaResponse.getSchemaName(); int ordinalPosition = 1; if (schemaResponse.getDimensions() != null) { for (JsonNode columns : schemaResponse.getDimensions()) { - appendColumnMeta(pinotMeta, tableName, ordinalPosition, columns); + appendColumnMeta(pinotMeta, tableNamePattern, ordinalPosition, columns); ordinalPosition++; } } if (schemaResponse.getMetrics() != null) { for (JsonNode columns : schemaResponse.getMetrics()) { - appendColumnMeta(pinotMeta, tableName, ordinalPosition, columns); + appendColumnMeta(pinotMeta, tableNamePattern, ordinalPosition, columns); ordinalPosition++; } } if (schemaResponse.getDateTimeFieldSpecs() != null) { for (JsonNode columns : schemaResponse.getDateTimeFieldSpecs()) { - appendColumnMeta(pinotMeta, tableName, ordinalPosition, columns); + appendColumnMeta(pinotMeta, tableNamePattern, ordinalPosition, columns); ordinalPosition++; } } diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotPreparedStatement.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotPreparedStatement.java index 8edac605d8..06ada14ac8 100644 --- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotPreparedStatement.java +++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/PinotPreparedStatement.java @@ -203,7 +203,7 @@ public class PinotPreparedStatement extends AbstractBasePreparedStatement { } return _resultSet; } catch (PinotClientException e) { - throw new SQLException("Failed to execute query : {}", _query, e); + throw new SQLException(String.format("Failed to execute query : %s", _query), e); } } diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/base/AbstractBaseConnection.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/base/AbstractBaseConnection.java index 73a1d19433..cbcad08d36 100644 --- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/base/AbstractBaseConnection.java +++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/base/AbstractBaseConnection.java @@ -51,7 +51,7 @@ public abstract class AbstractBaseConnection implements Connection { @Override public void clearWarnings() throws SQLException { - throw new SQLFeatureNotSupportedException(); + // no-op } @Override @@ -111,42 +111,43 @@ public abstract class AbstractBaseConnection implements Connection { @Override public boolean getAutoCommit() throws SQLException { - throw new SQLFeatureNotSupportedException(); + return false; } @Override public void setAutoCommit(boolean autoCommit) throws SQLException { - throw new SQLFeatureNotSupportedException(); + // no-op } @Override public String getCatalog() throws SQLException { - throw new SQLFeatureNotSupportedException(); + return null; } @Override public void setCatalog(String catalog) throws SQLException { - throw new SQLFeatureNotSupportedException(); + // no-op } @Override public String getClientInfo(String name) throws SQLException { - throw new SQLFeatureNotSupportedException(); + return null; } @Override public Properties getClientInfo() throws SQLException { - throw new SQLFeatureNotSupportedException(); + return null; } @Override public void setClientInfo(Properties properties) throws SQLClientInfoException { + // no-op } @Override @@ -170,13 +171,13 @@ public abstract class AbstractBaseConnection implements Connection { @Override public String getSchema() throws SQLException { - throw new SQLFeatureNotSupportedException(); + return null; } @Override public void setSchema(String schema) throws SQLException { - throw new SQLFeatureNotSupportedException(); + // no-op } @Override @@ -206,7 +207,7 @@ public abstract class AbstractBaseConnection implements Connection { @Override public SQLWarning getWarnings() throws SQLException { - throw new SQLFeatureNotSupportedException(); + return null; } @Override @@ -218,7 +219,7 @@ public abstract class AbstractBaseConnection implements Connection { @Override public void setReadOnly(boolean readOnly) throws SQLException { - throw new SQLFeatureNotSupportedException(); + // no-op } @Override @@ -310,6 +311,7 @@ public abstract class AbstractBaseConnection implements Connection { @Override public void setClientInfo(String name, String value) throws SQLClientInfoException { + // no-op } @Override diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/base/AbstractBaseStatement.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/base/AbstractBaseStatement.java index a061a3557e..b6c94f959f 100644 --- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/base/AbstractBaseStatement.java +++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/base/AbstractBaseStatement.java @@ -50,7 +50,7 @@ public abstract class AbstractBaseStatement implements Statement { @Override public void clearWarnings() throws SQLException { - throw new SQLFeatureNotSupportedException(); + // no-op } @Override @@ -194,7 +194,7 @@ public abstract class AbstractBaseStatement implements Statement { @Override public SQLWarning getWarnings() throws SQLException { - throw new SQLFeatureNotSupportedException(); + return null; } @Override @@ -212,7 +212,7 @@ public abstract class AbstractBaseStatement implements Statement { @Override public void setPoolable(boolean poolable) throws SQLException { - throw new SQLFeatureNotSupportedException(); + // no-op; } @Override @@ -230,7 +230,7 @@ public abstract class AbstractBaseStatement implements Statement { @Override public void setEscapeProcessing(boolean enable) throws SQLException { - throw new SQLFeatureNotSupportedException(); + // no-op } @Override diff --git a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/controller/PinotControllerTransport.java b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/controller/PinotControllerTransport.java index 6fc4679267..fdf2251af7 100644 --- a/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/controller/PinotControllerTransport.java +++ b/pinot-clients/pinot-jdbc-client/src/main/java/org/apache/pinot/client/controller/PinotControllerTransport.java @@ -76,7 +76,7 @@ public class PinotControllerTransport { userAgentProperties.load( PinotControllerTransport.class.getClassLoader().getResourceAsStream("version.properties")); } catch (IOException e) { - LOGGER.warn("Unable to set user agent version"); + LOGGER.warn("Unable to set user agent version", e); } String userAgentFromProperties = userAgentProperties.getProperty("ua", "unknown"); if (StringUtils.isNotEmpty(appId)) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org