You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Toshihiro Suzuki (JIRA)" <ji...@apache.org> on 2018/10/23 08:15:00 UTC
[jira] [Commented] (PHOENIX-4982) Query Fails For Join with Order
By that is fully qualified
[ https://issues.apache.org/jira/browse/PHOENIX-4982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16660241#comment-16660241 ]
Toshihiro Suzuki commented on PHOENIX-4982:
-------------------------------------------
[~akhor] what is a error are you facing with the test code?
> Query Fails For Join with Order By that is fully qualified
> ----------------------------------------------------------
>
> Key: PHOENIX-4982
> URL: https://issues.apache.org/jira/browse/PHOENIX-4982
> Project: Phoenix
> Issue Type: Bug
> Reporter: Andrew Khor
> Priority: Major
>
> {code:java}
> @Test
> public void testJoinWithOrderBy() throws Exception {
> String tableA = "A";
> String tableB = "B";
> String createA = "CREATE TABLE \"" + tableA + "\" (\n" +
> " \"a1\" VARCHAR PRIMARY KEY ,\n" +
> " \"a2\" VARCHAR \n" +
> ")";
> String createB = "CREATE TABLE \"" + tableB + "\" (\n" +
> " \"b1\" VARCHAR PRIMARY KEY ,\n" +
> " \"b2\" VARCHAR \n" +
> ")\n";
> try (Connection conn = DriverManager.getConnection(CONN_STRING);
> Statement stmt = conn.createStatement()) {
> conn.setAutoCommit(false);
> assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableA));
> assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableB));
> assertFalse(stmt.execute(createA));
> assertFalse(stmt.execute(createB));
> Statement statement = null;
> ResultSet rs = null;
> PreparedStatement ps = null;
> String sql = "SELECT \"" + tableA + "\".\"a2\" " +
> "FROM \"" + tableA + "\" JOIN \"" + tableB + "\" ON (\"" + tableA + "\".\"a1\" = \"" + tableB + "\".\"b1\") " +
> "WHERE (\"" + tableB + "\".\"b2\" = ?) " +
> "ORDER BY \""+ tableA + "\".\"a2\" ASC";
> ps = conn.prepareStatement(sql);
> rs = ps.executeQuery();
> assertFalse(rs.next());
> }
> }
> {code}
> See above for a test case.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)