From 42099133efd5b08fe9c64f45b793cf641f315835 Mon Sep 17 00:00:00 2001 From: Ralph Gasser Date: Sat, 13 Jul 2024 14:28:07 +0200 Subject: [PATCH] Fixes an issue with mismatch between physical and fetched fields. --- .../execution/operators/sources/IndexScanOperator.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/execution/operators/sources/IndexScanOperator.kt b/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/execution/operators/sources/IndexScanOperator.kt index 8d1ff7a4f..ce8ec816e 100644 --- a/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/execution/operators/sources/IndexScanOperator.kt +++ b/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/execution/operators/sources/IndexScanOperator.kt @@ -48,7 +48,8 @@ class IndexScanOperator( */ override fun toFlow(): Flow = 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 { @@ -56,9 +57,9 @@ class IndexScanOperator( 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)