这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@anthonyx24
Copy link

Hello, I implement a fix here for issue #4235 . The details of the issue can be found in that description, but to summarize briefly, the unit tests in SpannerSchemaUtilsTests that verify SQL statements may fail occasionally since the generated SQL strings may have different column orderings on different runs due to how they are obtained. Though the tests may be stable now, it's not guaranteed to remain this way if the underlying environment changes for whatever reason, so it might be beneficial to address this.

Fix:

The fix I implemented is the one I propose in the issue as well, which sorts the columns in the addColumnDdlStrings() method of SpannerSchemaUtils. I created a new method collectColumnDdlStrings() as a helper that preserves the original recursive column collection logic. Lastly, I changed the column ordering of the expected SQL strings in the 2 unit tests that are affected by this to alphabetical order.

I ran all tests using ./mvnw clean test and observed a passing result. I'm assuming that column name ordering in the SQL statements is not important; apologies if I've misunderstood or missed something. If it is necessary to preserve a certain order (ie the ones present currently in expected strings of the unit tests), or if there is a better way to address this issue, please let me know. Thank you!

…stic by implementing SQL column sorting in SpannerSchemaUtils
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.

1 participant