Skip to content

Commit

Permalink
Add missing return and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
snuyanzin committed Aug 19, 2024
1 parent fac9cfd commit 07f97e0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ protected Operation convertShowOperation(T sqlShowCall, ConvertContext context)
final CatalogManager catalogManager = context.getCatalogManager();
final String currentCatalogName = catalogManager.getCurrentCatalog();
final String currentDatabaseName = catalogManager.getCurrentDatabase();
if (skipQualifyingCatalogAndDatabase()) {
getOperationWithoutPrep(
if (skipQualifyingDefaultCatalogAndDatabase()) {
return getOperationWithoutPrep(
currentCatalogName, currentDatabaseName, sqlShowCall, likeOp);
}
final String catalogName = catalogManager.qualifyCatalog(currentCatalogName);
Expand Down Expand Up @@ -96,7 +96,7 @@ public abstract Operation getOperation(
@Override
public abstract Operation convertSqlNode(T node, ConvertContext context);

protected boolean skipQualifyingCatalogAndDatabase() {
protected boolean skipQualifyingDefaultCatalogAndDatabase() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ private static FunctionScope getFunctionScope(SqlShowFunctions sqlShowFunctions)
}

@Override
protected boolean skipQualifyingCatalogAndDatabase() {
protected boolean skipQualifyingDefaultCatalogAndDatabase() {
// It should be supported to list functions with unset catalog
// for more info FLINK-33093
// for more info FLINhK-33093
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private static Stream<Arguments> inputForShowTablesTest() {
"SHOW TABLES IN builtin.db2"),
Arguments.of(
"SHOW TABLES",
new ShowTablesOperation(null, null, null, null),
new ShowTablesOperation("builtin", "default", null, null),
"SHOW TABLES"));
}

Expand Down Expand Up @@ -246,7 +246,7 @@ private static Stream<Arguments> inputForShowViewsTest() {
"SHOW VIEWS IN builtin.db2"),
Arguments.of(
"SHOW VIEWS",
new ShowViewsOperation(null, null, null, null),
new ShowViewsOperation("builtin", "default", null, null),
"SHOW VIEWS"));
}

Expand Down Expand Up @@ -280,11 +280,13 @@ private static Stream<Arguments> inputForShowFunctionsTest() {
return Stream.of(
Arguments.of(
"show functions",
new ShowFunctionsOperation(FunctionScope.ALL, null, null, null, null),
new ShowFunctionsOperation(
FunctionScope.ALL, null, "builtin", "default", null),
"SHOW FUNCTIONS"),
Arguments.of(
"show user functions",
new ShowFunctionsOperation(FunctionScope.USER, null, null, null, null),
new ShowFunctionsOperation(
FunctionScope.USER, null, "builtin", "default", null),
"SHOW USER FUNCTIONS"),
Arguments.of(
"show functions from cat1.db1 not like 'f%'",
Expand Down Expand Up @@ -330,7 +332,7 @@ private static Stream<Arguments> inputForShowDatabasesTest() {
return Stream.of(
Arguments.of(
"SHOW DATABASES",
new ShowDatabasesOperation(null, null, null),
new ShowDatabasesOperation("builtin", null, null),
"SHOW DATABASES"),
Arguments.of(
"show databases from cat1 not like 'f%'",
Expand Down Expand Up @@ -382,7 +384,8 @@ private static Stream<Arguments> inputForShowProceduresTest() {
"SHOW procedures in db1",
new ShowProceduresOperation("builtin", "db1", "IN", null)),
Arguments.of(
"SHOW procedures", new ShowProceduresOperation(null, null, null, null)));
"SHOW procedures",
new ShowProceduresOperation("builtin", "default", null, null)));
}

@ParameterizedTest
Expand Down

0 comments on commit 07f97e0

Please sign in to comment.