Versions Compared

Key

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

...

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

// Changed Operations(offer filtering support)

// ShowCatalogsOperation
public class ShowCatalogsOperation implements ShowOperation {
	  
	  // has like sub-clause
    private final boolean withLike;
    // 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 withLike, boolean notLike, String likePattern) {
        this.withLike = withLike;
        this.notLike = notLike;
        this.likePattern = likePattern;
    }
}

// ShowDatabasesOperation
public class ShowDatabasesOperation implements ShowOperation {

    private final String catalogName;
    private final boolean useLikewithLike;
    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 useLikewithLike,
            boolean notLike,
            String likePattern,
            String preposition) {
        this.catalogName = catalogName;
        this.useLikewithLike = useLikewithLike;
        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 useLikewithLike;
    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 useLikewithLike,
            boolean notLike,
            String likePattern,
            String preposition,
            FunctionScope functionScope) {
        this.catalogName = catalogName;
        this.databaseName = databaseName;
        this.useLikewithLike = useLikewithLike;
        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 useLikewithLike;
    private final boolean notLike;
    private final String likePattern;
    private final String preposition;

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

// ShowModulesOperation
public class ShowModulesOperation implements ShowOperation {

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

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

    public boolean requireFull() {
        return requireFull;
    }
}

// ShowJarsOperation
public class ShowJarsOperation implements ShowOperation {

    private final boolean useLikewithLike;
    private final boolean notLike;
    private final String likePattern;

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

// ShowJobsOperation
public class ShowJobsOperation implements ShowOperation {

    private final boolean useLikewithLike;
    private final boolean notLike;
    private final String likePattern;

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

...