@Test
    public void tensor_fields_can_be_presence_checked_with_null() throws ParseException {
        var documents = createDocs();
        // Document 1 has `dense_tensor` field set, the others do not
        assertEquals(Result.TRUE, evaluate("test.dense_tensor != null", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.dense_tensor", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("null != test.dense_tensor", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("test.dense_tensor == null", documents.get(1)));
        assertEquals(Result.FALSE, evaluate("null == test.dense_tensor", documents.get(1)));
        assertEquals(Result.TRUE, evaluate("test.dense_tensor == null", documents.get(0)));
        assertEquals(Result.TRUE, evaluate("not test.dense_tensor", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.dense_tensor != null", documents.get(0)));
        // Tensors are not defined for any other operations than presence checks
        assertEquals(Result.INVALID, evaluate("test.dense_tensor == 1234", documents.get(1)));
        assertEquals(Result.INVALID, evaluate("test.dense_tensor < 1234", documents.get(1)));
        // ... not even identity checks
        assertEquals(Result.INVALID, evaluate("test.dense_tensor == test.dense_tensor", documents.get(1)));
        assertEquals(Result.INVALID, evaluate("test.dense_tensor != test.dense_tensor", documents.get(1)));
        // ... unless the fields are not set, in which case identity checks will succeed since the
        // expression degenerates to comparing null values.
        assertEquals(Result.TRUE, evaluate("test.dense_tensor == test.dense_tensor", documents.get(0)));
        assertEquals(Result.FALSE, evaluate("test.dense_tensor != test.dense_tensor", documents.get(0)));
    }
@author Simon Thoresen Hult
@author bratseth
document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java