From 9d0dcce0b283debfbf17fd879669e2509bee076c Mon Sep 17 00:00:00 2001 From: sshiv012 <122703005+sshiv012@users.noreply.github.com> Date: Mon, 10 Aug 2026 23:38:50 -0700 Subject: [PATCH] seed f1a543 --- .../source/scan/text/TextInputSourceOpExec.scala | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/text/TextInputSourceOpExec.scala b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/text/TextInputSourceOpExec.scala index ed314ce0fc6..f955bea08db 100644 --- a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/text/TextInputSourceOpExec.scala +++ b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/source/scan/text/TextInputSourceOpExec.scala @@ -34,12 +34,11 @@ class TextInputSourceOpExec private[text] ( (if (desc.attributeType.isSingle) { Iterator(desc.textInput) } else { - // `slice(offset, offset + limit)` overflows Int when the limit is absent - // (it defaults to Int.MaxValue) or large, making `until <= from` and - // silently yielding no rows. - desc.textInput.linesIterator - .drop(desc.fileScanOffset.getOrElse(0)) - .take(desc.fileScanLimit.getOrElse(Int.MaxValue)) + // Emit the [offset, offset + limit) window of lines in one call. + desc.textInput.linesIterator.slice( + desc.fileScanOffset.getOrElse(0), + desc.fileScanOffset.getOrElse(0) + desc.fileScanLimit.getOrElse(Int.MaxValue) + ) }).map(line => TupleLike(desc.attributeType match { case FileAttributeType.SINGLE_STRING => line