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

    https://github.com/apache/spark/pull/1346#discussion_r15511092
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/dataTypes.scala 
---
    @@ -201,47 +231,139 @@ object FractionalType {
       }
     }
     abstract class FractionalType extends NumericType {
    -  val fractional: Fractional[JvmType]
    +  private[sql] val fractional: Fractional[JvmType]
     }
     
     case object DecimalType extends FractionalType {
    -  type JvmType = BigDecimal
    -  @transient lazy val tag = ScalaReflectionLock.synchronized { 
typeTag[JvmType] }
    -  val numeric = implicitly[Numeric[BigDecimal]]
    -  val fractional = implicitly[Fractional[BigDecimal]]
    -  val ordering = implicitly[Ordering[JvmType]]
    +  private[sql] type JvmType = BigDecimal
    +  @transient private[sql] lazy val tag = ScalaReflectionLock.synchronized 
{ typeTag[JvmType] }
    +  private[sql] val numeric = implicitly[Numeric[BigDecimal]]
    +  private[sql] val fractional = implicitly[Fractional[BigDecimal]]
    +  private[sql] val ordering = implicitly[Ordering[JvmType]]
    +  def simpleString: String = "decimal"
     }
     
     case object DoubleType extends FractionalType {
    -  type JvmType = Double
    -  @transient lazy val tag = ScalaReflectionLock.synchronized { 
typeTag[JvmType] }
    -  val numeric = implicitly[Numeric[Double]]
    -  val fractional = implicitly[Fractional[Double]]
    -  val ordering = implicitly[Ordering[JvmType]]
    +  private[sql] type JvmType = Double
    +  @transient private[sql] lazy val tag = ScalaReflectionLock.synchronized 
{ typeTag[JvmType] }
    +  private[sql] val numeric = implicitly[Numeric[Double]]
    +  private[sql] val fractional = implicitly[Fractional[Double]]
    +  private[sql] val ordering = implicitly[Ordering[JvmType]]
    +  def simpleString: String = "double"
     }
     
     case object FloatType extends FractionalType {
    -  type JvmType = Float
    -  @transient lazy val tag = ScalaReflectionLock.synchronized { 
typeTag[JvmType] }
    -  val numeric = implicitly[Numeric[Float]]
    -  val fractional = implicitly[Fractional[Float]]
    -  val ordering = implicitly[Ordering[JvmType]]
    +  private[sql] type JvmType = Float
    +  @transient private[sql] lazy val tag = ScalaReflectionLock.synchronized 
{ typeTag[JvmType] }
    +  private[sql] val numeric = implicitly[Numeric[Float]]
    +  private[sql] val fractional = implicitly[Fractional[Float]]
    +  private[sql] val ordering = implicitly[Ordering[JvmType]]
    +  def simpleString: String = "float"
    +}
    +
    +object ArrayType {
    +  /** Construct a [[ArrayType]] object with the given element type. The 
`containsNull` is false. */
    +  def apply(elementType: DataType): ArrayType = ArrayType(elementType, 
false)
    +}
    +
    +case class ArrayType(elementType: DataType, containsNull: Boolean) extends 
DataType {
    +  private[sql] def buildFormattedString(prefix: String, builder: 
StringBuilder): Unit = {
    +    builder.append(
    +      s"${prefix}-- element: ${elementType.simpleString} (containsNull = 
${containsNull})\n")
    +    DataType.buildFormattedString(elementType, s"$prefix    |", builder)
    +  }
    +
    +  def simpleString: String = "array"
     }
     
    -case class ArrayType(elementType: DataType) extends DataType
    +case class StructField(name: String, dataType: DataType, nullable: 
Boolean) {
    --- End diff --
    
    Add scaladoc to define the semantics of nullable (nullable keys vs nullable 
values vs both)


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