Java源码示例:org.apache.kudu.client.KuduPredicate

示例1
public KuduPredicate toPredicate(ColumnSchema column) {
    KuduPredicate predicate;
    switch (this.type) {
        case IS_IN:
            predicate = KuduPredicate.newInListPredicate(column, (List<?>) this.value);
            break;
        case IS_NULL:
            predicate = KuduPredicate.newIsNullPredicate(column);
            break;
        case IS_NOT_NULL:
            predicate = KuduPredicate.newIsNotNullPredicate(column);
            break;
        default:
            predicate = predicateComparator(column);
            break;
    }
    return predicate;
}
 
示例2
public KuduPredicate toPredicate(ColumnSchema column) {
    KuduPredicate predicate;
    switch (this.type) {
        case IS_IN:
            predicate = KuduPredicate.newInListPredicate(column, (List<?>) this.value);
            break;
        case IS_NULL:
            predicate = KuduPredicate.newIsNullPredicate(column);
            break;
        case IS_NOT_NULL:
            predicate = KuduPredicate.newIsNotNullPredicate(column);
            break;
        default:
            predicate = predicateComparator(column);
            break;
    }
    return predicate;
}
 
示例3
public KuduPredicate toPredicate(ColumnSchema column) {
    KuduPredicate predicate;
    switch (this.type) {
        case IS_IN:
            predicate = KuduPredicate.newInListPredicate(column, (List<?>) this.value);
            break;
        case IS_NULL:
            predicate = KuduPredicate.newIsNullPredicate(column);
            break;
        case IS_NOT_NULL:
            predicate = KuduPredicate.newIsNotNullPredicate(column);
            break;
        default:
            predicate = predicateComparator(column);
            break;
    }
    return predicate;
}
 
示例4
/** Configures the scanner builder to conform to the spec. */
private static <T2> void configureBuilder(
    KuduIO.Read<T2> spec, Schema schema, AbstractKuduScannerBuilder builder) {
  builder.cacheBlocks(true); // as per kudu-spark
  if (spec.getBatchSize() != null) {
    builder.batchSizeBytes(spec.getBatchSize());
  }
  if (spec.getProjectedColumns() != null) {
    builder.setProjectedColumnNames(spec.getProjectedColumns());
  }
  if (spec.getFaultTolerent() != null) {
    builder.setFaultTolerant(spec.getFaultTolerent());
  }
  if (spec.getSerializablePredicates() != null) {
    for (Common.ColumnPredicatePB predicate : spec.getSerializablePredicates()) {
      builder.addPredicate(KuduPredicate.fromPB(schema, predicate));
    }
  }
}
 
示例5
private void runReadWithPredicates() {
  PCollection<String> output =
      readPipeline.apply(
          "Read with predicates",
          KuduIO.<String>read()
              .withMasterAddresses(options.getKuduMasterAddresses())
              .withTable(options.getKuduTable())
              .withParseFn(
                  (SerializableFunction<RowResult, String>) input -> input.getString(COL_NAME))
              .withPredicates(
                  Arrays.asList(
                      KuduPredicate.newComparisonPredicate(
                          SCHEMA.getColumn(COL_ID), KuduPredicate.ComparisonOp.GREATER_EQUAL, 2),
                      KuduPredicate.newComparisonPredicate(
                          SCHEMA.getColumn(COL_ID), KuduPredicate.ComparisonOp.LESS, 7)))
              .withCoder(StringUtf8Coder.of()));

  output.apply(Count.globally());

  PAssert.thatSingleton(output.apply("Count", Count.globally())).isEqualTo((long) 5);

  readPipeline.run().waitUntilFinish();
}
 
示例6
@Override
public void exitFILTER_COMPARISION_EXP(KuduSQLExpressionParser.FILTER_COMPARISION_EXPContext ctx)
{
  super.exitFILTER_COMPARISION_EXP(ctx);
  String columnName = extractColumnNameFromContext(ctx.idorcolumnname());
  if (columnSchemaLookups.containsKey(columnName)) {
    if (ctx.comparisionoperator().EQUAL_TO() != null) {
      kuduPredicateList.add(buildKuduPredicate(columnName,KuduPredicate.ComparisonOp.EQUAL,ctx.anyvalue()));
    }
    if (ctx.comparisionoperator().GREATER_THAN() != null) {
      kuduPredicateList.add(buildKuduPredicate(columnName,KuduPredicate.ComparisonOp.GREATER,ctx.anyvalue()));
    }
    if (ctx.comparisionoperator().LESSER_THAN() != null) {
      kuduPredicateList.add(buildKuduPredicate(columnName,KuduPredicate.ComparisonOp.LESS,ctx.anyvalue()));
    }
    if (ctx.comparisionoperator().GREATER_THAN_OR_EQUAL() != null) {
      kuduPredicateList.add(buildKuduPredicate(columnName,KuduPredicate.ComparisonOp.GREATER_EQUAL,ctx.anyvalue()));
    }
    if (ctx.comparisionoperator().LESSER_THAN_OR_EQUAL() != null) {
      kuduPredicateList.add(buildKuduPredicate(columnName,KuduPredicate.ComparisonOp.LESS_EQUAL,ctx.anyvalue()));
    }
  } else {
    LOG.error(columnName + " is not a valid column name for this kudu table");
    isSuccessfullyParsed = false;
  }
}
 
示例7
protected void lookUpAndPopulateRecord(UnitTestTablePojo keyInfo) throws Exception
{
  KuduScanner scanner = kuduClient.newScannerBuilder(kuduTable)
      .addPredicate(KuduPredicate.newComparisonPredicate(columnDefs.get("introwkey"),
      KuduPredicate.ComparisonOp.EQUAL,keyInfo.getIntrowkey()))
      .addPredicate(KuduPredicate.newComparisonPredicate(columnDefs.get("stringrowkey"),
      KuduPredicate.ComparisonOp.EQUAL,keyInfo.getStringrowkey()))
      .addPredicate(KuduPredicate.newComparisonPredicate(columnDefs.get("timestamprowkey"),
      KuduPredicate.ComparisonOp.EQUAL,keyInfo.getTimestamprowkey()))
      .build();
  RowResultIterator rowResultItr = scanner.nextRows();
  while (rowResultItr.hasNext()) {
    RowResult thisRow = rowResultItr.next();
    keyInfo.setFloatdata(thisRow.getFloat("floatdata"));
    keyInfo.setBooldata(thisRow.getBoolean("booldata"));
    keyInfo.setBinarydata(thisRow.getBinary("binarydata"));
    keyInfo.setLongdata(thisRow.getLong("longdata"));
    keyInfo.setTimestampdata(thisRow.getLong("timestampdata"));
    keyInfo.setStringdata("stringdata");
    break;
  }
}
 
示例8
public List<Delete> getDeletions(
    final KuduTable table,
    final List<KuduPredicate> predicates,
    final Function<RowResult, PersistentKuduRow> adapter) throws KuduException {
  // TODO: Kudu Java API does not support deleting with predicates, so we first perform a scan and
  // then perform individual row deletions with the full primary key. This is inefficient, because
  // we need to read in entire rows in order to perform deletions.
  final KuduScannerBuilder scannerBuilder = getScannerBuilder(table);
  for (final KuduPredicate pred : predicates) {
    scannerBuilder.addPredicate(pred);
  }
  final KuduScanner scanner = scannerBuilder.build();
  final List<RowResultIterator> allResults = new ArrayList<>();
  while (scanner.hasMoreRows()) {
    allResults.add(scanner.nextRows());
  }
  final Iterator<Delete> deletions =
      Streams.stream(Iterators.concat(allResults.iterator())).map(result -> {
        final PersistentKuduRow row = adapter.apply(result);
        final Delete delete = table.newDelete();
        row.populatePartialRowPrimaryKey(delete.getRow());
        return delete;
      }).iterator();
  return Lists.newArrayList(deletions);
}
 
示例9
private KuduPredicate createComparisonPredicate(ColumnSchema columnSchema, KuduPredicate.ComparisonOp op, Object value)
{
    io.prestosql.spi.type.Type type = TypeHelper.fromKuduColumn(columnSchema);
    Object javaValue = TypeHelper.getJavaValue(type, value);
    if (javaValue instanceof Long) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Long) javaValue);
    }
    if (javaValue instanceof BigDecimal) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (BigDecimal) javaValue);
    }
    if (javaValue instanceof Integer) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Integer) javaValue);
    }
    if (javaValue instanceof Short) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Short) javaValue);
    }
    if (javaValue instanceof Byte) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Byte) javaValue);
    }
    if (javaValue instanceof String) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (String) javaValue);
    }
    if (javaValue instanceof Double) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Double) javaValue);
    }
    if (javaValue instanceof Float) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Float) javaValue);
    }
    if (javaValue instanceof Boolean) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Boolean) javaValue);
    }
    if (javaValue instanceof byte[]) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (byte[]) javaValue);
    }
    if (javaValue == null) {
        throw new IllegalStateException("Unexpected null java value for column " + columnSchema.getName());
    }
    throw new IllegalStateException("Unexpected java value for column "
            + columnSchema.getName() + ": " + javaValue + "(" + javaValue.getClass() + ")");
}
 
示例10
@Override
public List<String> listSchemaNames() {
    try {
        if (rawSchemasTable == null) {
            if (!client.tableExists(rawSchemasTableName)) {
                createAndFillSchemasTable();
            }
            rawSchemasTable = getSchemasTable();
        }

        ColumnSchema tenantColumn = rawSchemasTable.getSchema().getColumnByIndex(0);
        KuduScanner scanner = client.newScannerBuilder(rawSchemasTable)
                .addPredicate(KuduPredicate.newComparisonPredicate(tenantColumn, KuduPredicate.ComparisonOp.EQUAL, tenantPrefix))
                .setProjectedColumnIndexes(ImmutableList.of(1))
                .build();
        RowResultIterator iterator = scanner.nextRows();
        ArrayList<String> result = new ArrayList<>();
        while (iterator != null) {
            for (RowResult row : iterator) {
                result.add(row.getString(0));
            }
            iterator = scanner.nextRows();
        }
        return result;
    } catch (KuduException e) {
        throw new PrestoException(GENERIC_INTERNAL_ERROR, e);
    }
}
 
示例11
private KuduPredicate createComparisonPredicate(ColumnSchema columnSchema,
                                                KuduPredicate.ComparisonOp op,
                                                Object value) {
    com.facebook.presto.spi.type.Type type = TypeHelper.fromKuduColumn(columnSchema);
    Object javaValue = TypeHelper.getJavaValue(type, value);
    if (javaValue instanceof Long) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Long) javaValue);
    } else if (javaValue instanceof Integer) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Integer) javaValue);
    } else if (javaValue instanceof Short) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Short) javaValue);
    } else if (javaValue instanceof Byte) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Byte) javaValue);
    } else if (javaValue instanceof String) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (String) javaValue);
    } else if (javaValue instanceof Double) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Double) javaValue);
    } else if (javaValue instanceof Float) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Float) javaValue);
    } else if (javaValue instanceof Boolean) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (Boolean) javaValue);
    } else if (javaValue instanceof byte[]) {
        return KuduPredicate.newComparisonPredicate(columnSchema, op, (byte[]) javaValue);
    } else if (javaValue == null) {
        throw new IllegalStateException("Unexpected null java value for column " + columnSchema.getName());
    } else {
        throw new IllegalStateException("Unexpected java value for column "
                + columnSchema.getName() + ": " + javaValue + "(" + javaValue.getClass() + ")");
    }
}
 
示例12
private KuduScanner scannerForFilters(Iterable<Row> filters, KuduTable table) throws KuduException {
  List<Row> filtersList = Lists.newArrayList(filters);

  if (filtersList.size() == 0) {
    throw new RuntimeException("Kudu existing filter was not provided.");
  }
  
  if (filtersList.get(0).schema() == null) {
    throw new RuntimeException("Kudu existing filter did not contain a schema.");
  }
  
  if (hasAccumulators()) {
    accumulators.getLongAccumulators().get(ACCUMULATOR_NUMBER_OF_SCANNERS).add(1);
    accumulators.getLongAccumulators().get(ACCUMULATOR_NUMBER_OF_FILTERS_SCANNED).add(filtersList.size());
  }
  
  KuduScannerBuilder builder = getConnection().getClient().newScannerBuilder(table);

  for (String fieldName : filtersList.get(0).schema().fieldNames()) {
    ColumnSchema columnSchema = table.getSchema().getColumn(fieldName);

    List<Object> columnValues = Lists.newArrayList();
    for (Row filter : filtersList) {
      Object columnValue = filter.getAs(fieldName);
      columnValues.add(columnValue);
    }

    KuduPredicate predicate = KuduPredicate.newInListPredicate(columnSchema, columnValues);

    builder = builder.addPredicate(predicate);
  }

  KuduScanner scanner = builder.build();

  return scanner;
}
 
示例13
/** Filters the rows read from Kudu using the given predicates. */
public Read<T> withPredicates(List<KuduPredicate> predicates) {
  checkArgument(predicates != null, "predicates cannot be null");
  // reuse the kudu protobuf serialization mechanism
  List<Common.ColumnPredicatePB> serializablePredicates =
      predicates.stream().map(KuduPredicate::toPB).collect(Collectors.toList());
  return builder().setSerializablePredicates(serializablePredicates).build();
}
 
示例14
/**
 * Retrieves the tagset IDs of all tagsets which contain the specified tag.
 * The tagset IDs are returned in sorted order.
 *
 * @param key the tag key
 * @param value the tag value
 * @return the sorted tagset IDs
 */
public Deferred<IntVec> getTagsetIDsForTag(final String key, final String value) {
  AsyncKuduScanner.AsyncKuduScannerBuilder scan = client.newScannerBuilder(table);
  scan.addPredicate(KuduPredicate.newComparisonPredicate(Tables.TAGS_KEY_COLUMN,
                                                         ComparisonOp.EQUAL, key));
  scan.addPredicate(KuduPredicate.newComparisonPredicate(Tables.TAGS_VALUE_COLUMN,
                                                         ComparisonOp.EQUAL, value));
  scan.setProjectedColumnIndexes(TAGSET_ID_PROJECTION);
  final AsyncKuduScanner scanner = scan.build();

  class GetTagCB implements Callback<Deferred<IntVec>, RowResultIterator> {
    private final IntVec tagsetIDs = IntVec.create();
    @Override
    public Deferred<IntVec> call(RowResultIterator results) {
      for (RowResult result : results) {
        tagsetIDs.push(result.getInt(0));
      }
      if (scanner.hasMoreRows()) {
        return scanner.nextRows().addCallbackDeferring(this);
      }
      // The Kudu java client doesn't yet allow us to specify a sorted
      // (fault-tolerant) scan, so have to sort manually.
      tagsetIDs.sort();
      return Deferred.fromResult(tagsetIDs);
    }
    @Override
    public String toString() {
      return MoreObjects.toStringHelper(this).add("key", key).add("value", value).toString();
    }
  }

  return scanner.nextRows().addCallbackDeferring(new GetTagCB());
}
 
示例15
/**
 * Creates an {@link AsyncKuduScanner} over the tagset table beginning with
 * the specified ID.
 *
 * @param id the ID to begin scanning from
 * @return the scanner
 */
private AsyncKuduScanner tagsetScanner(int id) {
  AsyncKuduScanner.AsyncKuduScannerBuilder scanBuilder = client.newScannerBuilder(tagsetsTable);
  scanBuilder.addPredicate(KuduPredicate.newComparisonPredicate(Tables.TAGSETS_ID_COLUMN,
                                                                ComparisonOp.GREATER_EQUAL,
                                                                id));
  if (id < Integer.MAX_VALUE - TAGSETS_PER_SCAN) {
    scanBuilder.addPredicate(KuduPredicate.newComparisonPredicate(Tables.TAGSETS_ID_COLUMN,
                                                                  ComparisonOp.LESS,
                                                                  id + TAGSETS_PER_SCAN));
  }
  scanBuilder.setProjectedColumnIndexes(columnIndexes);
  AbstractionBulldozer.sortResultsByPrimaryKey(scanBuilder);
  return scanBuilder.build();
}
 
示例16
@Override
public void exitIS_NULL_FILTER_EXP(KuduSQLExpressionParser.IS_NULL_FILTER_EXPContext ctx)
{
  super.exitIS_NULL_FILTER_EXP(ctx);
  String columnName = extractColumnNameFromContext(ctx.idorcolumnname());
  if (columnSchemaLookups.containsKey(columnName)) {
    kuduPredicateList.add(KuduPredicate.newIsNullPredicate(columnSchemaLookups.get(columnName)));
  } else {
    LOG.error(columnName + " is not a valid column name for this kudu table");
    isSuccessfullyParsed = false;
  }

}
 
示例17
@Override
public void exitIS_NOT_NULL_FILTER_EXP(KuduSQLExpressionParser.IS_NOT_NULL_FILTER_EXPContext ctx)
{
  super.exitIS_NOT_NULL_FILTER_EXP(ctx);
  String columnName = extractColumnNameFromContext(ctx.idorcolumnname());
  if (columnSchemaLookups.containsKey(columnName)) {
    kuduPredicateList.add(KuduPredicate.newIsNotNullPredicate(columnSchemaLookups.get(columnName)));
  } else {
    LOG.error(columnName + " is not a valid column name for this kudu table");
    isSuccessfullyParsed = false;
  }
}
 
示例18
@Override
public Optional<Record> lookup(Map<String, Object> coordinates) {

    //Scanner
    KuduScanner.KuduScannerBuilder builder = kuduClient.newScannerBuilder(table);

    builder.setProjectedColumnNames(columnNames);
    builder.replicaSelection(replicaSelection);

    //Only expecting one match
    builder.limit(1);

    coordinates.forEach((key,value)->
            builder.addPredicate(KuduPredicate.newComparisonPredicate(tableSchema.getColumn(key), KuduPredicate.ComparisonOp.EQUAL, value))
    );

    KuduScanner kuduScanner = builder.build();

    //Run lookup
    for ( RowResult row : kuduScanner){
        final Map<String, Object> values = new HashMap<>();
        for(String columnName : columnNames){
            Object object;
            if(row.getColumnType(columnName) == Type.BINARY){
                object = Base64.getEncoder().encodeToString(row.getBinaryCopy(columnName));
            } else {
                object = row.getObject(columnName);
            }
            values.put(columnName, object);
        }
        return Optional.of(new MapRecord(resultSchema, values));
    }

    //No match
    return Optional.empty();
}
 
示例19
private KuduPredicate createInListPredicate(ColumnSchema columnSchema, DiscreteValues discreteValues)
{
    io.prestosql.spi.type.Type type = TypeHelper.fromKuduColumn(columnSchema);
    List<Object> javaValues = discreteValues.getValues().stream().map(value -> TypeHelper.getJavaValue(type, value)).collect(toImmutableList());
    return KuduPredicate.newInListPredicate(columnSchema, javaValues);
}
 
示例20
private KuduPredicate createEqualsPredicate(ColumnSchema columnSchema, Object value)
{
    return createComparisonPredicate(columnSchema, KuduPredicate.ComparisonOp.EQUAL, value);
}
 
示例21
public KuduPredicate toPredicate(Schema schema) {
    return toPredicate(schema.getColumn(this.column));
}
 
示例22
private KuduPredicate predicateComparator(ColumnSchema column) {

        KuduPredicate.ComparisonOp comparison = this.type.comparator;

        KuduPredicate predicate;

        switch (column.getType()) {
            case STRING:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (String)this.value);
                break;
            case FLOAT:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Float)this.value);
                break;
            case INT8:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Byte)this.value);
                break;
            case INT16:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Short)this.value);
                break;
            case INT32:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Integer)this.value);
                break;
            case INT64:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Long)this.value);
                break;
            case DOUBLE:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Double)this.value);
                break;
            case BOOL:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Boolean)this.value);
                break;
            case UNIXTIME_MICROS:
                Long time = (Long)this.value;
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, time*1000);
                break;
            case BINARY:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (byte[])this.value);
                break;
            default:
                throw new IllegalArgumentException("Illegal var type: " + column.getType());
        }
        return predicate;
    }
 
示例23
FilterType(KuduPredicate.ComparisonOp comparator) {
    this.comparator = comparator;
}
 
示例24
public KuduPredicate toPredicate(Schema schema) {
    return toPredicate(schema.getColumn(this.column));
}
 
示例25
private KuduPredicate predicateComparator(ColumnSchema column) {

        KuduPredicate.ComparisonOp comparison = this.type.comparator;

        KuduPredicate predicate;

        switch (column.getType()) {
            case STRING:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (String)this.value);
                break;
            case FLOAT:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Float)this.value);
                break;
            case INT8:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Byte)this.value);
                break;
            case INT16:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Short)this.value);
                break;
            case INT32:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Integer)this.value);
                break;
            case INT64:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Long)this.value);
                break;
            case DOUBLE:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Double)this.value);
                break;
            case BOOL:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (Boolean)this.value);
                break;
            case UNIXTIME_MICROS:
                Long time = (Long)this.value;
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, time*1000);
                break;
            case BINARY:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (byte[])this.value);
                break;
            default:
                throw new IllegalArgumentException("Illegal var type: " + column.getType());
        }
        return predicate;
    }
 
示例26
FilterType(KuduPredicate.ComparisonOp comparator) {
    this.comparator = comparator;
}
 
示例27
private KuduPredicate createInListPredicate(ColumnSchema columnSchema, DiscreteValues discreteValues) {
    com.facebook.presto.spi.type.Type type = TypeHelper.fromKuduColumn(columnSchema);
    List<Object> javaValues = discreteValues.getValues().stream().map(value -> TypeHelper.getJavaValue(type, value)).collect(toImmutableList());
    return KuduPredicate.newInListPredicate(columnSchema, javaValues);
}
 
示例28
private KuduPredicate createEqualsPredicate(ColumnSchema columnSchema, Object value) {
    return createComparisonPredicate(columnSchema, KuduPredicate.ComparisonOp.EQUAL, value);
}
 
示例29
public KuduPredicate toPredicate(Schema schema) {
    return toPredicate(schema.getColumn(this.column));
}
 
示例30
private KuduPredicate predicateComparator(ColumnSchema column) {

        KuduPredicate.ComparisonOp comparison = this.type.comparator;

        KuduPredicate predicate;

        switch (column.getType()) {
            case STRING:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (String) this.value);
                break;
            case FLOAT:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, this.value);
                break;
            case INT8:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, this.value);
                break;
            case INT16:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, this.value);
                break;
            case INT32:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, this.value);
                break;
            case INT64:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, this.value);
                break;
            case DOUBLE:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, this.value);
                break;
            case BOOL:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, this.value);
                break;
            case UNIXTIME_MICROS:
                Long time = (Long) this.value;
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, time * 1000);
                break;
            case BINARY:
                predicate = KuduPredicate.newComparisonPredicate(column, comparison, (byte[]) this.value);
                break;
            default:
                throw new IllegalArgumentException("Illegal var type: " + column.getType());
        }
        return predicate;
    }