We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 63377a6 commit a489938Copy full SHA for a489938
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeFormatter.scala
@@ -89,6 +89,14 @@ object CodeFormatter {
89
}
90
new CodeAndComment(code.result().trim(), map)
91
92
+
93
+ def stripExtraNewLinesAndComments(input: String): String = {
94
+ val commentReg =
95
+ ("""([ |\t]*?\/\*[\s|\S]*?\*\/[ |\t]*?)|""" + // strip /*comment*/
96
+ """([ |\t]*?\/\/[\s\S]*?\n)""").r // strip //comment
97
+ val codeWithoutComment = commentReg.replaceAllIn(input, "")
98
+ codeWithoutComment.replaceAll("""\n\s*\n""", "\n") // strip ExtraNewLines
99
+ }
100
101
102
private class CodeFormatter {
0 commit comments