Skip to content

Commit f8c4006

Browse files
committed
[parquet-thrift] start removing things marked for deprecation
1 parent 9db6236 commit f8c4006

28 files changed

+39
-1734
lines changed

parquet-thrift/pom.xml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -120,29 +120,11 @@
120120
<type>test-jar</type>
121121
<scope>test</scope>
122122
</dependency>
123-
<dependency>
124-
<groupId>org.apache.parquet</groupId>
125-
<artifactId>parquet-pig</artifactId>
126-
<version>1.15.0</version>
127-
</dependency>
128-
<dependency>
129-
<groupId>org.apache.pig</groupId>
130-
<artifactId>pig</artifactId>
131-
<version>${pig.version}</version>
132-
<classifier>${pig.classifier}</classifier>
133-
<scope>provided</scope>
134-
</dependency>
135123
<dependency>
136124
<groupId>javax.annotation</groupId>
137125
<artifactId>javax.annotation-api</artifactId>
138126
<version>${javax.annotation.version}</version>
139127
</dependency>
140-
<dependency> <!-- for pig runtime in tests -->
141-
<groupId>org.antlr</groupId>
142-
<artifactId>antlr-runtime</artifactId>
143-
<version>3.5.3</version>
144-
<scope>test</scope>
145-
</dependency>
146128
<dependency>
147129
<groupId>org.apache.thrift</groupId>
148130
<artifactId>libthrift</artifactId>
@@ -160,13 +142,6 @@
160142
<version>${slf4j.version}</version>
161143
<scope>test</scope>
162144
</dependency>
163-
<dependency>
164-
<!-- needed for Pig tests -->
165-
<groupId>log4j</groupId>
166-
<artifactId>log4j</artifactId>
167-
<version>1.2.17</version>
168-
<scope>test</scope>
169-
</dependency>
170145
<dependency>
171146
<groupId>org.apache.parquet</groupId>
172147
<artifactId>parquet-hadoop</artifactId>

parquet-thrift/src/main/java/org/apache/parquet/hadoop/thrift/AbstractThriftWriteSupport.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package org.apache.parquet.hadoop.thrift;
1717

18-
import com.twitter.elephantbird.pig.util.ThriftToPig;
1918
import java.util.Map;
2019
import org.apache.hadoop.conf.Configuration;
2120
import org.apache.parquet.conf.HadoopParquetConfiguration;
@@ -25,13 +24,11 @@
2524
import org.apache.parquet.io.ColumnIOFactory;
2625
import org.apache.parquet.io.MessageColumnIO;
2726
import org.apache.parquet.io.api.RecordConsumer;
28-
import org.apache.parquet.pig.PigMetaData;
2927
import org.apache.parquet.schema.MessageType;
3028
import org.apache.parquet.thrift.ParquetWriteProtocol;
3129
import org.apache.parquet.thrift.ThriftMetaData;
3230
import org.apache.parquet.thrift.ThriftSchemaConverter;
3331
import org.apache.parquet.thrift.struct.ThriftType.StructType;
34-
import org.apache.thrift.TBase;
3532
import org.slf4j.Logger;
3633
import org.slf4j.LoggerFactory;
3734

@@ -99,26 +96,10 @@ protected void init(Class<T> thriftClass) {
9996

10097
final Map<String, String> extraMetaData =
10198
new ThriftMetaData(thriftClass.getName(), thriftStruct).toExtraMetaData();
102-
// adding the Pig schema as it would have been mapped from thrift
103-
// TODO: make this work for non-tbase types
104-
if (isPigLoaded() && TBase.class.isAssignableFrom(thriftClass)) {
105-
new PigMetaData(new ThriftToPig((Class<? extends TBase<?, ?>>) thriftClass).toSchema())
106-
.addToMetaData(extraMetaData);
107-
}
10899

109100
this.writeContext = new WriteContext(schema, extraMetaData);
110101
}
111102

112-
protected boolean isPigLoaded() {
113-
try {
114-
Class.forName("org.apache.pig.impl.logicalLayer.schema.Schema");
115-
return true;
116-
} catch (ClassNotFoundException e) {
117-
LOG.info("Pig is not loaded, pig metadata will not be written");
118-
return false;
119-
}
120-
}
121-
122103
@Override
123104
public WriteContext init(Configuration configuration) {
124105
return init(new HadoopParquetConfiguration(configuration));

parquet-thrift/src/main/java/org/apache/parquet/hadoop/thrift/ParquetThriftBytesOutputFormat.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,4 @@ public ParquetThriftBytesOutputFormat(
7272
FieldIgnoredHandler errorHandler) {
7373
super(new ThriftBytesWriteSupport(configuration, protocolFactory, thriftClass, buffered, errorHandler));
7474
}
75-
76-
/**
77-
* @param protocolFactory the protocol factory to use to read the bytes
78-
* @param thriftClass thriftClass the class to extract the schema from
79-
* @param buffered whether we should buffer each record
80-
* @param errorHandler handle record corruption and schema incompatible exception
81-
* @deprecated Use @link{ParquetThriftBytesOutputFormat(
82-
* Configuration configuration, TProtocolFactory protocolFactory,
83-
* {@literal Class<\? extends TBase<\?, ?>>} thriftClass, boolean buffered,
84-
* FieldIgnoredHandler errorHandler)} instead.
85-
*/
86-
@Deprecated
87-
public ParquetThriftBytesOutputFormat(
88-
TProtocolFactory protocolFactory,
89-
Class<? extends TBase<?, ?>> thriftClass,
90-
boolean buffered,
91-
FieldIgnoredHandler errorHandler) {
92-
this(new Configuration(), protocolFactory, thriftClass, buffered, errorHandler);
93-
}
9475
}

parquet-thrift/src/main/java/org/apache/parquet/hadoop/thrift/ParquetThriftOutputFormat.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
public class ParquetThriftOutputFormat<T extends TBase<?, ?>> extends ParquetOutputFormat<T> {
3030

3131
public static void setThriftClass(Job job, Class<? extends TBase<?, ?>> thriftClass) {
32-
ThriftWriteSupport.setThriftClass(ContextUtil.getConfiguration(job), thriftClass);
32+
TBaseWriteSupport.setThriftClass(ContextUtil.getConfiguration(job), thriftClass);
3333
}
3434

3535
public static Class<? extends TBase<?, ?>> getThriftClass(Job job) {
36-
return ThriftWriteSupport.getThriftClass(ContextUtil.getConfiguration(job));
36+
return TBaseWriteSupport.getThriftClass(ContextUtil.getConfiguration(job));
3737
}
3838

3939
public ParquetThriftOutputFormat() {
40-
super(new ThriftWriteSupport<T>());
40+
super(new TBaseWriteSupport<T>());
4141
}
4242
}

parquet-thrift/src/main/java/org/apache/parquet/hadoop/thrift/ThriftBytesWriteSupport.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,6 @@ public ThriftBytesWriteSupport() {
9999
this.errorHandler = null;
100100
}
101101

102-
/**
103-
* @deprecated Use @link{ThriftBytesWriteSupport(Configuration configuration,
104-
* TProtocolFactory protocolFactory, {@literal Class<? extends TBase<?,?>>} thriftClass,
105-
* boolean buffered, FieldIgnoredHandler errorHandler)} instead
106-
*/
107-
@Deprecated
108-
public ThriftBytesWriteSupport(
109-
TProtocolFactory protocolFactory,
110-
Class<? extends TBase<?, ?>> thriftClass,
111-
boolean buffered,
112-
FieldIgnoredHandler errorHandler) {
113-
this(new Configuration(), protocolFactory, thriftClass, buffered, errorHandler);
114-
}
115-
116102
public ThriftBytesWriteSupport(
117103
Configuration configuration,
118104
TProtocolFactory protocolFactory,

parquet-thrift/src/main/java/org/apache/parquet/hadoop/thrift/ThriftReadSupport.java

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.Map;
2424
import java.util.Set;
2525
import org.apache.hadoop.conf.Configuration;
26-
import org.apache.hadoop.mapred.JobConf;
2726
import org.apache.parquet.Strings;
2827
import org.apache.parquet.conf.HadoopParquetConfiguration;
2928
import org.apache.parquet.conf.ParquetConfiguration;
@@ -39,7 +38,6 @@
3938
import org.apache.parquet.thrift.projection.FieldProjectionFilter;
4039
import org.apache.parquet.thrift.projection.StrictFieldProjectionFilter;
4140
import org.apache.parquet.thrift.projection.ThriftProjectionException;
42-
import org.apache.parquet.thrift.projection.deprecated.DeprecatedFieldProjectionFilter;
4341
import org.apache.parquet.thrift.struct.ThriftType.StructType;
4442
import org.apache.thrift.TBase;
4543
import org.apache.thrift.protocol.TProtocol;
@@ -49,13 +47,6 @@
4947
public class ThriftReadSupport<T> extends ReadSupport<T> {
5048
private static final Logger LOG = LoggerFactory.getLogger(ThriftReadSupport.class);
5149

52-
/**
53-
* Deprecated. Use {@link #STRICT_THRIFT_COLUMN_FILTER_KEY}
54-
* Accepts a ";" delimited list of globs in the syntax implemented by {@link DeprecatedFieldProjectionFilter}
55-
*/
56-
@Deprecated
57-
public static final String THRIFT_COLUMN_FILTER_KEY = "parquet.thrift.column.filter";
58-
5950
/**
6051
* Accepts a ";" delimited list of glob paths, in the syntax implemented by {@link StrictFieldProjectionFilter}
6152
*/
@@ -73,20 +64,6 @@ public class ThriftReadSupport<T> extends ReadSupport<T> {
7364

7465
protected Class<T> thriftClass;
7566

76-
/**
77-
* A {@link ThriftRecordConverter} builds an object by working with {@link TProtocol}. The default
78-
* implementation creates standard Apache Thrift {@link TBase} objects; to support alternatives, such
79-
* as <a href="http://github.com/twitter/scrooge">Twiter's Scrooge</a>, a custom converter can be specified.
80-
*
81-
* @param conf a mapred jobconf
82-
* @param klass a thrift class
83-
* @deprecated use {@link #setRecordConverterClass(Configuration, Class)} below
84-
*/
85-
@Deprecated
86-
public static void setRecordConverterClass(JobConf conf, Class<?> klass) {
87-
setRecordConverterClass((Configuration) conf, klass);
88-
}
89-
9067
/**
9168
* A {@link ThriftRecordConverter} builds an object by working with {@link TProtocol}. The default
9269
* implementation creates standard Apache Thrift {@link TBase} objects; to support alternatives, such
@@ -99,11 +76,6 @@ public static void setRecordConverterClass(Configuration conf, Class<?> klass) {
9976
conf.set(RECORD_CONVERTER_CLASS_KEY, klass.getName());
10077
}
10178

102-
@Deprecated
103-
public static void setProjectionPushdown(JobConf jobConf, String projectionString) {
104-
jobConf.set(THRIFT_COLUMN_FILTER_KEY, projectionString);
105-
}
106-
10779
public static void setStrictFieldProjectionFilter(Configuration conf, String semicolonDelimitedGlobs) {
10880
conf.set(STRICT_THRIFT_COLUMN_FILTER_KEY, semicolonDelimitedGlobs);
10981
}
@@ -113,31 +85,12 @@ public static FieldProjectionFilter getFieldProjectionFilter(Configuration conf)
11385
}
11486

11587
public static FieldProjectionFilter getFieldProjectionFilter(ParquetConfiguration conf) {
116-
String deprecated = conf.get(THRIFT_COLUMN_FILTER_KEY);
11788
String strict = conf.get(STRICT_THRIFT_COLUMN_FILTER_KEY);
11889

119-
if (Strings.isNullOrEmpty(deprecated) && Strings.isNullOrEmpty(strict)) {
90+
if (Strings.isNullOrEmpty(strict)) {
12091
return null;
12192
}
12293

123-
if (!Strings.isNullOrEmpty(deprecated) && !Strings.isNullOrEmpty(strict)) {
124-
throw new ThriftProjectionException("You cannot provide both "
125-
+ THRIFT_COLUMN_FILTER_KEY
126-
+ " and "
127-
+ STRICT_THRIFT_COLUMN_FILTER_KEY
128-
+ "! "
129-
+ THRIFT_COLUMN_FILTER_KEY
130-
+ " is deprecated.");
131-
}
132-
133-
if (!Strings.isNullOrEmpty(deprecated)) {
134-
LOG.warn(
135-
"Using {} is deprecated. Please see the docs for {}!",
136-
THRIFT_COLUMN_FILTER_KEY,
137-
STRICT_THRIFT_COLUMN_FILTER_KEY);
138-
return new DeprecatedFieldProjectionFilter(deprecated);
139-
}
140-
14194
return StrictFieldProjectionFilter.fromSemicolonDelimitedString(strict);
14295
}
14396

@@ -166,8 +119,8 @@ public org.apache.parquet.hadoop.api.ReadSupport.ReadContext init(InitContext co
166119
if (partialSchemaString != null && projectionFilter != null) {
167120
throw new ThriftProjectionException(String.format(
168121
"You cannot provide both a partial schema and field projection filter."
169-
+ "Only one of (%s, %s, %s) should be set.",
170-
PARQUET_READ_SCHEMA, STRICT_THRIFT_COLUMN_FILTER_KEY, THRIFT_COLUMN_FILTER_KEY));
122+
+ "Only one of (%s, %s) should be set.",
123+
PARQUET_READ_SCHEMA, STRICT_THRIFT_COLUMN_FILTER_KEY));
171124
}
172125

173126
// set requestedProjections only when it's specified
@@ -197,13 +150,6 @@ protected MessageType getProjectedSchema(
197150
.convert((Class<TBase<?, ?>>) thriftClass);
198151
}
199152

200-
@Deprecated
201-
@SuppressWarnings("unchecked")
202-
protected MessageType getProjectedSchema(FieldProjectionFilter fieldProjectionFilter) {
203-
return new ThriftSchemaConverter(new Configuration(), fieldProjectionFilter)
204-
.convert((Class<TBase<?, ?>>) thriftClass);
205-
}
206-
207153
private void initThriftClassFromMultipleFiles(Map<String, Set<String>> fileMetadata, Configuration conf)
208154
throws ClassNotFoundException {
209155
initThriftClassFromMultipleFiles(fileMetadata, new HadoopParquetConfiguration(conf));

parquet-thrift/src/main/java/org/apache/parquet/hadoop/thrift/ThriftWriteSupport.java

Lines changed: 0 additions & 85 deletions
This file was deleted.

parquet-thrift/src/main/java/org/apache/parquet/thrift/TBaseRecordConverter.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,6 @@
3030

3131
public class TBaseRecordConverter<T extends TBase<?, ?>> extends ThriftRecordConverter<T> {
3232

33-
/**
34-
* This is for compatibility only.
35-
*
36-
* @param thriftClass a thrift class
37-
* @param requestedParquetSchema the requested Parquet schema
38-
* @param thriftType the thrift type
39-
* @deprecated will be removed in 2.x
40-
*/
41-
@Deprecated
42-
public TBaseRecordConverter(final Class<T> thriftClass, MessageType requestedParquetSchema, StructType thriftType) {
43-
this(thriftClass, requestedParquetSchema, thriftType, (HadoopParquetConfiguration) null);
44-
}
45-
4633
@SuppressWarnings("unused")
4734
public TBaseRecordConverter(
4835
final Class<T> thriftClass, MessageType requestedParquetSchema, StructType thriftType, Configuration conf) {

0 commit comments

Comments
 (0)