Skip to content

Conversation

@chakkk309
Copy link
Contributor

@chakkk309 chakkk309 commented Sep 24, 2025

Fixes #36583.

Changes proposed in this pull request:


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.
  • I have updated the Release Notes of the current development version. For more details, see Update Release Note

: INSERT insertSpecification INTO? tableName partitionNames? insertBody onDuplicateKeyClause? returningClause?
;

insertBody : insertValuesClause | setAssignmentsClause valueReference? | insertSelectClause valueReference? ;
Copy link
Member

Choose a reason for hiding this comment

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

Please put the content after : on a new line.

result.setInsertColumns(new InsertColumnsSegment(ctx.start.getStartIndex() - 1, ctx.start.getStartIndex() - 1, Collections.emptyList()));
}
result.getValues().addAll(createInsertValuesSegments(ctx.assignmentValues()));

Copy link
Member

Choose a reason for hiding this comment

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

Please remove useless blank line.

ValueReferenceSegment valueRef = (ValueReferenceSegment) visit(ctx.valueReference());
result.setValueReference(valueRef);
}

Copy link
Member

Choose a reason for hiding this comment

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

Please remove useless blank line.


@Override
public ASTNode visitRowAlias(final RowAliasContext ctx) {
return new CommonExpressionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.getText());
Copy link
Member

Choose a reason for hiding this comment

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

Why return CommonExpressionSegment?

Copy link
Member

Choose a reason for hiding this comment

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

May use RowAliasSegment here is better.

}
return new SetAssignmentSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), assignments);
SetAssignmentSegment setAssignment = new SetAssignmentSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), assignments);
return setAssignment;
Copy link
Member

Choose a reason for hiding this comment

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

Please remove setAssignment and return new xxx directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@chakkk309
Copy link
Contributor Author

Hi @strongduanmu , this pr is ready to review~

@strongduanmu
Copy link
Member

Hi @strongduanmu , this pr is ready to review~

Ok, I will review this pr later.

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.

Optimize MySQL INSERT INTO VALUES AS row_alias parse SQLStatement

2 participants