Hi colleagues,
Consider the following query. If the RelFieldTrimmer is applied to this,
then the expression is reduced to an empty LogicalValues:
SELECT field FROM table WHERE TRUE IS FALSE
However, the following query will not be simplified, leaving a table scan
with "always false" filter:
SELECT * FROM table WHERE TRUE IS FALSE
After some debugging I found that the problem is in the following piece of
code in the RelFieldTrimmer:
// If the input is unchanged, and we need to project all columns,
// there's nothing we can do.
if (newInput == input
&& fieldsUsed.cardinality() == fieldCount) {
return result(filter, Mappings.createIdentity(fieldCount));
}
My question - is it a known issue? Looks like this early return from the
method misses an important optimization opportunity. Can this check be
removed completely?
Regards,
Vladimir