You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2014/09/03 05:51:41 UTC
git commit: [SPARK-3300][SQL] No need to call clear() and shorten
build()
Repository: spark
Updated Branches:
refs/heads/master 19d3e1e8e -> 24ab38401
[SPARK-3300][SQL] No need to call clear() and shorten build()
The function `ensureFreeSpace` in object `ColumnBuilder` clears old buffer before copying its content to new buffer. This PR fixes it.
Author: Liang-Chi Hsieh <vi...@gmail.com>
Closes #2195 from viirya/fix_buffer_clear and squashes the following commits:
792f009 [Liang-Chi Hsieh] no need to call clear(). use flip() instead of calling limit(), position() and rewind().
df2169f [Liang-Chi Hsieh] should clean old buffer after copying its content.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/24ab3840
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/24ab3840
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/24ab3840
Branch: refs/heads/master
Commit: 24ab384018270e4f7af7eb8ca7192f337498eaf5
Parents: 19d3e1e
Author: Liang-Chi Hsieh <vi...@gmail.com>
Authored: Tue Sep 2 20:51:25 2014 -0700
Committer: Michael Armbrust <mi...@databricks.com>
Committed: Tue Sep 2 20:51:25 2014 -0700
----------------------------------------------------------------------
.../main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/24ab3840/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala b/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala
index 7e7bb28..247337a 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/columnar/ColumnBuilder.scala
@@ -75,8 +75,7 @@ private[sql] class BasicColumnBuilder[T <: DataType, JvmType](
}
override def build() = {
- buffer.limit(buffer.position()).rewind()
- buffer
+ buffer.flip().asInstanceOf[ByteBuffer]
}
}
@@ -129,7 +128,6 @@ private[sql] object ColumnBuilder {
val newSize = capacity + size.max(capacity / 8 + 1)
val pos = orig.position()
- orig.clear()
ByteBuffer
.allocate(newSize)
.order(ByteOrder.nativeOrder())
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org