phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gabrielreid <...@git.apache.org>
Subject [GitHub] phoenix pull request: PHOENIX-1722 Speedup CONVERT_TZ function
Date Fri, 27 Mar 2015 09:27:54 GMT
Github user gabrielreid commented on the pull request:

    https://github.com/apache/phoenix/pull/42#issuecomment-86879632
  
    @tzolkincz I just tried running this on a Phoenix install, and there seems to be an issue
with the code now if I use the CONVERT_TZ function over multiple rows.
    
    I'm able to replicate it in ConvertTimezoneFunctionIT with the following test:
    
        @Test
        public void testConvertMultipleRecords() throws Exception {
            Connection conn = DriverManager.getConnection(getUrl());
            String ddl = "CREATE TABLE IF NOT EXISTS TIMEZONE_OFFSET_TEST (k1 INTEGER NOT
NULL, dates DATE CONSTRAINT pk PRIMARY KEY (k1))";
            Statement stmt = conn.createStatement();
            stmt.execute(ddl);
            stmt.execute( "UPSERT INTO TIMEZONE_OFFSET_TEST (k1, dates) VALUES (1, TO_DATE('2014-03-01
00:00:00'))");
            stmt.execute( "UPSERT INTO TIMEZONE_OFFSET_TEST (k1, dates) VALUES (2, TO_DATE('2014-03-01
00:00:00'))");
            conn.commit();
    
            ResultSet rs = stmt.executeQuery(
                    "SELECT k1, dates, CONVERT_TZ(dates, 'UTC', 'America/Adak') FROM TIMEZONE_OFFSET_TEST");
    
            assertTrue(rs.next());
            assertEquals(1393596000000L, rs.getDate(3).getTime()); //Fri, 28 Feb 2014 14:00:00
            assertTrue(rs.next());
            assertEquals(1393596000000L, rs.getDate(3).getTime()); //Fri, 28 Feb 2014 14:00:00
            assertFalse(rs.next());
        }
    
    Running that test results in the following:
    
        java.sql.SQLException: ERROR 201 (22000): Illegal data. Unknown timezone �
Mime
View raw message