You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by cloud-fan <gi...@git.apache.org> on 2016/09/16 03:46:50 UTC

[GitHub] spark pull request #15064: [SPARK-17509][SQL]When wrapping catalyst datatype...

Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15064#discussion_r79102781
  
    --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala ---
    @@ -240,74 +240,173 @@ private[hive] trait HiveInspectors {
     
       /**
        * Wraps with Hive types based on object inspector.
    -   * TODO: Consolidate all hive OI/data interface code.
        */
       protected def wrapperFor(oi: ObjectInspector, dataType: DataType): Any => Any = oi match {
    -    case _: JavaHiveVarcharObjectInspector =>
    +    case x: ConstantObjectInspector =>
           (o: Any) =>
    -        if (o != null) {
    -          val s = o.asInstanceOf[UTF8String].toString
    -          new HiveVarchar(s, s.length)
    -        } else {
    -          null
    +        x.getWritableConstantValue
    +    case x: PrimitiveObjectInspector => x match {
    +      // TODO we don't support the HiveVarcharObjectInspector yet.
    +      case _: StringObjectInspector if x.preferWritable() =>
    +        (o: Any) => getStringWritable(o)
    --- End diff --
    
    in `wrap` we will only hit this branch if the input is not null, is it safe to skip this null checking here?


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org