Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/8799#discussion_r39895460
--- Diff:
sql/hive/src/main/scala/org/apache/spark/sql/hive/orc/OrcFilters.scala ---
@@ -102,46 +102,32 @@ private[orc] object OrcFilters extends Logging {
negate <- buildSearchArgument(child, builder.startNot())
} yield negate.end()
- case EqualTo(attribute, value) =>
- Option(value)
- .filter(isSearchableLiteral)
- .map(builder.equals(attribute, _))
+ case EqualTo(attribute, value) if isSearchableLiteral(value) =>
+ Some(builder.startAnd().equals(attribute, value).end())
- case EqualNullSafe(attribute, value) =>
- Option(value)
- .filter(isSearchableLiteral)
- .map(builder.nullSafeEquals(attribute, _))
+ case EqualNullSafe(attribute, value) if isSearchableLiteral(value) =>
+ Some(builder.startAnd().nullSafeEquals(attribute, value).end())
- case LessThan(attribute, value) =>
- Option(value)
- .filter(isSearchableLiteral)
- .map(builder.lessThan(attribute, _))
+ case LessThan(attribute, value) if isSearchableLiteral(value) =>
+ Some(builder.startAnd().lessThan(attribute, value).end())
- case LessThanOrEqual(attribute, value) =>
- Option(value)
- .filter(isSearchableLiteral)
- .map(builder.lessThanEquals(attribute, _))
+ case LessThanOrEqual(attribute, value) if isSearchableLiteral(value)
=>
+ Some(builder.startAnd().lessThanEquals(attribute, value).end())
- case GreaterThan(attribute, value) =>
- Option(value)
- .filter(isSearchableLiteral)
- .map(builder.startNot().lessThanEquals(attribute, _).end())
+ case GreaterThan(attribute, value) if isSearchableLiteral(value) =>
+ Some(builder.startNot().lessThanEquals(attribute, value).end())
- case GreaterThanOrEqual(attribute, value) =>
- Option(value)
- .filter(isSearchableLiteral)
- .map(builder.startNot().lessThan(attribute, _).end())
+ case GreaterThanOrEqual(attribute, value) if
isSearchableLiteral(value) =>
+ Some(builder.startNot().lessThan(attribute, value).end())
case IsNull(attribute) =>
- Some(builder.isNull(attribute))
+ Some(builder.startAnd().isNull(attribute).end())
case IsNotNull(attribute) =>
Some(builder.startNot().isNull(attribute).end())
- case In(attribute, values) =>
- Option(values)
- .filter(_.forall(isSearchableLiteral))
- .map(builder.in(attribute, _))
+ case In(attribute, values) if values.forall(isSearchableLiteral) =>
+ Some(builder.startAnd().in(attribute,
values.map(_.asInstanceOf[AnyRef]): _*).end())
--- End diff --
Will this `In` get changed to`InSet` by the optimizer when all values are
literals?
---
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]