From d11d9b6c45d956295a6379b41034e03297c519a8 Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Mon, 20 Jul 2015 21:59:38 -0500 Subject: [PATCH] dont waste memory in storing all lines from input CharSource.readLines() reads all lines from input into a in-memory list Since we need an iterator here, so this wastage can be easily prevented --- .../io/druid/query/aggregation/AggregationTestHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java b/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java index 93164e6d5d1..769160d0812 100644 --- a/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java +++ b/processing/src/test/java/io/druid/query/aggregation/AggregationTestHelper.java @@ -62,6 +62,7 @@ import io.druid.segment.Segment; import io.druid.segment.incremental.IncrementalIndex; import io.druid.segment.incremental.OnheapIncrementalIndex; import org.apache.commons.io.FileUtils; +import org.apache.commons.io.LineIterator; import java.io.File; import java.io.IOException; @@ -156,8 +157,7 @@ public class AggregationTestHelper { StringInputRowParser parser = mapper.readValue(parserJson, StringInputRowParser.class); - CharSource cs = Files.asCharSource(inputDataFile, Charset.defaultCharset()); - Iterator iter = cs.readLines().iterator(); + LineIterator iter = FileUtils.lineIterator(inputDataFile, "UTF-8"); List aggregatorSpecs = mapper.readValue( aggregators,