Skip to content

Commit

Permalink
Fixes an issue with mismatch between physical and fetched fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
ppanopticon committed Jul 13, 2024
1 parent bd9485d commit 4209913
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,18 @@ class IndexScanOperator(
*/
override fun toFlow(): Flow<Tuple> = flow {
val columns = this@IndexScanOperator.fetch.map { it.column }.toTypedArray()
var read = 0
val physical = this@IndexScanOperator.fetch.mapNotNull { it.physical }.toTypedArray()
var read = 0L
if (this@IndexScanOperator.partitions == 1) {
this@IndexScanOperator.index.filter(this@IndexScanOperator.predicate)
} else {
val entityTx = this@IndexScanOperator.index.dbo.parent.newTx(this@IndexScanOperator.context)
this@IndexScanOperator.index.filter(this@IndexScanOperator.predicate, entityTx.partitionFor(this@IndexScanOperator.partitionIndex, this@IndexScanOperator.partitions))
}.use { cursor ->
while (cursor.moveNext()) {
val record = cursor.value() as StandaloneTuple
emit(StandaloneTuple(record.tupleId, columns, record.values))
read += 1
val record = cursor.value()
emit(StandaloneTuple(record.tupleId, columns, physical.map { record[it] }.toTypedArray()))
read += 1L
}
}
LOGGER.debug("Read {} entries from {}.", read, this@IndexScanOperator.index.dbo.name)
Expand Down

0 comments on commit 4209913

Please sign in to comment.