monitorjbl / excel-streaming-reader

An easy-to-use implementation of a streaming Excel reader using Apache POI
Apache License 2.0
943 stars 342 forks source link

spliterator is not supported with Apache POI 5.2.0 (Unsupported operation getPhysicalNumberOfRows) #246

Open borjapenman opened 2 years ago

borjapenman commented 2 years ago

After updating to the latest version of the streaming reader (3.4.0) and Apache POI (5.2.0) the spliterator is no longer usable as it depends on the unsupported operation getPhysicalNumberOfRows. As a workaround I have changed my stream (I was using StreamSupport to make a stream from the spliterator) by a for loop with the row iterator but I would like to use spliterator again if possible. Let me know if you need further clarifications

Apache POI 5.2.0 spliterator implementation:

    /**
     *  Returns a spliterator of the physical rows
     *
     * @return a spliterator of the PHYSICAL rows.  Meaning the 3rd element may not
     * be the third row if say for instance the second row is undefined.
     *
     * @since POI 5.2.0
     */
    @Override
    default Spliterator<Row> spliterator() {
        return Spliterators.spliterator(rowIterator(), getPhysicalNumberOfRows(), 0);
    }
pjfanning commented 2 years ago

@borjapenman I don't know what the plans for this repo are but I have applied a fix on my fork - https://github.com/pjfanning/excel-streaming-reader/pull/96