Versions Compared

Key

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

...


before

after(under discussed)

Note

show catalogs

SHOW CATALOGS

SHOW CATALOGS[ [NOT] LIKE <sql_like_pattern> ]


show databases

SHOW DATABASES

SHOW DATABASES [ ( FROM | IN ) catalog_name] [ [NOT] LIKE <sql_like_pattern> ]


show functions

SHOW [USER] FUNCTIONS

SHOW [USER] FUNCTIONS [ ( FROM | IN ) [catalog_name.]database_name ] [ [NOT] LIKE <sql_like_pattern> ]


show views

SHOW VIEWS

SHOW VIEWS [ ( FROM | IN ) [catalog_name.]database_name ] [ [NOT] LIKE <sql_like_pattern> ]


show modules

SHOW [FULL] MODULES

SHOW [FULL] MODULES [ [NOT] LIKE <sql_like_pattern> ]


show jars

SHOW JARS

SHOW JARS [ [NOT] LIKE <sql_like_pattern> ]

only work in SQL CLI or SQL Gateway.

show jobs

SHOW JOBS

SHOW JOBS [ [NOT] LIKE <sql_like_pattern> ]

only work in SQL CLI or SQL Gateway.

describe catalog

Not Support

{ DESCRIBE | DESC } CATALOG catalog_name


describe database

Not Support

{ DESCRIBE | DESC } DATABASE [ EXTENDED ] db_name


describe function

Not Support

{ DESCRIBE | DESC } FUNCTION [ EXTENDED ] function_name


...




Proposed

...

CataLog 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);
}

Proposed CataLog API Changes:

No need to add new apis. 

We can use such as TableEnvironment.getCatalog(catalogName).get().listDatabases(), TableEnvironment.getCatalog(catalogName).get().listFunctions(databaseName) for util to get result.

In TableEnvironmentImpl we do filter for returned full results.


Some Operations could be added or changed.TBD

Code Block
languagejava
titleOperations
linenumberstrue
// Add DescribeDatabaseOperation
// Add DescribeViewOperation
// Add DescribeFunctionOperation

// Changed Operations

// ShowCatalogsOperation
public class ShowCatalogsOperation implements ShowOperation {
	
	// enable like
    private final boolean useLike;
    // true for not like, false is like
    private final boolean notLike;
    // like or not like pattern (sql-like-pattern, consistent with current flink behavior)
    private final String likePattern;

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

// ShowDatabasesOperation
public class ShowDatabasesOperation implements ShowOperation {

    private final String catalogName;
    private final boolean useLike;
    private final boolean notLike;
    private final String likePattern;
    // in or from to indicate specific catalog or database
    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;
    }
}

// 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;
    }

    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;
    }
}

// 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;
    }

    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;
    }
}

// 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;
    }
}

...