[Improve](fe)Use commons-lang3 uniformly and refactor PatternGenerator#generateTypePattern (#18666)

`commons-lang`(1and2) is no longer maintained since 2011, and the official recommendation is `commons-lang3`, which can be smoothly upgraded to be compatible with `commons-lang`.
We use both dependencies in `fe`, which can be completely unified.

`PatternGenerator#generateTypePattern` has many meaningless loops, and IntegerRange is introduced for,
which is unnecessary. So I refactored it.
This commit is contained in:
Calvin Kirs
2023-04-17 20:15:17 +08:00
committed by GitHub
parent b458c14d31
commit 575c1620c2
71 changed files with 154 additions and 145 deletions

View File

@ -48,7 +48,7 @@ import org.apache.doris.system.SystemInfoService.HostInfo;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -103,7 +103,7 @@ public class SystemHandler extends AlterHandler {
@Override
public List<List<Comparable>> getAlterJobInfosByDb(Database db) {
throw new NotImplementedException();
throw new NotImplementedException("getAlterJobInfosByDb is not supported in SystemHandler");
}
@Override

View File

@ -19,7 +19,7 @@ package org.apache.doris.analysis;
import org.apache.doris.alter.AlterOpType;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import java.util.Map;
@ -33,7 +33,7 @@ public abstract class AlterClause implements ParseNode {
}
public Map<String, String> getProperties() {
throw new NotImplementedException();
throw new NotImplementedException("AlterClause.getProperties() is not implemented");
}
public AlterOpType getOpType() {

View File

@ -23,7 +23,7 @@ import org.apache.doris.common.Config;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import java.util.Map;
@ -63,7 +63,7 @@ public class AlterClusterClause extends AlterClause {
@Override
public String toSql() {
// TODO Auto-generated method stub
throw new NotImplementedException();
throw new NotImplementedException("toSql is not implemented");
}
public int getInstanceNum() {

View File

@ -40,7 +40,7 @@ import org.apache.doris.qe.ConnectContext;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Map;

View File

@ -23,7 +23,7 @@ import org.apache.doris.common.AnalysisException;
import org.apache.doris.thrift.TExprNode;
import org.apache.doris.thrift.TExprNodeType;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.DataInput;
import java.io.DataOutput;

View File

@ -24,7 +24,7 @@ import org.apache.doris.system.SystemInfoService.HostInfo;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import java.util.List;
import java.util.Map;
@ -59,11 +59,11 @@ public class BackendClause extends AlterClause {
@Override
public String toSql() {
throw new NotImplementedException();
throw new NotImplementedException("Not support toSql for BackendClause");
}
@Override
public Map<String, String> getProperties() {
throw new NotImplementedException();
throw new NotImplementedException("Not support getProperties for BackendClause");
}
}

View File

@ -48,7 +48,7 @@ import org.apache.doris.system.SystemInfoService;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -23,7 +23,7 @@ import org.apache.doris.catalog.DistributionInfo.DistributionInfoType;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.DdlException;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import java.util.List;
import java.util.Set;
@ -55,14 +55,14 @@ public class DistributionDesc {
}
public void analyze(Set<String> colSet, List<ColumnDef> columnDefs, KeysDesc keysDesc) throws AnalysisException {
throw new NotImplementedException();
throw new NotImplementedException("analyze not implemented");
}
public String toSql() {
throw new NotImplementedException();
throw new NotImplementedException("toSql not implemented");
}
public DistributionInfo toDistributionInfo(List<Column> columns) throws DdlException {
throw new NotImplementedException();
throw new NotImplementedException("toDistributionInfo not implemented");
}
}

View File

@ -21,7 +21,7 @@ import org.apache.doris.alter.AlterOpType;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.UserException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.Map;

View File

@ -32,7 +32,7 @@ import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.qe.ConnectContext;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Set;

View File

@ -30,7 +30,7 @@ import org.apache.doris.system.SystemInfoService.HostInfo;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import java.util.Map;
@ -75,12 +75,12 @@ public class FrontendClause extends AlterClause {
@Override
public String toSql() {
throw new NotImplementedException();
throw new NotImplementedException("FrontendClause.toSql() not implemented");
}
@Override
public Map<String, String> getProperties() {
throw new NotImplementedException();
throw new NotImplementedException("FrontendClause.getProperties() not implemented");
}
}

View File

@ -26,7 +26,7 @@ import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import com.google.common.base.Strings;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.io.DataInput;
import java.io.DataOutput;

View File

@ -25,7 +25,7 @@ import org.apache.doris.thrift.TExprNodeType;
import org.apache.doris.thrift.TTypeDesc;
import org.apache.doris.thrift.TTypeNode;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.DataInput;
import java.io.DataOutput;

View File

@ -25,7 +25,7 @@ import org.apache.doris.system.SystemInfoService;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import java.util.List;
import java.util.Map;
@ -97,11 +97,11 @@ public class ModifyBrokerClause extends AlterClause {
@Override
public String toSql() {
throw new NotImplementedException();
throw new NotImplementedException("toSql not implemented");
}
@Override
public Map<String, String> getProperties() {
throw new NotImplementedException();
throw new NotImplementedException("getProperties not implemented");
}
}

View File

@ -24,7 +24,7 @@ import org.apache.doris.system.SystemInfoService.HostInfo;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.validator.routines.InetAddressValidator;
import java.net.InetAddress;
@ -83,6 +83,6 @@ public class ModifyNodeHostNameClause extends AlterClause {
@Override
public String toSql() {
throw new NotImplementedException();
throw new NotImplementedException("toSql() method not implemented");
}
}

View File

@ -30,7 +30,7 @@ import org.apache.doris.qe.ConnectContext;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import java.util.List;
import java.util.Map;
@ -156,11 +156,11 @@ public class PartitionDesc {
}
public String toSql() {
throw new NotImplementedException();
throw new NotImplementedException("toSql not implemented");
}
public PartitionInfo toPartitionInfo(List<Column> schema, Map<String, Long> partitionNameToId, boolean isTemp)
throws DdlException, AnalysisException {
throw new NotImplementedException();
throw new NotImplementedException("toPartitionInfo not implemented");
}
}

View File

@ -24,7 +24,7 @@ import org.apache.doris.common.AnalysisException;
import org.apache.doris.thrift.TExprNode;
import org.apache.doris.thrift.TExprNodeType;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.DataInput;
import java.io.DataOutput;

View File

@ -26,7 +26,7 @@ import org.apache.doris.thrift.TTableType;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -22,7 +22,7 @@ import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import java.io.DataInput;
import java.io.DataOutput;
@ -83,7 +83,7 @@ public abstract class DistributionInfo implements Writable {
}
public DistributionDesc toDistributionDesc() {
throw new NotImplementedException();
throw new NotImplementedException("toDistributionDesc not implemented");
}
@Override

View File

@ -35,8 +35,8 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -481,7 +481,7 @@ public abstract class Table extends MetaObject implements Writable, TableIf {
}
public CreateTableStmt toCreateTableStmt(String dbName) {
throw new NotImplementedException();
throw new NotImplementedException("toCreateTableStmt not implemented");
}
@Override
@ -522,7 +522,7 @@ public abstract class Table extends MetaObject implements Writable, TableIf {
@Override
public BaseAnalysisTask createAnalysisTask(AnalysisTaskInfo info) {
throw new NotImplementedException();
throw new NotImplementedException("createAnalysisTask not implemented");
}
/**

View File

@ -17,7 +17,7 @@
package org.apache.doris.catalog.authorizer;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveOperationType;
import org.apache.ranger.audit.model.AuthzAuditEvent;

View File

@ -33,7 +33,7 @@ import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.MasterCatalogExecutor;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -126,15 +126,15 @@ public class ExternalDatabase<T extends ExternalTable> implements DatabaseIf<T>,
}
protected void init() {
throw new NotImplementedException();
throw new NotImplementedException("init() is not implemented");
}
public T getTableForReplay(long tableId) {
throw new NotImplementedException();
throw new NotImplementedException("getTableForReplay() is not implemented");
}
public void replayInitDb(InitDatabaseLog log, ExternalCatalog catalog) {
throw new NotImplementedException();
throw new NotImplementedException("replayInitDb() is not implemented");
}
@Override
@ -210,42 +210,42 @@ public class ExternalDatabase<T extends ExternalTable> implements DatabaseIf<T>,
@Override
public List<T> getTables() {
throw new NotImplementedException();
throw new NotImplementedException("getTables() is not implemented");
}
@Override
public List<T> getTablesOnIdOrder() {
throw new NotImplementedException();
throw new NotImplementedException("getTablesOnIdOrder() is not implemented");
}
@Override
public List<T> getViews() {
throw new NotImplementedException();
throw new NotImplementedException("getViews() is not implemented");
}
@Override
public List<T> getTablesOnIdOrderIfExist(List<Long> tableIdList) {
throw new NotImplementedException();
throw new NotImplementedException("getTablesOnIdOrderIfExist() is not implemented");
}
@Override
public List<T> getTablesOnIdOrderOrThrowException(List<Long> tableIdList) throws MetaNotFoundException {
throw new NotImplementedException();
throw new NotImplementedException("getTablesOnIdOrderOrThrowException() is not implemented");
}
@Override
public Set<String> getTableNamesWithLock() {
throw new NotImplementedException();
throw new NotImplementedException("getTableNamesWithLock() is not implemented");
}
@Override
public T getTableNullable(String tableName) {
throw new NotImplementedException();
throw new NotImplementedException("getTableNullable() is not implemented");
}
@Override
public T getTableNullable(long tableId) {
throw new NotImplementedException();
throw new NotImplementedException("getTableNullable() is not implemented");
}
@Override
@ -263,10 +263,10 @@ public class ExternalDatabase<T extends ExternalTable> implements DatabaseIf<T>,
@Override
public void dropTable(String tableName) {
throw new NotImplementedException();
throw new NotImplementedException("dropTable() is not implemented");
}
public void createTable(String tableName, long tableId) {
throw new NotImplementedException();
throw new NotImplementedException("createTable() is not implemented");
}
}

View File

@ -37,7 +37,7 @@ import org.apache.doris.thrift.TTableDescriptor;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -309,7 +309,7 @@ public class ExternalTable implements TableIf, Writable, GsonPostProcessable {
@Override
public BaseAnalysisTask createAnalysisTask(AnalysisTaskInfo info) {
throw new NotImplementedException();
throw new NotImplementedException("createAnalysisTask not implemented");
}
@Override

View File

@ -24,7 +24,7 @@ import org.apache.doris.common.FeConstants;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.Arrays;
import java.util.List;

View File

@ -18,7 +18,7 @@
package org.apache.doris.common.util;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.Objects;

View File

@ -23,7 +23,7 @@ import org.apache.doris.analysis.FloatLiteral;
import org.apache.doris.analysis.StringLiteral;
import org.apache.doris.catalog.Type;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.util.ArrayList;

View File

@ -19,7 +19,7 @@ package org.apache.doris.common.util;
import org.apache.doris.common.AnalysisException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.parquet.Strings;
import java.util.TreeMap;

View File

@ -41,7 +41,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -116,7 +116,7 @@ public abstract class ExternalCatalog implements CatalogIf<ExternalDatabase>, Wr
* @return true if table exists, false otherwise
*/
public boolean tableExistInLocal(String dbName, String tblName) {
throw new NotImplementedException();
throw new NotImplementedException("tableExistInLocal not implemented");
}
/**
@ -426,11 +426,11 @@ public abstract class ExternalCatalog implements CatalogIf<ExternalDatabase>, Wr
}
public void dropDatabase(String dbName) {
throw new NotImplementedException();
throw new NotImplementedException("dropDatabase not implemented");
}
public void createDatabase(long dbId, String dbName) {
throw new NotImplementedException();
throw new NotImplementedException("createDatabase not implemented");
}
public Map getSpecifiedDatabaseMap() {

View File

@ -32,7 +32,7 @@ import org.apache.doris.datasource.property.constants.HMSProperties;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.api.CurrentNotificationEventId;

View File

@ -51,7 +51,7 @@ import com.google.common.collect.Range;
import com.google.common.collect.RangeMap;
import com.google.common.collect.TreeRangeMap;
import lombok.Data;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.BlockLocation;
import org.apache.hadoop.fs.LocatedFileStatus;

View File

@ -35,8 +35,8 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Queues;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -217,7 +217,7 @@ public class DeployManager extends MasterDaemon {
}
public void startListenerInternal() {
throw new NotImplementedException();
throw new NotImplementedException("startListenerInternal not implemented");
}
// Call init before each runOneCycle
@ -231,7 +231,7 @@ public class DeployManager extends MasterDaemon {
// Must implement in derived class.
// If encounter errors, return null
protected List<HostInfo> getGroupHostInfos(NodeType nodeType) {
throw new NotImplementedException();
throw new NotImplementedException("getGroupHostInfos not implemented");
}
protected String getBrokerName() {

View File

@ -40,7 +40,7 @@ import io.fabric8.kubernetes.client.Watch;
import io.fabric8.kubernetes.client.Watcher;
import io.fabric8.kubernetes.client.WatcherException;
import jline.internal.Log;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -24,7 +24,7 @@ import org.apache.doris.httpv2.entity.ResponseEntityBuilder;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -37,7 +37,7 @@ import org.apache.doris.qe.ConnectContext;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -46,7 +46,7 @@ import com.sleepycat.je.rep.RollbackException;
import com.sleepycat.je.rep.StateChangeListener;
import com.sleepycat.je.rep.util.DbResetRepGroup;
import com.sleepycat.je.rep.util.ReplicationGroupAdmin;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -32,7 +32,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -87,7 +87,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -42,7 +42,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -86,7 +86,7 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.gson.Gson;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -54,7 +54,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -56,7 +56,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -21,7 +21,7 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.logging.log4j.LogManager;

View File

@ -37,7 +37,7 @@ import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -25,8 +25,8 @@ import com.alibaba.otter.canal.protocol.CanalEntry;
import com.alibaba.otter.canal.protocol.Message;
import com.google.protobuf.InvalidProtocolBufferException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.SystemUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -90,7 +90,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -24,7 +24,7 @@ import org.apache.doris.common.PatternMatcherException;
import org.apache.doris.common.io.Text;
import com.google.common.base.Preconditions;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
import java.io.DataInput;
import java.io.IOException;
@ -170,7 +170,7 @@ public abstract class PrivEntry implements Comparable<PrivEntry> {
@Override
public int compareTo(PrivEntry o) {
throw new NotImplementedException();
throw new NotImplementedException("should be implemented by derived class");
}
/**

View File

@ -37,7 +37,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.DataInput;
import java.io.DataOutput;

View File

@ -25,7 +25,6 @@ import org.apache.doris.nereids.pattern.generator.javaast.MethodDeclaration;
import org.apache.doris.nereids.pattern.generator.javaast.VariableDeclarator;
import com.google.common.base.Joiner;
import org.apache.commons.lang.math.IntRange;
import org.apache.commons.lang3.StringUtils;
import java.util.AbstractMap.SimpleEntry;
@ -266,51 +265,55 @@ public abstract class PatternGenerator {
/** generate a pattern method code. */
public String generateTypePattern(String patterName, String className,
String genericParam, String predicate, boolean specifyChildren, boolean isMemoPattern) {
int childrenNum = childrenNum();
if (specifyChildren) {
String methodGeneric = Arrays.stream(new IntRange(1, childrenNum).toArray())
.mapToObj(i -> "C" + i + " extends Plan")
.collect(Collectors.joining(", ", "<", ">"));
StringBuilder methodGenericBuilder = new StringBuilder("<");
StringBuilder methodParamBuilder = new StringBuilder();
StringBuilder childrenPatternBuilder = new StringBuilder();
int min = Math.min(1, childrenNum);
int max = Math.max(1, childrenNum);
for (int i = min; i <= max; i++) {
methodGenericBuilder.append("C").append(i).append(" extends Plan");
methodParamBuilder.append("PatternDescriptor<C").append(i).append("> child").append(i);
childrenPatternBuilder.append("child").append(i).append(".pattern");
String methodParam = Arrays.stream(new IntRange(1, childrenNum).toArray())
.mapToObj(i -> "PatternDescriptor<C" + i + "> child" + i)
.collect(Collectors.joining(", "));
String childrenPattern = Arrays.stream(new IntRange(1, childrenNum).toArray())
.mapToObj(i -> "child" + i + ".pattern")
.collect(Collectors.joining(", "));
if (childrenNum > 0) {
childrenPattern = ", " + childrenPattern;
if (i < max) {
methodGenericBuilder.append(", ");
methodParamBuilder.append(", ");
childrenPatternBuilder.append(", ");
}
}
methodGenericBuilder.append(">");
String pattern = "default " + methodGeneric + "\n"
if (childrenNum > 0) {
childrenPatternBuilder.insert(0, ", ");
}
String pattern = "default " + methodGenericBuilder + "\n"
+ "PatternDescriptor" + genericParam + "\n"
+ " " + patterName + "(" + methodParam + ") {\n"
+ " " + patterName + "(" + methodParamBuilder + ") {\n"
+ " return new PatternDescriptor" + genericParam + "(\n"
+ " new TypePattern(" + className + ".class" + childrenPattern + "),\n"
+ " defaultPromise()\n"
+ " )" + predicate + ";\n"
+ "}\n";
generatePatterns.add(pattern);
return pattern;
} else {
String childrenPattern = StringUtils.repeat(
isMemoPattern ? "Pattern.GROUP" : "Pattern.ANY", ", ", childrenNum);
if (childrenNum > 0) {
childrenPattern = ", " + childrenPattern;
}
String pattern = "default PatternDescriptor" + genericParam + " " + patterName + "() {\n"
+ " return new PatternDescriptor" + genericParam + "(\n"
+ " new TypePattern(" + className + ".class" + childrenPattern + "),\n"
+ " new TypePattern(" + className + ".class" + childrenPatternBuilder + "),\n"
+ " defaultPromise()\n"
+ " )" + predicate + ";\n"
+ "}\n";
generatePatterns.add(pattern);
return pattern;
}
String childrenPattern = StringUtils.repeat(
isMemoPattern ? "Pattern.GROUP" : "Pattern.ANY", ", ", childrenNum);
if (childrenNum > 0) {
childrenPattern = ", " + childrenPattern;
}
String pattern = "default PatternDescriptor" + genericParam + " " + patterName + "() {\n"
+ " return new PatternDescriptor" + genericParam + "(\n"
+ " new TypePattern(" + className + ".class" + childrenPattern + "),\n"
+ " defaultPromise()\n"
+ " )" + predicate + ";\n"
+ "}\n";
generatePatterns.add(pattern);
return pattern;
}
public String generatePatterns() {

View File

@ -32,7 +32,7 @@ import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate;
import org.apache.doris.nereids.trees.plans.logical.LogicalSort;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Set;

View File

@ -30,7 +30,7 @@ import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.logical.LogicalAggregate;
import com.google.common.collect.ImmutableList;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Optional;

View File

@ -31,7 +31,7 @@ import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.expressions.SlotReference;
import com.google.common.base.Preconditions;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Optional;

View File

@ -34,7 +34,7 @@ import org.apache.doris.nereids.types.DataType;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import java.math.BigInteger;

View File

@ -28,7 +28,7 @@ import org.apache.doris.nereids.util.Utils;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
import java.util.Objects;

View File

@ -28,7 +28,7 @@ import org.apache.doris.thrift.TExportSink;
import org.apache.doris.thrift.TFileType;
import org.apache.doris.thrift.TNetworkAddress;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.StringEscapeUtils;
public class ExportSink extends DataSink {
private final String exportPath;

View File

@ -71,7 +71,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
import com.google.common.collect.Range;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -25,7 +25,7 @@ import org.apache.doris.persist.gson.GsonUtils;
import com.google.common.base.Strings;
import com.google.common.collect.Maps;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -25,7 +25,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -32,7 +32,7 @@ import org.apache.doris.qe.ConnectContext;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -34,7 +34,7 @@ import org.apache.doris.qe.ShowResultSetMetaData;
import com.google.common.collect.Lists;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -25,7 +25,7 @@ import org.apache.doris.thrift.TRuntimeFilterType;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -25,7 +25,7 @@ import org.apache.doris.common.ErrorReport;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

View File

@ -37,7 +37,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.commons.lang.SerializationUtils;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;

View File

@ -20,7 +20,7 @@ package org.apache.doris.qe;
import org.apache.doris.common.DdlException;
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.Map;

View File

@ -28,7 +28,7 @@ import org.apache.doris.thrift.TPipelineResourceGroup;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.DataInput;
import java.io.DataOutput;

View File

@ -20,7 +20,7 @@ package org.apache.doris.statistics;
import org.apache.doris.catalog.external.HMSExternalTable;
import org.apache.doris.common.Config;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.lang3.NotImplementedException;
public class HMSAnalysisTask extends BaseAnalysisTask {
@ -35,7 +35,7 @@ public class HMSAnalysisTask extends BaseAnalysisTask {
* Collect the column level stats for external table through metadata.
*/
protected void getColumnStatsByMeta() throws Exception {
throw new NotImplementedException();
throw new NotImplementedException("Code is not implemented");
}
/**
@ -43,7 +43,7 @@ public class HMSAnalysisTask extends BaseAnalysisTask {
* @return ColumnStatistics
*/
protected void getColumnStatsBySql() {
throw new NotImplementedException();
throw new NotImplementedException("getColumnStatsBySql is not implemented");
}
@Override

View File

@ -17,7 +17,7 @@
package org.apache.doris.system;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
public class BackendEvent {

View File

@ -46,7 +46,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.validator.routines.InetAddressValidator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;