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.