taiyang-li opened a new issue, #4943: URL: https://github.com/apache/incubator-gluten/issues/4943
### Description ![d722f3fabeb6881fe8b49f58cf0eb6c](https://github.com/apache/incubator-gluten/assets/8181003/8244ef97-fd00-4838-a341-adcb669847ec) ``` bool ReadBufferFromJavaInputStream::nextImpl() { int count = readFromJava(); if (count > 0) working_buffer.resize(count); return count > 0; } int ReadBufferFromJavaInputStream::readFromJava() const { GET_JNIENV(env) jint count = safeCallIntMethod( env, java_in, ShuffleReader::input_stream_read, reinterpret_cast<jlong>(working_buffer.begin()), memory.m_capacity); CLEAN_JNIENV return count; } ``` ``` @Override public long read(long destAddress, long maxReadSize) { return GlutenException.wrap( () -> { int maxReadSize32 = Math.toIntExact(maxReadSize); if (buffer == null || maxReadSize32 > buffer.length) { this.buffer = new byte[maxReadSize32]; } // The code conducts copy as long as 'in' wraps off-heap data, // which is about to be moved to heap int read = in.read(buffer, 0, maxReadSize32); if (read == -1 || read == 0) { return 0; } // The code conducts copy, from heap to off-heap // memCopyFromHeap(buffer, destAddress, read); PlatformDependent.copyMemory(buffer, 0, destAddress, read); bytesRead += read; return read; }); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@gluten.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@gluten.apache.org For additional commands, e-mail: commits-h...@gluten.apache.org