You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Sergio Sainz (JIRA)" <ji...@apache.org> on 2017/11/17 20:49:00 UTC

[jira] [Updated] (CALCITE-2060) connection.getMetaData().getTypeInfo();

     [ https://issues.apache.org/jira/browse/CALCITE-2060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergio Sainz updated CALCITE-2060:
----------------------------------
    Description: 
When running the following code we see the null pointer exception below:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;

public class druid_jdbc {
  public static void main (String[] args) throws ClassNotFoundException, SQLException
  {

    //Class.forName("org.apache.calcite.jdbc.Driver");
    String url = "jdbc:avatica:remote:url=http://host:8082/druid/v2/sql/avatica/";
    Properties connectionProperties = new Properties();
    try (Connection connection = DriverManager.getConnection(url, connectionProperties)) {
      connection.getMetaData().getTypeInfo();
      try (ResultSet resultSet = connection.createStatement().executeQuery("SELECT COUNT(*) AS cnt FROM CUSTOMER")) {
        int i = 0;
        while (resultSet.next()) {
          int cnt = resultSet.getInt("cnt");
          System.out.println("It " + i + " count: " + cnt);
          i++;
        }
      }
    }
  }
}



Exception in thread "main" AvaticaClientRuntimeException: Remote driver error: NullPointerException: (null exception message). Error -1 (00000) UNKNOWN

java.lang.NullPointerException
	at org.apache.calcite.avatica.MetaImpl.createResultSet(MetaImpl.java:288)
	at org.apache.calcite.avatica.MetaImpl.createEmptyResultSet(MetaImpl.java:219)
	at org.apache.calcite.avatica.MetaImpl.getTypeInfo(MetaImpl.java:1380)
	at org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:188)
	at org.apache.calcite.avatica.remote.Service$TypeInfoRequest.accept(Service.java:701)
	at org.apache.calcite.avatica.remote.Service$TypeInfoRequest.accept(Service.java:686)
	at org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:95)
	at org.apache.calcite.avatica.remote.JsonHandler.apply(JsonHandler.java:52)
	at org.apache.calcite.avatica.server.AvaticaJsonHandler.handle(AvaticaJsonHandler.java:129)
	at io.druid.sql.avatica.DruidAvaticaHandler.handle(DruidAvaticaHandler.java:63)
	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:534)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
	at java.lang.Thread.run(Thread.java:748)


	at org.apache.calcite.avatica.remote.Service$ErrorResponse.toException(Service.java:2476)
	at org.apache.calcite.avatica.remote.JsonService.decode(JsonService.java:55)
	at org.apache.calcite.avatica.remote.JsonService.apply(JsonService.java:108)
	at org.apache.calcite.avatica.remote.RemoteMeta$10.call(RemoteMeta.java:213)
	at org.apache.calcite.avatica.remote.RemoteMeta$10.call(RemoteMeta.java:210)
	at org.apache.calcite.avatica.AvaticaConnection.invokeWithRetries(AvaticaConnection.java:756)
	at org.apache.calcite.avatica.remote.RemoteMeta.getTypeInfo(RemoteMeta.java:209)
	at org.apache.calcite.avatica.AvaticaDatabaseMetaData$22.call(AvaticaDatabaseMetaData.java:1010)
	at org.apache.calcite.avatica.AvaticaDatabaseMetaData$22.call(AvaticaDatabaseMetaData.java:1007)
	at org.apache.calcite.avatica.AvaticaConnection.invokeWithRetries(AvaticaConnection.java:756)
	at org.apache.calcite.avatica.AvaticaDatabaseMetaData.getTypeInfo(AvaticaDatabaseMetaData.java:1006)
	at druid_jdbc.main(druid_jdbc.java:19)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Process finished with exit code 1


  was:
When running the following code we see the null pointer exception below:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;

/**
 * Created by ssainz on 11/17/17.
 */

public class druid_jdbc {
  public static void main (String[] args) throws ClassNotFoundException, SQLException
  {

    //Class.forName("org.apache.calcite.jdbc.Driver");
    String url = "jdbc:avatica:remote:url=http://host:8082/druid/v2/sql/avatica/";
    Properties connectionProperties = new Properties();
    try (Connection connection = DriverManager.getConnection(url, connectionProperties)) {
      connection.getMetaData().getTypeInfo();
      try (ResultSet resultSet = connection.createStatement().executeQuery("SELECT COUNT(*) AS cnt FROM CUSTOMER")) {
        int i = 0;
        while (resultSet.next()) {
          int cnt = resultSet.getInt("cnt");
          System.out.println("It " + i + " count: " + cnt);
          i++;
        }
      }
    }
  }
}



Exception in thread "main" AvaticaClientRuntimeException: Remote driver error: NullPointerException: (null exception message). Error -1 (00000) UNKNOWN

java.lang.NullPointerException
	at org.apache.calcite.avatica.MetaImpl.createResultSet(MetaImpl.java:288)
	at org.apache.calcite.avatica.MetaImpl.createEmptyResultSet(MetaImpl.java:219)
	at org.apache.calcite.avatica.MetaImpl.getTypeInfo(MetaImpl.java:1380)
	at org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:188)
	at org.apache.calcite.avatica.remote.Service$TypeInfoRequest.accept(Service.java:701)
	at org.apache.calcite.avatica.remote.Service$TypeInfoRequest.accept(Service.java:686)
	at org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:95)
	at org.apache.calcite.avatica.remote.JsonHandler.apply(JsonHandler.java:52)
	at org.apache.calcite.avatica.server.AvaticaJsonHandler.handle(AvaticaJsonHandler.java:129)
	at io.druid.sql.avatica.DruidAvaticaHandler.handle(DruidAvaticaHandler.java:63)
	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:534)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
	at java.lang.Thread.run(Thread.java:748)


	at org.apache.calcite.avatica.remote.Service$ErrorResponse.toException(Service.java:2476)
	at org.apache.calcite.avatica.remote.JsonService.decode(JsonService.java:55)
	at org.apache.calcite.avatica.remote.JsonService.apply(JsonService.java:108)
	at org.apache.calcite.avatica.remote.RemoteMeta$10.call(RemoteMeta.java:213)
	at org.apache.calcite.avatica.remote.RemoteMeta$10.call(RemoteMeta.java:210)
	at org.apache.calcite.avatica.AvaticaConnection.invokeWithRetries(AvaticaConnection.java:756)
	at org.apache.calcite.avatica.remote.RemoteMeta.getTypeInfo(RemoteMeta.java:209)
	at org.apache.calcite.avatica.AvaticaDatabaseMetaData$22.call(AvaticaDatabaseMetaData.java:1010)
	at org.apache.calcite.avatica.AvaticaDatabaseMetaData$22.call(AvaticaDatabaseMetaData.java:1007)
	at org.apache.calcite.avatica.AvaticaConnection.invokeWithRetries(AvaticaConnection.java:756)
	at org.apache.calcite.avatica.AvaticaDatabaseMetaData.getTypeInfo(AvaticaDatabaseMetaData.java:1006)
	at druid_jdbc.main(druid_jdbc.java:19)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Process finished with exit code 1



> connection.getMetaData().getTypeInfo();
> ---------------------------------------
>
>                 Key: CALCITE-2060
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2060
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica
>    Affects Versions: 1.11.0
>            Reporter: Sergio Sainz
>            Priority: Minor
>
> When running the following code we see the null pointer exception below:
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.ResultSet;
> import java.sql.SQLException;
> import java.util.Properties;
> public class druid_jdbc {
>   public static void main (String[] args) throws ClassNotFoundException, SQLException
>   {
>     //Class.forName("org.apache.calcite.jdbc.Driver");
>     String url = "jdbc:avatica:remote:url=http://host:8082/druid/v2/sql/avatica/";
>     Properties connectionProperties = new Properties();
>     try (Connection connection = DriverManager.getConnection(url, connectionProperties)) {
>       connection.getMetaData().getTypeInfo();
>       try (ResultSet resultSet = connection.createStatement().executeQuery("SELECT COUNT(*) AS cnt FROM CUSTOMER")) {
>         int i = 0;
>         while (resultSet.next()) {
>           int cnt = resultSet.getInt("cnt");
>           System.out.println("It " + i + " count: " + cnt);
>           i++;
>         }
>       }
>     }
>   }
> }
> Exception in thread "main" AvaticaClientRuntimeException: Remote driver error: NullPointerException: (null exception message). Error -1 (00000) UNKNOWN
> java.lang.NullPointerException
> 	at org.apache.calcite.avatica.MetaImpl.createResultSet(MetaImpl.java:288)
> 	at org.apache.calcite.avatica.MetaImpl.createEmptyResultSet(MetaImpl.java:219)
> 	at org.apache.calcite.avatica.MetaImpl.getTypeInfo(MetaImpl.java:1380)
> 	at org.apache.calcite.avatica.remote.LocalService.apply(LocalService.java:188)
> 	at org.apache.calcite.avatica.remote.Service$TypeInfoRequest.accept(Service.java:701)
> 	at org.apache.calcite.avatica.remote.Service$TypeInfoRequest.accept(Service.java:686)
> 	at org.apache.calcite.avatica.remote.AbstractHandler.apply(AbstractHandler.java:95)
> 	at org.apache.calcite.avatica.remote.JsonHandler.apply(JsonHandler.java:52)
> 	at org.apache.calcite.avatica.server.AvaticaJsonHandler.handle(AvaticaJsonHandler.java:129)
> 	at io.druid.sql.avatica.DruidAvaticaHandler.handle(DruidAvaticaHandler.java:63)
> 	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
> 	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
> 	at org.eclipse.jetty.server.Server.handle(Server.java:534)
> 	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
> 	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
> 	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
> 	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
> 	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
> 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
> 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
> 	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
> 	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
> 	at java.lang.Thread.run(Thread.java:748)
> 	at org.apache.calcite.avatica.remote.Service$ErrorResponse.toException(Service.java:2476)
> 	at org.apache.calcite.avatica.remote.JsonService.decode(JsonService.java:55)
> 	at org.apache.calcite.avatica.remote.JsonService.apply(JsonService.java:108)
> 	at org.apache.calcite.avatica.remote.RemoteMeta$10.call(RemoteMeta.java:213)
> 	at org.apache.calcite.avatica.remote.RemoteMeta$10.call(RemoteMeta.java:210)
> 	at org.apache.calcite.avatica.AvaticaConnection.invokeWithRetries(AvaticaConnection.java:756)
> 	at org.apache.calcite.avatica.remote.RemoteMeta.getTypeInfo(RemoteMeta.java:209)
> 	at org.apache.calcite.avatica.AvaticaDatabaseMetaData$22.call(AvaticaDatabaseMetaData.java:1010)
> 	at org.apache.calcite.avatica.AvaticaDatabaseMetaData$22.call(AvaticaDatabaseMetaData.java:1007)
> 	at org.apache.calcite.avatica.AvaticaConnection.invokeWithRetries(AvaticaConnection.java:756)
> 	at org.apache.calcite.avatica.AvaticaDatabaseMetaData.getTypeInfo(AvaticaDatabaseMetaData.java:1006)
> 	at druid_jdbc.main(druid_jdbc.java:19)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
> Process finished with exit code 1



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)