andygrove commented on a change in pull request #8172:
URL: https://github.com/apache/arrow/pull/8172#discussion_r491702697



##########
File path: rust/datafusion/src/sql/planner.rs
##########
@@ -343,7 +343,7 @@ impl<'a, S: SchemaProvider> SqlToRel<'a, S> {
         match *limit {
             Some(ref limit_expr) => {
                 let n = match self.sql_to_rex(&limit_expr, &input.schema())? {
-                    Expr::Literal(ScalarValue::Int64(n)) => Ok(n as usize),
+                    Expr::Literal(ScalarValue::Int64(n)) => Ok(n.unwrap() as 
usize),

Review comment:
       Could we math on `Some(n)` or add `if n.is_some()` on the match arm to 
be sure we aren't calling `unwrap` on ` None`?

##########
File path: rust/datafusion/src/sql/planner.rs
##########
@@ -343,7 +343,7 @@ impl<'a, S: SchemaProvider> SqlToRel<'a, S> {
         match *limit {
             Some(ref limit_expr) => {
                 let n = match self.sql_to_rex(&limit_expr, &input.schema())? {
-                    Expr::Literal(ScalarValue::Int64(n)) => Ok(n as usize),
+                    Expr::Literal(ScalarValue::Int64(n)) => Ok(n.unwrap() as 
usize),

Review comment:
       Could we match on `Some(n)` or add `if n.is_some()` on the match arm to 
be sure we aren't calling `unwrap` on ` None`?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to