use of org.apache.gora.kudu.query.KuduResult in project gora by apache.
the class KuduStore method execute.
@Override
public Result<K, T> execute(Query<K, T> query) throws GoraException {
String[] avFields = getFieldsToQuery(query.getFields());
List<String> dbFields = new ArrayList<>();
for (String af : avFields) {
dbFields.add(kuduMapping.getFields().get(af).getName());
}
try {
ColumnSchema column = table.getSchema().getColumn(kuduMapping.getPrimaryKey().get(0).getName());
dbFields.add(kuduMapping.getPrimaryKey().get(0).getName());
List<KuduPredicate> rangePredicates = KuduClientUtils.createRangePredicate(column, query.getStartKey(), query.getEndKey());
rangePredicates.add(KuduPredicate.newIsNotNullPredicate(column));
KuduScanner build = createScanner(rangePredicates, dbFields, query.getLimit());
return new KuduResult<>(this, query, build);
} catch (Exception e) {
throw new GoraException(e);
}
}
Aggregations