[Java] Spark job fails due to arrow buf limitation
- Dominant language
- Java
- Stars
- 94
- Forks
- 152
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 11
Description
Hello,
Groupby + applyinPandas results in following error. We need some parameter to tune buffer size.
```java
Caused by: java.lang.IndexOutOfBoundsException: index: 0, length: 1073741824 (expected: range(0, 0)) at io.netty.buffer.ArrowBuf.checkIndex(ArrowBuf.java:716) at io.netty.buffer.ArrowBuf.setBytes(ArrowBuf.java:954) at org.apache.arrow.vector.BaseVariableWidthVector.reallocDataBuffer(BaseVariableWidthVector.java:508) at org.apache.arrow.vector.BaseVariableWidthVector.handleSafe(BaseVariableWidthVector.java:1239) at org.apache.arrow.vector.BaseVariableWidthVector.setSafe(BaseVariableWidthVector.java:1066) at org.apache.spark.sql.execution.arrow.StringWriter.setValue(ArrowWriter.scala:287) at org.apache.spark.sql.execution.arrow.ArrowFieldWriter.write(ArrowWriter.scala:151) at org.apache.spark.sql.execution.arrow.ArrowWriter.write(ArrowWriter.scala:105) at org.apache.spark.sql.execution.python.ArrowPythonRunner$$anon$1.$anonfun$writeIteratorToStream$1(ArrowPythonRunner.scala:100) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1581) at org.apache.spark.sql.execution.python.ArrowPythonRunner$$anon$1.writeIteratorToStream(ArrowPythonRunner.scala:122) at org.apache.spark.api.python.BasePythonRunner$WriterThread.$anonfun$run$1(PythonRunner.scala:478) at org.apache.spark.util.Utils$.logUncaughtExceptions(Utils.scala:2146) at org.apache.spark.api.python.BasePythonRunner$WriterThread.run(PythonRunner.scala:270)
```
**Reporter**: [Shubham Chhabra](https://issues.apache.org/jira/browse/ARROW-15983)
**Note**: *This issue was originally created as [ARROW-15983](https://issues.apache.org/jira/browse/ARROW-15983). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*
Contributor guide
Research direction
The trace points to ArrowBuf.java, BaseVariableWidthVector, Spark's ArrowWriter.scala, and ArrowPythonRunner.scala; start by reproducing the groupby + applyInPandas case and tracing the buffer boundary. Done means the reported failure is addressed with the requested tunable buffer behavior and coverage for this path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala, spark
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100