[ https://issues.apache.org/jira/browse/PHOENIX-7527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
chaijunjie updated PHOENIX-7527: -------------------------------- Description: The sqlline use stmnt.execute and stmnt.getResultSet to get Data, it is different with our IT in ShowCreateTableIT, when do this way, the lastResultSet will be null... test: {code:java} 0: jdbc:phoenix:> SHOW CREATE TABLE TEST; java.lang.NullPointerException at sqlline.Rows.<init>(Rows.java:53) at sqlline.BufferedRows.<init>(BufferedRows.java:47) at sqlline.SqlLine.print(SqlLine.java:1672) at sqlline.Commands.executeSingleQuery(Commands.java:1063) at sqlline.Commands.execute(Commands.java:1003) at sqlline.Commands.sql(Commands.java:967) at sqlline.SqlLine.dispatch(SqlLine.java:734) at sqlline.SqlLine.begin(SqlLine.java:541) at sqlline.SqlLine.start(SqlLine.java:267) at sqlline.SqlLine.main(SqlLine.java:206) {code} UT: could add this to org.apache.phoenix.end2end.ShowCreateTableIT to reproduce it. {code:java} @Test public void testShowCreateTableUpperCase2() throws Exception { Properties props = new Properties(); Connection conn = DriverManager.getConnection(getUrl(), props); String tableName = generateUniqueName(); String schemaName = generateUniqueName(); String tableFullName = SchemaUtil.getQualifiedTableName(schemaName, tableName); String ddl = "CREATE TABLE " + tableFullName + "(K VARCHAR NOT NULL PRIMARY KEY, INT INTEGER)"; conn.createStatement().execute(ddl); Statement statement = conn.createStatement(); boolean execute = statement.execute("SHOW CREATE TABLE " + tableFullName); if (execute){ try (ResultSet rs = statement.getResultSet()) { Assert.assertNotNull(rs); } } }{code} ---------------------------------------------------------------------------- I think the root cause is here [https://github.com/apache/phoenix/blob/973778f9be425a41b430631097372f8ba8dc9c39/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java#L429C1-L431C68] was: The sqlline use stmnt.execute and stmnt.getResultSet to get Data, it is different with our IT in ShowCreateTableIT, when do this way, the lastResultSet will be null... test: {code:java} 0: jdbc:phoenix:> SHOW CREATE TABLE TEST; java.lang.NullPointerException at sqlline.Rows.<init>(Rows.java:53) at sqlline.BufferedRows.<init>(BufferedRows.java:47) at sqlline.SqlLine.print(SqlLine.java:1672) at sqlline.Commands.executeSingleQuery(Commands.java:1063) at sqlline.Commands.execute(Commands.java:1003) at sqlline.Commands.sql(Commands.java:967) at sqlline.SqlLine.dispatch(SqlLine.java:734) at sqlline.SqlLine.begin(SqlLine.java:541) at sqlline.SqlLine.start(SqlLine.java:267) at sqlline.SqlLine.main(SqlLine.java:206) {code} UT: could add this to org.apache.phoenix.end2end.ShowCreateTableIT to reproduce it. {code:java} @Test public void testShowCreateTableUpperCase2() throws Exception { Properties props = new Properties(); Connection conn = DriverManager.getConnection(getUrl(), props); String tableName = generateUniqueName(); String schemaName = generateUniqueName(); String tableFullName = SchemaUtil.getQualifiedTableName(schemaName, tableName); String ddl = "CREATE TABLE " + tableFullName + "(K VARCHAR NOT NULL PRIMARY KEY, INT INTEGER)"; conn.createStatement().execute(ddl); Statement statement = conn.createStatement(); boolean execute = statement.execute("SHOW CREATE TABLE " + tableFullName); if (execute){ try (ResultSet rs = statement.getResultSet()) { String string = rs.getString(1); System.out.println(string); } } } {code} > NPE thrown when exatact Table Schema use sqlline. > ------------------------------------------------- > > Key: PHOENIX-7527 > URL: https://issues.apache.org/jira/browse/PHOENIX-7527 > Project: Phoenix > Issue Type: Bug > Affects Versions: 5.2.1 > Reporter: chaijunjie > Priority: Major > > The sqlline use stmnt.execute and stmnt.getResultSet to get Data, it is > different with our IT in ShowCreateTableIT, when do this way, the > lastResultSet will be null... > test: > {code:java} > 0: jdbc:phoenix:> SHOW CREATE TABLE TEST; > java.lang.NullPointerException > at sqlline.Rows.<init>(Rows.java:53) > at sqlline.BufferedRows.<init>(BufferedRows.java:47) > at sqlline.SqlLine.print(SqlLine.java:1672) > at sqlline.Commands.executeSingleQuery(Commands.java:1063) > at sqlline.Commands.execute(Commands.java:1003) > at sqlline.Commands.sql(Commands.java:967) > at sqlline.SqlLine.dispatch(SqlLine.java:734) > at sqlline.SqlLine.begin(SqlLine.java:541) > at sqlline.SqlLine.start(SqlLine.java:267) > at sqlline.SqlLine.main(SqlLine.java:206) > {code} > > UT: > could add this to org.apache.phoenix.end2end.ShowCreateTableIT to reproduce > it. > > {code:java} > @Test > public void testShowCreateTableUpperCase2() throws Exception { > Properties props = new Properties(); > Connection conn = DriverManager.getConnection(getUrl(), props); > String tableName = generateUniqueName(); > String schemaName = generateUniqueName(); > String tableFullName = SchemaUtil.getQualifiedTableName(schemaName, > tableName); > String ddl = "CREATE TABLE " + tableFullName + "(K VARCHAR NOT NULL > PRIMARY KEY, INT INTEGER)"; > conn.createStatement().execute(ddl); > Statement statement = conn.createStatement(); > boolean execute = statement.execute("SHOW CREATE TABLE " + tableFullName); > if (execute){ > try (ResultSet rs = statement.getResultSet()) { > Assert.assertNotNull(rs); > } > } > }{code} > > ---------------------------------------------------------------------------- > I think the root cause is here > [https://github.com/apache/phoenix/blob/973778f9be425a41b430631097372f8ba8dc9c39/phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java#L429C1-L431C68] > > -- This message was sent by Atlassian Jira (v8.20.10#820010)