orientechnologies / orientdb

OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
https://orientdb.dev
Apache License 2.0
4.73k stars 869 forks source link

Unable to store result of unionall in let query variable #8955

Closed creisle closed 5 years ago

creisle commented 5 years ago

OrientDB Version: 3.0.20

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

Using the demodb I expected the following queries to both return the same result

select expand($d) 
  let $a = (select * from Countries where Name like 'A%'), 
       $b = (select * from Countries where Name like 'B%'), 
       $c = UNIONALL($a, $b), 
       $d = (select * from (select expand($c)) where Name like '%a');
select expand($d) 
  let $a = (select * from Countries where Name like 'A%'), 
       $b = (select * from Countries where Name like 'B%'), 
       $d = (select * from (select expand(UNIONALL($a, $b))) where Name like '%a');

Actual behavior

The first query returns nothing, The second query returns the expected 18 records

Steps to reproduce

Run the queries outlined above

creisle commented 5 years ago

Note that this used to work in v2

luigidellaquila commented 5 years ago

Hi @creisle

I have a fix for this, I'm pushing it to 3.0.x and develop branches now

Thanks

Luigi