spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maropu <>
Subject [GitHub] spark pull request #15257: [SPARK-17683][SQL] Support ArrayType in Literal.a...
Date Thu, 29 Sep 2016 08:25:03 GMT
Github user maropu commented on a diff in the pull request:
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala
    @@ -46,12 +57,17 @@ object Literal {
         case s: String => Literal(UTF8String.fromString(s), StringType)
         case b: Boolean => Literal(b, BooleanType)
         case d: BigDecimal => Literal(Decimal(d), DecimalType(Math.max(d.precision, d.scale),
    -    case d: java.math.BigDecimal =>
    +    case d: JavaBigDecimal =>
           Literal(Decimal(d), DecimalType(Math.max(d.precision, d.scale), d.scale()))
         case d: Decimal => Literal(d, DecimalType(Math.max(d.precision, d.scale), d.scale))
         case t: Timestamp => Literal(DateTimeUtils.fromJavaTimestamp(t), TimestampType)
         case d: Date => Literal(DateTimeUtils.fromJavaDate(d), DateType)
         case a: Array[Byte] => Literal(a, BinaryType)
    +    case a: Array[_] =>
    --- End diff --
    Seems your code only works at compile time.
    Actually, it did not work in runtime.
    I checked;
        case a: Array[_] =>
          val classSymbol = ru.runtimeMirror(getClass.getClassLoader).classSymbol(a.getClass)
          val tpe = classSymbol.selfType
    This threw an exception because type signatures were not available in runtime;
      java.lang.UnsupportedOperationException: Schema for type T is not supported
      at org.apache.spark.sql.catalyst.ScalaReflection$.schemaFor(ScalaReflection.scala:704)
      at org.apache.spark.sql.catalyst.ScalaReflection$.schemaFor(ScalaReflection.scala:660)
      at org.apache.spark.sql.catalyst.expressions.Literal$.apply(literals.scala:73)

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message