@@ -20,12 +20,11 @@ package org.apache.spark.sql.columnar
2020import java .nio .ByteBuffer
2121
2222import org .apache .spark .rdd .RDD
23+ import org .apache .spark .sql .Row
2324import org .apache .spark .sql .catalyst .analysis .MultiInstanceRelation
24- import org .apache .spark .sql .catalyst .expressions .{GenericMutableRow , Attribute }
25+ import org .apache .spark .sql .catalyst .expressions .{Attribute , GenericMutableRow }
2526import org .apache .spark .sql .catalyst .plans .logical .LogicalPlan
26- import org .apache .spark .sql .execution .{SparkPlan , LeafNode }
27- import org .apache .spark .sql .Row
28- import org .apache .spark .SparkConf
27+ import org .apache .spark .sql .execution .{LeafNode , SparkPlan }
2928
3029object InMemoryRelation {
3130 def apply (useCompression : Boolean , batchSize : Int , child : SparkPlan ): InMemoryRelation =
@@ -48,7 +47,9 @@ private[sql] case class InMemoryRelation(
4847 new Iterator [Array [ByteBuffer ]] {
4948 def next () = {
5049 val columnBuilders = output.map { attribute =>
51- ColumnBuilder (ColumnType (attribute.dataType).typeId, 0 , attribute.name, useCompression)
50+ val columnType = ColumnType (attribute.dataType)
51+ val initialBufferSize = columnType.defaultSize * batchSize
52+ ColumnBuilder (columnType.typeId, initialBufferSize, attribute.name, useCompression)
5253 }.toArray
5354
5455 var row : Row = null
0 commit comments