presto: Unsupported RowExpression type LambdaDefinitionExpression

Reproducible query:

WITH t AS (
  SELECT * FROM (VALUES (1, 2, 'c', 'd', '2018-11-01')) AS t (a, b, c, d, ds)
)
SELECT label
FROM (
  SELECT IF (p <= q, '1', '0') AS label
  FROM (
      SELECT
        reduce(               
          array_agg(a),
          CAST(Row(0.0, 0.0) AS ROW(field0 DOUBLE, field1 DOUBLE)),
          (s, x) -> CAST(ROW(s.field0, s.field1) AS ROW(field0 DOUBLE, field1 DOUBLE)),
          s -> s.field0 + s.field1
        ) as p,
        reduce(               
          array_agg(a),             
          CAST(Row(0.0, 0.0) AS ROW(field0 DOUBLE, field1 DOUBLE)),
          (s, x) -> CAST(ROW(s.field0, s.field1) AS ROW(field0 DOUBLE, field1 DOUBLE)),
          s -> s.field0 + s.field1
        ) as q
      FROM t
      WHERE ds = '2018-11-01' AND d = 'test' GROUP BY c
   )
WHERE p >= 0.75 AND q >= 0.75)

The query above works if i remove WHERE p >= 0.75 AND q >= 0.75.

I found commit 92b8a88 by bisecting from 0.213.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Yes, i was planning to revert the commit. What do you think?

This statement was confusing. My intent was to let @sopel39 (as the author of the commit and someone who has more context about why it was needed) evaluate the impact and discuss if we should revert the commit or fix it. I should have expressed it in a better way 😃.

Specifically, we don’t yet understand what’s the issue: is that commit bad or did it uncover a latent issue somewhere else?

@martint I think it’s the latter.

The problem is with ExpressionEquivalence.RowExpressionComparator#compare which lacks support for LambdaDefinitionExpression and VariableReferenceExpression Adding support for them shouldn’t be hard though.

Specifically, we don’t yet understand what’s the issue: is that commit bad or did it uncover a latent issue somewhere else?

@ggreg, unless the commit is fundamentally broken, we should fix the underlying issue, not revert it.