You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Yuri Au Yong (JIRA)" <ji...@apache.org> on 2015/04/02 06:06:52 UTC
[jira] [Updated] (CALCITE-657) NullPointerException when executing
JdbcAggregate implement method
[ https://issues.apache.org/jira/browse/CALCITE-657?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yuri Au Yong updated CALCITE-657:
---------------------------------
Attachment: [CALCITE-657]-Description.patch
> NullPointerException when executing JdbcAggregate implement method
> ------------------------------------------------------------------
>
> Key: CALCITE-657
> URL: https://issues.apache.org/jira/browse/CALCITE-657
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.0.0-incubating
> Reporter: Yuri Au Yong
> Assignee: Julian Hyde
> Attachments: [CALCITE-657]-Description.patch
>
>
> When select with aggregations on identifiers, getting java.lang.NullPointerException during execution of JdbcAggregate implement method.
> Cause:
> rowtype=null instead of getRowType() is used as parameter for addSelect method
> Test:
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.ResultSet;
> import java.sql.Statement;
> import java.util.Properties;
> import org.hsqldb.jdbcDriver;
> public class testJdbcAggregate {
> public static void main(String[] args) {
> try {
> String hsqldbMemUrl = "jdbc:hsqldb:mem:.";
> Connection baseConnection = DriverManager.getConnection(hsqldbMemUrl);
> Statement baseStmt = baseConnection.createStatement();
> baseStmt.execute("CREATE TABLE T1 (\n"
> + "ID INTEGER,\n"
> + "VALS INTEGER)");
> baseStmt.execute("INSERT INTO T1 VALUES (1, 1)");
> baseStmt.execute("INSERT INTO T1 VALUES (2, null)");
> baseStmt.close();
> baseConnection.commit();
> Properties info = new Properties();
> info.put("model",
> "inline:"
> + "{\n"
> + " version: '1.0',\n"
> + " defaultSchema: 'BASEJDBC',\n"
> + " schemas: [\n"
> + " {\n"
> + " type: 'jdbc',\n"
> + " name: 'BASEJDBC',\n"
> + " jdbcDriver: '" + jdbcDriver.class.getName() + "',\n"
> + " jdbcUrl: '" + hsqldbMemUrl + "',\n"
> + " jdbcCatalog: null,\n"
> + " jdbcSchema: null\n"
> + " }\n"
> + " ]\n"
> + "}");
> Connection calciteConnection = DriverManager.getConnection(
> "jdbc:calcite:", info);
> Integer n = 1;
> ResultSet rs = calciteConnection.prepareStatement("select 10 * count(ID) from t1").executeQuery();
> while (rs.next()){
> System.out.println ("calciteRs agg_compute:" + (Long) rs.getObject(n));
> n += 1;
> }
> rs.close();
> calciteConnection.close();
> }catch (Exception e){
> e.printStackTrace();
> }
> }
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)