Skip to content

Commit

Permalink
check that distance func is func
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxxen committed Apr 12, 2024
1 parent 692913f commit a85e973
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/hnsw/hnsw_plan_index_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ class HNSWIndexScanOptimizer : public OptimizerExtension {
auto &projection = immediate_child->Cast<LogicalProjection>();
auto projection_index = bound_column_ref.binding.column_index;

if(projection.expressions[projection_index]->type != ExpressionType::BOUND_FUNCTION) {
// The expression has to be a function
return;
}
auto &bound_function = projection.expressions[projection_index]->Cast<BoundFunctionExpression>();
if (!HNSWIndex::IsDistanceFunction(bound_function.function.name)) {
// We can only optimize if the order by expression is a distance function
Expand Down

0 comments on commit a85e973

Please sign in to comment.