Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hogql): better handling of known types for function calls #24237

Closed
wants to merge 40 commits into from

Conversation

thmsobrmlr
Copy link
Contributor

@thmsobrmlr thmsobrmlr commented Aug 7, 2024

Problem

HogQL doesn't know about the return types of functions, preventing us from having a fully-typed experience.

This can be seen in the generated ClickHouse SQL e.g. 2 = 1 + 1 currently becomes:

SELECT ifNull(equals(2, plus(1, 1)), 0)

After this PR it becomes the expected:

SELECT equals(2, plus(1, 1))

Further down the line we can add better auto-complete etc.

Todos

  • Investigate errors
  • would be great to have signatures for comparision functions e.g. greaterOrEquals, as they are used much
  • would be great to have signatures for transform
  • there seems to be some kind of issue with the timezone param - see error message

Changes

This PR adds signatures for most supported HogQL functions, as well as handling for the return types in HogQL.

How did you test this code?

CI run

select 2 = 1 + 1
select (1,2) = (1,2)
select [1,2] = [1,2]
select now() = now()

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the waiting label.

@posthog-bot
Copy link
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the waiting label.

@thmsobrmlr thmsobrmlr added waiting Prevents stale-bot from marking the PR as stale. and removed stale labels Sep 2, 2024
@thmsobrmlr thmsobrmlr closed this Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Prevents stale-bot from marking the PR as stale.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants