paul-rogers commented on code in PR #13404: URL: https://github.com/apache/druid/pull/13404#discussion_r1089506370
########## docs/querying/datasource.md: ########## @@ -302,12 +302,15 @@ use join datasources. SQL joins take the form: ``` -<o1> [ INNER | LEFT [OUTER] ] JOIN <o2> ON <condition> +<o1> [ INNER | LEFT [OUTER] | CROSS ] JOIN <o2> ON <condition> ``` -The condition must involve only equalities, but functions are okay, and there can be multiple equalities ANDed together. -Conditions like `t1.x = t2.x`, or `LOWER(t1.x) = t2.x`, or `t1.x = t2.x AND t1.y = t2.y` can all be handled. Conditions -like `t1.x <> t2.x` cannot currently be handled. +JOIN conditions have the following requirements: +- You can only use equality statements in JOIN conditions. For example: `t1.x = t2.x` Review Comment: "You can only use" --> "Druid supports only" To make it clear that, although you might have used other conditions in other SQL tools, Druid supports only equality. Also "equality statements" -> "the equality operator" In SQL, a "statement" is the entire SELECT or INSERT construct. Here we're talking about an "operator", specifically a boolean binary operator. ########## docs/querying/datasource.md: ########## @@ -302,12 +302,15 @@ use join datasources. SQL joins take the form: ``` -<o1> [ INNER | LEFT [OUTER] ] JOIN <o2> ON <condition> +<o1> [ INNER | LEFT [OUTER] | CROSS ] JOIN <o2> ON <condition> ``` -The condition must involve only equalities, but functions are okay, and there can be multiple equalities ANDed together. -Conditions like `t1.x = t2.x`, or `LOWER(t1.x) = t2.x`, or `t1.x = t2.x AND t1.y = t2.y` can all be handled. Conditions -like `t1.x <> t2.x` cannot currently be handled. +JOIN conditions have the following requirements: +- You can only use equality statements in JOIN conditions. For example: `t1.x = t2.x` +- You can use functions on the operands in JOIN conditions. For example: `LOWER(t1.x) = t2.x` +- You can apply multiple equality conditions using the AND operator. For example: `t1.x = t2.x AND t1.y = t2.y` +- Inequality conditions are unsupported. For example: `t1.x <> t2.x` +- Conditions are optional for CROSS JOIN. Review Comment: From a comment in `Parser.jj`: > We allow CROSS JOIN to have a join condition, even though that is not valid SQL; the validator will catch it. This seems to say that the Calcite parser allows join conditions, but the Calcite validator fails if a condition is provided. To avoid confusing users with this implementation detail, perhaps say: > [ [ INNER | LEFT [OUTER] JOIN <o2> ON <condition> ] | CROSS JOIN <o2> Or, just address it in text: > CROSS JOIN does not accept an `ON` condition. ########## docs/querying/datasource.md: ########## @@ -302,12 +302,15 @@ use join datasources. SQL joins take the form: ``` -<o1> [ INNER | LEFT [OUTER] ] JOIN <o2> ON <condition> +<o1> [ INNER | LEFT [OUTER] | CROSS ] JOIN <o2> ON <condition> ``` -The condition must involve only equalities, but functions are okay, and there can be multiple equalities ANDed together. -Conditions like `t1.x = t2.x`, or `LOWER(t1.x) = t2.x`, or `t1.x = t2.x AND t1.y = t2.y` can all be handled. Conditions -like `t1.x <> t2.x` cannot currently be handled. +JOIN conditions have the following requirements: +- You can only use equality statements in JOIN conditions. For example: `t1.x = t2.x` +- You can use functions on the operands in JOIN conditions. For example: `LOWER(t1.x) = t2.x` +- You can apply multiple equality conditions using the AND operator. For example: `t1.x = t2.x AND t1.y = t2.y` +- Inequality conditions are unsupported. For example: `t1.x <> t2.x` Review Comment: This is redundant with the "you can only use equality". -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
