All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vmware.dcm.ExtractAccessedTables Maven / Gradle / Ivy

Go to download

Library for building declarative cluster managers. Please refer to the README at github.com/vmware/declarative-cluster-management/ for instructions on setting up solvers before use.

There is a newer version: 0.15.0
Show newest version
/*
 * Copyright 2018-2020 VMware, Inc. All Rights Reserved.
 *
 * SPDX-License-Identifier: BSD-2
 */

package com.vmware.dcm;

import com.facebook.presto.sql.tree.DefaultTraversalVisitor;
import com.facebook.presto.sql.tree.Table;

import java.util.Locale;
import java.util.Set;

/**
 * Collects table names for every table referenced within a query.
 */
public class ExtractAccessedTables extends DefaultTraversalVisitor {
    final Set tableNames;

    ExtractAccessedTables(final Set tableNames) {
        this.tableNames = tableNames;
    }

    @Override
    protected Void visitTable(final Table node, final Void context) {
        tableNames.add(node.getName().getSuffix().toUpperCase(Locale.getDefault()));
        return super.visitTable(node, context);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy