Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Proposed TableEnvironment SQL API Changes:


Code Block
languagejava
titleTableEnvironment
linenumberstrue
public interface TableEnvironment {
	
	/**
     * Gets the names of all databases registered in the specific catalog.
     *
     * @param catalogName specific catalogName
     * @return A list of the names of all registered databases in the specific catalog.
     */
    String[] listDatabases(String catalogName);

    /**
     * Gets the names of all functions with specific catalog and database in this environment.
     *
     * @param catalogName specific catalogName
     * @param databaseName specific databaseName
     * @return A list of the names of all functions with the specific catalog and database.
     */
    String[] listFunctions(String catalogName, String databaseName);

    /**
     * Gets the names of all views available with the specific catalog and database. It returns both
     * temporary and permanent views.
     *
     * @param catalogName specific catalogName
     * @param databaseName specific databaseName
     * @return A list of the names of all registered views with the specific catalog and database.
     */
    String[] listViews(String catalogName, String databaseName);
}


Code Block
languagejava
titleShowOperations
linenumberstrue


// ShowCatalogsOperation
public class ShowCatalogsOperation implements ShowOperation {

    private final boolean useLike;
    private final boolean notLike;
    private final String likePattern;

    public ShowCatalogsOperation(boolean useLike, boolean notLike, String likePattern) {
        this.useLike = useLike;
        this.notLike = notLike;
        this.likePattern = likePattern;
    }

    @Override
    public String asSummaryString() {
        return "SHOW CATALOGS";
    }
}

// ShowDatabasesOperation
public class ShowDatabasesOperation implements ShowOperation {

    private final String catalogName;
    private final boolean useLike;
    private final boolean notLike;
    private final String likePattern;
    private final String preposition;

    public ShowDatabasesOperation(
            String catalogName,
            boolean useLike,
            boolean notLike,
            String likePattern,
            String preposition) {
        this.catalogName = catalogName;
        this.useLike = useLike;
        this.notLike = notLike;
        this.likePattern = likePattern;
        this.preposition = preposition;
    }

    @Override
    public String asSummaryString() {
        return "SHOW DATABASES";
    }
}

// ShowFunctionsOperation
public class ShowFunctionsOperation implements ShowOperation {

    private final String catalogName;
    private final String databaseName;
    private final boolean useLike;
    private final boolean notLike;
    private final String likePattern;
    private final String preposition;
    private final FunctionScope functionScope;

    /**
     * Represent scope of function.
     *
     * <ul>
     *   <li><b>USER</b> return only user-defined functions
     *   <li><b>ALL</b> return all user-defined and built-in functions
     * </ul>
     */
    public enum FunctionScope {
        USER,
        ALL
    }

    public ShowFunctionsOperation(
            String catalogName,
            String databaseName,
            boolean useLike,
            boolean notLike,
            String likePattern,
            String preposition,
            FunctionScope functionScope) {
        this.catalogName = catalogName;
        this.databaseName = databaseName;
        this.useLike = useLike;
        this.notLike = notLike;
        this.likePattern = likePattern;
        this.preposition = preposition;
        this.functionScope = functionScope;
    }

    @Override
    public String asSummaryString() {
        if (functionScope == FunctionScope.ALL) {
            return "SHOW FUNCTIONS";
        } else {
            return String.format("SHOW %s FUNCTIONS", functionScope);
        }
    }

    public FunctionScope getFunctionScope() {
        return functionScope;
    }
}

// ShowViewsOperation
public class ShowViewsOperation implements ShowOperation {

    private final String catalogName;
    private final String databaseName;
    private final boolean useLike;
    private final boolean notLike;
    private final String likePattern;
    private final String preposition;

    public ShowViewsOperation(
            String catalogName,
            String databaseName,
            boolean useLike,
            boolean notLike,
            String likePattern,
            String preposition) {
        this.catalogName = catalogName;
        this.databaseName = databaseName;
        this.useLike = useLike;
        this.notLike = notLike;
        this.likePattern = likePattern;
        this.preposition = preposition;
    }

    @Override
    public String asSummaryString() {
        return "SHOW VIEWS";
    }
}

// ShowModulesOperation
public class ShowModulesOperation implements ShowOperation {

    private final boolean requireFull;
    private final boolean useLike;
    private final boolean notLike;
    private final String likePattern;

    public ShowModulesOperation(
            boolean requireFull, boolean useLike, boolean notLike, String likePattern) {
        this.requireFull = requireFull;
        this.useLike = useLike;
        this.notLike = notLike;
        this.likePattern = likePattern;
    }

    @Override
    public String asSummaryString() {
        return requireFull ? "SHOW FULL MODULES" : "SHOW MODULES";
    }

    public boolean requireFull() {
        return requireFull;
    }
}

// ShowJarsOperation
public class ShowJarsOperation implements ShowOperation {

    private final boolean useLike;
    private final boolean notLike;
    private final String likePattern;

    public ShowJarsOperation(boolean useLike, boolean notLike, String likePattern) {
        this.useLike = useLike;
        this.notLike = notLike;
        this.likePattern = likePattern;
    }

    @Override
    public String asSummaryString() {
        return "SHOW JARS";
    }
}

// ShowJobsOperation
public class ShowJobsOperation implements ShowOperation {

    private final boolean useLike;
    private final boolean notLike;
    private final String likePattern;

    public ShowJobsOperation(boolean useLike, boolean notLike, String likePattern) {
        this.useLike = useLike;
        this.notLike = notLike;
        this.likePattern = likePattern;
    }

    @Override
    public String asSummaryString() {
        return "SHOW JOBS";
    }
}




Future Work

to be added

Compatibility, Deprecation, and Migration Plan

...