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

Include expression parsers for HashAggregate and ObjectHashAggregate #1432

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class GenericExecParser(
}

protected def getExprString: String = {
node.desc.replaceFirst(s"${node.name} ", "")
node.desc.replaceFirst(s"${node.name}\\s*", "")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I remember seeing HashAggregate( in the description
QQ: Is it possible that the node.name may not come at the beginning of the node description?
In that case we better use a regex ^(node_name)\\s* to guarantee that we replace node_name when it is at the beginning of the description.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @amahussein ! Updated it. Adding of expression parsers was missed during refactoring. Since we are getting the expressions in #1431, we should be able to update some of the tests to capture these kinds of bugs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks @nartal1 !

}

protected def getNotSupportedExprs(expressions: Array[String]): Seq[UnsupportedExpr] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ case class HashAggregateExecParser(
override val node: SparkPlanGraphNode,
override val checker: PluginTypeChecker,
override val sqlID: Long,
override val expressionFunction: Option[String => Array[String]],
appBase: AppBase) extends
GenericExecParser(node, checker, sqlID, app = Some(appBase)) with Logging {
GenericExecParser(node, checker, sqlID,
expressionFunction = expressionFunction, app = Some(appBase)) with Logging {

override def getDurationMetricIds: Seq[Long] = {
node.metrics.find(_.name == "time in aggregation build").map(_.accumulatorId).toSeq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ case class ObjectHashAggregateExecParser(
override val node: SparkPlanGraphNode,
override val checker: PluginTypeChecker,
override val sqlID: Long,
override val expressionFunction: Option[String => Array[String]],
appBase: AppBase) extends
GenericExecParser(node, checker, sqlID, app = Some(appBase)) with Logging {
GenericExecParser(node, checker, sqlID,
expressionFunction = expressionFunction, app = Some(appBase)) with Logging {

override def getDurationMetricIds: Seq[Long] = {
node.metrics.find(_.name == "time in aggregation build").map(_.accumulatorId).toSeq
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,13 @@ object SQLPlanParser extends Logging {
GenericExecParser(
node, checker, sqlID, expressionFunction = Some(parseGenerateExpressions)).parse
case "HashAggregate" =>
HashAggregateExecParser(node, checker, sqlID, app).parse
HashAggregateExecParser(
node, checker, sqlID, Some(parseAggregateExpressions), app).parse
case i if DataWritingCommandExecParser.isWritingCmdExec(i) =>
DataWritingCommandExecParser.parseNode(node, checker, sqlID)
case "ObjectHashAggregate" =>
ObjectHashAggregateExecParser(node, checker, sqlID, app).parse
ObjectHashAggregateExecParser(
node, checker, sqlID, Some(parseAggregateExpressions), app).parse
case "Project" =>
GenericExecParser(
node, checker, sqlID, expressionFunction = Some(parseProjectExpressions)).parse
Expand Down