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

Add support for GROUP BY with cs_grouped_value_v1 #55

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

CDThomas
Copy link
Contributor

This change adds support for decrypting encrypted columns included in the GROUP BY clause by using a new aggregate function, cs_grouped_value_v1.

How it works:

  • An ORE term (either in an ORE or SteVec index) can be used in GROUP BY
  • cs_grouped_value_v1 can be used in the SELECT target list to return a single source ciphertext for each group
  • the ORE index is used for the equality check needed for grouping
  • cs_grouped_value_v1 allows for using the source ciphertext in the SELECT target list (since SELECTed items must either use an aggregrate function or appear in the GROUP BY)
  • note that including the source ciphertext in the GROUP BY statement wouldn't work because source ciphertexts are non-deterministic and don't support comparison operations (that's what ORE indexes are for)

This change adds support for decrypting encrypted columns included in the
`GROUP BY` clause by using a new aggregate function, `cs_grouped_value_v1`.

How it works:
- An ORE term (either in an ORE or SteVec index) can be used in `GROUP BY`
- `cs_grouped_value_v1` can be used in the `SELECT` target list to return a
    single source ciphertext for each group
- the ORE index is used for the equality check needed for grouping
- `cs_grouped_value_v1` allows for using the source ciphertext in the `SELECT`
   target list (since `SELECT`ed items must either use an aggregrate function or
   appear in the `GROUP BY`)
- note that including the source ciphertext in the `GROUP BY` statement wouldn't
  work because source ciphertexts are non-deterministic and don't support
  comparison operations (that's what ORE indexes are for)
Copy link
Contributor

@freshtonic freshtonic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice implementation. More explicit than the min / max hack we used to have.

@CDThomas CDThomas merged commit c71d9fe into main Oct 31, 2024
4 checks passed
@CDThomas CDThomas deleted the add-group-by-support branch October 31, 2024 06:35
CDThomas added a commit that referenced this pull request Nov 5, 2024
`GROUP BY` support was accidentally removed in
#59.

This change adds back EQL functions for `GROUP BY` support.

Also see:
#55
@CDThomas CDThomas mentioned this pull request Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants