Github user icexelloss commented on a diff in the pull request:
https://github.com/apache/spark/pull/18659#discussion_r129412101
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowConverters.scala
---
@@ -132,6 +135,61 @@ private[sql] object ArrowConverters {
}
}
+ private[sql] def fromPayloadIterator(iter: Iterator[ArrowPayload]):
Iterator[InternalRow] = {
+ new Iterator[InternalRow] {
+ private val _allocator = new RootAllocator(Long.MaxValue)
+ private var _reader: ArrowFileReader = _
+ private var _root: VectorSchemaRoot = _
+ private var _index = 0
+
+ loadNextBatch()
+
+ override def hasNext: Boolean = _root != null && _index <
_root.getRowCount
+
+ override def next(): InternalRow = {
+ val fields = _root.getFieldVectors.asScala
+
+ val genericRowData = fields.map { field =>
+ field.getAccessor.getObject(_index)
+ }.toArray[Any]
--- End diff --
@BryanCutler,
I have implemented arrow -> unsafe row conversions in:
https://github.com/icexelloss/spark/commit/8f38c15ea372c1ec9c2fefc36c0bfc3a22c3be14#diff-52cca47e7a940849b28d476ddf99d65eR575
This reuses the row object and doesn't do boxing. Hopefully it's useful to
you as well?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]