You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean Owen (JIRA)" <ji...@apache.org> on 2017/06/07 08:22:18 UTC

[jira] [Resolved] (SPARK-20515) Issue with reading Hive ORC tables having char/varchar columns in Spark SQL

     [ https://issues.apache.org/jira/browse/SPARK-20515?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Owen resolved SPARK-20515.
-------------------------------
    Resolution: Duplicate

> Issue with reading Hive ORC tables having char/varchar columns in Spark SQL
> ---------------------------------------------------------------------------
>
>                 Key: SPARK-20515
>                 URL: https://issues.apache.org/jira/browse/SPARK-20515
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.0.2
>         Environment: AWS EMR Cluster
>            Reporter: Udit Mehrotra
>
> Reading from a Hive ORC table containing char/varchar columns fails in Spark SQL. This is caused by the fact that Spark SQL internally replaces the char/varchar columns with String data type. So, while reading from the table created in Hive which has varchar/char columns, it ends up using the wrong reader and causes a ClassCastException.
>  
> Here is the exception:
>  
> java.lang.ClassCastException: org.apache.hadoop.hive.serde2.io.HiveVarcharWritable cannot be cast to org.apache.hadoop.io.Text
>                 at org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableStringObjectInspector.getPrimitiveWritableObject(WritableStringObjectInspector.java:41)
>                 at org.apache.spark.sql.hive.HiveInspectors$class.unwrap(HiveInspectors.scala:324)
>                 at org.apache.spark.sql.hive.HadoopTableReader$.unwrap(TableReader.scala:333)
>                 at org.apache.spark.sql.hive.HadoopTableReader$$anonfun$14$$anonfun$apply$15.apply(TableReader.scala:419)
>                 at org.apache.spark.sql.hive.HadoopTableReader$$anonfun$14$$anonfun$apply$15.apply(TableReader.scala:419)
>                 at org.apache.spark.sql.hive.HadoopTableReader$$anonfun$fillObject$2.apply(TableReader.scala:435)
>                 at org.apache.spark.sql.hive.HadoopTableReader$$anonfun$fillObject$2.apply(TableReader.scala:426)
>                 at scala.collection.Iterator$$anon$11.next(Iterator.scala:409)
>                 at scala.collection.Iterator$$anon$11.next(Iterator.scala:409)
>                 at org.apache.spark.sql.execution.SparkPlan$$anonfun$4.apply(SparkPlan.scala:247)
>                 at org.apache.spark.sql.execution.SparkPlan$$anonfun$4.apply(SparkPlan.scala:240)
>                 at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$24.apply(RDD.scala:803)
>                 at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$24.apply(RDD.scala:803)
>                 at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38)
>                 at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:319)
>                 at org.apache.spark.rdd.RDD.iterator(RDD.scala:283)
>                 at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:70)
>                 at org.apache.spark.scheduler.Task.run(Task.scala:86)
>                 at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:274)
>                 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>                 at java.lang.Thread.run(Thread.java:745)
>  
> While the issue has been fixed in Spark 2.1.1 and 2.2.0 with SPARK-19459, it still needs to be fixed Spark 2.0.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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