Skip to content

Commit 976e2d2

Browse files
authored
GH-3163: Reduce memory and time overhead of ParquetRewriterTests (#3164)
1 parent 41e294c commit 976e2d2

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

parquet-hadoop/src/test/java/org/apache/parquet/hadoop/rewrite/ParquetRewriterTest.java

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@
107107
@RunWith(Parameterized.class)
108108
public class ParquetRewriterTest {
109109

110-
private final int numRecord = 100000;
111-
private final Configuration conf = new Configuration();
110+
private final int numRecord;
111+
private final Configuration conf;
112112
private final ParquetConfiguration parquetConf = new PlainParquetConfiguration();
113113
private final ParquetProperties.WriterVersion writerVersion;
114114
private final IndexCache.CacheStrategy indexCacheStrategy;
@@ -122,21 +122,31 @@ public class ParquetRewriterTest {
122122
private final EncryptionTestFile gzipEncryptionTestFileWithoutBloomFilterColumn;
123123
private final EncryptionTestFile uncompressedEncryptionTestFileWithoutBloomFilterColumn;
124124

125-
@Parameterized.Parameters(name = "WriterVersion = {0}, IndexCacheStrategy = {1}, UsingHadoop = {2}")
125+
@Parameterized.Parameters(
126+
name =
127+
"WriterVersion = {0}, IndexCacheStrategy = {1}, UsingHadoop = {2}, numRecord = {3}, rowsPerPage = {4}")
126128
public static Object[][] parameters() {
129+
final int DefaultNumRecord = 10000;
130+
final int DefaultRowsPerPage = DefaultNumRecord / 5;
127131
return new Object[][] {
128-
{"v1", "NONE", true},
129-
{"v1", "PREFETCH_BLOCK", true},
130-
{"v2", "PREFETCH_BLOCK", true},
131-
{"v2", "PREFETCH_BLOCK", false}
132+
{"v1", "NONE", true, DefaultNumRecord, DefaultRowsPerPage},
133+
{"v1", "PREFETCH_BLOCK", true, DefaultNumRecord, DefaultRowsPerPage},
134+
{"v2", "PREFETCH_BLOCK", true, DefaultNumRecord, DefaultRowsPerPage},
135+
{"v2", "PREFETCH_BLOCK", false, DefaultNumRecord, DefaultRowsPerPage}
132136
};
133137
}
134138

135-
public ParquetRewriterTest(String writerVersion, String indexCacheStrategy, boolean usingHadoop)
139+
public ParquetRewriterTest(
140+
String writerVersion, String indexCacheStrategy, boolean _usingHadoop, int _numRecord, int rowsPerPage)
136141
throws IOException {
137142
this.writerVersion = ParquetProperties.WriterVersion.fromString(writerVersion);
138143
this.indexCacheStrategy = IndexCache.CacheStrategy.valueOf(indexCacheStrategy);
139-
this.usingHadoop = usingHadoop;
144+
this.usingHadoop = _usingHadoop;
145+
this.numRecord = _numRecord;
146+
147+
Configuration _conf = new Configuration();
148+
_conf.set("parquet.page.row.count.limit", Integer.toString(rowsPerPage));
149+
this.conf = _conf;
140150

141151
MessageType testSchema = createSchema();
142152
this.gzipEncryptionTestFileWithoutBloomFilterColumn = new TestFileBuilder(conf, testSchema)

0 commit comments

Comments
 (0)