/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.trino.plugin.deltalake.metastore.glue;

import com.amazonaws.services.glue.model.Table;
import io.trino.plugin.hive.metastore.glue.DefaultGlueMetastoreTableFilterProvider;

import javax.inject.Inject;
import javax.inject.Provider;

import java.util.Map;
import java.util.function.Predicate;

import static java.util.Objects.requireNonNull;

public class DeltaLakeGlueMetastoreTableFilterProvider
        implements Provider<Predicate<Table>>
{
    private final boolean hideNonDeltaLakeTables;

    @Inject
    public DeltaLakeGlueMetastoreTableFilterProvider(DeltaLakeGlueMetastoreConfig config)
    {
        requireNonNull(config, "config is null");
        this.hideNonDeltaLakeTables = config.isHideNonDeltaLakeTables();
    }

    @Override
    public Predicate<Table> get()
    {
        if (hideNonDeltaLakeTables) {
            return DeltaLakeGlueMetastoreTableFilterProvider::isDeltaLakeTable;
        }
        return table -> true;
    }

    private static boolean isDeltaLakeTable(Table table)
    {
        Map<String, String> parameters = table.getParameters();
        if (parameters == null) {
            return false;
        }
        // todo; add parameters == null check to DefaultGlueMetastoreTableFilterProvider.isDeltaLakeTable (https://github.com/trinodb/trino/issues/12013)
        return DefaultGlueMetastoreTableFilterProvider.isDeltaLakeTable(table);
    }
}

@@ -802,30 +802,8 @@
 r;%0A%0A
-import java.util.Map;%0A
 impo
@@ -1390,23 +1390,21 @@
 eturn De
-ltaLake
+fault
 GlueMeta
@@ -1496,445 +1496,7 @@
    %7D
-%0A%0A    private static boolean isDeltaLakeTable(Table table)%0A    %7B%0A        Map%3CString, String%3E parameters = table.getParameters();%0A        if (parameters == null) %7B%0A            return false;%0A        %7D%0A        // todo; add parameters == null check to DefaultGlueMetastoreTableFilterProvider.isDeltaLakeTable (https://github.com/trinodb/trino/issues/12013)%0A        return DefaultGlueMetastoreTableFilterProvider.isDeltaLakeTable(table);%0A    %7D
 %0A%7D%0A

Remove DeltaLakeGlueMetastoreTableFilterProvider.isDeltaLakeTable