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 {
870
870
IsNull (nodeToExpr(child))
871
871
case Token (" TOK_FUNCTION" , Token (" IN" , Nil ) :: value :: list) =>
872
872
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)))
873
884
874
885
/* Boolean Logic */
875
886
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._
24
24
*/
25
25
class HiveQuerySuite extends HiveComparisonTest {
26
26
27
+ createQueryTest(" between" ,
28
+ " SELECT * FROM src WHERE key between 1 and 2"
29
+ )
30
+
27
31
test(" Query expressed in SQL" ) {
28
32
assert(sql(" SELECT 1" ).collect() === Array (Seq (1 )))
29
33
}
You can’t perform that action at this time.
0 commit comments