3131
3232import static com .facebook .presto .plugin .clp .ClpErrorCode .CLP_MANDATORY_METADATA_FILTER_NOT_VALID ;
3333import static com .facebook .presto .plugin .clp .ClpErrorCode .CLP_METADATA_FILTER_CONFIG_NOT_FOUND ;
34- import static com .facebook .presto .plugin .clp .metadata .filter .ClpMetadataFilter . MetadataProviderSpecific ;
34+ import static com .facebook .presto .plugin .clp .metadata .filter .ClpMetadataFilterConfig . MetadataProviderSpecificOptions ;
3535import static com .google .common .collect .ImmutableSet .toImmutableSet ;
3636import static java .util .Objects .requireNonNull ;
3737
4646 * to all tables within that schema).
4747 * <p></p>
4848 * Different metadata providers can customize filter configurations through the
49- * {@code metadataProviderSpecific} field within each {@link ClpMetadataFilter }.
49+ * {@code metadataProviderSpecific} field within each {@link ClpMetadataFilterConfig }.
5050 */
5151public abstract class ClpMetadataFilterProvider
5252{
53- protected final Map <String , List <ClpMetadataFilter >> filterMap ;
53+ protected final Map <String , List <ClpMetadataFilterConfig >> filterMap ;
5454
5555 public ClpMetadataFilterProvider (ClpConfig config )
5656 {
@@ -63,22 +63,22 @@ public ClpMetadataFilterProvider(ClpConfig config)
6363 ObjectMapper mapper = new ObjectMapper ();
6464 SimpleModule module = new SimpleModule ();
6565 module .addDeserializer (
66- MetadataProviderSpecific .class ,
67- new ClpMetadataProviderSpecificDeserializer ( getMetadataProviderSpecificClass ()));
66+ MetadataProviderSpecificOptions .class ,
67+ new ClpMetadataProviderSpecificOptionsDeserializer ( getMetadataProviderSpecificOptionsClass ()));
6868 mapper .registerModule (module );
6969 try {
7070 filterMap = mapper .readValue (
7171 new File (config .getMetadataFilterConfig ()),
72- new TypeReference <Map <String , List <ClpMetadataFilter >>>() {});
72+ new TypeReference <Map <String , List <ClpMetadataFilterConfig >>>() {});
7373 }
7474 catch (IOException e ) {
7575 throw new PrestoException (CLP_METADATA_FILTER_CONFIG_NOT_FOUND , "Failed to open metadata filter config file" , e );
7676 }
7777 }
7878
7979 /**
80- * Rewrites the given pushed-down expression for metadata filtering to remap filter conditions
81- * based on the configured range mappings for the given scope.
80+ * Rewrites the given {@code pushDownExpression} for metadata filtering to remap filter
81+ * conditions based on the configured range mappings for the given scope.
8282 * <p></p>
8383 * The {@code scope} follows the format {@code catalog[.schema][.table]}, and determines
8484 * which filter mappings to apply, since mappings from more specific scopes (e.g., table-level)
@@ -87,19 +87,19 @@ public ClpMetadataFilterProvider(ClpConfig config)
8787 * filter configuration.
8888 *
8989 * @param scope the scope of the filter
90- * @param pushDownExpression the pushed-down expression for metadata filtering that needs to
91- * be rewritten
92- * @return the rewritten pushed-down expression for metadata filtering
90+ * @param pushDownExpression the {@code pushDownExpression} for metadata filtering that needs
91+ * to be rewritten
92+ * @return the rewritten {@code pushDownExpression} for metadata filtering
9393 */
9494 public abstract String remapMetadataFilterPushDown (String scope , String pushDownExpression );
9595
9696 /**
97- * Checks for the given table, if the given pushed-down expression for metadata filtering
97+ * Checks for the given table, if the given {@code pushDownExpression} for metadata filtering
9898 * contains all required fields.
9999 *
100100 * @param tableScopeSet the set of scopes of the tables that are being queried
101- * @param metadataFilterPushDownExpression the pushed-down expression for metadata filtering
102- * to be checked
101+ * @param metadataFilterPushDownExpression the {@code pushDownExpression} for metadata
102+ * filtering to be checked
103103 */
104104 public void checkContainsRequiredFilters (Set <String > tableScopeSet , String metadataFilterPushDownExpression )
105105 {
@@ -126,20 +126,20 @@ public Set<String> getColumnNames(String scope)
126126 }
127127
128128 /**
129- * Returns the {@link MetadataProviderSpecific } class implemented by the user. To respect our
129+ * Returns the {@link MetadataProviderSpecificOptions } class implemented by the user. To respect our
130130 * code style, we recommend implementing a {@code protected static class} as an inner class
131131 * in the user-implemented {@link ClpMetadataFilterProvider} class.
132132 *
133- * @return the user-implemented {@link MetadataProviderSpecific } class.
133+ * @return the user-implemented {@link MetadataProviderSpecificOptions } class.
134134 */
135- protected abstract Class <? extends MetadataProviderSpecific > getMetadataProviderSpecificClass ();
135+ protected abstract Class <? extends MetadataProviderSpecificOptions > getMetadataProviderSpecificOptionsClass ();
136136
137137 private Set <String > getRequiredColumnNames (String scope )
138138 {
139139 return collectColumnNamesFromScopes (scope , this ::getRequiredColumnNamesFromFilters );
140140 }
141141
142- private Set <String > collectColumnNamesFromScopes (String scope , Function <List <ClpMetadataFilter >, Set <String >> extractor )
142+ private Set <String > collectColumnNamesFromScopes (String scope , Function <List <ClpMetadataFilterConfig >, Set <String >> extractor )
143143 {
144144 String [] splitScope = scope .split ("\\ ." );
145145 ImmutableSet .Builder <String > builder = ImmutableSet .builder ();
@@ -157,14 +157,14 @@ private Set<String> collectColumnNamesFromScopes(String scope, Function<List<Clp
157157 return builder .build ();
158158 }
159159
160- private Set <String > getAllColumnNamesFromFilters (List <ClpMetadataFilter > filters )
160+ private Set <String > getAllColumnNamesFromFilters (List <ClpMetadataFilterConfig > filters )
161161 {
162162 return null != filters ? filters .stream ()
163163 .map (filter -> filter .columnName )
164164 .collect (toImmutableSet ()) : ImmutableSet .of ();
165165 }
166166
167- private Set <String > getRequiredColumnNamesFromFilters (List <ClpMetadataFilter > filters )
167+ private Set <String > getRequiredColumnNamesFromFilters (List <ClpMetadataFilterConfig > filters )
168168 {
169169 return null != filters ? filters .stream ()
170170 .filter (filter -> filter .required )
0 commit comments