HyukjinKwon commented on a change in pull request #24051: [SPARK-26879][SQL] 
Standardize one-based column indexing for stack and json_tuple function
URL: https://github.com/apache/spark/pull/24051#discussion_r293313934
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/jsonExpressions.scala
 ##########
 @@ -372,7 +372,7 @@ case class JsonTuple(children: Seq[Expression])
   @transient private lazy val constantFields: Int = foldableFieldNames.count(_ 
!= null)
 
   override def elementSchema: StructType = 
StructType(fieldExpressions.zipWithIndex.map {
-    case (_, idx) => StructField(s"c$idx", StringType, nullable = true)
+    case (_, idx) => StructField(s"col${idx + 1}", StringType, nullable = true)
 
 Review comment:
   last question, @chakravarthiT. What does Hive's `json_tuple` returns for the 
column names? I think we matched the column names with Hive when we added this 
long time ago.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to