Fix Windowing/scanAndSort query issues on top of Joins.#15996
Fix Windowing/scanAndSort query issues on top of Joins.#15996abhishekagarwal87 merged 9 commits intoapache:masterfrom
Conversation
* allow a hashjoin result to be converted to RowsAndColumns * fix incorrect isConcrete() return values during early phase of planning
imply-cheddar
left a comment
There was a problem hiding this comment.
This looks fine to me. Given that this code path should hopefully only run on top of the results of another query, I suspect that it will be fine. I'll admit that I find StorageAdapterRowsAndColumns to be a little gross (it's like... doing something but trying not to do anything), but it should just work for the intended purpose here.
| return new ColumnPlus( | ||
| frameCol, | ||
| ColumnCapabilitiesImpl.createSimpleNumericColumnCapabilities(frameCol.getType()) | ||
| .setHasNulls(NullHandling.sqlCompatible() && frameCol.hasNulls), |
There was a problem hiding this comment.
what is the reason for this change?
There was a problem hiding this comment.
- I think even in case we are defaulting
null-s to something somewhere; we may still have thenullvalue.
running the following query with druid-27.0.0 withdruid.generic.useDefaultValueForNull: true
select null,'',0,cast(null as integer)
null | empty | 0 | null
which suggests that the column value can be null
- in this case the incoming column also reported that it has nulls - I think it shouldn't be allowed to narrow the scope
There was a problem hiding this comment.
the cast thing returning null is probably a bug (though its been a bug for so long that imo it isn't worth fixing in a deprecated mode), the native cast expression would spit out 0 from an expression selector if it actually ran...
I think to not risk any inadvertent changes we shouldn't make this change for now if possible. Default value mode is deprecated and will be removed in a future release, so we should probably just leave things as they are whenever possible.
There was a problem hiding this comment.
I think that:
- the system do allow
null-s - via by a simple cast - sonullexists even indefaultValuemode - so I don't see it bad... - I believe this codepath is only triggered for windowoperator related stuff - but I'll check it (I'll update this comment when it finishes)
- the incoming frame declares that it has
nullvalues (which is being covered) - we also have the ClusteredGroupPartitionerTest#testDefaultClusteredGroupPartitionerWithNulls which essentially inputs
null-s as inputs...should I disable that testcase fordefaultValues? it will most likely just hide the issue I was facing - but I can live with that...should I just do that?
I believe the original logic incorrectly narrows to doesn't have nulls (NullHandling.sqlCompatible() && frameCol.hasNulls) - which could be false irrsepectively that the backing one does have (frameCol.hasNulls) ...if that's not allowed an exception should be thrown right away and not take further risks...
I see the following options:
- allow nulls - as the incoming frame already contained them
- raise an exception and mark the testcase
ClusteredGroupPartitionerTest#testDefaultClusteredGroupPartitionerWithNullsnot apply whenuseDefaultValueis enabled
There was a problem hiding this comment.
I've taken the second approach:
- restored these classes to the previous state
- added an
assumeTrue(sqlCompatible)to the testcase
I still think that it might not be a good idea to retain/make tweaks like this...null does exists in the system even when defaultValue is enabled...so it may naturally happen as a value in a column as well.
RowsAndColumnsStorageAdapterRowsAndColumnsisConcrete()return values during early phase of planningFixes #XXXX.
Description
Fixed the bug ...
Renamed the class ...
Added a forbidden-apis entry ...
Release note
Key changed/added classes in this PR
MyFooOurBarTheirBazThis PR has: