phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samarth Jain (JIRA)" <j...@apache.org>
Subject [jira] [Created] (PHOENIX-1301) PTable.getParentTableName() should include the schema name if present
Date Mon, 29 Sep 2014 19:16:35 GMT
Samarth Jain created PHOENIX-1301:
-------------------------------------

             Summary: PTable.getParentTableName() should include the schema name if present
                 Key: PHOENIX-1301
                 URL: https://issues.apache.org/jira/browse/PHOENIX-1301
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 5.0.0, 4.2, 3.2
            Reporter: Samarth Jain


{code}
@Test
    public void testParentTableNameShouldIncludeSchemaName() throws Exception {
        Connection conn = DriverManager.getConnection(getUrl(), new Properties());

        // create table
        conn.createStatement().execute("create table "
                + "XYZ.ABC"
                + "   (organization_id char(15) not null, \n"
                + "    entity_id char(15) not null,\n"
                + "    a_string_array varchar(100) array[] not null,\n"
                + "    b_string varchar(100),\n"
                + "    a_integer integer,\n"
                + "    a_date date,\n"
                + "    CONSTRAINT pk PRIMARY KEY (organization_id, entity_id, a_string_array)\n"
                + ")" + "SALT_BUCKETS=4");


        // create index
        conn.createStatement().execute("CREATE INDEX ABC_IDX ON XYZ.ABC (a_integer) INCLUDE
(a_date)");

        // query using the index
        String sql = "SELECT a_date FROM XYZ.ABC where a_integer = ?";
        PreparedStatement stmt = conn.prepareStatement(sql);
        stmt.setInt(1, 1000);
        QueryPlan plan = stmt.unwrap(PhoenixPreparedStatement.class).optimizeQuery();
        assertEquals("Query should use index", PTableType.INDEX, plan.getTableRef().getTable().getType());
        assertEquals("Parent table name should have the schema name", "XYZ.ABC", plan.getTableRef().getTable().getParentName().getString());
        assertEquals("Parent table name should have the schema name", "XYZ.ABC", plan.getTableRef().getTable().getParentTableName());
        conn.close();
    }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message