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

Equal predicate with MAX_VALUE of Integer/Long not working

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.2.0
    • Component/s: client
    • Labels:
      None
    • Environment:
      Used cloudera kudu sandbox 5.8.0

      Description

      Equal predicate is working for Integer.MIN_VALUE to (Integer.MAX_VALUE - 1) and failing for Integer.MAX_VALUE.

      To replicate:

                  String tableName = "java_sample-" + System.currentTimeMillis();
                  KuduClient client = new KuduClient.KuduClientBuilder(KUDU_MASTER).build();
                  
                  Integer key = Integer.MAX_VALUE;
                  List<ColumnSchema> columns = new ArrayList<>(2);
                  columns.add(new ColumnSchema.ColumnSchemaBuilder("key", Type.INT32).key(true).build());
                  columns.add(new ColumnSchema.ColumnSchemaBuilder("value", Type.STRING).build());
                  List<String> rangeKeys = new ArrayList<>();
                  rangeKeys.add("key");
      
                  Schema schema = new Schema(columns);
                  client.createTable(tableName, schema, new CreateTableOptions().setRangePartitionColumns(rangeKeys));
      
      
                  KuduTable table = client.openTable(tableName);
                  KuduSession session = client.newSession();
                  Insert insert = table.newInsert();
                  PartialRow row = insert.getRow();
                  row.addInt(0, key);
                  row.addString(1, "dev");
                  session.apply(insert);
      
                  KuduPredicate predicate = KuduPredicate.newComparisonPredicate(
                          new ColumnSchema.ColumnSchemaBuilder("key", Type.INT32).key(true).build(),
                          KuduPredicate.ComparisonOp.EQUAL, key);
                  KuduScanner scanner = client.newScannerBuilder(table).addPredicate(predicate).build();
      
                  while (scanner.hasMoreRows())
                  {
                      RowResultIterator results = scanner.nextRows();
                      while (results.hasNext())
                      {
                          System.out.println("Find with EQUAL predicate...");
                          RowResult result = results.next();
                          System.out.println(result.getInt("key"));
                          System.out.println(result.getString("value"));
                      }
                  }
      

        Attachments

          Activity

            People

            • Assignee:
              danburkert Dan Burkert
              Reporter:
              karthik123 karthik
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: