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

Added Unit test for ExpressionSegmentBinder #28883

Conversation

Gowrishankar04
Copy link

@Gowrishankar04 Gowrishankar04 commented Oct 27, 2023

Fixes #28538.

Changes proposed in this pull request:

Added Unit test for ExpressionSegmentBinder

Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.

@Gowrishankar04
Copy link
Author

@strongduanmu - Kindly review and merge this PR.

@Gowrishankar04
Copy link
Author

@strongduanmu - Kindly re-review and merge it. Thanks

@Gowrishankar04
Copy link
Author

@strongduanmu - Is there any review pending?

SQLStatementBinderContext statementBinderContext = new SQLStatementBinderContext(new ShardingSphereMetaData(), "db", new MockedDatabaseType(), Collections.emptyList());
ExpressionSegment actual = ExpressionSegmentBinder.bind(binaryOperationExpression, SegmentType.INSERT_COLUMNS, statementBinderContext, Collections.emptyMap(), Collections.emptyMap());
assertTrue(actual instanceof BinaryOperationExpression);
assertThat(binaryOperationExpression.getLeft(), is(((BinaryOperationExpression) actual).getLeft()));
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this logic is wrong, and the segment that passes through bind will be regenerated. Whether you can assert the actual type and instance, the type should be same, and instance is different.

Copy link
Member

Choose a reason for hiding this comment

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

Hi @Gowrishankar04, can you take a look at this recommend?

@strongduanmu
Copy link
Member

Since this pr has long time no reponse, I will close it. You are welcome to submit another PR based on comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more unit tests for ExpressionSegmentBinder
2 participants