ming535 commented on code in PR #2694:
URL: https://github.com/apache/arrow-datafusion/pull/2694#discussion_r892293272
##########
datafusion/sql/src/planner.rs:
##########
@@ -1212,57 +1206,59 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
}
/// Wrap a plan in a limit
- fn limit(&self, input: LogicalPlan, limit: Option<SQLExpr>) ->
Result<LogicalPlan> {
- match limit {
- Some(limit_expr) => {
- let n = match self.sql_to_rex(
- limit_expr,
- input.schema(),
- &mut HashMap::new(),
- )? {
- Expr::Literal(ScalarValue::Int64(Some(n))) => Ok(n as
usize),
- _ => Err(DataFusionError::Plan(
- "Unexpected expression for LIMIT clause".to_string(),
- )),
- }?;
-
- LogicalPlanBuilder::from(input).limit(n)?.build()
- }
- _ => Ok(input),
- }
- }
-
- /// Wrap a plan in a offset
- fn offset(
+ fn limit(
&self,
input: LogicalPlan,
- offset: Option<SQLOffset>,
+ skip: Option<SQLOffset>,
+ fetch: Option<SQLExpr>,
) -> Result<LogicalPlan> {
- match offset {
- Some(offset_expr) => {
- let offset = match self.sql_to_rex(
- offset_expr.value,
+ if skip.is_none() && fetch.is_none() {
+ return Ok(input);
+ }
+
+ let skip = match skip {
Review Comment:
tried this, `map` is complaining about the type. When error happens in
parsing the `i64` value, it cannot figure out the right return type.
<img width="1231" alt="Screen Shot 2022-06-08 at 20 24 39"
src="https://user-images.githubusercontent.com/7576663/172615511-06647bc5-9ccb-44d7-a119-0e2fde02556a.png">
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]