You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Gabriel Reid (JIRA)" <ji...@apache.org> on 2014/03/16 08:21:32 UTC

[jira] [Resolved] (PHOENIX-784) CASE expression returning ARRAY doesn't have the correct type

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

Gabriel Reid resolved PHOENIX-784.
----------------------------------

    Resolution: Fixed

Bulk resolve of closed issues imported from GitHub. This status was reached by first re-opening all closed imported issues and then resolving them in bulk.

> CASE expression returning ARRAY doesn't have the correct type
> -------------------------------------------------------------
>
>                 Key: PHOENIX-784
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-784
>             Project: Phoenix
>          Issue Type: Task
>    Affects Versions: 3.0-Release
>            Reporter: James Taylor
>            Assignee: ramkrishna
>              Labels: bug
>
> The following test in TestArray fails, but should succeed as the type returned by the CASE expression should be an ARRAY:
>     @Test
>     public void testCaseWithArray() throws Exception {
>         long ts = nextTimestamp();
>         String tenantId = getOrganizationId();
>         createTableWithArray(BaseConnectedQueryTest.getUrl(),
>                 getDefaultSplits(tenantId), null, ts - 2);
>         initTablesWithArrays(tenantId, null, ts);
>         String query = "SELECT CASE WHEN A_INTEGER = 1 THEN a_double_array ELSE null END [2] FROM table_with_array";
>         Properties props = new Properties(TEST_PROPERTIES);
>         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB,
>                 Long.toString(ts + 2)); // Execute at timestamp 2
>         Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props);
>         try {
>             PreparedStatement statement = conn.prepareStatement(query);
>             ResultSet rs = statement.executeQuery();
>             assertTrue(rs.next());
>             // Need to support primitive
>             Double[] doubleArr = new Double[1];
>             doubleArr[0] = 37.56;
>             Double result =  rs.getDouble(1);
>             assertEquals(result, doubleArr[0]);
>             assertFalse(rs.next());
>         } finally {
>             conn.close();
>         }
>     }



--
This message was sent by Atlassian JIRA
(v6.2#6252)