133133import org .apache .iceberg .DataFiles ;
134134import org .apache .iceberg .DeleteFile ;
135135import org .apache .iceberg .DeleteFiles ;
136+ import org .apache .iceberg .FileFormat ;
136137import org .apache .iceberg .FileMetadata ;
137138import org .apache .iceberg .FileScanTask ;
138139import org .apache .iceberg .IsolationLevel ;
281282import static io .trino .plugin .iceberg .IcebergTableProperties .FILE_FORMAT_PROPERTY ;
282283import static io .trino .plugin .iceberg .IcebergTableProperties .FORMAT_VERSION_PROPERTY ;
283284import static io .trino .plugin .iceberg .IcebergTableProperties .OBJECT_STORE_LAYOUT_ENABLED_PROPERTY ;
285+ import static io .trino .plugin .iceberg .IcebergTableProperties .PARQUET_BLOOM_FILTER_COLUMNS_PROPERTY ;
284286import static io .trino .plugin .iceberg .IcebergTableProperties .PARTITIONING_PROPERTY ;
285287import static io .trino .plugin .iceberg .IcebergTableProperties .SORTED_BY_PROPERTY ;
286288import static io .trino .plugin .iceberg .IcebergTableProperties .getPartitioning ;
287289import static io .trino .plugin .iceberg .IcebergTableProperties .getTableLocation ;
288290import static io .trino .plugin .iceberg .IcebergUtil .buildPath ;
289291import static io .trino .plugin .iceberg .IcebergUtil .canEnforceColumnConstraintInSpecs ;
292+ import static io .trino .plugin .iceberg .IcebergUtil .checkFormatForProperty ;
290293import static io .trino .plugin .iceberg .IcebergUtil .commit ;
291294import static io .trino .plugin .iceberg .IcebergUtil .createColumnHandle ;
292295import static io .trino .plugin .iceberg .IcebergUtil .deserializePartitionValue ;
370373import static org .apache .iceberg .TableProperties .DELETE_ISOLATION_LEVEL_DEFAULT ;
371374import static org .apache .iceberg .TableProperties .FORMAT_VERSION ;
372375import static org .apache .iceberg .TableProperties .OBJECT_STORE_ENABLED ;
376+ import static org .apache .iceberg .TableProperties .PARQUET_BLOOM_FILTER_COLUMN_ENABLED_PREFIX ;
373377import static org .apache .iceberg .TableProperties .WRITE_DATA_LOCATION ;
374378import static org .apache .iceberg .TableProperties .WRITE_LOCATION_PROVIDER_IMPL ;
375379import static org .apache .iceberg .expressions .Expressions .alwaysTrue ;
@@ -392,6 +396,7 @@ public class IcebergMetadata
392396 .add (FORMAT_VERSION_PROPERTY )
393397 .add (OBJECT_STORE_LAYOUT_ENABLED_PROPERTY )
394398 .add (DATA_LOCATION_PROPERTY )
399+ .add (PARQUET_BLOOM_FILTER_COLUMNS_PROPERTY )
395400 .add (PARTITIONING_PROPERTY )
396401 .add (SORTED_BY_PROPERTY )
397402 .build ();
@@ -2273,6 +2278,21 @@ public void setTableProperties(ConnectorSession session, ConnectorTableHandle ta
22732278 extraProperties .forEach (updateProperties ::set );
22742279 }
22752280
2281+ if (properties .containsKey (PARQUET_BLOOM_FILTER_COLUMNS_PROPERTY )) {
2282+ checkFormatForProperty (getFileFormat (icebergTable ).toIceberg (), FileFormat .PARQUET , PARQUET_BLOOM_FILTER_COLUMNS_PROPERTY );
2283+ //noinspection unchecked
2284+ List <String > parquetBloomFilterColumns = (List <String >) properties .get (PARQUET_BLOOM_FILTER_COLUMNS_PROPERTY )
2285+ .orElseThrow (() -> new IllegalArgumentException ("The parquet_bloom_filter_columns property cannot be empty" ));
2286+ if (parquetBloomFilterColumns .isEmpty ()) {
2287+ icebergTable .properties ().keySet ().stream ()
2288+ .filter (key -> key .startsWith (PARQUET_BLOOM_FILTER_COLUMN_ENABLED_PREFIX ))
2289+ .forEach (updateProperties ::remove );
2290+ }
2291+ else {
2292+ parquetBloomFilterColumns .forEach (column -> updateProperties .set (PARQUET_BLOOM_FILTER_COLUMN_ENABLED_PREFIX + column , "true" ));
2293+ }
2294+ }
2295+
22762296 if (properties .containsKey (FILE_FORMAT_PROPERTY )) {
22772297 IcebergFileFormat fileFormat = (IcebergFileFormat ) properties .get (FILE_FORMAT_PROPERTY )
22782298 .orElseThrow (() -> new IllegalArgumentException ("The format property cannot be empty" ));
0 commit comments