Skip to content

CONTAINSANY/CONTAINSALL not consistent with IN when using LET variable in filtering #8961

@creisle

Description

@creisle

OrientDB Version: 3.0.22

Java Version

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

OS: centos07

Expected behavior

I expected to need to expand for all filtering comparison against subqueries or none, rather than having the behaviour depend on the operator being used

Actual behavior

I am not sure if this behaviour is intended or not, but when I use a subquery let variable in filtering the parent query, I have to use expand to make CONTAINSANY/CONTAINSALL work but not when using IN. Why are they treated differently? How do I know when I need to expand?

Steps to reproduce

initial setup

// set up the schema classes
create class Kid extends V
create property Kid.name string
create class Parent extends V
create property Parent.children LINKSET Kid
create property Parent.favorite LINK Kid

// create some records
create vertex Kid set name = 'bob'
// #13:0
create vertex Kid set name = 'alice'
// #14:0
create vertex Parent set children = [13:0, 14:0], favorite = 13:0
create vertex Parent set children = [14:0]

Then when I use a subquery to filter against the link property using IN it works without expanding

SELECT * from Parent LET $kids = (select * from Kid where name = 'bob') WHERE favorite IN $kids

But when I try something similar for the linkset property it fails silent and nothing is returned

SELECT * from Parent LET $kids = (select * from Kid where name = 'bob') WHERE children CONTAINSANY $kids

However if I add expand then the above works as expected

SELECT * from Parent LET $kids = (select * from Kid where name = 'bob') WHERE children CONTAINSANY (SELECT expand($kids))

I am finding it confusing to know when I need to use expand

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions