Skip to content

Commit 6a5428f

Browse files
author
Piyush Narang
committed
Clean up some stuff in ValuesWriterFactory
1 parent 0f8cd09 commit 6a5428f

File tree

1 file changed

+13
-25
lines changed

1 file changed

+13
-25
lines changed

parquet-column/src/main/java/org/apache/parquet/column/values/ValuesWriterFactory.java

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private ValuesWriter getFixedLenByteArrayValuesWriter(ColumnDescriptor path) {
100100
}
101101

102102
private ValuesWriter getBinaryValuesWriter(ColumnDescriptor path) {
103-
if(writerVersion == WriterVersion.PARQUET_1_0) {
103+
if (writerVersion == WriterVersion.PARQUET_1_0) {
104104
ValuesWriter fallbackWriter = new PlainValuesWriter(initialSlabSize, pageSizeThreshold, allocator);
105105
return dictWriterWithFallBack(path, fallbackWriter);
106106
} else {
@@ -110,7 +110,7 @@ private ValuesWriter getBinaryValuesWriter(ColumnDescriptor path) {
110110
}
111111

112112
private ValuesWriter getInt32ValuesWriter(ColumnDescriptor path) {
113-
if(writerVersion == WriterVersion.PARQUET_1_0) {
113+
if (writerVersion == WriterVersion.PARQUET_1_0) {
114114
ValuesWriter fallbackWriter = new PlainValuesWriter(initialSlabSize, pageSizeThreshold, allocator);
115115
return dictWriterWithFallBack(path, fallbackWriter);
116116
} else {
@@ -120,7 +120,7 @@ private ValuesWriter getInt32ValuesWriter(ColumnDescriptor path) {
120120
}
121121

122122
private ValuesWriter getInt64ValuesWriter(ColumnDescriptor path) {
123-
if(writerVersion == WriterVersion.PARQUET_1_0) {
123+
if (writerVersion == WriterVersion.PARQUET_1_0) {
124124
ValuesWriter fallbackWriter = new PlainValuesWriter(initialSlabSize, pageSizeThreshold, allocator);
125125
return dictWriterWithFallBack(path, fallbackWriter);
126126
} else {
@@ -131,29 +131,17 @@ private ValuesWriter getInt64ValuesWriter(ColumnDescriptor path) {
131131

132132
private ValuesWriter getInt96ValuesWriter(ColumnDescriptor path) {
133133
ValuesWriter fallbackWriter = new FixedLenByteArrayPlainValuesWriter(12, initialSlabSize, pageSizeThreshold, allocator);
134-
if(writerVersion == WriterVersion.PARQUET_1_0) {
135-
return dictWriterWithFallBack(path, fallbackWriter);
136-
} else {
137-
return dictWriterWithFallBack(path, fallbackWriter);
138-
}
134+
return dictWriterWithFallBack(path, fallbackWriter);
139135
}
140136

141137
private ValuesWriter getDoubleValuesWriter(ColumnDescriptor path) {
142138
ValuesWriter fallbackWriter = new PlainValuesWriter(initialSlabSize, pageSizeThreshold, allocator);
143-
if(writerVersion == WriterVersion.PARQUET_1_0) {
144-
return dictWriterWithFallBack(path, fallbackWriter);
145-
} else {
146-
return dictWriterWithFallBack(path, fallbackWriter);
147-
}
139+
return dictWriterWithFallBack(path, fallbackWriter);
148140
}
149141

150142
private ValuesWriter getFloatValuesWriter(ColumnDescriptor path) {
151143
ValuesWriter fallbackWriter = new PlainValuesWriter(initialSlabSize, pageSizeThreshold, allocator);
152-
if(writerVersion == WriterVersion.PARQUET_1_0) {
153-
return dictWriterWithFallBack(path, fallbackWriter);
154-
} else {
155-
return dictWriterWithFallBack(path, fallbackWriter);
156-
}
144+
return dictWriterWithFallBack(path, fallbackWriter);
157145
}
158146

159147
@SuppressWarnings("deprecation")
@@ -176,19 +164,19 @@ private DictionaryValuesWriter dictionaryWriter(ColumnDescriptor path) {
176164
case BOOLEAN:
177165
throw new IllegalArgumentException("no dictionary encoding for BOOLEAN");
178166
case BINARY:
179-
return new DictionaryValuesWriter.PlainBinaryDictionaryValuesWriter(dictionaryPageSizeThreshold, encodingForDataPage, encodingForDictionaryPage, this.allocator);
167+
return new DictionaryValuesWriter.PlainBinaryDictionaryValuesWriter(dictionaryPageSizeThreshold, encodingForDataPage, encodingForDictionaryPage, allocator);
180168
case INT32:
181-
return new DictionaryValuesWriter.PlainIntegerDictionaryValuesWriter(dictionaryPageSizeThreshold, encodingForDataPage, encodingForDictionaryPage, this.allocator);
169+
return new DictionaryValuesWriter.PlainIntegerDictionaryValuesWriter(dictionaryPageSizeThreshold, encodingForDataPage, encodingForDictionaryPage, allocator);
182170
case INT64:
183-
return new DictionaryValuesWriter.PlainLongDictionaryValuesWriter(dictionaryPageSizeThreshold, encodingForDataPage, encodingForDictionaryPage, this.allocator);
171+
return new DictionaryValuesWriter.PlainLongDictionaryValuesWriter(dictionaryPageSizeThreshold, encodingForDataPage, encodingForDictionaryPage, allocator);
184172
case INT96:
185-
return new DictionaryValuesWriter.PlainFixedLenArrayDictionaryValuesWriter(dictionaryPageSizeThreshold, 12, encodingForDataPage, encodingForDictionaryPage, this.allocator);
173+
return new DictionaryValuesWriter.PlainFixedLenArrayDictionaryValuesWriter(dictionaryPageSizeThreshold, 12, encodingForDataPage, encodingForDictionaryPage, allocator);
186174
case DOUBLE:
187-
return new DictionaryValuesWriter.PlainDoubleDictionaryValuesWriter(dictionaryPageSizeThreshold, encodingForDataPage, encodingForDictionaryPage, this.allocator);
175+
return new DictionaryValuesWriter.PlainDoubleDictionaryValuesWriter(dictionaryPageSizeThreshold, encodingForDataPage, encodingForDictionaryPage, allocator);
188176
case FLOAT:
189-
return new DictionaryValuesWriter.PlainFloatDictionaryValuesWriter(dictionaryPageSizeThreshold, encodingForDataPage, encodingForDictionaryPage, this.allocator);
177+
return new DictionaryValuesWriter.PlainFloatDictionaryValuesWriter(dictionaryPageSizeThreshold, encodingForDataPage, encodingForDictionaryPage, allocator);
190178
case FIXED_LEN_BYTE_ARRAY:
191-
return new DictionaryValuesWriter.PlainFixedLenArrayDictionaryValuesWriter(dictionaryPageSizeThreshold, path.getTypeLength(), encodingForDataPage, encodingForDictionaryPage, this.allocator);
179+
return new DictionaryValuesWriter.PlainFixedLenArrayDictionaryValuesWriter(dictionaryPageSizeThreshold, path.getTypeLength(), encodingForDataPage, encodingForDictionaryPage, allocator);
192180
default:
193181
throw new IllegalArgumentException("Unknown type " + path.getType());
194182
}

0 commit comments

Comments
 (0)