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

Hyukjin Kwon commented on SPARK-14962:
--------------------------------------

I see. This was because ORC tries to apply a filter on the column which has the 
type ORC does not supprot ({{ArrayType}}).

ORC supports {{String}}, {{Long}}, {{Double}}, {{Byte}}, {{Short}}, 
{{Integer}}, {{Float}}, {{DateWritable}}, {{HiveDecimal}}, {{HiveChar}} and 
{{HiveVarchar}}. This is apparently OK because it does not take a type as an 
argument (Hive 1.2.x) during building filters ({{SearchArgument}}) but this 
became problematic when tries to evaluate.

Currently {{IsNull}} and {{IsNotNull}} can be built for ORC on all types in 
Spark-side but it does not filter correctly because stored statistics always 
produces {{null}} for not supported types, eg {{ArrayType}} in ORC-side. So, it 
is always {{true}} for {{IsNull}} which ends up always {{false}} for 
{{IsNotNull}}.

This was prevented in Hive 1.3.x by forcing to give a type when building a 
filter ({{SearchArgument}} but Hive 1.2.x is not doing this. 

Let me submit a PR with a more clear description.

> spark.sql.orc.filterPushdown=true breaks DataFrame where functionality
> ----------------------------------------------------------------------
>
>                 Key: SPARK-14962
>                 URL: https://issues.apache.org/jira/browse/SPARK-14962
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.5.2, 2.0.0
>            Reporter: Justin Foster
>
> When running spark-shell with the configuration 
> "spark.sql.orc.filterPushdown=true", the DataFrame function where and filter 
> have an error. In particular, "column is not null" fails.
> Example Code:
> import sqlContext.implicits._
> case class MyData(string_field: String, array_field: Seq[String])
> val myDataArray = Array(
>     MyData("foo", Seq("bar")),
>     MyData("foobar", null)
> )
> val myDataDF = sc.parallelize(myDataArray).toDF
> myDataDF.count // 2
> myDataDF.where("array_field is null").count // 1
> myDataDF.where("array_field is not null").count // 1
> myDataDF.write.format("orc").save("/tmp/mydata.orc")
> val myLoadedDataDF = sqlContext.read.format("orc").load("/tmp/mydata.orc")
> myLoadedDataDF.count // 2
> myLoadedDataDF.where("array_field is not null").count // 0 incorrect



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to