Skip to content

Commit

Permalink
[KYUUBI apache#6168] Check if forcedMaxOutputRows is negative
Browse files Browse the repository at this point in the history
# 🔍 Description
## Issue References 🔗

This pull request fixes apache#6168

## Describe Your Solution 🔧

Check if forcedMaxOutputRows is negative.

## Types of changes 🔖

- [X] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪

#### Behavior Without This Pull Request ⚰️

#### Behavior With This Pull Request 🎉

#### Related Unit Tests

---

# Checklist 📝

- [X] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

**Be nice. Be informative.**

Closes apache#6169 from wForget/KYUUBI-6168.

Closes apache#6168

b18d8e5 [wforget] fix style
057c538 [wforget] Check if forcedMaxOutputRows is negative

Authored-by: wforget <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
(cherry picked from commit 6a4f6f0)
  • Loading branch information
wForget committed Mar 14, 2024
1 parent 4632565 commit 6afab77
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ trait ForcedMaxOutputRowsBase extends Rule[LogicalPlan] {

protected def canInsertLimit(p: LogicalPlan, maxOutputRowsOpt: Option[Int]): Boolean = {
maxOutputRowsOpt match {
case Some(forcedMaxOutputRows) => canInsertLimitInner(p) &&
!p.maxRows.exists(_ <= forcedMaxOutputRows)
case None => false
case Some(forcedMaxOutputRows) if forcedMaxOutputRows >= 0 =>
canInsertLimitInner(p) && !p.maxRows.exists(_ <= forcedMaxOutputRows)
case _ => false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ trait ForcedMaxOutputRowsBase extends Rule[LogicalPlan] {

protected def canInsertLimit(p: LogicalPlan, maxOutputRowsOpt: Option[Int]): Boolean = {
maxOutputRowsOpt match {
case Some(forcedMaxOutputRows) => canInsertLimitInner(p) &&
!p.maxRows.exists(_ <= forcedMaxOutputRows)
case None => false
case Some(forcedMaxOutputRows) if forcedMaxOutputRows >= 0 =>
canInsertLimitInner(p) && !p.maxRows.exists(_ <= forcedMaxOutputRows)
case _ => false
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ trait ForcedMaxOutputRowsBase extends Rule[LogicalPlan] {

protected def canInsertLimit(p: LogicalPlan, maxOutputRowsOpt: Option[Int]): Boolean = {
maxOutputRowsOpt match {
case Some(forcedMaxOutputRows) => canInsertLimitInner(p) &&
!p.maxRows.exists(_ <= forcedMaxOutputRows)
case None => false
case Some(forcedMaxOutputRows) if forcedMaxOutputRows >= 0 =>
canInsertLimitInner(p) && !p.maxRows.exists(_ <= forcedMaxOutputRows)
case _ => false
}
}

Expand Down

0 comments on commit 6afab77

Please sign in to comment.