Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0.0-incubating
-
None
-
None
Description
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"
+ " ]\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())
rs.close();
calciteConnection.close();
}catch (Exception e)
{ e.printStackTrace(); } }
}