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 � Dx�g Adak
at
org.apache.phoenix.exception.SQLExceptionCode$Factory$1.newException(SQLExceptionCode.java:362)
at
org.apache.phoenix.exception.SQLExceptionInfo.buildException(SQLExceptionInfo.java:133)
at
org.apache.phoenix.schema.IllegalDataException.<init>(IllegalDataException.java:38)
at
org.apache.phoenix.cache.JodaTimezoneCache.getInstance(JodaTimezoneCache.java:48)
at
org.apache.phoenix.cache.JodaTimezoneCache.getInstance(JodaTimezoneCache.java:60)
at
org.apache.phoenix.expression.function.ConvertTimezoneFunction.evaluate(ConvertTimezoneFunction.java:70)
at
org.apache.phoenix.compile.ExpressionProjector.getValue(ExpressionProjector.java:69)
at
org.apache.phoenix.jdbc.PhoenixResultSet.getDate(PhoenixResultSet.java:356)
at
org.apache.phoenix.end2end.ConvertTimezoneFunctionIT.testConvertMultipleRecords(ConvertTimezoneFunctionIT.java:80)
Could you look into what's going wrong?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---