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

Fix crash in map_lifting.rs #8726

Merged
merged 4 commits into from
Oct 19, 2021

Conversation

umanwizard
Copy link
Contributor

@umanwizard umanwizard commented Oct 19, 2021

Motivation

Fixes #8713

Tips for reviewer

Some true elements have already been popped from the_same (line 128), so this could panic before.

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered.
  • This PR adds a release note for any
    user-facing behavior changes.

Copy link
Contributor

@asenac asenac left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this. It seems I introduced this crash under #6520.

I'd add a unit tests for this like the following:

diff --git a/src/transform/tests/testdata/lifting b/src/transform/tests/testdata/lifting
index 6694bf3b4..a0ca96417 100644
--- a/src/transform/tests/testdata/lifting
+++ b/src/transform/tests/testdata/lifting
@@ -368,3 +368,20 @@ opt
 | Union %1 %2
 ----
 ----
+
+build format=types apply=LiteralLifting
+(constant [[1 2 3] [1 4 3]] ([int64 int64 int64] [[1 2]]))
+----
+%0 =
+| Constant (2) (4)
+| | types = (Int64?)
+| | keys = ((#0))
+| Map 1
+| | types = (Int64?, Int64)
+| | keys = ((#0))
+| Project (#1, #0)
+| | types = (Int64, Int64?)
+| | keys = ((#1))
+| Map 3
+| | types = (Int64, Int64?, Int64)
+| | keys = ((#1))

@umanwizard
Copy link
Contributor Author

OK, thanks for letting me know about those data-driven tests @asenac . I've added the one you suggested.

Copy link
Contributor

@philip-stoev philip-stoev left a comment

Choose a reason for hiding this comment

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

As discussed with @umanwizard I am going to re-test this once all the 3 PRs have collectively landed in "main". So hitting "Approve" here.

@umanwizard umanwizard merged commit f50391f into MaterializeInc:main Oct 19, 2021
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.

panic: index out of bounds: the len is 2 but the index is 2 with constant column, GROUP BY
3 participants