[druid-user] Error in query

Hi, when i run this query , it shows an error
(SELECT COUNT(*) FROM “test1” i WHERE o.id >= i.id) “rowNum”
, __time
FROM “test1” o

error: SQL requires a join with ‘GREATER_THAN_OR_EQUAL’ condition that is not supported.

I noticed your question and I happened to have been reading about JOINs in Druid SQL. You may find this doc helpful https://druid.apache.org/docs/latest/querying/datasource.html#join.
I’m not sure I understand what you are trying to do with the query, but it appears that Druid sometimes treats subqueries as JOINs (in the native language query), and Druid can only perform JOINs with equality conditions.
Feel free to let us know if this helps.

I agree, there’s an implicit join in use. What is the query trying to do exactly? Seems like it’s trying to find a pseudo rowNum, but I don’t get the logic behind it.

I thought that Druid only recognizes equality join conditions … so that WHERE condition should be recognized as a regular filter condition, not a join condition.

For generating Rank/Rownum like this, you may have to do a CROSS JOIN between the two tables and then apply the inequality WHERE condition:

– John