You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@parquet.apache.org by ga...@apache.org on 2021/04/01 14:02:53 UTC
[parquet-mr] branch master updated: PARQUET-2012 Mark
ProtoParquetWriter constructors deprecated (#886)
This is an automated email from the ASF dual-hosted git repository.
gabor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-mr.git
The following commit(s) were added to refs/heads/master by this push:
new 8624081 PARQUET-2012 Mark ProtoParquetWriter constructors deprecated (#886)
8624081 is described below
commit 86240813839f3e15d5c4a0ea56215c616841b6c1
Author: Aaron Niskode-Dossett <an...@etsy.com>
AuthorDate: Thu Apr 1 09:02:43 2021 -0500
PARQUET-2012 Mark ProtoParquetWriter constructors deprecated (#886)
---
.../org/apache/parquet/proto/ProtoParquetWriter.java | 18 +++++++++++-------
.../test/java/org/apache/parquet/proto/TestUtils.java | 14 +++++---------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoParquetWriter.java b/parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoParquetWriter.java
index bef7436..b113030 100644
--- a/parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoParquetWriter.java
+++ b/parquet-protobuf/src/main/java/org/apache/parquet/proto/ProtoParquetWriter.java
@@ -43,7 +43,10 @@ public class ProtoParquetWriter<T extends MessageOrBuilder> extends ParquetWrite
* @param blockSize HDFS block size
* @param pageSize See parquet write up. Blocks are subdivided into pages for alignment and other purposes.
* @throws IOException if there is an error while writing
+ *
+ * @deprecated will be removed in 2.0.0.; Use ProtoParquetWriter.Builder instead
*/
+ @Deprecated
public ProtoParquetWriter(Path file, Class<? extends Message> protoMessage,
CompressionCodecName compressionCodecName, int blockSize,
int pageSize) throws IOException {
@@ -62,7 +65,10 @@ public class ProtoParquetWriter<T extends MessageOrBuilder> extends ParquetWrite
* @param enableDictionary Whether to use a dictionary to compress columns.
* @param validating to turn on validation using the schema
* @throws IOException if there is an error while writing
+ *
+ * @deprecated will be removed in 2.0.0.; Use ProtoParquetWriter.Builder instead
*/
+ @Deprecated
public ProtoParquetWriter(Path file, Class<? extends Message> protoMessage,
CompressionCodecName compressionCodecName, int blockSize,
int pageSize, boolean enableDictionary, boolean validating) throws IOException {
@@ -77,12 +83,14 @@ public class ProtoParquetWriter<T extends MessageOrBuilder> extends ParquetWrite
* @param file The file name to write to.
* @param protoMessage Protobuf message class
* @throws IOException if there is an error while writing
+ *
+ * @deprecated will be removed in 2.0.0.; Use ProtoParquetWriter.Builder instead
*/
+ @Deprecated
public ProtoParquetWriter(Path file, Class<? extends Message> protoMessage) throws IOException {
this(file, protoMessage, CompressionCodecName.UNCOMPRESSED,
DEFAULT_BLOCK_SIZE, DEFAULT_PAGE_SIZE);
}
-
public static <T> Builder<T> builder(Path file) {
return new Builder<T>(file);
}
@@ -90,13 +98,10 @@ public class ProtoParquetWriter<T extends MessageOrBuilder> extends ParquetWrite
public static <T> Builder<T> builder(OutputFile file) {
return new Builder<T>(file);
}
-
private static <T extends MessageOrBuilder> WriteSupport<T> writeSupport(Class<? extends Message> protoMessage) {
- return new ProtoWriteSupport<T>(protoMessage);
+ return new ProtoWriteSupport<>(protoMessage);
}
-
public static class Builder<T> extends ParquetWriter.Builder<T, Builder<T>> {
-
Class<? extends Message> protoMessage = null;
private Builder(Path file) {
@@ -110,7 +115,6 @@ public class ProtoParquetWriter<T extends MessageOrBuilder> extends ParquetWrite
protected Builder<T> self() {
return this;
}
-
public Builder<T> withMessage(Class<? extends Message> protoMessage){
this.protoMessage = protoMessage;
return this;
@@ -118,6 +122,6 @@ public class ProtoParquetWriter<T extends MessageOrBuilder> extends ParquetWrite
protected WriteSupport<T> getWriteSupport(Configuration conf) {
return (WriteSupport<T>) ProtoParquetWriter.writeSupport(protoMessage);
- }
+ }
}
}
diff --git a/parquet-protobuf/src/test/java/org/apache/parquet/proto/TestUtils.java b/parquet-protobuf/src/test/java/org/apache/parquet/proto/TestUtils.java
index 38256f4..85cb33d 100644
--- a/parquet-protobuf/src/test/java/org/apache/parquet/proto/TestUtils.java
+++ b/parquet-protobuf/src/test/java/org/apache/parquet/proto/TestUtils.java
@@ -26,6 +26,7 @@ import com.twitter.elephantbird.util.Protobufs;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.parquet.hadoop.ParquetReader;
+import org.apache.parquet.hadoop.ParquetWriter;
import org.apache.parquet.hadoop.util.HadoopInputFile;
import org.apache.parquet.io.InputFile;
@@ -46,9 +47,7 @@ public class TestUtils {
}
public static <T extends MessageOrBuilder> List<T> writeAndRead(T... records) throws IOException {
- Class<? extends Message> cls = inferRecordsClass(records);
-
- Path file = writeMessages(cls, records);
+ Path file = writeMessages(records);
return readMessages(file);
}
@@ -198,14 +197,11 @@ public class TestUtils {
* Writes messages to temporary file and returns its path.
*/
public static Path writeMessages(MessageOrBuilder... records) throws IOException {
- return writeMessages(inferRecordsClass(records), records);
- }
-
- public static Path writeMessages(Class<? extends Message> cls, MessageOrBuilder... records) throws IOException {
Path file = someTemporaryFilePath();
+ Class<? extends Message> cls = inferRecordsClass(records);
- ProtoParquetWriter<MessageOrBuilder> writer =
- new ProtoParquetWriter<MessageOrBuilder>(file, cls);
+ ParquetWriter<MessageOrBuilder> writer =
+ ProtoParquetWriter.<MessageOrBuilder>builder(file).withMessage(cls).build();
for (MessageOrBuilder record : records) {
writer.write(record);