Skip to content

Commit ea575d9

Browse files
authored
[chore](fe) clear cod under analysis package (#62448)
1 parent f01d36c commit ea575d9

File tree

18 files changed

+69
-365
lines changed

18 files changed

+69
-365
lines changed

fe/fe-core/src/main/java/org/apache/doris/analysis/AggregateInfo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ private AggregateInfo(ArrayList<Expr> groupingExprs,
6969
ArrayList<FunctionCallExpr> aggExprs, AggPhase aggPhase) {
7070
Preconditions.checkState(groupingExprs != null || aggExprs != null);
7171
this.groupingExprs =
72-
groupingExprs != null ? Expr.cloneList(groupingExprs) : new ArrayList<Expr>();
72+
groupingExprs != null ? Expr.cloneList(groupingExprs) : new ArrayList<>();
7373
aggregateExprs =
74-
aggExprs != null ? Expr.cloneList(aggExprs) : new ArrayList<FunctionCallExpr>();
74+
aggExprs != null ? Expr.cloneList(aggExprs) : new ArrayList<>();
7575
this.aggPhase = aggPhase;
7676
}
7777

fe/fe-core/src/main/java/org/apache/doris/analysis/AnalyticWindow.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public enum Type {
4141

4242
private final String description;
4343

44-
private Type(String d) {
44+
Type(String d) {
4545
description = d;
4646
}
4747

@@ -64,7 +64,7 @@ public enum BoundaryType {
6464

6565
private final String description;
6666

67-
private BoundaryType(String d) {
67+
BoundaryType(String d) {
6868
description = d;
6969
}
7070

@@ -104,7 +104,7 @@ public static class Boundary {
104104

105105
// The offset value. Set during analysis after evaluating expr_. Integral valued
106106
// for ROWS windows.
107-
private BigDecimal offsetValue;
107+
private final BigDecimal offsetValue;
108108

109109
public BoundaryType getType() {
110110
return type;

fe/fe-core/src/main/java/org/apache/doris/analysis/AssertNumRowsElement.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public TAssertion toThrift() {
4848
}
4949
}
5050

51-
private long desiredNumOfRows;
52-
private String subqueryString;
53-
private Assertion assertion;
51+
private final long desiredNumOfRows;
52+
private final String subqueryString;
53+
private final Assertion assertion;
5454

5555
public AssertNumRowsElement(long desiredNumOfRows, String subqueryString, Assertion assertion) {
5656
this.desiredNumOfRows = desiredNumOfRows;

fe/fe-core/src/main/java/org/apache/doris/analysis/ColWithComment.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

fe/fe-core/src/main/java/org/apache/doris/analysis/ColumnDef.java

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.apache.doris.catalog.AggregateType;
2424
import org.apache.doris.catalog.Column;
2525
import org.apache.doris.catalog.GeneratedColumnInfo;
26-
import org.apache.doris.catalog.KeysType;
2726
import org.apache.doris.catalog.PrimitiveType;
2827
import org.apache.doris.catalog.ScalarType;
2928
import org.apache.doris.catalog.Type;
@@ -34,8 +33,6 @@
3433
import org.apache.doris.nereids.types.DataType;
3534

3635
import com.google.common.base.Preconditions;
37-
import org.apache.logging.log4j.LogManager;
38-
import org.apache.logging.log4j.Logger;
3936

4037
import java.time.LocalDateTime;
4138
import java.time.format.DateTimeFormatter;
@@ -51,7 +48,6 @@
5148
// id bigint key NOT NULL DEFAULT "-1" "user id"
5249
// pv bigint sum NULL DEFAULT "-1" "page visit"
5350
public class ColumnDef {
54-
private static final Logger LOG = LogManager.getLogger(ColumnDef.class);
5551

5652
/*
5753
* User can set default value for a column
@@ -162,21 +158,19 @@ public String getValue() {
162158
}
163159

164160
// parameter initialized in constructor
165-
private String name;
166-
private Type type;
167-
private AggregateType aggregateType;
161+
private final String name;
162+
private final Type type;
163+
private final AggregateType aggregateType;
168164

169165
private boolean isKey;
170166
private boolean isAllowNull;
171-
private boolean isAutoInc;
172-
private long autoIncInitValue;
173-
private KeysType keysType;
174-
private DefaultValue defaultValue;
175-
private String comment;
176-
private boolean visible;
177-
private int clusterKeyId = -1;
167+
private final boolean isAutoInc;
168+
private final long autoIncInitValue;
169+
private final DefaultValue defaultValue;
170+
private final String comment;
171+
private final boolean visible;
178172
private Optional<GeneratedColumnInfo> generatedColumnInfo = Optional.empty();
179-
private Set<String> generatedColumnsThatReferToThis = new HashSet<>();
173+
private final Set<String> generatedColumnsThatReferToThis = new HashSet<>();
180174

181175
public ColumnDef(String name, Type type) {
182176
this(name, type, false, null, ColumnNullableType.NOT_NULLABLE, DefaultValue.NOT_SET, "");
@@ -301,10 +295,6 @@ public void setIsKey(boolean isKey) {
301295
this.isKey = isKey;
302296
}
303297

304-
public void setKeysType(KeysType keysType) {
305-
this.keysType = keysType;
306-
}
307-
308298
public Type getType() {
309299
return type;
310300
}
@@ -317,18 +307,6 @@ public boolean isVisible() {
317307
return visible;
318308
}
319309

320-
public int getClusterKeyId() {
321-
return this.clusterKeyId;
322-
}
323-
324-
public void setClusterKeyId(int clusterKeyId) {
325-
this.clusterKeyId = clusterKeyId;
326-
}
327-
328-
public void analyze(boolean isOlap) throws AnalysisException {
329-
}
330-
331-
332310
@SuppressWarnings("checkstyle:Indentation")
333311
public static void validateDefaultValue(Type type, String defaultValue, DefaultValueExprDef defaultValueExprDef)
334312
throws AnalysisException {
@@ -520,7 +498,7 @@ public String toSql() {
520498
public Column toColumn() {
521499
return new Column(name, this.type, isKey, aggregateType, isAllowNull, autoIncInitValue, defaultValue.value,
522500
comment, visible, defaultValue.defaultValueExprDef, Column.COLUMN_UNIQUE_ID_INIT_VALUE,
523-
defaultValue.getValue(), clusterKeyId, generatedColumnInfo.orElse(null), generatedColumnsThatReferToThis);
501+
defaultValue.getValue(), -1, generatedColumnInfo.orElse(null), generatedColumnsThatReferToThis);
524502
}
525503

526504
@Override

fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
import org.apache.doris.catalog.Column;
2222
import org.apache.doris.catalog.Database;
2323
import org.apache.doris.catalog.Env;
24+
import org.apache.doris.catalog.NameSpaceContext;
2425
import org.apache.doris.catalog.OlapTable;
2526
import org.apache.doris.catalog.info.PartitionNamesInfo;
2627
import org.apache.doris.common.AnalysisException;
2728
import org.apache.doris.common.ErrorCode;
2829
import org.apache.doris.common.ErrorReport;
2930
import org.apache.doris.common.Pair;
3031
import org.apache.doris.common.UserException;
31-
import org.apache.doris.datasource.InternalCatalog;
3232
import org.apache.doris.datasource.property.fileformat.CsvFileFormatProperties;
3333
import org.apache.doris.datasource.property.fileformat.FileFormatProperties;
3434
import org.apache.doris.datasource.property.fileformat.JsonFileFormatProperties;
@@ -39,7 +39,6 @@
3939
import org.apache.doris.nereids.trees.expressions.Expression;
4040
import org.apache.doris.nereids.util.PlanUtils;
4141
import org.apache.doris.qe.ConnectContext;
42-
import org.apache.doris.thrift.TNetworkAddress;
4342
import org.apache.doris.thrift.TUniqueKeyUpdateMode;
4443

4544
import com.google.common.base.Function;
@@ -113,13 +112,11 @@ public class DataDescription {
113112
// this only used in multi load, all filePaths is file not dir
114113
private List<Long> fileSize;
115114
// column names of source files
116-
private List<String> fileFieldNames;
117-
// Used for mini load
118-
private TNetworkAddress beAddr;
115+
private final List<String> fileFieldNames;
119116
private String columnDef;
120117
private long backendId;
121118

122-
private String sequenceCol;
119+
private final String sequenceCol;
123120

124121
// Merged from fileFieldNames, columnsFromPath and columnMappingList
125122
// ImportColumnDesc: column name to (expr or null)
@@ -367,14 +364,6 @@ public boolean isNegative() {
367364
return isNegative;
368365
}
369366

370-
public TNetworkAddress getBeAddr() {
371-
return beAddr;
372-
}
373-
374-
public void setBeAddr(TNetworkAddress addr) {
375-
beAddr = addr;
376-
}
377-
378367
public String getSequenceCol() {
379368
return sequenceCol;
380369
}
@@ -415,14 +404,6 @@ public List<ImportColumnDesc> getParsedColumnExprList() {
415404
return parsedColumnExprList;
416405
}
417406

418-
public void setIsHadoopLoad(boolean isHadoopLoad) {
419-
this.isHadoopLoad = isHadoopLoad;
420-
}
421-
422-
public boolean isHadoopLoad() {
423-
return isHadoopLoad;
424-
}
425-
426407
public boolean isClientLocal() {
427408
return clientLocal;
428409
}
@@ -652,7 +633,7 @@ private void checkLoadPriv(String fullDbName) throws AnalysisException {
652633

653634
// check auth
654635
if (!Env.getCurrentEnv().getAccessManager()
655-
.checkTblPriv(ConnectContext.get(), InternalCatalog.INTERNAL_CATALOG_NAME, fullDbName, tableName,
636+
.checkTblPriv(ConnectContext.get(), NameSpaceContext.INTERNAL_CATALOG_NAME, fullDbName, tableName,
656637
PrivPredicate.LOAD)) {
657638
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "LOAD",
658639
ConnectContext.get().getQualifiedUser(),
@@ -662,8 +643,8 @@ private void checkLoadPriv(String fullDbName) throws AnalysisException {
662643
// check hive table auth
663644
if (isLoadFromTable()) {
664645
if (!Env.getCurrentEnv().getAccessManager()
665-
.checkTblPriv(ConnectContext.get(), InternalCatalog.INTERNAL_CATALOG_NAME, fullDbName, srcTableName,
666-
PrivPredicate.SELECT)) {
646+
.checkTblPriv(ConnectContext.get(), NameSpaceContext.INTERNAL_CATALOG_NAME, fullDbName,
647+
srcTableName, PrivPredicate.SELECT)) {
667648
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "SELECT",
668649
ConnectContext.get().getQualifiedUser(),
669650
ConnectContext.get().getRemoteIP(), fullDbName + ": " + srcTableName);
@@ -740,12 +721,7 @@ public String toSql() {
740721
} else {
741722
sb.append(mergeType.toString());
742723
sb.append(" DATA INFILE (");
743-
Joiner.on(", ").appendTo(sb, Lists.transform(filePaths, new Function<String, String>() {
744-
@Override
745-
public String apply(String s) {
746-
return "'" + s + "'";
747-
}
748-
})).append(")");
724+
Joiner.on(", ").appendTo(sb, Lists.transform(filePaths, s -> "'" + s + "'")).append(")");
749725
}
750726
if (isNegative) {
751727
sb.append(" NEGATIVE");
@@ -769,7 +745,7 @@ public String apply(String s) {
769745
.append("'");
770746
}
771747
if (!Strings.isNullOrEmpty(analysisMap.get(FileFormatProperties.PROP_FORMAT))) {
772-
sb.append(" FORMAT AS '" + analysisMap.get(FileFormatProperties.PROP_FORMAT) + "'");
748+
sb.append(" FORMAT AS '").append(analysisMap.get(FileFormatProperties.PROP_FORMAT)).append("'");
773749
}
774750
if (fileFieldNames != null && !fileFieldNames.isEmpty()) {
775751
sb.append(" (");
@@ -781,12 +757,9 @@ public String apply(String s) {
781757
}
782758
if (columnMappingList != null && !columnMappingList.isEmpty()) {
783759
sb.append(" SET (");
784-
Joiner.on(", ").appendTo(sb, Lists.transform(columnMappingList, new Function<Expr, Object>() {
785-
@Override
786-
public Object apply(Expr expr) {
787-
return expr.accept(ExprToSqlVisitor.INSTANCE, ToSqlParams.WITH_TABLE);
788-
}
789-
})).append(")");
760+
Joiner.on(", ").appendTo(sb, Lists.transform(columnMappingList,
761+
(Function<Expr, Object>) expr -> expr.accept(
762+
ExprToSqlVisitor.INSTANCE, ToSqlParams.WITH_TABLE))).append(")");
790763
}
791764
if (whereExpr != null) {
792765
sb.append(" WHERE ").append(whereExpr.accept(ExprToSqlVisitor.INSTANCE, ToSqlParams.WITH_TABLE));

fe/fe-core/src/main/java/org/apache/doris/analysis/DataSortInfo.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ public int getColNum() {
6666
return colNum;
6767
}
6868

69-
public void setColNum(int colNum) {
70-
this.colNum = colNum;
71-
}
72-
7369
@Override
7470
public boolean equals(Object o) {
7571
if (this == o) {
@@ -88,8 +84,7 @@ public int hashCode() {
8884
}
8985

9086
public String toSql() {
91-
String res = ",\n\"" + DATA_SORT_TYPE + "\" = \"" + this.sortType + "\""
87+
return ",\n\"" + DATA_SORT_TYPE + "\" = \"" + this.sortType + "\""
9288
+ ",\n\"" + DATA_SORT_COL_NUM + "\" = \"" + this.colNum + "\"";
93-
return res;
9489
}
9590
}

fe/fe-core/src/main/java/org/apache/doris/analysis/ImportColumnsStmt.java

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)