Search in sources :

Example 1 with TableLayoutFilterCoverage

use of com.facebook.presto.spi.TableLayoutFilterCoverage in project presto by prestodb.

the class WarnOnScanWithoutPartitionPredicate method validate.

@Override
public void validate(PlanNode plan, Session session, Metadata metadata, SqlParser sqlParser, TypeProvider types, WarningCollector warningCollector) {
    for (TableScanNode scan : searchFrom(plan).where(TableScanNode.class::isInstance).<TableScanNode>findAll()) {
        TableHandle tableHandle = scan.getTable();
        TableLayoutFilterCoverage partitioningFilterCoverage = metadata.getTableLayoutFilterCoverage(session, tableHandle, warnOnNoTableLayoutFilter);
        if (partitioningFilterCoverage == NOT_COVERED) {
            String warningMessage = String.format("No partition filter for scan of table %s", scan.getTable().getConnectorHandle());
            warningCollector.add(new PrestoWarning(PERFORMANCE_WARNING, warningMessage));
        }
    }
}
Also used : TableLayoutFilterCoverage(com.facebook.presto.spi.TableLayoutFilterCoverage) TableScanNode(com.facebook.presto.spi.plan.TableScanNode) PrestoWarning(com.facebook.presto.spi.PrestoWarning) TableHandle(com.facebook.presto.spi.TableHandle)

Aggregations

PrestoWarning (com.facebook.presto.spi.PrestoWarning)1 TableHandle (com.facebook.presto.spi.TableHandle)1 TableLayoutFilterCoverage (com.facebook.presto.spi.TableLayoutFilterCoverage)1 TableScanNode (com.facebook.presto.spi.plan.TableScanNode)1