Skip to content

Commit

Permalink
avoid converting table filter type OPTIONAL_FILTER to substrait
Browse files Browse the repository at this point in the history
Also, make sure filter type constant comparison always returns a boolean
  • Loading branch information
srikrishnak committed Jan 7, 2025
1 parent cbffcb0 commit 95f42b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/to_substrait.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ substrait::Expression *DuckDBToSubstrait::TransformConstantComparisonFilter(uint
auto s_expr = new substrait::Expression();
auto s_scalar = s_expr->mutable_scalar_function();
auto &constant_filter = dfilter.Cast<ConstantFilter>();
*s_scalar->mutable_output_type() = DuckToSubstraitType(return_type);
*s_scalar->mutable_output_type() = DuckToSubstraitType(LogicalTypeId::BOOLEAN);
auto s_arg = s_scalar->add_arguments();
CreateFieldRef(s_arg->mutable_value(), col_idx);
s_arg = s_scalar->add_arguments();
Expand Down Expand Up @@ -740,6 +740,8 @@ substrait::Expression *DuckDBToSubstrait::TransformFilter(uint64_t col_idx, Logi
return TransformConjuctionAndFilter(col_idx, column_type, dfilter, return_type);
case TableFilterType::CONSTANT_COMPARISON:
return TransformConstantComparisonFilter(col_idx, column_type, dfilter, return_type);
case TableFilterType::OPTIONAL_FILTER:
return nullptr;
default:
throw InternalException("Unsupported table filter type");
}
Expand Down

0 comments on commit 95f42b3

Please sign in to comment.