You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Derived TPC-DS Query 66 fails on Sail, when it previously did not.
Exception: Error executing query q66 with error: Internal error:
Physical input schema should be the same as the one converted from logical input schema.
Differences:
- field nullability at index 7 [#98]: (physical) false vs (logical) true.
2. Another regression is that implementing the is_nullable function in the ScalarUDFImpl trait no longer works. For example:
Digging into the code, I see that it's deprecated (it should still work even though it's deprecated). What's strange, however, is that the deprecation warning is not propagating to me as a downstream user. I only found this out due to a failed test.
1. Derived TPC-DS Query 66 still failing, with same error.
2. Same issue still. I ended up removing is_nullable and implementing return_type_from_args. This seems to be a breaking change rather than is_nullable simply being deprecated.
I think this should be allowed, especially since we run further optimizations on the physical plans.
For example a query
SELECT nullable_value FROM ...
UNOIN ALL
SELECT non_null_value FROM ...
may have it's first union branch eventually eliminated at some point, and this may happen on the physical stage. As a result, nullable field becomes non-null.
@alamb This doesn't surprise me considering that Sail doesn't use SQLToRel. My concern isn't necessarily with TPC-DS 66, but rather the implications of this error. There is either some bug or break that has been surfaced by this test and we don't know the impact that this has. IMO it would be risky to do this release without further debugging this. I am available this evening to debug though.
Not sure if this is the right file to be looking at, but it's where the error comes from (Physical input schema should be the same as the one converted from logical input schema).
There are only a handful of PRs that have touched /datafusion/core/src/physical_planner.rs since 44:
Not sure if this is the right file to be looking at, but it's where the error comes from (Physical input schema should be the same as the one converted from logical input schema). There are only a handful of PRs that have touched /datafusion/core/src/physical_planner.rs since 44:
It seems like the issue may be from 5 -- which now adds additional checks to catch errors earlier rather than later (for example now the error will happen during planning rather than when RecordBatchs are created during execution)
So the question then in my mind is if the error is due to:
Some code in Sail (and we just happen now to catch the error earlier)
Some code in DataFusion
I think this should be allowed, especially since we run further optimizations on the physical plans.
@findepi do you mean we should relax the check to ignore nullable / non nullable annotations? -- I think that would probably be ok too.
I think in general the split between what a Phyiscal optimizer is allowed to do / not (the "invariants" are not very clear). #13986 took a first step at formalizing them but maybe we have found other corner cases where it is not reasonable
From my perspective it seems like all the tests in DataFusion are passing, so clearly we have some sort of test coverage / gap
@shehabgamin I wonder if this would be a good time to add more tests that cover your usecase in Sail (or perhaps that would be part of adding Spark functions as discussed in #5600) 🤔
@findepi@alamb I Just confirmed that this fixes TPC-DS 66 on Sail! Unfortunately this fix didn't make it into the 45 release.
From my perspective it seems like all the tests in DataFusion are passing, so clearly we have some sort of test coverage / gap
@shehabgamin I wonder if this would be a good time to add more tests that cover your usecase in Sail (or perhaps that would be part of adding Spark functions as discussed in #5600) 🤔
@alamb I agree this would add value. While Spark function test coverage is a starting point, I believe what we're looking for here is broader. I'm not entirely sure about the best approach yet, but I suspect Sail's pattern of catching these bugs/breaks stems from not using DataFusion out-of-the-box.
For example, in the TPC-DS 66 case, adding a DataFusion test wouldn't have helped since there was already a test in place. Maybe one approach could be exporting Logical Plans from Sail's tests and using their evaluation as DataFusion test cases? In the case of TPC-DS 66, we would take the Logical Plan that Sail produced and make the evaluation of that plan a DataFusion test case.
P.S. I'm recovering from a harsh cold so sorry if I'm not making much sense lol
@findepi@alamb I Just confirmed that this fixes TPC-DS 66 on Sail! Unfortunately this fix didn't make it into the 45 release.
From my perspective it seems like all the tests in DataFusion are passing, so clearly we have some sort of test coverage / gap @shehabgamin I wonder if this would be a good time to add more tests that cover your usecase in Sail (or perhaps that would be part of adding Spark functions as discussed in #5600) 🤔
@alamb I agree this would add value. While Spark function test coverage is a starting point, I believe what we're looking for here is broader. I'm not entirely sure about the best approach yet, but I suspect Sail's pattern of catching these bugs/breaks stems from not using DataFusion out-of-the-box.
Yes, we have a similar issue downstream in InfluxDB IOx as well (we make extensive use of the DataFusion APIs and so often find bugs that are not covered by existing tests in DataFusion)
What we have tried to do is to add the appropriate test coverage for such issues when we find them, though what "appropriate" means varies case by case
For example, in the TPC-DS 66 case, adding a DataFusion test wouldn't have helped since there was already a test in place. Maybe one approach could be exporting Logical Plans from Sail's tests and using their evaluation as DataFusion test cases? In the case of TPC-DS 66, we would take the Logical Plan that Sail produced and make the evaluation of that plan a DataFusion test case.
That is one approach for sure.
If there is a broader pattern of how Sail is creating / using Logical Plans too that we could get tested that would also help a lot.
P.S. I'm recovering from a harsh cold so sorry if I'm not making much sense lol
Activity
shehabgamin commentedon Feb 2, 2025
take
Omega359 commentedon Feb 2, 2025
I'd be curious if this could be narrowed down via git bisect. Probably would need a small script to do it and a quick test case
findepi commentedon Feb 2, 2025
I think this should be allowed, especially since we run further optimizations on the physical plans.
For example a query
may have it's first union branch eventually eliminated at some point, and this may happen on the physical stage. As a result, nullable field becomes non-null.
alamb commentedon Feb 3, 2025
In terms of TPC-DS errors, I think we have tests for those queries as part of the regression tests
https://github.com/apache/datafusion/blob/main/datafusion/core/tests/tpc-ds/66.sql
Seems to pass on main
Maybe we can look into what is different in sail 🤔
shehabgamin commentedon Feb 3, 2025
@alamb This doesn't surprise me considering that Sail doesn't use SQLToRel. My concern isn't necessarily with TPC-DS 66, but rather the implications of this error. There is either some bug or break that has been surfaced by this test and we don't know the impact that this has. IMO it would be risky to do this release without further debugging this. I am available this evening to debug though.
shehabgamin commentedon Feb 4, 2025
Not sure if this is the right file to be looking at, but it's where the error comes from (
Physical input schema should be the same as the one converted from logical input schema).There are only a handful of PRs that have touched
/datafusion/core/src/physical_planner.rssince44:ValuesExecin favour ofMemoryExec#14032SchemaRefinJoinFilter#14182alamb commentedon Feb 6, 2025
It seems like the issue may be from 5 -- which now adds additional checks to catch errors earlier rather than later (for example now the error will happen during planning rather than when RecordBatchs are created during execution)
So the question then in my mind is if the error is due to:
@findepi do you mean we should relax the check to ignore nullable / non nullable annotations? -- I think that would probably be ok too.
@wiedld perhaps you have some comments here
I think in general the split between what a Phyiscal optimizer is allowed to do / not (the "invariants" are not very clear). #13986 took a first step at formalizing them but maybe we have found other corner cases where it is not reasonable
findepi commentedon Feb 6, 2025
yes, i think so -- #14519
alamb commentedon Feb 7, 2025
From my perspective it seems like all the tests in DataFusion are passing, so clearly we have some sort of test coverage / gap
@shehabgamin I wonder if this would be a good time to add more tests that cover your usecase in Sail (or perhaps that would be part of adding Spark functions as discussed in #5600) 🤔
shehabgamin commentedon Feb 8, 2025
@findepi @alamb I Just confirmed that this fixes TPC-DS
66on Sail! Unfortunately this fix didn't make it into the45release.@alamb I agree this would add value. While Spark function test coverage is a starting point, I believe what we're looking for here is broader. I'm not entirely sure about the best approach yet, but I suspect Sail's pattern of catching these bugs/breaks stems from not using DataFusion out-of-the-box.
For example, in the TPC-DS
66case, adding a DataFusion test wouldn't have helped since there was already a test in place. Maybe one approach could be exporting Logical Plans from Sail's tests and using their evaluation as DataFusion test cases? In the case of TPC-DS66, we would take the Logical Plan that Sail produced and make the evaluation of that plan a DataFusion test case.P.S. I'm recovering from a harsh cold so sorry if I'm not making much sense lol
alamb commentedon Feb 10, 2025
Yes, we have a similar issue downstream in InfluxDB IOx as well (we make extensive use of the DataFusion APIs and so often find bugs that are not covered by existing tests in DataFusion)
What we have tried to do is to add the appropriate test coverage for such issues when we find them, though what "appropriate" means varies case by case
That is one approach for sure.
If there is a broader pattern of how Sail is creating / using Logical Plans too that we could get tested that would also help a lot.
alamb commentedon Feb 13, 2025
Since we have released DF 45 I think we can claim the testing is complete