posthog icon indicating copy to clipboard operation
posthog copied to clipboard

feat(hogql): add support for using join contraint

Open thmsobrmlr opened this issue 2 years ago • 0 comments

Problem

We need support for JOIN USING ... in HogQL.

Changes

This PR adds support for it.

  • This is a CH example for a join that is only possible with USING, but not with ON: https://clickhouse.com/docs/en/sql-reference/statements/select/join#:~:text=The%20USING%20clause%20specifies%20one,join%20conditions%20are%20not%20supported.
  • This is a good spec for JOIN USING: https://docs.oracle.com/javadb/10.10.1.2/ref/rrefsqljusing.html

Todos

  • [ ] Make it work (Current issue is "posthog.hogql.errors.ResolverException: Ambiguous query. Found multiple sources for field: distinct_id")
  • [ ] Make the cpp parser work

How did you test this code?

  • [ ] test_using -> test_query
  • [ ] test_printer
  • [ ] test_parser

thmsobrmlr avatar Feb 12 '24 14:02 thmsobrmlr