Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/8049#discussion_r36936730
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSourceStrategy.scala
---
@@ -343,31 +343,57 @@ private[sql] object DataSourceStrategy extends
Strategy with Logging {
* and convert them.
*/
protected[sql] def selectFilters(filters: Seq[Expression]) = {
+ import CatalystTypeConverters._
+
def translate(predicate: Expression): Option[Filter] = predicate match
{
case expressions.EqualTo(a: Attribute, Literal(v, _)) =>
Some(sources.EqualTo(a.name, v))
case expressions.EqualTo(Literal(v, _), a: Attribute) =>
Some(sources.EqualTo(a.name, v))
+ case expressions.EqualTo(Cast(a: Attribute, _), l: Literal) =>
+ Some(sources.EqualTo(a.name, convertToScala(Cast(l,
a.dataType).eval(), a.dataType)))
+ case expressions.EqualTo(l: Literal, Cast(a: Attribute, _)) =>
+ Some(sources.EqualTo(a.name, convertToScala(Cast(l,
a.dataType).eval(), a.dataType)))
--- End diff --
Hmm, depends on what implicit casting rules various databases do. Can you
investigate more?
In the mean time I think we should revert this from the release branch as
pushing down wrong filters is worse than not pushing down filters.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]