-
Notifications
You must be signed in to change notification settings - Fork 439
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
[GLUTEN-8010][CORE] Don't generate native metrics if transformer don't generate relNode #8011
Conversation
Run Gluten Clickhouse CI on x86 |
1 similar comment
Run Gluten Clickhouse CI on x86 |
Run Gluten Clickhouse CI on x86 |
Thanks! Though it feels like a workaround since there is no real filter node in Velox query plan? Do we have other better options? |
Sounds fair. Let's see if it works. BTW I think one of the promising ways is to exclude the filter node from Spark query plan as well. Though I remember there were some issues with an relevant attempt. |
We can't exclude the filter node, because it's output may differ from child's output. |
Run Gluten Clickhouse CI on x86 |
Run Gluten Clickhouse CI on x86 |
@@ -54,9 +54,6 @@ object MetricsUtil extends Logging { | |||
MetricsUpdaterTree( | |||
smj.metricsUpdater(), | |||
Seq(treeifyMetricsUpdaters(smj.bufferedPlan), treeifyMetricsUpdaters(smj.streamedPlan))) | |||
case t: TransformSupport if t.metricsUpdater() == MetricsUpdater.None => | |||
assert(t.children.size == 1, "MetricsUpdater.None can only be used on unary operator") | |||
treeifyMetricsUpdaters(t.children.head) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will cause operatorId inconsistencies. It should be handled in updateTransformerMetricsInternal
. cc @zhztheplayer
@zhztheplayer Can you help take a look again? Thanks. |
@@ -219,6 +216,7 @@ object MetricsUtil extends Logging { | |||
}) | |||
|
|||
mutNode.updater match { | |||
case MetricsUpdater.None => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure about this?
The code is likely something done by MetricsUpdater.Todo
. I remember MetricsUpdater.Todo
and MetricsUpdater.None
don't share the same semantic.
Did you check the UI? Are all the metrics still normal with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MetricsUpdater.Todo
means that native metrics exist, but does not update them. MetricsUpdater.None
means that native metrics do not exist, and updateNativeMetrics is not supported, so this is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. My impressions about this part of code is:
- When
registerEmptyRelToOperator
is called, a fake operator creation is actually emulated soMetricsUpdator.Todo
should be considered - When
child.asInstanceOf[TransformSupport].transform(context)
is used,MetricsUpdator.None
should be considered
Would you like to check whether the two rule apply?
And if we no longer need MetricsUpdater.None
, we can just remove this type of metrics updater.
Run Gluten Clickhouse CI on x86 |
@@ -112,13 +115,12 @@ case class ExpandExecTransformer( | |||
|
|||
override protected def doTransform(context: SubstraitContext): TransformContext = { | |||
val childCtx = child.asInstanceOf[TransformSupport].transform(context) | |||
val operatorId = context.nextOperatorId(this.nodeName) | |||
if (projections == null || projections.isEmpty) { | |||
if (metricsUpdater == MetricsUpdater.None) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zml1206
Can we create a new utility method, e.g, isNoop
that can be called both by doTransform
and metricUpdater
in each operator? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other code looks good to me.
Run Gluten Clickhouse CI on x86 |
Run Gluten Clickhouse CI on x86 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit. Thanks!
@@ -61,7 +61,9 @@ abstract class FilterExecTransformerBase(val cond: Expression, val input: SparkP | |||
case _ => false | |||
} | |||
|
|||
override def metricsUpdater(): MetricsUpdater = if (getRemainingCondition == null) { | |||
override def isLoop: Boolean = getRemainingCondition == null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/isLoop/isNoop/
@@ -48,7 +48,9 @@ case class ExpandExecTransformer( | |||
AttributeSet.fromAttributeSets(projections.flatten.map(_.references)) | |||
} | |||
|
|||
override def metricsUpdater(): MetricsUpdater = if (projections == null || projections.isEmpty) { | |||
override def isLoop: Boolean = projections == null || projections.isEmpty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/isLoop/isNoop/
@@ -44,7 +44,9 @@ case class SortExecTransformer( | |||
@transient override lazy val metrics = | |||
BackendsApiManager.getMetricsApiInstance.genSortTransformerMetrics(sparkContext) | |||
|
|||
override def metricsUpdater(): MetricsUpdater = if (sortOrder == null || sortOrder.isEmpty) { | |||
override def isLoop: Boolean = sortOrder == null || sortOrder.isEmpty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/isLoop/isNoop/
override def metricsUpdater(): MetricsUpdater = if ( | ||
windowExpression == null || windowExpression.isEmpty | ||
) { | ||
override def isLoop: Boolean = windowExpression == null || windowExpression.isEmpty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/isLoop/isNoop/
What changes were proposed in this pull request?
(Fixes: #8010)
How was this patch tested?
Local test.
Before PR:
After PR: