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

sql field comment semicolon with escape #4967

Merged
merged 3 commits into from
Dec 11, 2023
Merged

sql field comment semicolon with escape #4967

merged 3 commits into from
Dec 11, 2023

Conversation

sjgllgh
Copy link
Contributor

@sjgllgh sjgllgh commented Nov 15, 2023

Related issues/PRs

Related issues: #4966

Brief change log

  • Define regular syntax, match sql statement field comments, and escape;

Checklist

  • I have read the Contributing Guidelines on pull requests.
  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the Linkis mailing list first)
  • If this is a code change: I have written unit tests to fully verify the new behavior.

private val logger: Logger = LoggerFactory.getLogger(getClass)

def replaceComment(code: String): String = {
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

better to add junit test case for this new function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok,I do

while (matcher.find()) {
val commentKeyword = matcher.group(1)
val comment = matcher.group(2)
val escapedComment = comment.replaceAll(";", "\\\\\\\\;")
Copy link
Contributor

Choose a reason for hiding this comment

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

batter to add some comments to explain for using "\\\\" (eight )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please review again.Thanks!

@casionone
Copy link
Contributor

run mvn spoltess:apply to fix the failed action
image

 2.add code comment
Copy link
Contributor

@peacewong peacewong left a comment

Choose a reason for hiding this comment

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

LGTM.

@peacewong peacewong merged commit 87c40ec into apache:master Dec 11, 2023
12 checks passed
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.

3 participants