Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1118#discussion_r13936033
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/hiveOperators.scala 
---
    @@ -445,7 +445,19 @@ case class NativeCommand(
         if (sideEffectResult.size == 0) {
           context.emptyResult
         } else {
    -      val rows = sideEffectResult.map(r => new GenericRow(Array[Any](r)))
    +      // TODO: Need a better way to handle the result of a native command.
    +      // We may want to consider to use JsonMetaDataFormatter in Hive.
    +      val isDescribe = sql.trim.startsWith("describe")
    +      val rows = if (isDescribe) {
    +        // TODO: If we upgrade Hive to 0.13, we need to check the results 
of
    +        // context.sessionState.isHiveServerQuery() to determine how to 
split the result.
    +        // This method is introduced by 
https://issues.apache.org/jira/browse/HIVE-4545.
    +        // Right now, we split every string by any number of consecutive 
spaces.
    +        sideEffectResult.map(
    +          r => r.split("\\s+")).map(r => new 
GenericRow(r.asInstanceOf[Array[Any]]))
    --- End diff --
    
    actually for describe can we only split up to 3 columns?
    ```scala
    scala> "a b c d e".split("\\s+", 3)
    res2: Array[String] = Array(a, b, c d e)
    ```


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to