Versions Compared

Key

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

...

Code Block
languagejava
titleOperations
linenumberstrue
// Add DescribeDatabaseOperation -> CatalogDataBase
// Add DescribeViewOperation -> CatalogView
// Add DescribeFunctionOperation -> CatalogFunction

// Changed Operations(offer filtering support)

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

...