Uploaded image for project: 'Kudu'
  1. Kudu
  2. KUDU-3152

KuduPredicate class in Java client does not handle Date columns

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.12.0
    • Fix Version/s: 1.13.0
    • Component/s: client, java
    • Labels:
      None

      Description

      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

      KuduPredicate.newComparisonPredicate(tableSchema.getColumn("sql_date"), KuduPredicate.ComparisonOp.EQUAL, value)

      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

      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);
      

      as a result, if you have a table with DATE column, you cannot scan for it using the java client.

       

        Attachments

          Activity

            People

            • Assignee:
              grishick Greg Solovyev
              Reporter:
              grishick Greg Solovyev
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: