Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/11301#discussion_r54685922
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala
---
@@ -72,22 +72,41 @@ object ParseDriver extends Logging {
// Find the non null token tree in the result.
def nonNullToken(tree: CommonTree): CommonTree = {
- if (tree.token != null || tree.getChildCount == 0) tree
- else nonNullToken(tree.getChild(0).asInstanceOf[CommonTree])
+ if (tree.token != null || tree.getChildCount == 0) {
+ if (tree.token.getInputStream != null &&
+ tree.token.getInputStream.isInstanceOf[ANTLRStringStream]) {
+ val input =
tree.token.getInputStream.asInstanceOf[ANTLRStringStream]
+ if (input.name == null) {
+ val callSite = org.apache.spark.util.Utils.getCallSite()
+ input.name = callSite.shortForm
+ }
+ } else {
+ val input = new ANTLRStringStream(command)
+ val callSite = org.apache.spark.util.Utils.getCallSite()
+ input.name = callSite.shortForm
+ tree.token.setInputStream(input)
+ }
+ tree
+ } else nonNullToken(tree.getChild(0).asInstanceOf[CommonTree])
--- End diff --
I agree. I will call Utils.getCallSite() in a constructor of ASTNode and
revert changes in ParseDriver.scala.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]