forked from duckdb/duckdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
diff --git a/src/to_substrait.cpp b/src/to_substrait.cpp | ||
index 03d9778..d2429c6 100644 | ||
--- a/src/to_substrait.cpp | ||
+++ b/src/to_substrait.cpp | ||
@@ -777,8 +777,31 @@ substrait::Rel *DuckDBToSubstrait::TransformLimit(LogicalOperator &dop) { | ||
auto stopn = res->mutable_fetch(); | ||
stopn->set_allocated_input(TransformOp(*dop.children[0])); | ||
|
||
- stopn->set_offset(dlimit.offset_val); | ||
- stopn->set_count(dlimit.limit_val); | ||
+ idx_t limit_val; | ||
+ idx_t offset_val; | ||
+ | ||
+ switch(dlimit.limit_val.Type()) { | ||
+ case LimitNodeType::CONSTANT_VALUE: | ||
+ limit_val = dlimit.limit_val.GetConstantValue(); | ||
+ break; | ||
+ case LimitNodeType::UNSET: | ||
+ limit_val = 2ULL << 62ULL; | ||
+ break; | ||
+ default: | ||
+ throw InternalException("Unsupported limit value type"); | ||
+ } | ||
+ switch(dlimit.offset_val.Type()) { | ||
+ case LimitNodeType::CONSTANT_VALUE: | ||
+ offset_val = dlimit.offset_val.GetConstantValue(); | ||
+ break; | ||
+ case LimitNodeType::UNSET: | ||
+ offset_val = 0; | ||
+ break; | ||
+ default: | ||
+ throw InternalException("Unsupported offset value type"); | ||
+ } | ||
+ stopn->set_offset(offset_val); | ||
+ stopn->set_count(limit_val); | ||
return res; | ||
} | ||
|