Skip to content

Commit

Permalink
Remove deprecated parts
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Oct 18, 2023
1 parent 16a1aa5 commit bc38a73
Showing 1 changed file with 3 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,13 @@
import org.apache.parquet.thrift.projection.FieldProjectionFilter;
import org.apache.parquet.thrift.projection.StrictFieldProjectionFilter;
import org.apache.parquet.thrift.projection.ThriftProjectionException;
import org.apache.parquet.thrift.projection.deprecated.DeprecatedFieldProjectionFilter;
import org.apache.parquet.thrift.struct.ThriftType.StructType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Deprecated
public class ThriftReadSupport<T> extends ReadSupport<T> {
private static final Logger LOG = LoggerFactory.getLogger(ThriftReadSupport.class);

/**
* Deprecated. Use {@link #STRICT_THRIFT_COLUMN_FILTER_KEY}
* Accepts a ";" delimited list of globs in the syntax implemented by {@link DeprecatedFieldProjectionFilter}
*/
@Deprecated
public static final String THRIFT_COLUMN_FILTER_KEY = "parquet.thrift.column.filter";

/**
* Accepts a ";" delimited list of glob paths, in the syntax implemented by {@link StrictFieldProjectionFilter}
*/
Expand Down Expand Up @@ -102,41 +93,17 @@ public static void setRecordConverterClass(Configuration conf,
conf.set(RECORD_CONVERTER_CLASS_KEY, klass.getName());
}

@Deprecated
public static void setProjectionPushdown(JobConf jobConf, String projectionString) {
jobConf.set(THRIFT_COLUMN_FILTER_KEY, projectionString);
}

public static void setStrictFieldProjectionFilter(Configuration conf, String semicolonDelimitedGlobs) {
conf.set(STRICT_THRIFT_COLUMN_FILTER_KEY, semicolonDelimitedGlobs);
}

public static FieldProjectionFilter getFieldProjectionFilter(Configuration conf) {
String deprecated = conf.get(THRIFT_COLUMN_FILTER_KEY);
String strict = conf.get(STRICT_THRIFT_COLUMN_FILTER_KEY);

if (Strings.isNullOrEmpty(deprecated) && Strings.isNullOrEmpty(strict)) {
if (Strings.isNullOrEmpty(strict)) {
return null;
}

if(!Strings.isNullOrEmpty(deprecated) && !Strings.isNullOrEmpty(strict)) {
throw new ThriftProjectionException(
"You cannot provide both "
+ THRIFT_COLUMN_FILTER_KEY
+ " and "
+ STRICT_THRIFT_COLUMN_FILTER_KEY
+"! "
+ THRIFT_COLUMN_FILTER_KEY
+ " is deprecated."
);
}

if (!Strings.isNullOrEmpty(deprecated)) {
LOG.warn("Using {} is deprecated. Please see the docs for {}!",
THRIFT_COLUMN_FILTER_KEY, STRICT_THRIFT_COLUMN_FILTER_KEY);
return new DeprecatedFieldProjectionFilter(deprecated);
}

return StrictFieldProjectionFilter.fromSemicolonDelimitedString(strict);
}

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

//set requestedProjections only when it's specified
Expand Down

0 comments on commit bc38a73

Please sign in to comment.