You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spark.apache.org by EarthsonLu <Ea...@gmail.com> on 2014/11/25 03:08:11 UTC
[SparkSQL] Why this AttributeReference.exprId is not setted?
https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/Aggregate.scala#L85
I can't understand this code, it seems to be a "bug", but group by of
SparkSQL just works fine.
with code below, some expressions are mapping to AttributeReferences, then
"bindReference" method will find there references. But resultAttribute's
exprId is new, I don't think it can find the true reference(But it does,
Why? How?)
private[this] val resultExpressions = aggregateExpressions.map { agg =>
agg.transform {
case e: Expression if resultMap.contains(e) => resultMap(e)
}
}
I'm trying to write a DSL with Catalyst
--
View this message in context: http://apache-spark-developers-list.1001551.n3.nabble.com/SparkSQL-Why-this-AttributeReference-exprId-is-not-setted-tp9521.html
Sent from the Apache Spark Developers List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
For additional commands, e-mail: dev-help@spark.apache.org
Re: [SparkSQL][Solved] Why this AttributeReference.exprId is not
setted?
Posted by EarthsonLu <Ea...@gmail.com>.
Got it.
Only NamedExpression have exprId, we have to make new Attribute here.
private[this] val computedSchema = computedAggregates.map(_.resultAttribute)
--
View this message in context: http://apache-spark-developers-list.1001551.n3.nabble.com/SparkSQL-Why-this-AttributeReference-exprId-is-not-setted-tp9521p9522.html
Sent from the Apache Spark Developers List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org
For additional commands, e-mail: dev-help@spark.apache.org