From e663f20d33ee5c13dff47f1f6c4b884d51ce6a0d Mon Sep 17 00:00:00 2001 From: Mark Raasveldt Date: Wed, 28 Feb 2024 10:01:07 +0100 Subject: [PATCH] Patch substrait --- .github/config/out_of_tree_extensions.cmake | 1 + .../extensions/substrait/substrait.patch | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .github/patches/extensions/substrait/substrait.patch diff --git a/.github/config/out_of_tree_extensions.cmake b/.github/config/out_of_tree_extensions.cmake index fd89689f8816..cb4355450cdd 100644 --- a/.github/config/out_of_tree_extensions.cmake +++ b/.github/config/out_of_tree_extensions.cmake @@ -93,5 +93,6 @@ if (NOT WIN32) LOAD_TESTS DONT_LINK GIT_URL https://github.com/duckdb/substrait GIT_TAG 870bab8725d1123905296bfb1f35ce737434e0b3 + APPLY_PATCHES ) endif() diff --git a/.github/patches/extensions/substrait/substrait.patch b/.github/patches/extensions/substrait/substrait.patch new file mode 100644 index 000000000000..481ca475bd29 --- /dev/null +++ b/.github/patches/extensions/substrait/substrait.patch @@ -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; + } +