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

Steve Drew commented on SPARK-17557:
------------------------------------

Hi,

This issue is still happening (spark 2.1.1).  Hopefully this provides better 
repro-steps.

We create a folder daily in an S3 bucket under meta-data/ec where we store 
event counts at a grain level, to be aggregated up as needed.   Somewhere over 
the past 6 months, the dev made a code change that changed the data type of one 
of the columns stored there.  However, when I try to read one day using a where 
clause, the error referenced above occurs.
spark.read.parquet("s3://my-bucket/meta-data/ec/").*where("td='07-31-2017'")*.groupBy("dataClass","dt","event_type","clientVersion").agg(sum("crow").as("crow")).coalesce(1).write.option("header","true").csv("s3://mya-disco-out/csv/PRR731/")

There are two work-arounds that seem to work.
#1 - filter by the specific folder if you only need one within your path:
spark.read.parquet("s3://my-bucket/meta-data/ec*/td=07-31-2017/*").groupBy("dataClass","dt","event_type","clientVersion").agg(sum("crow").as("crow")).coalesce(1).write.option("header","true").csv("s3://mya-disco-out/csv/PRR731/")

#2 - apply a schema manually:
     val schema =  StructType(scala.Array(
        StructField("folder",StringType,false),
        StructField("dataClass",StringType,false),
        StructField("dt",StringType,false),
        StructField("parentEvent",StringType,false),
        StructField("eventSuperClass",StringType,false),
        StructField("event_type",StringType,false),
        StructField("piifield0", StringType, false),
        StructField("piifield1",StringType,false),
        StructField("piifield2",StringType,false),
        StructField("piifield3",StringType,false),
        StructField("piifield4",StringType,false),
        StructField("crow",LongType,false)
      ))
(where crow WAS an "int" for some days and became a "long" "a long" the way.)
spark.read*.schema(schema)*.parquet("s3://my-bucket/meta-data/ec/").where("td='07-31-2017'").groupBy("dataClass","dt","event_type","clientVersion").agg(sum("crow").as("crow")).coalesce(1).write.option("header","true").csv("s3://output-path/")

Steve

> SQL query on parquet table java.lang.UnsupportedOperationException: 
> org.apache.parquet.column.values.dictionary.PlainValuesDictionary
> -------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-17557
>                 URL: https://issues.apache.org/jira/browse/SPARK-17557
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.0.0
>            Reporter: Egor Pahomov
>
> Working on 1.6.2, broken on 2.0
> {code}
> select * from logs.a where year=2016 and month=9 and day=14 limit 100
> {code}
> {code}
> java.lang.UnsupportedOperationException: 
> org.apache.parquet.column.values.dictionary.PlainValuesDictionary$PlainBinaryDictionary
>       at org.apache.parquet.column.Dictionary.decodeToInt(Dictionary.java:48)
>       at 
> org.apache.spark.sql.execution.vectorized.OnHeapColumnVector.getInt(OnHeapColumnVector.java:233)
>       at 
> org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIterator.processNext(Unknown
>  Source)
>       at 
> org.apache.spark.sql.execution.BufferedRowIterator.hasNext(BufferedRowIterator.java:43)
>       at 
> org.apache.spark.sql.execution.WholeStageCodegenExec$$anonfun$8$$anon$1.hasNext(WholeStageCodegenExec.scala:370)
>       at 
> org.apache.spark.sql.execution.SparkPlan$$anonfun$4.apply(SparkPlan.scala:246)
>       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:1145)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to