Hello community, I was playing with set / array operators and I found something a bit surprising. Let us say I have a table "MyTable" that contains one of such fields, with potentially null values for certain rows. Executing the following query will run just fine: SELECT * FROM MyTable t WHERE CARDINALITY(t.field) = 0
However, a "similar" query with IS EMPTY operator, will result in a NPE in the Calcite generated code: SELECT * FROM MyTable t WHERE t.field IS EMPTY The reason for that seems to be that CARDINALITY defines NullPolicy.STRICT, whereas IS EMPTY defines NullPolicy.NONE, see RexImpTable [1]. Looking a bit more in detail, it seems there is a mix of null policies in these operators. For instance CARDINALITY was added a long time ago (as STRICT); then a bunch of operators were added via [2], all of them as NONE; and a few others were added recently in [3] as STRICT. Is this intended? Is there a rule in place to explain this apparent inconsistency regarding null policies in these operators? Best, Ruben [1] https://github.com/apache/calcite/blob/7e0057e8de93930f1b2952a1cbcee8ad7a6bfb4b/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java#L513 [2] https://github.com/apache/calcite/commit/d35c11c73cc78cf379d7e886cbbfb62b91d75fad [3] https://github.com/apache/calcite/commit/f61541d633cfde53a4b0de0c23a010250c93274e
