Repository navigation
Commit df678aa
fix(jsonl-scan): count the worker slice from the offset, not the file (#7247)
### What changes were proposed in this PR?
`JSONLScanSourceOpExec.open()` applies the requested offset twice. It
drops `offset` lines from the reader, so the iterator it keeps already
begins at the requested row; it then computes the worker's slice bounds
as `offsetValue + …`, which are positions in the original file, and
applies those bounds to that already-offset iterator. The rows in
between are skipped, and when what remains is shorter than the offset
the operator emits nothing at all. Neither case raises an error or
writes a log line, so the operator reports success with rows missing.
This PR resolves the bounds against the iterator they are actually
applied to, by dropping the `offsetValue +` from both expressions. That
is the first of the two options the issue describes; it keeps the
reader-side `drop` doing the offset and leaves the slice to do only what
it exists for, which is dividing the window across workers.
### Any related issues, documentation, discussions?
Closes #7245
### How was this PR tested?
Two cases were added to `JSONLScanSourceOpExecSpec`, which previously
covered the row limit but never set an offset: an offset on its own, and
an offset together with a limit — the combination that used to yield no
rows at all. Both fail against the current code and pass with the
change, and the three existing cases are unaffected.
Beyond those, the operator was driven over a five-line file across every
combination of offset (unset, 0, 1, 2, 4, 5, 7), limit (unset, 0, 2, 3,
9) and worker count (1, 2, 3), with each result compared against
`drop(offset).take(limit)` — the reading that `ArrowSourceOpExec` and
this operator's own `sourceSchema()` already follow. 36 of the 105
combinations were wrong before the change and none after. Every one of
the 36 had an offset of 1 or more, which is why an unset offset was
unaffected and the gap went unnoticed. That sweep was a scratch harness
for checking the fix and is not part of the diff; the two added cases
are the representatives of it that are worth keeping.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5)
---------
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: Xuan Gu <[email protected]>1 parent 2ae9a97 commit df678aa
2 files changed
Lines changed: 43 additions & 3 deletions
File tree
- common/workflow-operator/src
- main/scala/org/apache/texera/amber/operator/source/scan/json
- test/scala/org/apache/texera/amber/operator/source/scan/json
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | | - | |
74 | | - | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
84 | 123 | | |
0 commit comments