diff --git a/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/queries/operators/physical/sources/IndexScanPhysicalOperatorNode.kt b/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/queries/operators/physical/sources/IndexScanPhysicalOperatorNode.kt index 1a3876a0b..72eb4c0ed 100644 --- a/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/queries/operators/physical/sources/IndexScanPhysicalOperatorNode.kt +++ b/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/queries/operators/physical/sources/IndexScanPhysicalOperatorNode.kt @@ -111,7 +111,7 @@ class IndexScanPhysicalOperatorNode(override val groupId: Int, /* Populate statistics. */ if (!this.statistics.containsKey(binding.physical) && entityProduces.contains(binding.physical)) { - this.statistics[binding.column] = entityTx.columnForName(binding.physical!!.name).newTx(this.index.context).statistics() as ValueStatistics + this.statistics[binding.physical] = entityTx.columnForName(binding.physical!!.name).newTx(this.index.context).statistics() as ValueStatistics } } else { require(indexProduces.contains(binding.column)) { diff --git a/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/statistics/selectivity/NaiveSelectivityCalculator.kt b/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/statistics/selectivity/NaiveSelectivityCalculator.kt index e58bb0281..ceaa5f8c6 100644 --- a/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/statistics/selectivity/NaiveSelectivityCalculator.kt +++ b/cottontaildb-dbms/src/main/kotlin/org/vitrivr/cottontail/dbms/statistics/selectivity/NaiveSelectivityCalculator.kt @@ -73,9 +73,8 @@ object NaiveSelectivityCalculator { val right = predicate.operator.right return when { left is Binding.Literal && right is Binding.Literal -> if (left.getValue() == right.getValue()) Selectivity.ALL else Selectivity.NOTHING - left is Binding.Literal && right is Binding.Column -> statistics[right.physical]?.estimateSelectivity(predicate) ?: Selectivity.DEFAULT - left is Binding.Column && right is Binding.Literal -> statistics[left.physical]?.estimateSelectivity(predicate) ?: Selectivity.DEFAULT - left is Binding.Column && right is Binding.LiteralList -> statistics[left.physical]?.estimateSelectivity(predicate) ?: Selectivity.DEFAULT + left !is Binding.Column && right is Binding.Column -> statistics[right.physical]?.estimateSelectivity(predicate) ?: Selectivity.DEFAULT + left is Binding.Column && right !is Binding.Column -> statistics[left.physical]?.estimateSelectivity(predicate) ?: Selectivity.DEFAULT else -> Selectivity.DEFAULT } }