Thanks for your rely. 

`SELECT * FROM tb WHERE id = 1`
can be converted into `UNION ALL`, but i am worried how to handle some 
aggregation SQLs, e.g `SELECT AVG(NUM) FROM tb`.


 Juan Pan


panj...@apache.org
Juan Pan(Trista), Apache ShardingSphere


On 10/22/2019 11:04,Julian Hyde<jh...@apache.org> wrote:
Not currently, but it wouldn’t be too much work.

Consider a similar query:

SELECT * FROM mysqlTable
UNION ALL
SELECT * FROM cassandraTable

This would convert into an EnumerableUnion which would send sub-queries to the 
two back ends and combine the results.

You’d need a new relational operator which, I assume, would go with whichever 
result arrives first. A new sub-class of RelNode, perhaps similar to 
EnumerableUnion, or perhaps you could use a table-valued function.

Julian


On Oct 21, 2019, at 7:27 PM, Juan Pan <panj...@apache.org> wrote:

Hi everyone,


Thanks for your attention. I can not get a clear result after read most of 
Calcite document. So i send this email for your suggestion.


Suppose there are two data storages, e.g, MySQL and Cassandra behind Calcite, 
and data is separately stored in two of them, can i execute a query, e.g 
`SELECT * FROM tb WHERE id = 1` simultaneously on two of data storages through 
Calcite? In other words, i want to get the final combined result from MySQL and 
Cassandra, which store part of data in different forms separately through 
Calcite.


Looking forward to your suggestions and thoughts.


Best wishes,
Trista


Juan Pan


panj...@apache.org
Juan Pan(Trista), Apache ShardingSphere

Reply via email to