You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Samarth Jain (JIRA)" <ji...@apache.org> on 2014/10/01 01:38:34 UTC

[jira] [Resolved] (PHOENIX-1301) PTable.getParentTableName() should include the schema name if present

     [ https://issues.apache.org/jira/browse/PHOENIX-1301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Samarth Jain resolved PHOENIX-1301.
-----------------------------------
    Resolution: Not a Problem

> 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)