You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Liang-Chi Hsieh (JIRA)" <ji...@apache.org> on 2015/05/14 12:25:00 UTC

[jira] [Comment Edited] (SPARK-7626) Actions on DataFrame created from HIVE table with newly added column throw NPE

    [ https://issues.apache.org/jira/browse/SPARK-7626?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14543464#comment-14543464 ] 

Liang-Chi Hsieh edited comment on SPARK-7626 at 5/14/15 10:24 AM:
------------------------------------------------------------------

I created a PR for this ticket because the code looks problematic. However, I can't reproduce this error when writing test for it.

I simply create a table.
{code}CREATE TABLE table_with_partition(key int, value string) PARTITIONED by (ds string) {code}

Then, insert some test data into a partition.
{code}INSERT OVERWRITE TABLE table_with_partition partition (ds='1') SELECT key, value FROM testData{code}

Add new column to the table:
{code}ALTER TABLE table_with_partition ADD COLUMNS (value2 string){code}

Finally, query the partition:
{code}SELECT * FROM table_with_partition WHERE ds = '1'{code}

Looks like the partition has recognize the newly added column values.

Do you have any idea about it or can you provide more information?


was (Author: viirya):
I created a PR for this ticket because the codes looks problematic. However, I can't reproduce this error when writing test for it.

I simply create a table.
{code}CREATE TABLE table_with_partition(key int, value string) PARTITIONED by (ds string) {code}

Then, insert some test data into a partition.
{code}INSERT OVERWRITE TABLE table_with_partition partition (ds='1') SELECT key, value FROM testData{code}

Add new column to the table:
{code}ALTER TABLE table_with_partition ADD COLUMNS (value2 string){code}

Finally, query the partition:
{code}SELECT * FROM table_with_partition WHERE ds = '1'{code}

Looks like the partition has recognize the newly added column values.

Do you have any idea about it or can you provide more information?

> Actions on DataFrame created from HIVE table with newly added column throw NPE 
> -------------------------------------------------------------------------------
>
>                 Key: SPARK-7626
>                 URL: https://issues.apache.org/jira/browse/SPARK-7626
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 1.3.1
>            Reporter: Zhiyang Guo
>
> We recently added a new column page_context to a hive table named "clicks", partitioned by data_date.  This leads to NPE being thrown on DataFrame created on older partitions without this column populated. For example:
> val hc = new HiveContext(sc)
> val clk = hc.sql("select * from clicks where data_date=20150302")
> clk.show()
> throws the following error msg:
> java.lang.RuntimeException: cannot find field page_context from [0:log_format_number, .....]
>         at org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils.getStandardStructFieldRef(ObjectInspectorUtils.java:415)
>         at org.apache.hadoop.hive.serde2.lazy.objectinspector.LazySimpleStructObjectInspector.getStructFieldRef(LazySimpleStructObjectInspector.java:173)
>         at org.apache.spark.sql.hive.HadoopTableReader$$anonfun$12.apply(TableReader.scala:278)
>         at org.apache.spark.sql.hive.HadoopTableReader$$anonfun$12.apply(TableReader.scala:277)
>         at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
>         at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
>         at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
>         at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
>         at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
>         at scala.collection.AbstractTraversable.map(Traversable.scala:105)
>         at org.apache.spark.sql.hive.HadoopTableReader$.fillObject(TableReader.scala:277)
>         at org.apache.spark.sql.hive.HadoopTableReader$$anonfun$4$$anonfun$9.apply(TableReader.scala:194)
>         at org.apache.spark.sql.hive.HadoopTableReader$$anonfun$4$$anonfun$9.apply(TableReader.scala:188)
>         at org.apache.spark.rdd.RDD$$anonfun$14.apply(RDD.scala:634)
>         at org.apache.spark.rdd.RDD$$anonfun$14.apply(RDD.scala:634)
>         at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:35)
>         at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:277)
>         at org.apache.spark.rdd.RDD.iterator(RDD.scala:244)
>         at org.apache.spark.rdd.UnionRDD.compute(UnionRDD.scala:87)
>         at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:277)
>         at org.apache.spark.rdd.RDD.iterator(RDD.scala:244)
>         at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:35)
>         at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:277)
>         at org.apache.spark.rdd.RDD.iterator(RDD.scala:244)
>         at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:61)
>         at org.apache.spark.scheduler.Task.run(Task.scala:64)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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