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

ASF subversion and git services commented on KUDU-3152:
-------------------------------------------------------

Commit e56374a2b0f12621482d540eef031b2864fc6095 in kudu's branch 
refs/heads/branch-1.12.x from Greg Solovyev
[ https://gitbox.apache.org/repos/asf?p=kudu.git;h=e56374a ]

[client] KUDU-3152 fix predicates on DATE column

Add a missing 'if' statement to route calls
to correct variant of newComparisonPredicate
when value is Object.

Add checks for min/max boundaries of integer
representation of java.sql.Date to match
MIN_DATE_VALUE and MAX_DATE_VALUE in DateUtil.

Add Predicate tests for DATE column.

Change-Id: I2759f1228852b78075bd5278f8f1efd19d0d029e
Reviewed-on: http://gerrit.cloudera.org:8080/16101
Tested-by: Alexey Serbin <aser...@cloudera.com>
Reviewed-by: Alexey Serbin <aser...@cloudera.com>
Reviewed-by: Grant Henke <granthe...@apache.org>
(cherry picked from commit 594cf2662a98192d099d271bd744019c659bd5a9)
Reviewed-on: http://gerrit.cloudera.org:8080/16109


> KuduPredicate class in Java client does not handle Date columns
> ---------------------------------------------------------------
>
>                 Key: KUDU-3152
>                 URL: https://issues.apache.org/jira/browse/KUDU-3152
>             Project: Kudu
>          Issue Type: Bug
>          Components: client, java
>    Affects Versions: 1.12.0
>            Reporter: Greg Solovyev
>            Assignee: Greg Solovyev
>            Priority: Major
>             Fix For: 1.13.0
>
>
> I ran into this trying to add a Date type field to 
> nifi-kudu-controller-service 
> (https://issues.apache.org/jira/browse/NIFI-7551). The following code throws  
> _java.lang.IllegalArgumentException_ if _sql_date_ column is defined as DATE 
> and _value_ is either _java.sql.Date_ or _int_
> {code:java}
> KuduPredicate.newComparisonPredicate(tableSchema.getColumn("sql_date"), 
> KuduPredicate.ComparisonOp.EQUAL, value){code}
> If _value_ is DATE, _IllegalArgumentException_ is thrown by this code in 
> KuduPredicate class:
> static long minIntValue(Type type) {
>   switch (type) {
>     case INT8:
>       return Byte.MIN_VALUE;
>     case INT16:
>       return Short.MIN_VALUE;
>     case INT32:
>       return Integer.MIN_VALUE;
>     case UNIXTIME_MICROS:
>     case INT64:
>       return Long.MIN_VALUE;
>     default:
>       throw new IllegalArgumentException("type must be an integer type");
>   }
> }
> if _value_ is an integer, then _IllegalArgumentException_ is thrown by this 
> code
> {code:java}
> public static KuduPredicate newComparisonPredicate(ColumnSchema column,
>                                                    ComparisonOp op,
>                                                    long value) {
>   checkColumn(column, Type.INT8, Type.INT16, Type.INT32, Type.INT64, 
> Type.UNIXTIME_MICROS,
>       Type.DATE);
> {code}
> as a result, if you have a table with DATE column, you cannot scan for it 
> using the java client.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to