File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
main/scala/org/apache/spark/sql/hive
test/scala/org/apache/spark/sql/hive/execution Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -870,6 +870,17 @@ private[hive] object HiveQl {
870870 IsNull (nodeToExpr(child))
871871 case Token (" TOK_FUNCTION" , Token (" IN" , Nil ) :: value :: list) =>
872872 In (nodeToExpr(value), list.map(nodeToExpr))
873+ case Token (" TOK_FUNCTION" ,
874+ Token (" between" , Nil ) ::
875+ Token (" KW_FALSE" , Nil ) ::
876+ target ::
877+ minValue ::
878+ maxValue :: Nil ) =>
879+
880+ val targetExpression = nodeToExpr(target)
881+ And (
882+ GreaterThanOrEqual (targetExpression, nodeToExpr(minValue)),
883+ LessThanOrEqual (targetExpression, nodeToExpr(maxValue)))
873884
874885 /* Boolean Logic */
875886 case Token (AND (), left :: right:: Nil ) => And (nodeToExpr(left), nodeToExpr(right))
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ import org.apache.spark.sql.hive.test.TestHive._
2424 */
2525class HiveQuerySuite extends HiveComparisonTest {
2626
27+ createQueryTest(" between" ,
28+ " SELECT * FROM src WHERE key between 1 and 2"
29+ )
30+
2731 test(" Query expressed in SQL" ) {
2832 assert(sql(" SELECT 1" ).collect() === Array (Seq (1 )))
2933 }
You can’t perform that action at this time.
0 commit comments