@@ -20,12 +20,11 @@ package org.apache.spark.sql.columnar
20
20
import java .nio .ByteBuffer
21
21
22
22
import org .apache .spark .rdd .RDD
23
+ import org .apache .spark .sql .Row
23
24
import 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 }
25
26
import 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 }
29
28
30
29
object InMemoryRelation {
31
30
def apply (useCompression : Boolean , batchSize : Int , child : SparkPlan ): InMemoryRelation =
@@ -48,7 +47,9 @@ private[sql] case class InMemoryRelation(
48
47
new Iterator [Array [ByteBuffer ]] {
49
48
def next () = {
50
49
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)
52
53
}.toArray
53
54
54
55
var row : Row = null
0 commit comments