You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by ajbozarth <gi...@git.apache.org> on 2017/01/18 21:45:49 UTC
[GitHub] spark pull request #14158: [SPARK-13547] [SQL] [WEBUI] Add SQL query in web ...
Github user ajbozarth commented on a diff in the pull request:
https://github.com/apache/spark/pull/14158#discussion_r96740460
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/ParseDriver.scala ---
@@ -50,13 +50,29 @@ abstract class AbstractSqlParser extends ParserInterface with Logging {
}
/** Creates LogicalPlan for a given SQL string. */
- override def parsePlan(sqlText: String): LogicalPlan = parse(sqlText) { parser =>
- astBuilder.visitSingleStatement(parser.singleStatement()) match {
- case plan: LogicalPlan => plan
- case _ =>
- val position = Origin(None, None)
- throw new ParseException(Option(sqlText), "Unsupported SQL statement", position, position)
+ override def parsePlan(sqlText: String): LogicalPlan = {
+ val logicalPlan = parse(sqlText) { parser =>
+ astBuilder.visitSingleStatement(parser.singleStatement()) match {
+ case plan: LogicalPlan => plan
+ case _ =>
+ val position = Origin(None, None)
+ throw new ParseException(Option(sqlText), "Unsupported SQL statement", position, position)
+ }
+ }
+ // Record the original sql text in the top logical plan for checking in the web UI.
+ // Truncate the text to avoid downing browsers or web UI servers by running out of memory.
+ val maxLength = 1000
+ val suffix = " ... (truncated)"
+ val truncateLength = maxLength - suffix.length
--- End diff --
Is this really necessary? Given the reasoning behind the max length I don't see a reason to include extra lines of code to include the suffix as part of the max length.
---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org