Open ryanhamilton opened 1 year ago
Workaround: Use Union Join Annoying as:
select * from (
(select ts,bid,ask,
cast(NULL as double) as trade_SD_TRIANGLE,
cast(NULL as double) as trade_SD_SIZE
from order
WHERE ts > timestamp_floor('m', now() - 10*60000000L)
UNION
(select ts, NULL as bid, NULL as ask,
price AS trade_SD_TRIANGLE,
10+10*log(1+amount) AS trade_SD_SIZE
from trade WHERE ts > timestamp_floor('m', now() - (10*60000000L))))) order by ts;
Future Options:
user-vol On some databases combining time-series is very difficult.
e.g. I have: queryA - returns (ts timestamp, price, ..........) queryB - returns (ts timestamp, size, ...........) I want a combined result (ts, price, size, ........) Where ts is matching join, where ts only occurs in queryB append as a new row.
Proposal: Allow the user to specify multiple queries Combine the result by taking the first timestamp column in each as the join. Do NOT support more than just joining on the 1 timestamp column. Some databases support this but given how we display data I don't think it makes sense for us.
AlternativesA: Extend SQL to have MERGE(query1, query2) that we then separate in backend. Don't like it as it means in the SQL editor, we would have non-SQL.
AlternativesB: Don't support. Difficult to say now as in some databases this join just wouldn't be possible.