Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/11696#discussion_r56120740
--- Diff:
sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
@@ -229,6 +224,30 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext:
SQLContext) extends Loggi
)
}
+ private def generateToSQL(g: Generate): String = {
+ val columnAliases = g.generatorOutput.map(_.sql).mkString(",")
+
+ val childSQL = if (g.child == OneRowRelation) {
+ // This only happens when we put UDTF in project list and there is
no FROM clause. Because we
+ // always generate LATERAL VIEW for `Generate`, here we use a trick
to put a dummy sub-query
+ // after FROM clause, so that we can generate a valid LATERAL VIEW
SQL string.
+ s"(SELECT 1) ${SQLBuilder.newSubqueryName}"
+ }
+ else {
--- End diff --
else on the prev line
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]