MaxGekk commented on code in PR #37209:
URL: https://github.com/apache/spark/pull/37209#discussion_r927546514
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/trees/TreeNode.scala:
##########
@@ -147,6 +166,16 @@ case class Origin(
builder.result()
}
}
+
+ /** Gets the textual fragment of a SQL query. */
+ def getFragment: String = {
+ if (sqlText.isEmpty || startIndex.isEmpty || stopIndex.isEmpty ||
+ startIndex.get < 0 || stopIndex.get >= sqlText.get.length ||
startIndex.get > stopIndex.get) {
+ ""
+ } else {
+ sqlText.get.substring(startIndex.get, stopIndex.get)
Review Comment:
Not sure about this. We have truncated the output in the **summary** already
when show it to users. But the method returns the SQL fragment as part of
machine readable form. And we can confuse peers if we returns a fragment of a
fragment. And there are no benefits of memory usage - `sqlText` has been
allocated already.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]