@@ -20,13 +20,13 @@ package org.apache.spark.sql.execution.datasources
2020import org .apache .spark .{Logging , TaskContext }
2121import org .apache .spark .deploy .SparkHadoopUtil
2222import org .apache .spark .rdd .{MapPartitionsRDD , RDD , UnionRDD }
23- import org .apache .spark .sql .catalyst .{CatalystTypeConverters , InternalRow , expressions }
23+ import org .apache .spark .sql .catalyst .{InternalRow , expressions }
2424import org .apache .spark .sql .catalyst .expressions ._
2525import org .apache .spark .sql .catalyst .planning .PhysicalOperation
2626import org .apache .spark .sql .catalyst .plans .logical
2727import org .apache .spark .sql .catalyst .plans .logical .LogicalPlan
2828import org .apache .spark .sql .sources ._
29- import org .apache .spark .sql .types .{TimestampType , DateType , StringType , StructType }
29+ import org .apache .spark .sql .types .{StringType , StructType }
3030import org .apache .spark .sql .{SaveMode , Strategy , execution , sources , _ }
3131import org .apache .spark .unsafe .types .UTF8String
3232import org .apache .spark .util .{SerializableConfiguration , Utils }
@@ -343,17 +343,11 @@ private[sql] object DataSourceStrategy extends Strategy with Logging {
343343 * and convert them.
344344 */
345345 protected [sql] def selectFilters (filters : Seq [Expression ]) = {
346- import CatalystTypeConverters ._
347-
348346 def translate (predicate : Expression ): Option [Filter ] = predicate match {
349347 case expressions.EqualTo (a : Attribute , Literal (v, _)) =>
350348 Some (sources.EqualTo (a.name, v))
351349 case expressions.EqualTo (Literal (v, _), a : Attribute ) =>
352350 Some (sources.EqualTo (a.name, v))
353- case expressions.EqualTo (Cast (a : Attribute , _), l : Literal ) =>
354- Some (sources.EqualTo (a.name, convertToScala(Cast (l, a.dataType).eval(), a.dataType)))
355- case expressions.EqualTo (l : Literal , Cast (a : Attribute , _)) =>
356- Some (sources.EqualTo (a.name, convertToScala(Cast (l, a.dataType).eval(), a.dataType)))
357351
358352 case expressions.EqualNullSafe (a : Attribute , Literal (v, _)) =>
359353 Some (sources.EqualNullSafe (a.name, v))
@@ -364,41 +358,21 @@ private[sql] object DataSourceStrategy extends Strategy with Logging {
364358 Some (sources.GreaterThan (a.name, v))
365359 case expressions.GreaterThan (Literal (v, _), a : Attribute ) =>
366360 Some (sources.LessThan (a.name, v))
367- case expressions.GreaterThan (Cast (a : Attribute , _), l : Literal ) =>
368- Some (sources.GreaterThan (a.name, convertToScala(Cast (l, a.dataType).eval(), a.dataType)))
369- case expressions.GreaterThan (l : Literal , Cast (a : Attribute , _)) =>
370- Some (sources.LessThan (a.name, convertToScala(Cast (l, a.dataType).eval(), a.dataType)))
371361
372362 case expressions.LessThan (a : Attribute , Literal (v, _)) =>
373363 Some (sources.LessThan (a.name, v))
374364 case expressions.LessThan (Literal (v, _), a : Attribute ) =>
375365 Some (sources.GreaterThan (a.name, v))
376- case expressions.LessThan (Cast (a : Attribute , _), l : Literal ) =>
377- Some (sources.LessThan (a.name, convertToScala(Cast (l, a.dataType).eval(), a.dataType)))
378- case expressions.LessThan (l : Literal , Cast (a : Attribute , _)) =>
379- Some (sources.GreaterThan (a.name, convertToScala(Cast (l, a.dataType).eval(), a.dataType)))
380366
381367 case expressions.GreaterThanOrEqual (a : Attribute , Literal (v, _)) =>
382368 Some (sources.GreaterThanOrEqual (a.name, v))
383369 case expressions.GreaterThanOrEqual (Literal (v, _), a : Attribute ) =>
384370 Some (sources.LessThanOrEqual (a.name, v))
385- case expressions.GreaterThanOrEqual (Cast (a : Attribute , _), l : Literal ) =>
386- Some (sources.GreaterThanOrEqual (a.name,
387- convertToScala(Cast (l, a.dataType).eval(), a.dataType)))
388- case expressions.GreaterThanOrEqual (l : Literal , Cast (a : Attribute , _)) =>
389- Some (sources.LessThanOrEqual (a.name,
390- convertToScala(Cast (l, a.dataType).eval(), a.dataType)))
391371
392372 case expressions.LessThanOrEqual (a : Attribute , Literal (v, _)) =>
393373 Some (sources.LessThanOrEqual (a.name, v))
394374 case expressions.LessThanOrEqual (Literal (v, _), a : Attribute ) =>
395375 Some (sources.GreaterThanOrEqual (a.name, v))
396- case expressions.LessThanOrEqual (Cast (a : Attribute , _), l : Literal ) =>
397- Some (sources.LessThanOrEqual (a.name,
398- convertToScala(Cast (l, a.dataType).eval(), a.dataType)))
399- case expressions.LessThanOrEqual (l : Literal , Cast (a : Attribute , _)) =>
400- Some (sources.GreaterThanOrEqual (a.name,
401- convertToScala(Cast (l, a.dataType).eval(), a.dataType)))
402376
403377 case expressions.InSet (a : Attribute , set) =>
404378 Some (sources.In (a.name, set.toArray))
0 commit comments