|
42 | 42 |
|
43 | 43 | /** |
44 | 44 | * Loads and manages metadata filter configurations for the CLP connector. |
45 | | - * <p> |
| 45 | + * <p></p> |
46 | 46 | * The configuration file is specified by the {@code clp.metadata-filter-config} property |
47 | 47 | * and defines metadata filters used to optimize query execution through split pruning. |
48 | | - * Filters can be declared at different scopes: |
| 48 | + * <p></p> |
| 49 | + * Filter configs can be declared at either a catalog, schema, or table scope. Filter configs under |
| 50 | + * a particular scope will apply to all child scopes (e.g., schema-level filter configs will apply |
| 51 | + * to all tables within that schema). |
| 52 | + * <p></p> |
| 53 | + * Each filter config includes the following fields: |
49 | 54 | * <ul> |
50 | | - * <li><b>Catalog-level</b>: applies to all schemas and tables within a catalog.</li> |
51 | | - * <li><b>Schema-level</b>: applies to all tables within a specific catalog and schema.</li> |
52 | | - * <li><b>Table-level</b>: applies to a fully qualified table {@code catalog.schema.table}.</li> |
53 | | - * </ul> |
54 | | - * |
55 | | - * <p>Each scope maps to a list of filter definitions. Each filter includes the following fields: |
56 | | - * <ul> |
57 | | - * <li><b>{@code columnName}</b> (required): the name of a column in the table's logical schema. |
58 | | - * Only columns of numeric type are currently supported as metadata filters.</li> |
| 55 | + * <li><b>{@code columnName}</b>: the name of a column in the table's logical schema. Currently, |
| 56 | + * only numeric-type columns can be used as metadata filters.</li> |
59 | 57 | * |
60 | 58 | * <li><b>{@code rangeMapping}</b> (optional): remaps a logical filter to physical metadata-only columns. |
61 | 59 | * This field is valid only for numeric-type columns. |
|
69 | 67 | * }</pre> |
70 | 68 | * This ensures the filter applies to a superset of the actual result set, enabling safe pruning.</li> |
71 | 69 | * |
72 | | - * <li><b>{@code required}</b> (optional, default: {@code false}): indicates whether the filter must be present |
73 | | - * in the extracted metadata filter SQL query. If a required filter is missing or cannot be pushed down, |
74 | | - * the query will be rejected.</li> |
| 70 | + * <li><b>{@code required}</b> (optional, defaults to {@code false}): indicates whether the filter |
| 71 | + * must be present in the translated metadata filter SQL query. If a required filter is missing or |
| 72 | + * cannot be pushed down, the query will be rejected.</li> |
75 | 73 | * </ul> |
76 | 74 | */ |
77 | 75 | public class ClpMetadataFilterProvider |
@@ -112,29 +110,27 @@ public void checkContainsRequiredFilters(SchemaTableName schemaTableName, String |
112 | 110 | } |
113 | 111 |
|
114 | 112 | /** |
115 | | - * Rewrites the input SQL string by remapping filter conditions based on the configured |
116 | | - * metadata filter range mappings for the given scope. |
| 113 | + * Rewrites the given SQL string to remap filter conditions based on the configured range |
| 114 | + * mappings for the given scope. |
117 | 115 | * |
118 | 116 | * <p>The {@code scope} follows the format {@code catalog[.schema][.table]}, and determines |
119 | | - * which filter mappings to apply. For each level of scope (catalog, schema, table), this |
120 | | - * method collects all range mappings defined in the metadata filter configuration. Mappings |
121 | | - * from more specific scopes (e.g., table-level) override or supplement those from broader |
122 | | - * scopes (e.g., catalog-level). |
| 117 | + * which filter mappings to apply, since mappings from more specific scopes (e.g., table-level) |
| 118 | + * override or supplement those from broader scopes (e.g., catalog-level). For each scope |
| 119 | + * (catalog, schema, table), this method collects all range mappings defined in the metadata |
| 120 | + * filter configuration. |
123 | 121 | * |
124 | 122 | * <p>This method performs regex-based replacements to convert numeric filter expressions such |
125 | 123 | * as: |
126 | | - * |
127 | 124 | * <ul> |
128 | 125 | * <li>{@code "msg.timestamp" >= 1234} → {@code end_timestamp >= 1234}</li> |
129 | 126 | * <li>{@code "msg.timestamp" <= 5678} → {@code begin_timestamp <= 5678}</li> |
130 | 127 | * <li>{@code "msg.timestamp" = 4567} → |
131 | 128 | * {@code (begin_timestamp <= 4567 AND end_timestamp >= 4567)}</li> |
132 | 129 | * </ul> |
133 | 130 | * |
134 | | - * @param scope the catalog.schema.table scope used to resolve applicable filter mappings |
135 | | - * @param sql the original SQL expression to be remapped |
136 | | - * @return the rewritten SQL string with metadata filter expressions remapped according to the |
137 | | - * configured range mappings |
| 131 | + * @param scope |
| 132 | + * @param sql |
| 133 | + * @return the rewritten SQL string |
138 | 134 | */ |
139 | 135 | public String remapFilterSql(String scope, String sql) |
140 | 136 | { |
|
0 commit comments