phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Taylor (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-3918) Ensure all function implementations handle null args correctly
Date Wed, 14 Jun 2017 19:50:00 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-3918?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16049583#comment-16049583
] 

James Taylor commented on PHOENIX-3918:
---------------------------------------

Thanks, [~tdsilva]. Do the tests look good after this change? Couple minor nits:
- Use ByteUtil.EMPTY_BYTE_ARRAY here instead:
{code}
+        if (fillPtr.getLength()==0) {
+            ptr.set(new byte[]{});
+            return true;
+        }
{code}
- Check rs.wasNull() here:
{code}
         ResultSet rs =
                 conn.createStatement()
-                        .executeQuery("SELECT OCTET_LENGTH(vb), OCTET_LENGTH(b) FROM " +
TABLE_NAME
-                            + " WHERE OCTET_LENGTH(vb)=4 and OCTET_LENGTH(b)=4");
+                        .executeQuery("SELECT OCTET_LENGTH(vb1), OCTET_LENGTH(b), OCTET_LENGTH(vb2)
FROM " + TABLE_NAME);
         assertTrue(rs.next());
         assertEquals(4, rs.getInt(1));
         assertEquals(4, rs.getInt(2));
+        assertEquals(0, rs.getInt(3));
         assertTrue(!rs.next());
{code}
- Remove this code in LpadFunction:
{code}
        if (fillExprLen < 1) {
            // return if fill is empty
            return false;
        }
{code}

> Ensure all function implementations handle null args correctly
> --------------------------------------------------------------
>
>                 Key: PHOENIX-3918
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3918
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Samarth Jain
>            Assignee: Thomas D'Silva
>             Fix For: 4.12.0
>
>         Attachments: PHOENIX-3918.patch, PHOENIX-3918-v2.patch, PHOENIX-3918-v3.patch
>
>
> {code}
> testBothParametersNull(org.apache.phoenix.end2end.TimezoneOffsetFunctionIT)  Time elapsed:
2.272 sec  <<< ERROR!
> java.sql.SQLException: ERROR 201 (22000): Illegal data. Unknown timezone 
> 	at org.apache.phoenix.end2end.TimezoneOffsetFunctionIT.testBothParametersNull(TimezoneOffsetFunctionIT.java:130)
> timezoneParameterNull(org.apache.phoenix.end2end.TimezoneOffsetFunctionIT)  Time elapsed:
2.273 sec  <<< ERROR!
> java.sql.SQLException: ERROR 201 (22000): Illegal data. Unknown timezone 
> 	at org.apache.phoenix.end2end.TimezoneOffsetFunctionIT.timezoneParameterNull(TimezoneOffsetFunctionIT.java:151)
> dateParameterNull(org.apache.phoenix.end2end.TimezoneOffsetFunctionIT)  Time elapsed:
2.254 sec  <<< ERROR!
> java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at least 8
bytes, but had 0
> 	at org.apache.phoenix.end2end.TimezoneOffsetFunctionIT.dateParameterNull(TimezoneOffsetFunctionIT.java:172)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message