目标表kudu
很大。我有以下内容,scala
我想检查该行是否存在于kudu
. 这四列是表中的主键,kudu
但是当我定义一个上限时,我似乎得到了所有的行。
如何在 中选择特定行kudu
?在这里,我希望只返回一行。
val table2 : KuduTable = kuduClient.openTable("event-sets")
val eventColumns: util.List[String] = List(
OccurrenceSchema.SetId.name,
OccurrenceSchema.Period.name,
OccurrenceSchema.Event.name,
OccurrenceSchema.Date.name).asJava
val end:PartialRow = table2.getSchema.newPartialRow()
end.addInt(OccurrenceSchema.Period.name,1476)
end.addInt(OccurrenceSchema.SetId.name,82)
end.addInt(OccurrenceSchema.Event.name,3195167)
end.addLong(OccurrenceSchema.Date.name,1367922840000L)
val kuduScanner: KuduScanner = kuduClient.newScannerBuilder(table2)
.setProjectedColumnNames(eventColumns)
.lowerBound(end)
.exclusiveUpperBound((end))
.build()
assert(kuduScanner.hasMoreRows)
while (kuduScanner.hasMoreRows) {
val resultIterator: RowResultIterator = kuduScanner.nextRows()
while (resultIterator.hasNext) {
val result: RowResult = resultIterator.next()
assert(result != null)
logger.info(" : SetId Value -- " + result.getInt(OccurrenceSchema.SetId.name))
logger.info(" : Period Value -- " + result.getInt(OccurrenceSchema.Period.name))
logger.info(" : Event Value -- " + result.getInt(OccurrenceSchema.Event.name))
logger.info(" : Date Value -- " + result.getLong(OccurrenceSchema.Date.name))
}
}