mc2-project / mc2-project/opaque-sql

Group By does not support complex expression

Open
#262 2 comments 0 reactions 1 assignee View on GitHub

@xlxie is already working on this.

Since Oct 13, 2021.

enhancement good first issue
Dominant language
Scala
Stars
190
Forks
70
PR merge metrics
No merged PRs in 30d

Description

Summary of Bug

The group by operation does not support complex expression as the group by key. For example, group by (case when column1 is null)...

Version

Reproducible on all versions.

Steps to Reproduce

select case when column1 is null then 'null_value' else column end, max(column2) group by case when column1 is null then 'null_value' else column1 end

Reasons

I tried to find out the behind reason. An exception was thrown at Utils.scala:1464. The serializer treefold the CASE WHEN expression and tried to look for column1 in the output list of the sub-executor and it failed.

Finally, I found the root cause is at strategies.scala:177-234. When the optimizer generates the plan for encrypted SQL, it generates multiple executors for one AGG executor. And it simply passes the group by key of the original AGG executor to other nodes. As such, for some of the generated executors, the serializer failed to find the input of the executors from the sub-executor's output.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.