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

    https://github.com/apache/spark/pull/1041#discussion_r13664158
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala ---
    @@ -296,16 +296,25 @@ class SQLContext(@transient val sparkContext: 
SparkContext)
        * TODO: We only support primitive types, add support for nested types.
        */
       private[sql] def inferSchema(rdd: RDD[Map[String, _]]): SchemaRDD = {
    +    import scala.collection.JavaConversions._
    +    def typeFor(obj: Any): DataType = obj match {
    +      case c: java.lang.String => StringType
    +      case c: java.lang.Integer => IntegerType
    +      case c: java.lang.Long => LongType
    +      case c: java.lang.Double => DoubleType
    +      case c: java.lang.Boolean => BooleanType
    +      case c: java.util.List[_] => ArrayType(typeFor(c.toList.head))
    +      case c: java.util.Set[_] => ArrayType(typeFor(c.toList.head))
    +      case c: java.util.Map[_, _] =>
    --- End diff --
    
    So I think a key question here is if nested dictionaries are Maps or 
Structs.  Right now the outermost dict is treated like a struct with named 
attributes, so I'm kind of inclined to continue that trend.  Although, I think 
then we would want some way to create a map.  What do you think?


---
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.
---

Reply via email to