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(spanner/spansql): fix unstable SelectFromTable SQL #4473

Merged
merged 1 commit into from Jul 21, 2021

Conversation

nktks
Copy link
Contributor

@nktks nktks commented Jul 21, 2021

#4457 made unstable SQL string, and fail test sometimes like this.

--- FAIL: TestSQL (0.00s)
    sql_test.go:410: {{false [A] [{Table  map[FORCE_INDEX:Idx GROUPBY_SCAN_OPTIMIZATION:TRUE]}] {4 B b <nil>} [] [] []} [] <nil> <nil>}.SQL() wrong.
         got SELECT A FROM Table@{GROUPBY_SCAN_OPTIMIZATION=TRUE,FORCE_INDEX=Idx} WHERE B = @b
        want SELECT A FROM Table@{FORCE_INDEX=Idx,GROUPBY_SCAN_OPTIMIZATION=TRUE} WHERE B = @b

Because map range result is unstable.
This PR makes the SQL output stable by sorting the Hints keys.

googleapis#4457 made unstable SQL string, and fail test sometimes like this.
```
--- FAIL: TestSQL (0.00s)
    sql_test.go:410: {{false [A] [{Table  map[FORCE_INDEX:Idx GROUPBY_SCAN_OPTIMIZATION:TRUE]}] {4 B b <nil>} [] [] []} [] <nil> <nil>}.SQL() wrong.
         got SELECT A FROM Table@{GROUPBY_SCAN_OPTIMIZATION=TRUE,FORCE_INDEX=Idx} WHERE B = @b
        want SELECT A FROM Table@{FORCE_INDEX=Idx,GROUPBY_SCAN_OPTIMIZATION=TRUE} WHERE B = @b
```
Because map range result is unstable.
This PR makes the SQL output stable by sorting the Hints keys.
@nktks nktks requested review from hengfengli, skuruppu and a team as code owners Jul 21, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 21, 2021
@product-auto-label product-auto-label bot added the api: spanner Issues related to the Cloud Spanner API. label Jul 21, 2021
@olavloite olavloite added the kokoro:run Add this label to force Kokoro to re-run the tests. label Jul 21, 2021
@kokoro-team kokoro-team removed the kokoro:run Add this label to force Kokoro to re-run the tests. label Jul 21, 2021
@hengfengli hengfengli changed the title feat(spanner/spansql): fix unstable SelectFromTable SQL fix(spanner/spansql): fix unstable SelectFromTable SQL Jul 21, 2021
@hengfengli hengfengli added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 21, 2021
@hengfengli hengfengli merged commit 39bc4ec into googleapis:master Jul 21, 2021
4 checks passed
@nktks nktks deleted the fix/spansql-failed-test branch Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Cloud Spanner API. cla: yes This human has signed the Contributor License Agreement. kokoro:force-run Add this label to force Kokoro to re-run the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants