drill icon indicating copy to clipboard operation
drill copied to clipboard

DRILL-8512: ReduceAndSimplifyFilterRule fails with NullPointerException

Open rymarm opened this issue 1 year ago • 3 comments

DRILL-8512: ReduceAndSimplifyFilterRule fails with NullPointerException

Description

I'm not sure why the following issue wasn't before, but it's clear, why the issue appears at all - because we provide neither inputs RelNodes(we calling DrillOptiq.toDrill with null for the input, see code change) or RexBuilder along with RelDataType.

Testing

Tested with the query the issue was reproduced:

SELECT *
FROM
(
SELECT
(CASE WHEN (true) THEN 'qwe' ELSE null END) res1
FROM (VALUES(1)) test_tbl
) test
where res1 IN ('ab','dab','qw','qwe') 

rymarm avatar Sep 24 '24 19:09 rymarm

@jnturton I'm unsure whether the fix is correct because calcite is a black box to me, but I think I found the correct place where the change should be made.

I'll be glad if you advise me on how to cover the case with unit tests.

rymarm avatar Sep 24 '24 19:09 rymarm

@jnturton I'm unsure whether the fix is correct because calcite is a black box to me, but I think I found the correct place where the change should be made.

I'll be glad if you advise me on how to cover the case with unit tests.

You're not the only one to whom Calcite is a black box... :-)

cgivre avatar Sep 25 '24 20:09 cgivre

I saw the failing tests. I need to find another solution to solve the issue...

rymarm avatar Sep 26 '24 07:09 rymarm