Wei Zheng
Wei Zheng
You're right. It looks like Trino is more strict on this: it requires the type to be present even for a NULL column in the view. Do you think if...
@sopel39 Thanks for taking a look! I just realized there can be other failing cases, e.g., ``` select max(CAST(case when c1 = 1 then c2 end AS INT)) as m1,...
I think regardless the type, the problem is due to the over-generous qualification for CAST in expression like this: ``` max(CAST(case when c1 = 1 then c2 end AS INT))...
Yes, VARCHAR 'd' cannot be converted to INT, but the conversion shouldn't have been attempted in the first place: it is conditional based on the context provided by the specific...
@sopel39 The wrapping approach sounds good. I've identified two scenarios that are subject to this treatment: 1. agg(CAST(case when c1 = 1 then c2 end AS INT)) 2. agg(case when...
The conditional expressions that could potentially fail (incl. division by zero) are covered by `#2` above. You're right the two use cases produce the same plan. I just wanted to...
@sopel39 Do you have any other concerns regarding the fix?
Can we have this merged? @sopel39
@sopel39 In my latest revision, there is still one failing case - the CAST-wrapped CASE: https://github.com/trinodb/trino/pull/20652#issuecomment-1945592190 In my previous approach, this case was covered, because of the "early wrapping" in...
@martint I understand that #15680 will fix the issue from the perspective of not producing problematic symbol mappings. But I think the fix of this PR is still needed, as...