spark-cassandra-connector icon indicating copy to clipboard operation
spark-cassandra-connector copied to clipboard

PrefetchingResultSetIterator: fix bug w/r/t intermediate zero-row pages

Open eappere opened this issue 1 year ago • 0 comments

Description

How did the Spark Cassandra Connector Work or Not Work Before this Patch

Zero row pages (that aren't the last) can sometimes happen, for example when using "filtering".

The iterator has a logic bug which makes it throw an exception when encountering this.

Fix this issue with minimal code changes and add associated unit test.

General Design of the patch

The fix is rather simple: skip such pages in maybePrefetch (if -> while), and call maybePrefetch in constructor in the event the first page(s) being affected.

Fixes: SPARKC-717

How Has This Been Tested?

Unit test has been added to validate and check the presence of the fix.

Checklist:

  • [x] I have a ticket in the OSS JIRA
  • [x] I have performed a self-review of my own code
  • [x] Locally all tests pass (make sure tests fail without your patch)

eappere avatar Feb 03 '25 10:02 eappere