Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-2669

Hyracks exception from OBJECT_REMOVE_FIELDS subquery

    XMLWordPrintableJSON

    Details

      Description

      This query does not work:
      SELECT VALUE t FROM (SELECT VALUE OBJECT_REMOVE_FIELDS(t, ["message"]) FROM GleambookMessages t) t WHERE t.messageId >= 3;

      It gives a semi-nasty-looking error message:
      org.apache.hyracks.algebricks.core.algebra.expressions.ScalarFunctionCallExpression cannot be cast to org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression [ClassCastException]

      This variant of the query (with type-casting before the comparison) works:
      SELECT VALUE t FROM (SELECT VALUE OBJECT_REMOVE_FIELDS(t, ["message"]) FROM GleambookMessages t) t WHERE int(t.messageId) >= 3;

      Seems like this is a bug related to the compiler not knowing what to expect following the application of OBJECT_REMOVE_FIELDS - but it seems like it should indeed work as long as the data is okay (all numbers) at runtime. In the event of "bad" data for the comparison at runtime, it seems like it should still work without an error, but should yield a bad comparison warning.

        Attachments

          Activity

            People

            • Assignee:
              dlychagin-cb Dmitry Lychagin
              Reporter:
              dtabass Michael J. Carey
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: