Skip to content

Commit

Permalink
Fix comment
Browse files Browse the repository at this point in the history
Signed-off-by: wyb <wybb86@gmail.com>
  • Loading branch information
wyb committed Sep 2, 2024
1 parent ebc541b commit 80b1dd5
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public class FeConstants {

public static final int DEFAULT_UNPARTITIONED_TABLE_BUCKET_NUM = 16;

public static final String YES = "YES";
public static final String NO = "NO";

public static final String DOCUMENT_SHOW_ALTER =
"https://docs.starrocks.io/docs/sql-reference/sql-statements/data-manipulation/SHOW_ALTER";
public static final String DOCUMENT_SHOW_ALTER_MATERIALIZED_VIEW =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.google.common.collect.Lists;
import com.starrocks.catalog.Column;
import com.starrocks.common.AnalysisException;
import com.starrocks.common.FeConstants;
import org.apache.commons.lang.StringUtils;

import java.util.Arrays;
Expand Down Expand Up @@ -94,7 +95,7 @@ public ProcResult fetchResult() throws AnalysisException {

List<String> rowList = Arrays.asList(column.getName(),
column.getType().canonicalName().toLowerCase(),
column.isAllowNull() ? "YES" : "NO",
column.isAllowNull() ? FeConstants.YES : FeConstants.NO,
((Boolean) column.isKey()).toString(),
defaultStr,
extraStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.starrocks.catalog.Table;
import com.starrocks.catalog.Type;
import com.starrocks.common.DdlException;
import com.starrocks.common.FeConstants;
import com.starrocks.connector.exception.StarRocksConnectorException;

import java.sql.Connection;
Expand Down Expand Up @@ -90,7 +91,7 @@ public List<Column> convertToSRTable(ResultSet columnSet) throws SQLException {
columnSet.getInt("COLUMN_SIZE"),
columnSet.getInt("DECIMAL_DIGITS"));
fullSchema.add(new Column(columnSet.getString("COLUMN_NAME"), type,
columnSet.getString("IS_NULLABLE").equals("YES")));
columnSet.getString("IS_NULLABLE").equals(FeConstants.YES)));
}
return fullSchema;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.starrocks.catalog.Table;
import com.starrocks.catalog.Type;
import com.starrocks.common.DdlException;
import com.starrocks.common.FeConstants;

import java.sql.Connection;
import java.sql.ResultSet;
Expand Down Expand Up @@ -56,7 +57,7 @@ public List<Column> convertToSRTable(ResultSet columnSet) throws SQLException {
columnSet.getInt("DECIMAL_DIGITS"));
String columnName = columnSet.getString("COLUMN_NAME");
fullSchema.add(new Column(columnName, type,
columnSet.getString("IS_NULLABLE").equals("YES")));
columnSet.getString("IS_NULLABLE").equals(FeConstants.YES)));
}
return fullSchema;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.starrocks.catalog.Table;
import com.starrocks.catalog.Type;
import com.starrocks.common.DdlException;
import com.starrocks.common.FeConstants;
import com.starrocks.common.util.TimeUtils;

import java.sql.Connection;
Expand Down Expand Up @@ -61,7 +62,7 @@ public List<Column> convertToSRTable(ResultSet columnSet) throws SQLException {
columnName = "\"" + columnName + "\"";
}
fullSchema.add(new Column(columnName, type,
columnSet.getString("IS_NULLABLE").equals("YES")));
columnSet.getString("IS_NULLABLE").equals(FeConstants.YES)));
}
return fullSchema;
}
Expand Down
3 changes: 2 additions & 1 deletion fe/fe-core/src/main/java/com/starrocks/mysql/MysqlProto.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import com.starrocks.common.DdlException;
import com.starrocks.common.ErrorCode;
import com.starrocks.common.ErrorReport;
import com.starrocks.common.FeConstants;
import com.starrocks.qe.ConnectContext;
import com.starrocks.server.GlobalStateMgr;
import com.starrocks.sql.ast.UserIdentity;
Expand All @@ -62,7 +63,7 @@ public class MysqlProto {
// randomString: data send by server in plug-in data field
// user_name#HIGH@cluster_name
private static boolean authenticate(ConnectContext context, byte[] scramble, byte[] randomString, String user) {
String usePasswd = scramble.length == 0 ? "NO" : "YES";
String usePasswd = scramble.length == 0 ? FeConstants.NO : FeConstants.YES;

if (user == null || user.isEmpty()) {
ErrorReport.report(ErrorCode.ERR_AUTHENTICATION_FAIL, "", usePasswd);
Expand Down
21 changes: 13 additions & 8 deletions fe/fe-core/src/main/java/com/starrocks/qe/ShowExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
import com.starrocks.common.DdlException;
import com.starrocks.common.ErrorCode;
import com.starrocks.common.ErrorReport;
import com.starrocks.common.FeConstants;
import com.starrocks.common.MetaNotFoundException;
import com.starrocks.common.Pair;
import com.starrocks.common.PatternMatcher;
Expand Down Expand Up @@ -880,12 +881,16 @@ public ShowResultSet visitShowResourceGroupUsageStatement(ShowResourceGroupUsage
@Override
public ShowResultSet visitShowEnginesStatement(ShowEnginesStmt statement, ConnectContext context) {
List<List<String>> rowSet = Lists.newArrayList();
rowSet.add(Lists.newArrayList("OLAP", "YES", "Default storage engine of StarRocks", "NO", "NO", "NO"));
rowSet.add(Lists.newArrayList("MySQL", "YES", "MySQL server which data is in it", "NO", "NO", "NO"));
rowSet.add(Lists.newArrayList("ELASTICSEARCH", "YES", "ELASTICSEARCH cluster which data is in it", "NO", "NO",
"NO"));
rowSet.add(Lists.newArrayList("HIVE", "YES", "HIVE database which data is in it", "NO", "NO", "NO"));
rowSet.add(Lists.newArrayList("ICEBERG", "YES", "ICEBERG data lake which data is in it", "NO", "NO", "NO"));
rowSet.add(Lists.newArrayList("OLAP", FeConstants.YES, "Default storage engine of StarRocks", FeConstants.NO,
FeConstants.NO, FeConstants.NO));
rowSet.add(Lists.newArrayList("MySQL", FeConstants.YES, "MySQL server which data is in it", FeConstants.NO,
FeConstants.NO, FeConstants.NO));
rowSet.add(Lists.newArrayList("ELASTICSEARCH", FeConstants.YES, "ELASTICSEARCH cluster which data is in it",
FeConstants.NO, FeConstants.NO, FeConstants.NO));
rowSet.add(Lists.newArrayList("HIVE", FeConstants.YES, "HIVE database which data is in it", FeConstants.NO,
FeConstants.NO, FeConstants.NO));
rowSet.add(Lists.newArrayList("ICEBERG", FeConstants.YES, "ICEBERG data lake which data is in it", FeConstants.NO,
FeConstants.NO, FeConstants.NO));

// Only success
return new ShowResultSet(statement.getMetaData(), rowSet);
Expand Down Expand Up @@ -1002,8 +1007,8 @@ public ShowResultSet visitShowColumnStatement(ShowColumnStmt statement, ConnectC
}
final String columnName = col.getName();
final String columnType = col.getType().canonicalName().toLowerCase();
final String isAllowNull = col.isAllowNull() ? "YES" : "NO";
final String isKey = col.isKey() ? "YES" : "NO";
final String isAllowNull = col.isAllowNull() ? FeConstants.YES : FeConstants.NO;
final String isKey = col.isKey() ? FeConstants.YES : FeConstants.NO;
String defaultValue = null;
if (!col.getType().isOnlyMetricType()) {
defaultValue = col.getMetaDefaultValue(Lists.newArrayList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.starrocks.common.DdlException;
import com.starrocks.common.ErrorCode;
import com.starrocks.common.ErrorReport;
import com.starrocks.common.FeConstants;
import com.starrocks.common.proc.ExternalTableProcDir;
import com.starrocks.common.proc.PartitionsProcDir;
import com.starrocks.common.proc.ProcNodeInterface;
Expand Down Expand Up @@ -351,7 +352,7 @@ private void descTableFunctionTable(DescribeStmt node, ConnectContext context) {
List<String> row = Arrays.asList(
column.getName(),
column.getType().canonicalName().toLowerCase(),
column.isAllowNull() ? "YES" : "NO");
column.isAllowNull() ? FeConstants.YES : FeConstants.NO);
node.getTotalRows().add(row);
}
}
Expand Down Expand Up @@ -394,7 +395,7 @@ private void descInternalCatalogTable(DescribeStmt node, ConnectContext context)
// If you do not follow this specification, it may cause the BI system,
// such as superset, to fail to recognize the column type.
column.getType().canonicalName().toLowerCase(),
column.isAllowNull() ? "YES" : "NO",
column.isAllowNull() ? FeConstants.YES : FeConstants.NO,
((Boolean) column.isKey()).toString(),
defaultStr,
extraStr);
Expand Down Expand Up @@ -473,7 +474,7 @@ private void descInternalCatalogTable(DescribeStmt node, ConnectContext context)
// If you do not follow this specification, it may cause the BI system,
// such as superset, to fail to recognize the column type.
column.getType().canonicalName().toLowerCase(),
column.isAllowNull() ? "YES" : "NO",
column.isAllowNull() ? FeConstants.YES : FeConstants.NO,
((Boolean) column.isKey()).toString(),
defaultStr,
extraStr);
Expand Down

0 comments on commit 80b1dd5

Please sign in to comment.