dtenedor commented on code in PR #42420:
URL: https://github.com/apache/spark/pull/42420#discussion_r1297823052
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -2118,11 +2121,32 @@ class Analyzer(override val catalogManager:
CatalogManager) extends RuleExecutor
tableArgs.size)
}
val alias =
SubqueryAlias.generateSubqueryName(s"_${tableArgs.size}")
+ // Propagate the column indexes for TABLE arguments to the
PythonUDTF instance.
+ val tvfWithTableColumnIndexes: LogicalPlan = tvf match {
+ case g @ Generate(p: PythonUDTF, _, _, _, _, _) =>
+ functionTableSubqueryArgs.headOption.map { tableArg =>
+ val indexes = PythonUDTFPartitionColumnIndexes(
+ tableArg.partitioningExpressionIndexes)
+ g.copy(generator = p.copy(pythonUDTFPartitionColumnIndexes
= Some(indexes)))
+ }.getOrElse {
+ g
+ }
+ case g @ Generate(p: UnresolvedPolymorphicPythonUDTF, _, _, _,
_, _) =>
+ functionTableSubqueryArgs.headOption.map { tableArg =>
+ val indexes = PythonUDTFPartitionColumnIndexes(
+ tableArg.partitioningExpressionIndexes)
+ g.copy(generator = p.copy(pythonUDTFPartitionColumnIndexes
= Some(indexes)))
+ }.getOrElse {
+ g
Review Comment:
I tried this and it turns out it doesn't compile because the type of the
object that `p` refers to is not determinable :| I was able to deduplicate this
logic into a helper function though to avoid repeating it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]