This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new adfef85c0c [improve](fe): use `Pair.of` to replace `new Pair<>()` (#11945) adfef85c0c is described below commit adfef85c0ca0093927c9bf447a2f42e7fbabd08e Author: jakevin <jakevin...@gmail.com> AuthorDate: Mon Aug 22 08:27:40 2022 +0800 [improve](fe): use `Pair.of` to replace `new Pair<>()` (#11945) --- .../apache/doris/alter/SchemaChangeHandler.java | 2 +- .../org/apache/doris/analysis/BinaryPredicate.java | 2 +- .../java/org/apache/doris/analysis/CastExpr.java | 8 ++-- .../org/apache/doris/analysis/DataDescription.java | 2 +- .../java/org/apache/doris/analysis/InsertStmt.java | 4 +- .../org/apache/doris/analysis/LoadColumnsInfo.java | 2 +- .../org/apache/doris/analysis/PartitionName.java | 4 +- .../analysis/RoutineLoadDataSourceProperties.java | 2 +- .../java/org/apache/doris/analysis/SelectStmt.java | 2 +- .../apache/doris/analysis/SetUserPropertyStmt.java | 2 +- .../java/org/apache/doris/analysis/TableRef.java | 2 +- .../org/apache/doris/backup/BackupHandler.java | 4 +- .../org/apache/doris/backup/BrokerStorage.java | 2 +- .../java/org/apache/doris/backup/Repository.java | 2 +- .../java/org/apache/doris/backup/RestoreJob.java | 4 +- .../java/org/apache/doris/catalog/Database.java | 2 +- .../main/java/org/apache/doris/catalog/Env.java | 14 +++--- .../org/apache/doris/catalog/InfoSchemaDb.java | 2 +- .../org/apache/doris/catalog/SparkResource.java | 2 +- .../main/java/org/apache/doris/catalog/Tablet.java | 36 +++++++-------- .../main/java/org/apache/doris/catalog/Type.java | 2 +- .../doris/clone/DynamicPartitionScheduler.java | 6 +-- .../apache/doris/clone/PartitionRebalancer.java | 2 +- .../java/org/apache/doris/clone/TabletChecker.java | 4 +- .../org/apache/doris/clone/TabletScheduler.java | 2 +- .../clone/TwoDimensionalGreedyRebalanceAlgo.java | 2 +- .../main/java/org/apache/doris/common/Pair.java | 27 ++++------- .../doris/common/proc/FrontendsProcNode.java | 2 +- .../apache/doris/common/profile/CounterNode.java | 2 +- .../org/apache/doris/common/util/BrokerUtil.java | 2 +- .../org/apache/doris/common/util/DebugUtil.java | 4 +- .../org/apache/doris/common/util/KafkaUtil.java | 4 +- .../apache/doris/common/util/RuntimeProfile.java | 6 +-- .../org/apache/doris/deploy/DeployManager.java | 12 ++--- .../apache/doris/deploy/impl/K8sDeployManager.java | 2 +- .../apache/doris/httpv2/rest/MetaInfoAction.java | 4 +- .../doris/httpv2/rest/manager/HttpUtils.java | 2 +- .../doris/httpv2/rest/manager/NodeAction.java | 6 +-- .../doris/httpv2/restv2/MetaInfoActionV2.java | 4 +- .../src/main/java/org/apache/doris/load/Load.java | 4 +- .../main/java/org/apache/doris/load/Source.java | 2 +- .../org/apache/doris/load/loadv2/SparkLoadJob.java | 4 +- .../doris/load/routineload/KafkaProgress.java | 8 ++-- .../load/routineload/KafkaRoutineLoadJob.java | 2 +- .../apache/doris/mysql/privilege/UserProperty.java | 2 +- .../doris/mysql/privilege/UserPropertyInfo.java | 2 +- .../java/org/apache/doris/nereids/memo/Group.java | 6 +-- .../apache/doris/nereids/memo/GroupExpression.java | 4 +- .../java/org/apache/doris/nereids/memo/Memo.java | 8 ++-- .../rules/exploration/join/JoinLAsscomHelper.java | 2 +- .../org/apache/doris/nereids/util/JoinUtils.java | 2 +- .../apache/doris/persist/BackendTabletsInfo.java | 2 +- .../apache/doris/planner/DistributedPlanner.java | 2 +- .../org/apache/doris/planner/HashJoinNode.java | 2 +- .../apache/doris/planner/PredicatePushDown.java | 4 +- .../apache/doris/planner/SingleNodePlanner.java | 6 +-- .../java/org/apache/doris/qe/ConnectProcessor.java | 4 +- .../main/java/org/apache/doris/qe/Coordinator.java | 10 ++-- .../java/org/apache/doris/qe/SimpleScheduler.java | 2 +- .../org/apache/doris/rewrite/InferFiltersRule.java | 24 +++++----- .../doris/statistics/OlapScanStatsDerive.java | 4 +- .../org/apache/doris/system/SystemInfoService.java | 2 +- .../org/apache/doris/task/ExportPendingTask.java | 2 +- .../org/apache/doris/task/HadoopLoadEtlTask.java | 2 +- .../doris/transaction/DatabaseTransactionMgr.java | 2 +- .../org/apache/doris/backup/BrokerStorageTest.java | 2 +- .../org/apache/doris/catalog/AdminStmtTest.java | 2 +- .../java/org/apache/doris/catalog/TabletTest.java | 8 ++-- .../org/apache/doris/catalog/UserPropertyTest.java | 28 +++++------ .../java/org/apache/doris/clone/RebalanceTest.java | 8 ++-- .../TwoDimensionalGreedyRebalanceAlgoTest.java | 2 +- .../apache/doris/load/loadv2/SparkLoadJobTest.java | 2 +- .../load/routineload/KafkaRoutineLoadJobTest.java | 2 +- .../exploration/join/JoinLAsscomProjectTest.java | 2 +- .../rules/exploration/join/JoinLAsscomTest.java | 2 +- .../doris/planner/SingleNodePlannerTest.java | 54 +++++++++++----------- .../org/apache/doris/system/HeartbeatMgrTest.java | 2 +- .../main/java/org/apache/doris/udf/UdfUtils.java | 10 ++-- 78 files changed, 212 insertions(+), 221 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java index 55ff279e7d..a98850b9db 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java @@ -1918,7 +1918,7 @@ public class SchemaChangeHandler extends AlterHandler { for (Replica replica : tablet.getReplicas()) { Set<Pair<Long, Integer>> tabletIdWithHash = beIdToTabletIdWithHash.computeIfAbsent( replica.getBackendId(), k -> Sets.newHashSet()); - tabletIdWithHash.add(new Pair<>(tablet.getId(), schemaHash)); + tabletIdWithHash.add(Pair.of(tablet.getId(), schemaHash)); } } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java index 83d4e3cdc4..61bc8ed44c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/BinaryPredicate.java @@ -511,7 +511,7 @@ public class BinaryPredicate extends Predicate implements Writable { if (rhs == null) { return null; } - return new Pair<SlotId, SlotId>(lhs.getSlotId(), rhs.getSlotId()); + return Pair.of(lhs.getSlotId(), rhs.getSlotId()); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java index c07a8d8029..7950c04db4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java @@ -75,11 +75,11 @@ public class CastExpr extends Expr { continue; } if (fromType.isStringType() && !toType.isStringType()) { - TYPE_NULLABLE_MODE.put(new Pair<>(fromType, toType), Function.NullableMode.ALWAYS_NULLABLE); + TYPE_NULLABLE_MODE.put(Pair.of(fromType, toType), Function.NullableMode.ALWAYS_NULLABLE); } else if (!fromType.isDateType() && toType.isDateType()) { - TYPE_NULLABLE_MODE.put(new Pair<>(fromType, toType), Function.NullableMode.ALWAYS_NULLABLE); + TYPE_NULLABLE_MODE.put(Pair.of(fromType, toType), Function.NullableMode.ALWAYS_NULLABLE); } else { - TYPE_NULLABLE_MODE.put(new Pair<>(fromType, toType), Function.NullableMode.DEPEND_ON_ARGUMENT); + TYPE_NULLABLE_MODE.put(Pair.of(fromType, toType), Function.NullableMode.DEPEND_ON_ARGUMENT); } } } @@ -179,7 +179,7 @@ public class CastExpr extends Expr { String beSymbol = "doris::" + beClass + "::cast_to_" + typeName; functionSet.addBuiltinBothScalaAndVectorized(ScalarFunction.createBuiltin(getFnName(toType), - toType, TYPE_NULLABLE_MODE.get(new Pair<>(fromType, toType)), + toType, TYPE_NULLABLE_MODE.get(Pair.of(fromType, toType)), Lists.newArrayList(fromType), false, beSymbol, null, null, true)); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java index e6539e8b38..814e0ccab7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java @@ -707,7 +707,7 @@ public class DataDescription { } } - Pair<String, List<String>> functionPair = new Pair<String, List<String>>(functionName, args); + Pair<String, List<String>> functionPair = Pair.of(functionName, args); columnToHadoopFunction.put(columnName, functionPair); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertStmt.java index 483b5bc8e0..a155129067 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertStmt.java @@ -447,7 +447,7 @@ public class InsertStmt extends DdlStmt { for (int i = 0; i < targetColumns.size(); i++) { if (targetColumns.get(i).nameEquals(origName, false)) { // Rule A - origColIdxsForExtendCols.add(new Pair<>(i, null)); + origColIdxsForExtendCols.add(Pair.of(i, null)); targetColumns.add(column); break; } @@ -462,7 +462,7 @@ public class InsertStmt extends DdlStmt { String origName = refColumn.getColumnName(); for (int originColumnIdx = 0; originColumnIdx < targetColumns.size(); originColumnIdx++) { if (targetColumns.get(originColumnIdx).nameEquals(origName, false)) { - origColIdxsForExtendCols.add(new Pair<>(originColumnIdx, column)); + origColIdxsForExtendCols.add(Pair.of(originColumnIdx, column)); targetColumns.add(column); break; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/LoadColumnsInfo.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/LoadColumnsInfo.java index ab949add28..26fc245782 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LoadColumnsInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/LoadColumnsInfo.java @@ -144,7 +144,7 @@ public class LoadColumnsInfo implements ParseNode { } } - Pair<String, List<String>> functionPair = new Pair<String, List<String>>(functionName, args); + Pair<String, List<String>> functionPair = Pair.of(functionName, args); columnToFunction.put(column, functionPair); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionName.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionName.java index 63077e7b74..839d3d7d72 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionName.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionName.java @@ -162,10 +162,10 @@ public class PartitionName { List<Pair<String, String>> newPairs = Lists.newArrayList(); Map<String, String> tableRenameMap = Maps.newHashMap(); for (PartitionName partitionName : partitionNames) { - Pair<String, String> oldPair = new Pair<String, String>(partitionName.getTableName(), + Pair<String, String> oldPair = Pair.of(partitionName.getTableName(), partitionName.getPartitionName()); oldPairs.add(oldPair); - Pair<String, String> newPair = new Pair<String, String>(partitionName.getNewTableName(), + Pair<String, String> newPair = Pair.of(partitionName.getNewTableName(), partitionName.getNewPartitionName()); newPairs.add(newPair); diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/RoutineLoadDataSourceProperties.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/RoutineLoadDataSourceProperties.java index 26d335a18e..95ff5519c1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/RoutineLoadDataSourceProperties.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/RoutineLoadDataSourceProperties.java @@ -305,7 +305,7 @@ public class RoutineLoadDataSourceProperties { String[] kafkaPartitionsStringList = kafkaPartitionsString.split(","); for (String s : kafkaPartitionsStringList) { try { - kafkaPartitionOffsets.add(Pair.create(getIntegerValueFromString( + kafkaPartitionOffsets.add(Pair.of(getIntegerValueFromString( s, CreateRoutineLoadStmt.KAFKA_PARTITIONS_PROPERTY), KafkaProgress.OFFSET_END_VAL)); } catch (AnalysisException e) { throw new AnalysisException(CreateRoutineLoadStmt.KAFKA_PARTITIONS_PROPERTY diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java index 6139ef795e..95d1ef5ad3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SelectStmt.java @@ -738,7 +738,7 @@ public class SelectStmt extends QueryStmt { rowCount = ((OlapTable) (tblRef.getTable())).getRowCount(); LOG.debug("tableName={} rowCount={}", tblRef.getAlias(), rowCount); } - candidates.add(new Pair(tblRef, rowCount)); + candidates.add(Pair.of(tblRef, rowCount)); } // give InlineView row count long last = 0; diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetUserPropertyStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetUserPropertyStmt.java index dc1d19e448..fb1d4fec3b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetUserPropertyStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetUserPropertyStmt.java @@ -46,7 +46,7 @@ public class SetUserPropertyStmt extends DdlStmt { public List<Pair<String, String>> getPropertyPairList() { List<Pair<String, String>> list = Lists.newArrayList(); for (SetVar var : propertyList) { - list.add(Pair.create(((SetUserPropertyVar) var).getPropertyKey(), + list.add(Pair.of(((SetUserPropertyVar) var).getPropertyKey(), ((SetUserPropertyVar) var).getPropertyValue())); } return list; diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/TableRef.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/TableRef.java index 56811b0f75..98a252c27e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/TableRef.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/TableRef.java @@ -480,7 +480,7 @@ public class TableRef implements ParseNode, Writable { // if (leftTblRef != null) { for (TupleId tupleId : leftTblRef.getAllTableRefIds()) { - Pair<TupleId, TupleId> tids = new Pair<>(tupleId, getId()); + Pair<TupleId, TupleId> tids = Pair.of(tupleId, getId()); analyzer.registerAnyTwoTalesJoinOperator(tids, joinOp); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java index 5a79384bef..1329f64b48 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java @@ -650,12 +650,12 @@ public class BackupHandler extends MasterDaemon implements Writable { for (AbstractJob job : getAllCurrentJobs()) { if (job.getType() == JobType.BACKUP) { if (!job.isDone() && job.getJobId() == jobId && type == TTaskType.UPLOAD) { - job.taskProgress.put(taskId, Pair.create(finishedNum, totalNum)); + job.taskProgress.put(taskId, Pair.of(finishedNum, totalNum)); return true; } } else if (job.getType() == JobType.RESTORE) { if (!job.isDone() && job.getJobId() == jobId && type == TTaskType.DOWNLOAD) { - job.taskProgress.put(taskId, Pair.create(finishedNum, totalNum)); + job.taskProgress.put(taskId, Pair.of(finishedNum, totalNum)); return true; } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/BrokerStorage.java b/fe/fe-core/src/main/java/org/apache/doris/backup/BrokerStorage.java index a2fabcfd4e..093413c953 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/BrokerStorage.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/BrokerStorage.java @@ -609,7 +609,7 @@ public class BrokerStorage extends BlobStorage { } public Pair<TPaloBrokerService.Client, TNetworkAddress> getBroker() { - Pair<TPaloBrokerService.Client, TNetworkAddress> result = new Pair<>(null, null); + Pair<TPaloBrokerService.Client, TNetworkAddress> result = Pair.of(null, null); FsBroker broker; try { String localIP = FrontendOptions.getLocalHostAddress(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java b/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java index 794da52a80..3ce98c9649 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/Repository.java @@ -159,7 +159,7 @@ public class Repository implements Writable { return null; } - return Pair.create(fileName, md5sum); + return Pair.of(fileName, md5sum); } // in: /path/to/orig_file diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java index bcd06071e1..4a592d71cf 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java @@ -616,7 +616,7 @@ public class RestoreJob extends AbstractJob { if (restorePart == null) { return; } - restoredPartitions.add(Pair.create(localOlapTbl.getName(), restorePart)); + restoredPartitions.add(Pair.of(localOlapTbl.getName(), restorePart)); } } else { // It is impossible that a single partitioned table exist @@ -1813,7 +1813,7 @@ public class RestoreJob extends AbstractJob { for (int i = 0; i < size; i++) { String tblName = Text.readString(in); Partition part = Partition.read(in); - restoredPartitions.add(Pair.create(tblName, part)); + restoredPartitions.add(Pair.of(tblName, part)); } size = in.readInt(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java index 9f19f1de44..b01a020f4a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java @@ -353,7 +353,7 @@ public class Database extends MetaObject implements Writable, DatabaseIf<Table> Env.getCurrentEnv().getEsRepository().registerTable((EsTable) table); } } - return Pair.create(result, isTableExist); + return Pair.of(result, isTableExist); } finally { writeUnlock(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java index c0d131660d..060a044074 100755 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java @@ -1136,7 +1136,7 @@ public class Env { } private void getSelfHostPort() { - selfNode = new Pair<String, Integer>(FrontendOptions.getLocalHostAddress(), Config.edit_log_port); + selfNode = Pair.of(FrontendOptions.getLocalHostAddress(), Config.edit_log_port); LOG.debug("get self node: {}", selfNode); } @@ -1187,7 +1187,7 @@ public class Env { } } else { // If helper node is not designated, use local node as helper node. - helperNodes.add(Pair.create(selfNode.first, Config.edit_log_port)); + helperNodes.add(Pair.of(selfNode.first, Config.edit_log_port)); } } @@ -1210,7 +1210,7 @@ public class Env { // This is not the first time this node start up. // It should already added to FE group, just set helper node as it self. LOG.info("role file exist. this is not the first time to start up"); - helperNodes = Lists.newArrayList(Pair.create(selfNode.first, Config.edit_log_port)); + helperNodes = Lists.newArrayList(Pair.of(selfNode.first, Config.edit_log_port)); return; } @@ -2487,7 +2487,7 @@ public class Env { BDBHA bdbha = (BDBHA) haProtocol; if (role == FrontendNodeType.FOLLOWER || role == FrontendNodeType.REPLICA) { bdbha.addHelperSocket(host, editLogPort); - helperNodes.add(Pair.create(host, editLogPort)); + helperNodes.add(Pair.of(host, editLogPort)); bdbha.addUnReadyElectableNode(nodeName, getFollowerCount()); } bdbha.removeConflictNodeIfExist(host, editLogPort); @@ -2517,7 +2517,7 @@ public class Env { if (fe.getRole() == FrontendNodeType.FOLLOWER || fe.getRole() == FrontendNodeType.REPLICA) { haProtocol.removeElectableNode(fe.getNodeName()); - helperNodes.remove(Pair.create(host, port)); + helperNodes.remove(Pair.of(host, port)); BDBHA ha = (BDBHA) haProtocol; ha.removeUnReadyElectableNode(nodeName, getFollowerCount()); } @@ -3181,7 +3181,7 @@ public class Env { // DO NOT add helper sockets here, cause BDBHA is not instantiated yet. // helper sockets will be added after start BDBHA // But add to helperNodes, just for show - helperNodes.add(Pair.create(fe.getHost(), fe.getEditLogPort())); + helperNodes.add(Pair.of(fe.getHost(), fe.getEditLogPort())); } } finally { unlock(); @@ -3197,7 +3197,7 @@ public class Env { return; } if (removedFe.getRole() == FrontendNodeType.FOLLOWER || removedFe.getRole() == FrontendNodeType.REPLICA) { - helperNodes.remove(Pair.create(removedFe.getHost(), removedFe.getEditLogPort())); + helperNodes.remove(Pair.of(removedFe.getHost(), removedFe.getEditLogPort())); } removedFrontends.add(removedFe.getNodeName()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/InfoSchemaDb.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/InfoSchemaDb.java index ab26cbab75..5624addc6f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/InfoSchemaDb.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/InfoSchemaDb.java @@ -41,7 +41,7 @@ public class InfoSchemaDb extends Database { @Override public Pair<Boolean, Boolean> createTableWithLock(Table table, boolean isReplay, boolean setIfNotExist) { - return Pair.create(false, false); + return Pair.of(false, false); } @Override diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/SparkResource.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/SparkResource.java index c936f96c58..c8b59bfa26 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/SparkResource.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/SparkResource.java @@ -150,7 +150,7 @@ public class SparkResource extends Resource { } public Pair<String, String> getYarnResourcemanagerAddressPair() { - return Pair.create(YARN_RESOURCE_MANAGER_ADDRESS, sparkConfigs.get(SPARK_YARN_RESOURCE_MANAGER_ADDRESS)); + return Pair.of(YARN_RESOURCE_MANAGER_ADDRESS, sparkConfigs.get(SPARK_YARN_RESOURCE_MANAGER_ADDRESS)); } public SparkResource getCopiedResource() { diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java index 38f7865549..810dffd56c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Tablet.java @@ -470,7 +470,7 @@ public class Tablet extends MetaObject implements Writable { // 1. alive replicas are not enough int aliveBackendsNum = aliveBeIdsInCluster.size(); if (alive == 0) { - return Pair.create(TabletStatus.UNRECOVERABLE, Priority.VERY_HIGH); + return Pair.of(TabletStatus.UNRECOVERABLE, Priority.VERY_HIGH); } else if (alive < replicationNum && replicas.size() >= aliveBackendsNum && aliveBackendsNum >= replicationNum && replicationNum > 1) { // there is no enough backend for us to create a new replica, so we have to delete an existing replica, @@ -482,26 +482,26 @@ public class Tablet extends MetaObject implements Writable { // 3. aliveBackendsNum >= replicationNum: make sure after deleting, // there will be at least one backend for new replica. // 4. replicationNum > 1: if replication num is set to 1, do not delete any replica, for safety reason - return Pair.create(TabletStatus.FORCE_REDUNDANT, TabletSchedCtx.Priority.VERY_HIGH); + return Pair.of(TabletStatus.FORCE_REDUNDANT, TabletSchedCtx.Priority.VERY_HIGH); } else if (alive < (replicationNum / 2) + 1) { - return Pair.create(TabletStatus.REPLICA_MISSING, TabletSchedCtx.Priority.HIGH); + return Pair.of(TabletStatus.REPLICA_MISSING, TabletSchedCtx.Priority.HIGH); } else if (alive < replicationNum) { - return Pair.create(TabletStatus.REPLICA_MISSING, TabletSchedCtx.Priority.NORMAL); + return Pair.of(TabletStatus.REPLICA_MISSING, TabletSchedCtx.Priority.NORMAL); } // 2. version complete replicas are not enough if (aliveAndVersionComplete == 0) { - return Pair.create(TabletStatus.UNRECOVERABLE, Priority.VERY_HIGH); + return Pair.of(TabletStatus.UNRECOVERABLE, Priority.VERY_HIGH); } else if (aliveAndVersionComplete < (replicationNum / 2) + 1) { - return Pair.create(TabletStatus.VERSION_INCOMPLETE, TabletSchedCtx.Priority.HIGH); + return Pair.of(TabletStatus.VERSION_INCOMPLETE, TabletSchedCtx.Priority.HIGH); } else if (aliveAndVersionComplete < replicationNum) { - return Pair.create(TabletStatus.VERSION_INCOMPLETE, TabletSchedCtx.Priority.NORMAL); + return Pair.of(TabletStatus.VERSION_INCOMPLETE, TabletSchedCtx.Priority.NORMAL); } else if (aliveAndVersionComplete > replicationNum) { if (needFurtherRepairReplica != null) { - return Pair.create(TabletStatus.NEED_FURTHER_REPAIR, TabletSchedCtx.Priority.HIGH); + return Pair.of(TabletStatus.NEED_FURTHER_REPAIR, TabletSchedCtx.Priority.HIGH); } // we set REDUNDANT as VERY_HIGH, because delete redundant replicas can free the space quickly. - return Pair.create(TabletStatus.REDUNDANT, TabletSchedCtx.Priority.VERY_HIGH); + return Pair.of(TabletStatus.REDUNDANT, TabletSchedCtx.Priority.VERY_HIGH); } // 3. replica is under relocating @@ -514,36 +514,36 @@ public class Tablet extends MetaObject implements Writable { if (replicaBeIds.containsAll(availableBeIds) && availableBeIds.size() >= replicationNum && replicationNum > 1) { // No BE can be choose to create a new replica - return Pair.create(TabletStatus.FORCE_REDUNDANT, + return Pair.of(TabletStatus.FORCE_REDUNDANT, stable < (replicationNum / 2) + 1 ? TabletSchedCtx.Priority.NORMAL : TabletSchedCtx.Priority.LOW); } if (stable < (replicationNum / 2) + 1) { - return Pair.create(TabletStatus.REPLICA_RELOCATING, TabletSchedCtx.Priority.NORMAL); + return Pair.of(TabletStatus.REPLICA_RELOCATING, TabletSchedCtx.Priority.NORMAL); } else if (stable < replicationNum) { - return Pair.create(TabletStatus.REPLICA_RELOCATING, TabletSchedCtx.Priority.LOW); + return Pair.of(TabletStatus.REPLICA_RELOCATING, TabletSchedCtx.Priority.LOW); } } // 4. healthy replicas in cluster are not enough if (availableInCluster < replicationNum) { - return Pair.create(TabletStatus.REPLICA_MISSING_IN_CLUSTER, TabletSchedCtx.Priority.LOW); + return Pair.of(TabletStatus.REPLICA_MISSING_IN_CLUSTER, TabletSchedCtx.Priority.LOW); } // 5. got enough healthy replicas, check tag for (Map.Entry<Tag, Short> alloc : allocMap.entrySet()) { if (!currentAllocMap.containsKey(alloc.getKey()) || currentAllocMap.get(alloc.getKey()) < alloc.getValue()) { - return Pair.create(TabletStatus.REPLICA_MISSING_FOR_TAG, TabletSchedCtx.Priority.NORMAL); + return Pair.of(TabletStatus.REPLICA_MISSING_FOR_TAG, TabletSchedCtx.Priority.NORMAL); } } if (replicas.size() > replicationNum) { if (needFurtherRepairReplica != null) { - return Pair.create(TabletStatus.NEED_FURTHER_REPAIR, TabletSchedCtx.Priority.HIGH); + return Pair.of(TabletStatus.NEED_FURTHER_REPAIR, TabletSchedCtx.Priority.HIGH); } // we set REDUNDANT as VERY_HIGH, because delete redundant replicas can free the space quickly. - return Pair.create(TabletStatus.REDUNDANT, TabletSchedCtx.Priority.VERY_HIGH); + return Pair.of(TabletStatus.REDUNDANT, TabletSchedCtx.Priority.VERY_HIGH); } // 6. find a replica's version count is much more than others, and drop it @@ -555,12 +555,12 @@ public class Tablet extends MetaObject implements Writable { double ratio = (double) delta / versions.get(versions.size() - 1); if (versions.get(versions.size() - 1) > Config.min_version_count_indicate_replica_compaction_too_slow && ratio > Config.valid_version_count_delta_ratio_between_replicas) { - return Pair.create(TabletStatus.REPLICA_COMPACTION_TOO_SLOW, Priority.HIGH); + return Pair.of(TabletStatus.REPLICA_COMPACTION_TOO_SLOW, Priority.HIGH); } } // 7. healthy - return Pair.create(TabletStatus.HEALTHY, TabletSchedCtx.Priority.NORMAL); + return Pair.of(TabletStatus.HEALTHY, TabletSchedCtx.Priority.NORMAL); } /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java index 164f125da4..d504e52a0a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Type.java @@ -799,7 +799,7 @@ public abstract class Type { break; } } - return new Pair<Type, Integer>(type, tmpNodeIdx); + return Pair.of(type, tmpNodeIdx); } /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java b/fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java index 8a684a2d0d..dde22e54d0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/clone/DynamicPartitionScheduler.java @@ -98,16 +98,16 @@ public class DynamicPartitionScheduler extends MasterDaemon { } public void executeDynamicPartitionFirstTime(Long dbId, Long tableId) { - List<Pair<Long, Long>> tempDynamicPartitionTableInfo = Lists.newArrayList(new Pair<>(dbId, tableId)); + List<Pair<Long, Long>> tempDynamicPartitionTableInfo = Lists.newArrayList(Pair.of(dbId, tableId)); executeDynamicPartition(tempDynamicPartitionTableInfo); } public void registerDynamicPartitionTable(Long dbId, Long tableId) { - dynamicPartitionTableInfo.add(new Pair<>(dbId, tableId)); + dynamicPartitionTableInfo.add(Pair.of(dbId, tableId)); } public void removeDynamicPartitionTable(Long dbId, Long tableId) { - dynamicPartitionTableInfo.remove(new Pair<>(dbId, tableId)); + dynamicPartitionTableInfo.remove(Pair.of(dbId, tableId)); } public String getRuntimeInfo(long tableId, String key) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/clone/PartitionRebalancer.java b/fe/fe-core/src/main/java/org/apache/doris/clone/PartitionRebalancer.java index b43af45c29..2accb92a27 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/clone/PartitionRebalancer.java +++ b/fe/fe-core/src/main/java/org/apache/doris/clone/PartitionRebalancer.java @@ -157,7 +157,7 @@ public class PartitionRebalancer extends Rebalancer { alternativeTablets.add(tabletCtx); // Pair<Move, ToDeleteReplicaId>, ToDeleteReplicaId should be -1L before scheduled successfully movesInProgress.get().put(pickedTabletId, - new Pair<>(new TabletMove(pickedTabletId, move.fromBe, move.toBe), -1L)); + Pair.of(new TabletMove(pickedTabletId, move.fromBe, move.toBe), -1L)); counterBalanceMoveCreated.incrementAndGet(); // Synchronize with movesInProgress inProgressIds.add(pickedTabletId); diff --git a/fe/fe-core/src/main/java/org/apache/doris/clone/TabletChecker.java b/fe/fe-core/src/main/java/org/apache/doris/clone/TabletChecker.java index 373264be1d..cc6d8a47a2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/clone/TabletChecker.java +++ b/fe/fe-core/src/main/java/org/apache/doris/clone/TabletChecker.java @@ -447,7 +447,7 @@ public class TabletChecker extends MasterDaemon { long tblId = tblEntry.getKey(); OlapTable tbl = (OlapTable) db.getTableNullable(tblId); if (tbl == null) { - deletedPrios.add(Pair.create(dbId, tblId)); + deletedPrios.add(Pair.of(dbId, tblId)); continue; } tbl.readLock(); @@ -456,7 +456,7 @@ public class TabletChecker extends MasterDaemon { parts = parts.stream().filter(p -> (tbl.getPartition(p.partId) != null && !p.isTimeout())).collect( Collectors.toSet()); if (parts.isEmpty()) { - deletedPrios.add(Pair.create(dbId, tblId)); + deletedPrios.add(Pair.of(dbId, tblId)); } } finally { tbl.readUnlock(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java b/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java index c4430decd8..d585996600 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java @@ -528,7 +528,7 @@ public class TabletScheduler extends MasterDaemon { partition.getVisibleVersion(), tbl.getPartitionInfo().getReplicaAllocation(partition.getId()), backendsSet); - statusPair = Pair.create(st, Priority.HIGH); + statusPair = Pair.of(st, Priority.HIGH); tabletCtx.setColocateGroupBackendIds(backendsSet); } else { List<Long> aliveBeIdsInCluster = infoService.getClusterBackendIds(db.getClusterName(), true); diff --git a/fe/fe-core/src/main/java/org/apache/doris/clone/TwoDimensionalGreedyRebalanceAlgo.java b/fe/fe-core/src/main/java/org/apache/doris/clone/TwoDimensionalGreedyRebalanceAlgo.java index b589b3f157..05e7528336 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/clone/TwoDimensionalGreedyRebalanceAlgo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/clone/TwoDimensionalGreedyRebalanceAlgo.java @@ -279,7 +279,7 @@ public class TwoDimensionalGreedyRebalanceAlgo { return null; } Long count = (extremumType == ExtremumType.MIN) ? multimap.keySet().first() : multimap.keySet().last(); - return new Pair<>(count, multimap.get(count)); + return Pair.of(count, multimap.get(count)); } /** Update the balance state in 'ClusterBalanceInfo'(the two maps) with the outcome of the move 'move'. diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/Pair.java b/fe/fe-core/src/main/java/org/apache/doris/common/Pair.java index 86c94b97dc..581e896033 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/Pair.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/Pair.java @@ -23,10 +23,11 @@ package org.apache.doris.common; import com.google.gson.annotations.SerializedName; import java.util.Comparator; +import java.util.Objects; /** * The equivalent of C++'s std::pair<>. - * + * <p> * Notice: When using Pair for persistence, users need to guarantee that F and S can be serialized through Gson */ public class Pair<F, S> { @@ -37,41 +38,31 @@ public class Pair<F, S> { @SerializedName(value = "second") public S second; - public Pair(F first, S second) { + private Pair(F first, S second) { this.first = first; this.second = second; } - public static <F, S> Pair<F, S> create(F first, S second) { - return new Pair<F, S>(first, second); + public static <F, S> Pair<F, S> of(F first, S second) { + return new Pair<>(first, second); } - public F getFirst() { - return first; - } - - public S getSecond() { - return second; - } - - @Override /** * A pair is equal if both parts are equal(). */ + @Override public boolean equals(Object o) { if (o instanceof Pair) { Pair<F, S> other = (Pair<F, S>) o; - return this.first.equals(other.first) && this.second.equals(other.second); + return first.equals(other.first) + && second.equals(other.second); } return false; } @Override public int hashCode() { - int hashFirst = first != null ? first.hashCode() : 0; - int hashSecond = second != null ? second.hashCode() : 0; - - return (hashFirst + hashSecond) * hashSecond + hashFirst; + return Objects.hash(first, second); } @Override diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/proc/FrontendsProcNode.java b/fe/fe-core/src/main/java/org/apache/doris/common/proc/FrontendsProcNode.java index d78b67d44c..1371fa598a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/proc/FrontendsProcNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/proc/FrontendsProcNode.java @@ -156,7 +156,7 @@ public class FrontendsProcNode implements ProcNodeInterface { private static List<Pair<String, Integer>> convertToHostPortPair(List<InetSocketAddress> addrs) { List<Pair<String, Integer>> hostPortPair = Lists.newArrayList(); for (InetSocketAddress addr : addrs) { - hostPortPair.add(Pair.create(addr.getAddress().getHostAddress(), addr.getPort())); + hostPortPair.add(Pair.of(addr.getAddress().getHostAddress(), addr.getPort())); } return hostPortPair; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/profile/CounterNode.java b/fe/fe-core/src/main/java/org/apache/doris/common/profile/CounterNode.java index 5934f05f05..bb4d4a5f1c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/profile/CounterNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/profile/CounterNode.java @@ -24,7 +24,7 @@ public class CounterNode extends TreeNode<CounterNode> { private Pair<String, String> counter; public void setCounter(String key, String value) { - counter = Pair.create(key, value); + counter = Pair.of(key, value); } public Pair<String, String> getCounter() { diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/BrokerUtil.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/BrokerUtil.java index 73c315d975..253c6b9f01 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/BrokerUtil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/BrokerUtil.java @@ -527,7 +527,7 @@ public class BrokerUtil { public static Pair<TPaloBrokerService.Client, TNetworkAddress> getBrokerAddressAndClient(BrokerDesc brokerDesc) throws UserException { - Pair<TPaloBrokerService.Client, TNetworkAddress> pair = new Pair<>(null, null); + Pair<TPaloBrokerService.Client, TNetworkAddress> pair = Pair.of(null, null); TNetworkAddress address = getAddress(brokerDesc); TPaloBrokerService.Client client = borrowClient(address); pair.first = client; diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/DebugUtil.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/DebugUtil.java index 1f4f1680cc..75fb331347 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/DebugUtil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/DebugUtil.java @@ -55,7 +55,7 @@ public class DebugUtil { unit = "K"; doubleValue /= THOUSAND; } - Pair<Double, String> returnValue = Pair.create(doubleValue, unit); + Pair<Double, String> returnValue = Pair.of(doubleValue, unit); return returnValue; } @@ -115,7 +115,7 @@ public class DebugUtil { } else { unit = "B"; } - Pair<Double, String> returnValue = Pair.create(doubleValue, unit); + Pair<Double, String> returnValue = Pair.of(doubleValue, unit); return returnValue; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/KafkaUtil.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/KafkaUtil.java index 70bb42b128..28da357119 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/KafkaUtil.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/KafkaUtil.java @@ -133,7 +133,7 @@ public class KafkaUtil { List<InternalService.PIntegerPair> pairs = result.getPartitionOffsets().getOffsetTimesList(); List<Pair<Integer, Long>> partitionOffsets = Lists.newArrayList(); for (InternalService.PIntegerPair pair : pairs) { - partitionOffsets.add(Pair.create(pair.getKey(), pair.getVal())); + partitionOffsets.add(Pair.of(pair.getKey(), pair.getVal())); } LOG.debug("finish to get offsets for times of topic: {}, {}", topic, partitionOffsets); return partitionOffsets; @@ -191,7 +191,7 @@ public class KafkaUtil { List<InternalService.PIntegerPair> pairs = result.getPartitionOffsets().getOffsetTimesList(); List<Pair<Integer, Long>> partitionOffsets = Lists.newArrayList(); for (InternalService.PIntegerPair pair : pairs) { - partitionOffsets.add(Pair.create(pair.getKey(), pair.getVal())); + partitionOffsets.add(Pair.of(pair.getKey(), pair.getVal())); } LOG.debug("finish to get latest offsets for partitions {} in topic: {}, task {}, job {}", partitionOffsets, topic, taskId, jobId); diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java b/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java index 82402c294d..aceb7dc1e5 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/util/RuntimeProfile.java @@ -208,7 +208,7 @@ public class RuntimeProfile { if (childProfile == null) { childMap.put(childName, new RuntimeProfile(childName)); childProfile = this.childMap.get(childName); - Pair<RuntimeProfile, Boolean> pair = Pair.create(childProfile, tchild.indent); + Pair<RuntimeProfile, Boolean> pair = Pair.of(childProfile, tchild.indent); this.childList.add(pair); } } finally { @@ -371,7 +371,7 @@ public class RuntimeProfile { childList.removeIf(e -> e.first.name.equals(child.name)); } this.childMap.put(child.name, child); - Pair<RuntimeProfile, Boolean> pair = Pair.create(child, true); + Pair<RuntimeProfile, Boolean> pair = Pair.of(child, true); this.childList.add(pair); } finally { childLock.writeLock().unlock(); @@ -388,7 +388,7 @@ public class RuntimeProfile { childList.removeIf(e -> e.first.name.equals(child.name)); } this.childMap.put(child.name, child); - Pair<RuntimeProfile, Boolean> pair = Pair.create(child, true); + Pair<RuntimeProfile, Boolean> pair = Pair.of(child, true); this.childList.addFirst(pair); } finally { childLock.writeLock().unlock(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/deploy/DeployManager.java b/fe/fe-core/src/main/java/org/apache/doris/deploy/DeployManager.java index 2a14cf8398..33806e0e59 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/deploy/DeployManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/deploy/DeployManager.java @@ -242,7 +242,7 @@ public class DeployManager extends MasterDaemon { System.exit(-1); } - helperNodes.add(Pair.create(splittedHostPort[0], port)); + helperNodes.add(Pair.of(splittedHostPort[0], port)); } return helperNodes; @@ -370,7 +370,7 @@ public class DeployManager extends MasterDaemon { .getClusterBackends(SystemInfoService.DEFAULT_CLUSTER); List<Pair<String, Integer>> localBackendHosts = Lists.newArrayList(); for (Backend backend : localBackends) { - localBackendHosts.add(Pair.create(backend.getHost(), backend.getHeartbeatPort())); + localBackendHosts.add(Pair.of(backend.getHost(), backend.getHeartbeatPort())); } LOG.debug("get local backend addrs: {}", localBackendHosts); if (inspectNodeChange(remoteBackendHosts, localBackendHosts, NodeType.BACKEND)) { @@ -417,7 +417,7 @@ public class DeployManager extends MasterDaemon { Pair<String, Integer> foundHost = getHostFromPairList(remoteList, addr.ip, addr.port); if (foundHost == null) { List<Pair<String, Integer>> list = Lists.newArrayList(); - list.add(Pair.create(addr.ip, addr.port)); + list.add(Pair.of(addr.ip, addr.port)); try { env.getBrokerMgr().dropBrokers(brokerName, list); LOG.info("drop broker {}:{} with name: {}", @@ -436,7 +436,7 @@ public class DeployManager extends MasterDaemon { if (foundAddr == null) { // add new broker List<Pair<String, Integer>> list = Lists.newArrayList(); - list.add(Pair.create(pair.first, pair.second)); + list.add(Pair.of(pair.first, pair.second)); try { env.getBrokerMgr().addBrokers(brokerName, list); LOG.info("add broker {}:{} with name {}", pair.first, pair.second, brokerName); @@ -586,7 +586,7 @@ public class DeployManager extends MasterDaemon { break; case BACKEND: List<Pair<String, Integer>> newBackends = Lists.newArrayList(); - newBackends.add(Pair.create(remoteIp, remotePort)); + newBackends.add(Pair.of(remoteIp, remotePort)); Env.getCurrentSystemInfo().addBackends(newBackends, false); break; default: @@ -619,7 +619,7 @@ public class DeployManager extends MasterDaemon { private List<Pair<String, Integer>> convertToHostPortPair(List<Frontend> frontends) { List<Pair<String, Integer>> hostPortPair = Lists.newArrayList(); for (Frontend fe : frontends) { - hostPortPair.add(Pair.create(fe.getHost(), fe.getEditLogPort())); + hostPortPair.add(Pair.of(fe.getHost(), fe.getEditLogPort())); } return hostPortPair; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/deploy/impl/K8sDeployManager.java b/fe/fe-core/src/main/java/org/apache/doris/deploy/impl/K8sDeployManager.java index cf0d53fb61..0c3bfef320 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/deploy/impl/K8sDeployManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/deploy/impl/K8sDeployManager.java @@ -148,7 +148,7 @@ public class K8sDeployManager extends DeployManager { List<EndpointAddress> addrs = subset.getAddresses(); for (EndpointAddress eaddr : addrs) { - result.add(Pair.create(eaddr.getIp(), port)); + result.add(Pair.of(eaddr.getIp(), port)); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/MetaInfoAction.java b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/MetaInfoAction.java index a51b6bea13..6f8a956474 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/MetaInfoAction.java +++ b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/MetaInfoAction.java @@ -322,8 +322,8 @@ public class MetaInfoAction extends RestBaseController { } if (maxNum <= 0) { - return Pair.create(0, 0); + return Pair.of(0, 0); } - return Pair.create(Math.min(offset, maxNum - 1), Math.min(limit + offset, maxNum)); + return Pair.of(Math.min(offset, maxNum - 1), Math.min(limit + offset, maxNum)); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/HttpUtils.java b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/HttpUtils.java index 71e3fd1964..dc238bfcec 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/HttpUtils.java +++ b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/HttpUtils.java @@ -49,7 +49,7 @@ public class HttpUtils { static List<Pair<String, Integer>> getFeList() { return Env.getCurrentEnv().getFrontends(null) - .stream().filter(Frontend::isAlive).map(fe -> new Pair<>(fe.getHost(), Config.http_port)) + .stream().filter(Frontend::isAlive).map(fe -> Pair.of(fe.getHost(), Config.http_port)) .collect(Collectors.toList()); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/NodeAction.java b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/NodeAction.java index 78eec49c51..f294e7a050 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/NodeAction.java +++ b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/manager/NodeAction.java @@ -484,7 +484,7 @@ public class NodeAction extends RestBaseController { List<Map<String, String>> failedTotal = Lists.newArrayList(); List<NodeConfigs> nodeConfigList = parseSetConfigNodes(requestBody, failedTotal); List<Pair<String, Integer>> aliveFe = Env.getCurrentEnv().getFrontends(null) - .stream().filter(Frontend::isAlive).map(fe -> new Pair<>(fe.getHost(), Config.http_port)) + .stream().filter(Frontend::isAlive).map(fe -> Pair.of(fe.getHost(), Config.http_port)) .collect(Collectors.toList()); checkNodeIsAlive(nodeConfigList, aliveFe, failedTotal); @@ -587,7 +587,7 @@ public class NodeAction extends RestBaseController { List<Pair<String, Integer>> aliveBe = Env.getCurrentSystemInfo().getBackendIds(true) .stream().map(beId -> { Backend be = Env.getCurrentSystemInfo().getBackend(beId); - return new Pair<>(be.getHost(), be.getHttpPort()); + return Pair.of(be.getHost(), be.getHttpPort()); }) .collect(Collectors.toList()); checkNodeIsAlive(nodeConfigList, aliveBe, failedTotal); @@ -784,7 +784,7 @@ public class NodeAction extends RestBaseController { private Map<String, String> nonPersistConfigs; public NodeConfigs(String host, Integer httpPort) { - hostPort = new Pair<>(host, httpPort); + hostPort = Pair.of(host, httpPort); persistConfigs = Maps.newHashMap(); nonPersistConfigs = Maps.newHashMap(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/httpv2/restv2/MetaInfoActionV2.java b/fe/fe-core/src/main/java/org/apache/doris/httpv2/restv2/MetaInfoActionV2.java index 24496a567d..45ff9c0a32 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/httpv2/restv2/MetaInfoActionV2.java +++ b/fe/fe-core/src/main/java/org/apache/doris/httpv2/restv2/MetaInfoActionV2.java @@ -347,9 +347,9 @@ public class MetaInfoActionV2 extends RestBaseController { } if (maxNum <= 0) { - return Pair.create(0, 0); + return Pair.of(0, 0); } - return Pair.create(Math.min(offset, maxNum - 1), Math.min(limit + offset, maxNum)); + return Pair.of(Math.min(offset, maxNum - 1), Math.min(limit + offset, maxNum)); } @Getter diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/Load.java b/fe/fe-core/src/main/java/org/apache/doris/load/Load.java index 846d8aa78f..4a7732fd26 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/Load.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/Load.java @@ -610,7 +610,7 @@ public class Load { * (A, B, C) SET (__doris_shadow_B = substitute(B)) */ columnToHadoopFunction.put(column.getName(), - Pair.create("substitute", Lists.newArrayList(originCol))); + Pair.of("substitute", Lists.newArrayList(originCol))); ImportColumnDesc importColumnDesc = new ImportColumnDesc(column.getName(), new SlotRef(null, originCol)); parsedColumnExprList.add(importColumnDesc); @@ -636,7 +636,7 @@ public class Load { * -> * (A, B, C) SET (__DORIS_DELETE_SIGN__ = 0) */ - columnToHadoopFunction.put(column.getName(), Pair.create("default_value", + columnToHadoopFunction.put(column.getName(), Pair.of("default_value", Lists.newArrayList(column.getDefaultValue()))); ImportColumnDesc importColumnDesc = null; try { diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/Source.java b/fe/fe-core/src/main/java/org/apache/doris/load/Source.java index a901503489..de212fe6cb 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/Source.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/Source.java @@ -204,7 +204,7 @@ public class Source implements Writable { args.add(Text.readString(in)); } } - columnToFunction.put(column, new Pair<String, List<String>>(functionName, args)); + columnToFunction.put(column, Pair.of(functionName, args)); } } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/SparkLoadJob.java b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/SparkLoadJob.java index 8028074e67..22cde5328e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/SparkLoadJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/loadv2/SparkLoadJob.java @@ -372,7 +372,7 @@ public class SparkLoadJob extends BulkLoadJob { continue; } String tabletMetaStr = EtlJobConfig.getTabletMetaStr(filePath); - tabletMetaToFileInfo.put(tabletMetaStr, Pair.create(filePath, entry.getValue())); + tabletMetaToFileInfo.put(tabletMetaStr, Pair.of(filePath, entry.getValue())); } loadingStatus = etlStatus; @@ -775,7 +775,7 @@ public class SparkLoadJob extends BulkLoadJob { int size = in.readInt(); for (int i = 0; i < size; i++) { String tabletMetaStr = Text.readString(in); - Pair<String, Long> fileInfo = Pair.create(Text.readString(in), in.readLong()); + Pair<String, Long> fileInfo = Pair.of(Text.readString(in), in.readLong()); tabletMetaToFileInfo.put(tabletMetaStr, fileInfo); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/routineload/KafkaProgress.java b/fe/fe-core/src/main/java/org/apache/doris/load/routineload/KafkaProgress.java index d4ecdcfcc2..bb31d3ce54 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/routineload/KafkaProgress.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/routineload/KafkaProgress.java @@ -132,17 +132,17 @@ public class KafkaProgress extends RoutineLoadProgress { List<Pair<Integer, String>> pairs = Lists.newArrayList(); for (Map.Entry<Integer, Long> entry : partitionIdToOffset.entrySet()) { if (entry.getValue() == 0) { - pairs.add(Pair.create(entry.getKey(), OFFSET_ZERO)); + pairs.add(Pair.of(entry.getKey(), OFFSET_ZERO)); } else if (entry.getValue() == -1) { - pairs.add(Pair.create(entry.getKey(), OFFSET_END)); + pairs.add(Pair.of(entry.getKey(), OFFSET_END)); } else if (entry.getValue() == -2) { - pairs.add(Pair.create(entry.getKey(), OFFSET_BEGINNING)); + pairs.add(Pair.of(entry.getKey(), OFFSET_BEGINNING)); } else { long offset = entry.getValue(); if (alreadyConsumed) { offset -= 1; } - pairs.add(Pair.create(entry.getKey(), "" + offset)); + pairs.add(Pair.of(entry.getKey(), "" + offset)); } } return pairs; diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/routineload/KafkaRoutineLoadJob.java b/fe/fe-core/src/main/java/org/apache/doris/load/routineload/KafkaRoutineLoadJob.java index 32c6e264e4..e469d2399e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/routineload/KafkaRoutineLoadJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/routineload/KafkaRoutineLoadJob.java @@ -463,7 +463,7 @@ public class KafkaRoutineLoadJob extends RoutineLoadJob { // get default offset long beginOffset = convertedDefaultOffsetToLong(); for (Integer kafkaPartition : newPartitions) { - partitionOffsets.add(Pair.create(kafkaPartition, beginOffset)); + partitionOffsets.add(Pair.of(kafkaPartition, beginOffset)); } if (isOffsetForTimes()) { try { diff --git a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java index ac1bcdc7a7..308aade5d9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserProperty.java @@ -439,7 +439,7 @@ public class UserProperty implements Writable { } } - return Pair.create(tmpCluster, dppConfig); + return Pair.of(tmpCluster, dppConfig); } public List<List<String>> fetchProperty() { diff --git a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserPropertyInfo.java b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserPropertyInfo.java index 49127578cd..647ac40fce 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserPropertyInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/UserPropertyInfo.java @@ -72,7 +72,7 @@ public class UserPropertyInfo implements Writable { for (int i = 0; i < size; i++) { String key = Text.readString(in); String val = Text.readString(in); - properties.add(Pair.create(key, val)); + properties.add(Pair.of(key, val)); } } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Group.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Group.java index 93d23cc7ec..035d86b9b7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Group.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Group.java @@ -145,15 +145,15 @@ public class Group { } /** - * Set or update lowestCostPlans: properties --> new Pair<>(cost, expression) + * Set or update lowestCostPlans: properties --> Pair.of(cost, expression) */ public void setBestPlan(GroupExpression expression, double cost, PhysicalProperties properties) { if (lowestCostPlans.containsKey(properties)) { if (lowestCostPlans.get(properties).first > cost) { - lowestCostPlans.put(properties, new Pair<>(cost, expression)); + lowestCostPlans.put(properties, Pair.of(cost, expression)); } } else { - lowestCostPlans.put(properties, new Pair<>(cost, expression)); + lowestCostPlans.put(properties, Pair.of(cost, expression)); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/GroupExpression.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/GroupExpression.java index dc9e343b0d..f58baa7dba 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/GroupExpression.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/GroupExpression.java @@ -146,13 +146,13 @@ public class GroupExpression { double cost) { if (lowestCostTable.containsKey(outputProperties)) { if (lowestCostTable.get(outputProperties).first > cost) { - lowestCostTable.put(outputProperties, new Pair<>(cost, childrenInputProperties)); + lowestCostTable.put(outputProperties, Pair.of(cost, childrenInputProperties)); return true; } else { return false; } } else { - lowestCostTable.put(outputProperties, new Pair<>(cost, childrenInputProperties)); + lowestCostTable.put(outputProperties, Pair.of(cost, childrenInputProperties)); return true; } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java index 64096a7d06..867950446d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/memo/Memo.java @@ -75,7 +75,7 @@ public class Memo { public Pair<Boolean, GroupExpression> copyIn(Plan node, @Nullable Group target, boolean rewrite) { Optional<GroupExpression> groupExpr = node.getGroupExpression(); if (!rewrite && groupExpr.isPresent() && groupExpressions.containsKey(groupExpr.get())) { - return new Pair<>(false, groupExpr.get()); + return Pair.of(false, groupExpr.get()); } List<Group> childrenGroups = Lists.newArrayList(); for (int i = 0; i < node.children().size(); i++) { @@ -146,7 +146,7 @@ public class Memo { if (target != null && !target.getGroupId().equals(existedGroupExpression.getOwnerGroup().getGroupId())) { mergeGroup(existedGroupExpression.getOwnerGroup(), target); } - return new Pair<>(false, existedGroupExpression); + return Pair.of(false, existedGroupExpression); } if (target != null) { target.addGroupExpression(groupExpression); @@ -155,7 +155,7 @@ public class Memo { groups.add(group); } groupExpressions.put(groupExpression, groupExpression); - return new Pair<>(true, groupExpression); + return Pair.of(true, groupExpression); } /** @@ -213,7 +213,7 @@ public class Memo { groups.add(group); } groupExpressions.put(groupExpression, groupExpression); - return new Pair<>(newGroupExpressionGenerated, groupExpression); + return Pair.of(newGroupExpressionGenerated, groupExpression); } /** diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomHelper.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomHelper.java index 0a67d42bbb..a406a7f36b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomHelper.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomHelper.java @@ -158,7 +158,7 @@ public class JoinLAsscomHelper { } } - return new Pair<>(newLeftProjectExpr, newRightProjectExprs); + return Pair.of(newLeftProjectExpr, newRightProjectExprs); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java index 3648d1603f..632c974482 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/JoinUtils.java @@ -94,7 +94,7 @@ public class JoinUtils { public static Pair<List<SlotReference>, List<SlotReference>> getOnClauseUsedSlots( AbstractPhysicalJoin<Plan, Plan> join) { Pair<List<SlotReference>, List<SlotReference>> childSlots = - new Pair<>(Lists.newArrayList(), Lists.newArrayList()); + Pair.of(Lists.newArrayList(), Lists.newArrayList()); List<SlotReference> leftSlots = Utils.getOutputSlotReference(join.left()); List<SlotReference> rightSlots = Utils.getOutputSlotReference(join.right()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/persist/BackendTabletsInfo.java b/fe/fe-core/src/main/java/org/apache/doris/persist/BackendTabletsInfo.java index aa3a57cf22..99d5a8f160 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/persist/BackendTabletsInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/persist/BackendTabletsInfo.java @@ -111,7 +111,7 @@ public class BackendTabletsInfo implements Writable { for (int i = 0; i < size; i++) { long tabletId = in.readLong(); int schemaHash = in.readInt(); - tabletSchemaHash.add(Pair.create(tabletId, schemaHash)); + tabletSchemaHash.add(Pair.of(tabletId, schemaHash)); } bad = in.readBoolean(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/DistributedPlanner.java b/fe/fe-core/src/main/java/org/apache/doris/planner/DistributedPlanner.java index 3c5fd828e4..90fc34674a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/DistributedPlanner.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/DistributedPlanner.java @@ -459,7 +459,7 @@ public class DistributedPlanner { if (rightScanNode == null) { return false; } - Pair<OlapScanNode, OlapScanNode> eqPair = new Pair<>(leftScanNode, rightScanNode); + Pair<OlapScanNode, OlapScanNode> eqPair = Pair.of(leftScanNode, rightScanNode); List<BinaryPredicate> predicateList = scanNodeWithJoinConjuncts.get(eqPair); if (predicateList == null) { predicateList = Lists.newArrayList(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/HashJoinNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/HashJoinNode.java index ce290abbae..1d0d684bc8 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/HashJoinNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/HashJoinNode.java @@ -726,7 +726,7 @@ public class HashJoinNode extends PlanNode { List<EqJoinConjunctScanSlots> eqJoinConjunctSlots) { Map<Pair<TupleId, TupleId>, List<EqJoinConjunctScanSlots>> scanSlotsByJoinedTids = new LinkedHashMap<>(); for (EqJoinConjunctScanSlots slots : eqJoinConjunctSlots) { - Pair<TupleId, TupleId> tids = Pair.create(slots.lhsTid(), slots.rhsTid()); + Pair<TupleId, TupleId> tids = Pair.of(slots.lhsTid(), slots.rhsTid()); List<EqJoinConjunctScanSlots> scanSlots = scanSlotsByJoinedTids.get(tids); if (scanSlots == null) { scanSlots = new ArrayList<>(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/PredicatePushDown.java b/fe/fe-core/src/main/java/org/apache/doris/planner/PredicatePushDown.java index 4f11d1a17e..37bd1be626 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/PredicatePushDown.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/PredicatePushDown.java @@ -111,7 +111,7 @@ public class PredicatePushDown { LOG.debug("pushDownConjunct: {}", pushDownConjunct); if (!analyzer.getGlobalInDeDuplication().contains(pushDownConjunct) && !analyzer.getGlobalSlotToLiteralDeDuplication() - .contains(new Pair<>(pushDownConjunct.getChild(0), pushDownConjunct.getChild(1)))) { + .contains(Pair.of(pushDownConjunct.getChild(0), pushDownConjunct.getChild(1)))) { scanNode.addConjunct(pushDownConjunct); } } else if (otherSlot.isBound(rightSlot.getSlotId()) @@ -120,7 +120,7 @@ public class PredicatePushDown { LOG.debug("pushDownConjunct: {}", pushDownConjunct); if (!analyzer.getGlobalInDeDuplication().contains(pushDownConjunct) && !analyzer.getGlobalSlotToLiteralDeDuplication() - .contains(new Pair<>(pushDownConjunct.getChild(0), pushDownConjunct.getChild(1)))) { + .contains(Pair.of(pushDownConjunct.getChild(0), pushDownConjunct.getChild(1)))) { scanNode.addConjunct(pushDownConjunct); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java index e7f1517417..1ebb5ad1a7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/SingleNodePlanner.java @@ -711,14 +711,14 @@ public class SingleNodePlanner { if (plan.getCardinality() == -1) { // use 0 for the size to avoid it becoming the leftmost input // TODO: Consider raw size of scanned partitions in the absence of stats. - candidates.add(new Pair<>(ref, new Long(0))); + candidates.add(Pair.of(ref, new Long(0))); LOG.debug("The candidate of " + ref.getUniqueAlias() + ": -1. " + "Using 0 instead of -1 to avoid error"); continue; } Preconditions.checkState(ref.isAnalyzed()); long materializedSize = plan.getCardinality(); - candidates.add(new Pair<>(ref, new Long(materializedSize))); + candidates.add(Pair.of(ref, new Long(materializedSize))); LOG.debug("The candidate of " + ref.getUniqueAlias() + ": " + materializedSize); } if (candidates.isEmpty()) { @@ -1002,7 +1002,7 @@ public class SingleNodePlanner { } Preconditions.checkState(plan != null); - refPlans.add(new Pair(ref, plan)); + refPlans.add(Pair.of(ref, plan)); } // save state of conjunct assignment; needed for join plan generation for (Pair<TableRef, PlanNode> entry : refPlans) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java index c9c9b34cbd..0be0d61646 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java @@ -265,7 +265,7 @@ public class ConnectProcessor { ctx.getState().serverStatus |= MysqlServerStatusFlag.SERVER_MORE_RESULTS_EXISTS; finalizeCommand(); } - auditInfoList.add(new Pair<>(executor.getParsedStmt(), executor.getQueryStatisticsForAuditLog())); + auditInfoList.add(Pair.of(executor.getParsedStmt(), executor.getQueryStatisticsForAuditLog())); alreadyAddedToAuditInfoList = true; } } catch (IOException e) { @@ -291,7 +291,7 @@ public class ConnectProcessor { // that means execute some statement failed if (!alreadyAddedToAuditInfoList && executor != null) { - auditInfoList.add(new Pair<>(executor.getParsedStmt(), executor.getQueryStatisticsForAuditLog())); + auditInfoList.add(Pair.of(executor.getParsedStmt(), executor.getQueryStatisticsForAuditLog())); } // audit after exec, analysis query would not be recorded diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java b/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java index 8282a56e7a..b409043eae 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/Coordinator.java @@ -662,7 +662,7 @@ public class Coordinator { } states.scopedSpan = new ScopedSpan(span); states.unsetFields(); - futures.add(Pair.create(states, states.execRemoteFragmentsAsync())); + futures.add(Pair.of(states, states.execRemoteFragmentsAsync())); } waitRpc(futures, this.timeoutDeadline - System.currentTimeMillis(), "send fragments"); @@ -676,7 +676,7 @@ public class Coordinator { .setParent(parentSpanContext).setSpanKind(SpanKind.CLIENT).startSpan(); } states.scopedSpan = new ScopedSpan(span); - futures.add(Pair.create(states, states.execPlanFragmentStartAsync())); + futures.add(Pair.of(states, states.execPlanFragmentStartAsync())); } waitRpc(futures, this.timeoutDeadline - System.currentTimeMillis(), "send execution start"); } @@ -1397,7 +1397,7 @@ public class Coordinator { fatherPlan = newPlan; newPlan = newPlan.getChild(0); } - return new Pair<PlanNode, PlanNode>(fatherPlan, newPlan); + return Pair.of(fatherPlan, newPlan); } private <K, V> V findOrInsert(HashMap<K, V> m, final K key, final V defaultVal) { @@ -1447,7 +1447,7 @@ public class Coordinator { // 2. different scanNode id scan different scanRange which belong to the scanNode id // 3. split how many scanRange one instance should scan, same bucket do not split to different instance Pair<Integer, Map<Integer, List<TScanRangeParams>>> filteredScanRanges - = Pair.create(scanRanges.getKey(), filteredNodeScanRanges); + = Pair.of(scanRanges.getKey(), filteredNodeScanRanges); if (!addressToScanRanges.containsKey(address)) { addressToScanRanges.put(address, Lists.newArrayList()); @@ -1981,7 +1981,7 @@ public class Coordinator { } } Pair<Integer, Map<Integer, List<TScanRangeParams>>> filteredScanRanges - = Pair.create(scanRanges.getKey(), filteredNodeScanRanges); + = Pair.of(scanRanges.getKey(), filteredNodeScanRanges); if (!addressToScanRanges.containsKey(address)) { addressToScanRanges.put(address, Lists.newArrayList()); diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SimpleScheduler.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SimpleScheduler.java index 2064b553ee..16dbbceba3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/SimpleScheduler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SimpleScheduler.java @@ -191,7 +191,7 @@ public class SimpleScheduler { return; } - blacklistBackends.put(backendID, Pair.create(FeConstants.heartbeat_interval_second + 1, reason)); + blacklistBackends.put(backendID, Pair.of(FeConstants.heartbeat_interval_second + 1, reason)); LOG.warn("add backend {} to black list. reason: {}", backendID, reason); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/rewrite/InferFiltersRule.java b/fe/fe-core/src/main/java/org/apache/doris/rewrite/InferFiltersRule.java index ff7f266dce..1574fd4c86 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/rewrite/InferFiltersRule.java +++ b/fe/fe-core/src/main/java/org/apache/doris/rewrite/InferFiltersRule.java @@ -180,7 +180,7 @@ public class InferFiltersRule implements ExprRewriteRule { && conjunct.getChild(1) != null) { if (conjunct.getChild(0).unwrapSlotRef() != null && conjunct.getChild(1) instanceof LiteralExpr) { - Pair<Expr, Expr> pair = new Pair<>(conjunct.getChild(0).unwrapSlotRef(), conjunct.getChild(1)); + Pair<Expr, Expr> pair = Pair.of(conjunct.getChild(0).unwrapSlotRef(), conjunct.getChild(1)); if (!slotToLiteralDeDuplication.contains(pair)) { slotToLiteralDeDuplication.add(pair); slotToLiteralExpr.add(conjunct); @@ -193,9 +193,9 @@ public class InferFiltersRule implements ExprRewriteRule { } else if (((BinaryPredicate) conjunct).getOp().isEquivalence() && conjunct.getChild(0).unwrapSlotRef() != null && conjunct.getChild(1).unwrapSlotRef() != null) { - Pair<Expr, Expr> pair = new Pair<>(conjunct.getChild(0).unwrapSlotRef(), + Pair<Expr, Expr> pair = Pair.of(conjunct.getChild(0).unwrapSlotRef(), conjunct.getChild(1).unwrapSlotRef()); - Pair<Expr, Expr> eqPair = new Pair<>(conjunct.getChild(1).unwrapSlotRef(), + Pair<Expr, Expr> eqPair = Pair.of(conjunct.getChild(1).unwrapSlotRef(), conjunct.getChild(0).unwrapSlotRef()); if (!slotEqSlotDeDuplication.contains(pair) && !slotEqSlotDeDuplication.contains(eqPair)) { @@ -335,7 +335,7 @@ public class InferFiltersRule implements ExprRewriteRule { continue; } warshall[i][j] = 1; - Pair<Integer, Integer> pair = new Pair<>(i, j); + Pair<Integer, Integer> pair = Pair.of(i, j); newSlotsArray.add(pair); } } @@ -354,9 +354,9 @@ public class InferFiltersRule implements ExprRewriteRule { Analyzer analyzer, ExprRewriter.ClauseType clauseType) { for (Pair<Integer, Integer> slotPair : newSlots) { - Pair<Expr, Expr> pair = new Pair<>(warshallArraySubscriptToExpr.get(slotPair.first), + Pair<Expr, Expr> pair = Pair.of(warshallArraySubscriptToExpr.get(slotPair.first), warshallArraySubscriptToExpr.get(slotPair.second)); - Pair<Expr, Expr> eqPair = new Pair<>(warshallArraySubscriptToExpr.get(slotPair.second), + Pair<Expr, Expr> eqPair = Pair.of(warshallArraySubscriptToExpr.get(slotPair.second), warshallArraySubscriptToExpr.get(slotPair.first)); if (!slotEqSlotDeDuplication.contains(pair) && !slotEqSlotDeDuplication.contains(eqPair)) { slotEqSlotDeDuplication.add(pair); @@ -433,12 +433,12 @@ public class InferFiltersRule implements ExprRewriteRule { boolean ret = false; TupleId newTid = newSlot.getDesc().getParent().getRef().getId(); TupleId checkTid = checkSlot.getDesc().getParent().getRef().getId(); - Pair<TupleId, TupleId> tids = new Pair<>(newTid, checkTid); + Pair<TupleId, TupleId> tids = Pair.of(newTid, checkTid); if (analyzer.isContainTupleIds(tids)) { JoinOperator joinOperator = analyzer.getAnyTwoTablesJoinOp(tids); ret = checkNeedInfer(joinOperator, false, clauseType); } else { - Pair<TupleId, TupleId> changeTids = new Pair<>(checkTid, newTid); + Pair<TupleId, TupleId> changeTids = Pair.of(checkTid, newTid); if (analyzer.isContainTupleIds(changeTids)) { JoinOperator joinOperator = analyzer.getAnyTwoTablesJoinOp(changeTids); ret = checkNeedInfer(joinOperator, true, clauseType); @@ -495,10 +495,10 @@ public class InferFiltersRule implements ExprRewriteRule { ExprRewriter.ClauseType clauseType) { if (expr instanceof BinaryPredicate) { BinaryPredicate newBP = (BinaryPredicate) expr; - Pair<Expr, Expr> pair = new Pair<>(newBP.getChild(0), newBP.getChild(1)); + Pair<Expr, Expr> pair = Pair.of(newBP.getChild(0), newBP.getChild(1)); if (!slotToLiteralDeDuplication.contains(pair)) { slotToLiteralDeDuplication.add(pair); - Pair<Expr, Boolean> newBPWithBool = new Pair<>(newBP, needAddnewExprWithState); + Pair<Expr, Boolean> newBPWithBool = Pair.of(newBP, needAddnewExprWithState); newExprWithState.add(newBPWithBool); if (clauseType.isOnClause()) { analyzer.registerOnSlotToLiteralDeDuplication(pair); @@ -577,7 +577,7 @@ public class InferFiltersRule implements ExprRewriteRule { IsNullPredicate newExpr = (IsNullPredicate) expr; if (!isNullDeDuplication.contains(newExpr.getChild(0))) { isNullDeDuplication.add(newExpr.getChild(0)); - Pair<Expr, Boolean> newExprWithBoolean = new Pair<>(newExpr, true); + Pair<Expr, Boolean> newExprWithBoolean = Pair.of(newExpr, true); newExprWithState.add(newExprWithBoolean); if (clauseType.isOnClause()) { analyzer.registerOnIsNullExpr(newExpr); @@ -662,7 +662,7 @@ public class InferFiltersRule implements ExprRewriteRule { InPredicate newIP = (InPredicate) expr; if (!inDeDuplication.contains(newIP)) { inDeDuplication.add(newIP); - Pair<Expr, Boolean> newBPWithBool = new Pair<>(newIP, needAddnewExprWithState); + Pair<Expr, Boolean> newBPWithBool = Pair.of(newIP, needAddnewExprWithState); newExprWithState.add(newBPWithBool); if (clauseType.isOnClause()) { analyzer.registerInDeDuplication(newIP); diff --git a/fe/fe-core/src/main/java/org/apache/doris/statistics/OlapScanStatsDerive.java b/fe/fe-core/src/main/java/org/apache/doris/statistics/OlapScanStatsDerive.java index 59530bb954..bbe1dd2f69 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/statistics/OlapScanStatsDerive.java +++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/OlapScanStatsDerive.java @@ -94,7 +94,7 @@ public class OlapScanStatsDerive extends BaseStatsDerive { long tableId = slot.getParent().getTable().getId(); String columnName = slot.getColumn().getName(); - slotIdToTableIdAndColumnName.put(slot.getId(), new Pair<>(tableId, columnName)); + slotIdToTableIdAndColumnName.put(slot.getId(), Pair.of(tableId, columnName)); } } @@ -124,6 +124,6 @@ public class OlapScanStatsDerive extends BaseStatsDerive { .getColumnStats(pair.first).get(pair.second).getDataSize(); } */ - return new Pair<>(ndv, dataSize); + return Pair.of(ndv, dataSize); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java b/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java index 9a087ff4bd..c7688d873a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java +++ b/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java @@ -937,7 +937,7 @@ public class SystemInfoService { throw new AnalysisException("Port is out of range: " + heartbeatPort); } - return new Pair<String, Integer>(host, heartbeatPort); + return Pair.of(host, heartbeatPort); } catch (UnknownHostException e) { throw new AnalysisException("Unknown host: " + e.getMessage()); } catch (Exception e) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/task/ExportPendingTask.java b/fe/fe-core/src/main/java/org/apache/doris/task/ExportPendingTask.java index df29f1b2e1..e2248cf7e3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/task/ExportPendingTask.java +++ b/fe/fe-core/src/main/java/org/apache/doris/task/ExportPendingTask.java @@ -125,7 +125,7 @@ public class ExportPendingTask extends MasterTask { LOG.warn("{}, export job: {}", err, job.getId()); return new Status(TStatusCode.CANCELLED, err); } - job.addSnapshotPath(new Pair<TNetworkAddress, String>(address, result.getSnapshotPath())); + job.addSnapshotPath(Pair.of(address, result.getSnapshotPath())); } } return Status.OK; diff --git a/fe/fe-core/src/main/java/org/apache/doris/task/HadoopLoadEtlTask.java b/fe/fe-core/src/main/java/org/apache/doris/task/HadoopLoadEtlTask.java index f5697b3e9f..d80f67152c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/task/HadoopLoadEtlTask.java +++ b/fe/fe-core/src/main/java/org/apache/doris/task/HadoopLoadEtlTask.java @@ -105,7 +105,7 @@ public class HadoopLoadEtlTask extends LoadEtlTask { String filePath = entry.getKey(); String partitionIndexBucket = getPartitionIndexBucketString(filePath); filePath = String.format("%s/data%s?%s", httpServer, filePath, ugi); - filePathMap.put(partitionIndexBucket, Pair.create(filePath, entry.getValue())); + filePathMap.put(partitionIndexBucket, Pair.of(filePath, entry.getValue())); } return filePathMap; diff --git a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java index ca1457bbdd..63d1dc7cd7 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java @@ -1421,7 +1421,7 @@ public class DatabaseTransactionMgr { .filter(t -> (t.getCoordinator().sourceType == TransactionState.TxnSourceType.BE && t.getCoordinator().ip.equals(coordinateHost))) .limit(limit) - .forEach(t -> txnInfos.add(new Pair<>(t.getDbId(), t.getTransactionId()))); + .forEach(t -> txnInfos.add(Pair.of(t.getDbId(), t.getTransactionId()))); } finally { readUnlock(); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/backup/BrokerStorageTest.java b/fe/fe-core/src/test/java/org/apache/doris/backup/BrokerStorageTest.java index 55342fdf24..8526bf59cc 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/backup/BrokerStorageTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/backup/BrokerStorageTest.java @@ -75,7 +75,7 @@ public class BrokerStorageTest { @Before public void setUp() throws Exception { - pair = new Pair<>(null, null); + pair = Pair.of(null, null); TTransport transport = new TSocket(brokerHost, 8111); transport.open(); TProtocol protocol = new TBinaryProtocol(transport); diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/AdminStmtTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/AdminStmtTest.java index 33be728ae3..3be8952841 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/catalog/AdminStmtTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/AdminStmtTest.java @@ -64,7 +64,7 @@ public class AdminStmtTest extends TestWithFeService { for (MaterializedIndex index : partition.getMaterializedIndices(IndexExtState.VISIBLE)) { for (Tablet tablet : index.getTablets()) { for (Replica replica : tablet.getReplicas()) { - tabletToBackendList.add(Pair.create(tablet.getId(), replica.getBackendId())); + tabletToBackendList.add(Pair.of(tablet.getId(), replica.getBackendId())); } } } diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/TabletTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/TabletTest.java index 10a707b7cd..d7fdb2694a 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/catalog/TabletTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/TabletTest.java @@ -179,25 +179,25 @@ public class TabletTest { // [1 2 4] testTabletColocateHealthStatus0( Tablet.TabletStatus.COLOCATE_MISMATCH, - Pair.create(1L, false), Pair.create(2L, false), Pair.create(4L, false) + Pair.of(1L, false), Pair.of(2L, false), Pair.of(4L, false) ); // [1 2 3(bad)] testTabletColocateHealthStatus0( Tablet.TabletStatus.VERSION_INCOMPLETE, - Pair.create(1L, false), Pair.create(2L, false), Pair.create(3L, true) + Pair.of(1L, false), Pair.of(2L, false), Pair.of(3L, true) ); // 1 2 3 4(good) testTabletColocateHealthStatus0( Tablet.TabletStatus.COLOCATE_REDUNDANT, - Pair.create(1L, false), Pair.create(2L, false), Pair.create(3L, false), Pair.create(4L, false) + Pair.of(1L, false), Pair.of(2L, false), Pair.of(3L, false), Pair.of(4L, false) ); // [1 2 3 4(bad)] testTabletColocateHealthStatus0( Tablet.TabletStatus.COLOCATE_REDUNDANT, - Pair.create(1L, false), Pair.create(2L, false), Pair.create(3L, false), Pair.create(4L, true) + Pair.of(1L, false), Pair.of(2L, false), Pair.of(3L, false), Pair.of(4L, true) ); } } diff --git a/fe/fe-core/src/test/java/org/apache/doris/catalog/UserPropertyTest.java b/fe/fe-core/src/test/java/org/apache/doris/catalog/UserPropertyTest.java index 16e8fb21f3..e7e8435871 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/catalog/UserPropertyTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/UserPropertyTest.java @@ -99,14 +99,14 @@ public class UserPropertyTest { @Test public void testUpdate() throws UserException { List<Pair<String, String>> properties = Lists.newArrayList(); - properties.add(Pair.create("MAX_USER_CONNECTIONS", "100")); - properties.add(Pair.create("resource.cpu_share", "101")); - properties.add(Pair.create("quota.normal", "102")); - properties.add(Pair.create("load_cluster.dpp-cluster.hadoop_palo_path", "/user/palo2")); - properties.add(Pair.create("default_load_cluster", "dpp-cluster")); - properties.add(Pair.create("max_qUERY_instances", "3000")); - properties.add(Pair.create("sql_block_rules", "rule1,rule2")); - properties.add(Pair.create("cpu_resource_limit", "2")); + properties.add(Pair.of("MAX_USER_CONNECTIONS", "100")); + properties.add(Pair.of("resource.cpu_share", "101")); + properties.add(Pair.of("quota.normal", "102")); + properties.add(Pair.of("load_cluster.dpp-cluster.hadoop_palo_path", "/user/palo2")); + properties.add(Pair.of("default_load_cluster", "dpp-cluster")); + properties.add(Pair.of("max_qUERY_instances", "3000")); + properties.add(Pair.of("sql_block_rules", "rule1,rule2")); + properties.add(Pair.of("cpu_resource_limit", "2")); UserProperty userProperty = new UserProperty(); userProperty.update(properties); @@ -150,13 +150,13 @@ public class UserPropertyTest { // set palo path null properties.clear(); - properties.add(Pair.create("load_cluster.dpp-cluster.hadoop_palo_path", null)); + properties.add(Pair.of("load_cluster.dpp-cluster.hadoop_palo_path", null)); userProperty.update(properties); Assert.assertEquals(null, userProperty.getLoadClusterInfo("dpp-cluster").second.getPaloPath()); // remove dpp-cluster properties.clear(); - properties.add(Pair.create("load_cluster.dpp-cluster", null)); + properties.add(Pair.of("load_cluster.dpp-cluster", null)); Assert.assertEquals("dpp-cluster", userProperty.getDefaultLoadCluster()); userProperty.update(properties); Assert.assertEquals(null, userProperty.getLoadClusterInfo("dpp-cluster").second); @@ -164,11 +164,11 @@ public class UserPropertyTest { // sql block rule properties.clear(); - properties.add(Pair.create("sql_block_rules", "")); + properties.add(Pair.of("sql_block_rules", "")); userProperty.update(properties); Assert.assertEquals(1, userProperty.getSqlBlockRules().length); properties.clear(); - properties.add(Pair.create("sql_block_rules", "test1, test2,test3")); + properties.add(Pair.of("sql_block_rules", "test1, test2,test3")); userProperty.update(properties); Assert.assertEquals(3, userProperty.getSqlBlockRules().length); } @@ -176,13 +176,13 @@ public class UserPropertyTest { @Test public void testValidation() throws UserException { List<Pair<String, String>> properties = Lists.newArrayList(); - properties.add(Pair.create("cpu_resource_limit", "-1")); + properties.add(Pair.of("cpu_resource_limit", "-1")); UserProperty userProperty = new UserProperty(); userProperty.update(properties); Assert.assertEquals(-1, userProperty.getCpuResourceLimit()); properties = Lists.newArrayList(); - properties.add(Pair.create("cpu_resource_limit", "-2")); + properties.add(Pair.of("cpu_resource_limit", "-2")); userProperty = new UserProperty(); try { userProperty.update(properties); diff --git a/fe/fe-core/src/test/java/org/apache/doris/clone/RebalanceTest.java b/fe/fe-core/src/test/java/org/apache/doris/clone/RebalanceTest.java index b68348cfd5..eefc2716b4 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/clone/RebalanceTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/clone/RebalanceTest.java @@ -327,9 +327,9 @@ public class RebalanceTest { Configurator.setLevel("org.apache.doris.clone.MovesInProgressCache", Level.DEBUG); MovesCacheMap m = new MovesCacheMap(); m.updateMapping(statisticMap, 3); - m.getCache(SystemInfoService.DEFAULT_CLUSTER, Tag.DEFAULT_BACKEND_TAG, TStorageMedium.HDD).get().put(1L, new Pair<>(null, -1L)); - m.getCache(SystemInfoService.DEFAULT_CLUSTER, Tag.DEFAULT_BACKEND_TAG, TStorageMedium.SSD).get().put(2L, new Pair<>(null, -1L)); - m.getCache(SystemInfoService.DEFAULT_CLUSTER, Tag.DEFAULT_BACKEND_TAG, TStorageMedium.SSD).get().put(3L, new Pair<>(null, -1L)); + m.getCache(SystemInfoService.DEFAULT_CLUSTER, Tag.DEFAULT_BACKEND_TAG, TStorageMedium.HDD).get().put(1L, Pair.of(null, -1L)); + m.getCache(SystemInfoService.DEFAULT_CLUSTER, Tag.DEFAULT_BACKEND_TAG, TStorageMedium.SSD).get().put(2L, Pair.of(null, -1L)); + m.getCache(SystemInfoService.DEFAULT_CLUSTER, Tag.DEFAULT_BACKEND_TAG, TStorageMedium.SSD).get().put(3L, Pair.of(null, -1L)); // Maintenance won't clean up the entries of cache m.maintain(); Assert.assertEquals(3, m.size()); @@ -338,7 +338,7 @@ public class RebalanceTest { m.updateMapping(statisticMap, 1); Assert.assertEquals(0, m.size()); - m.getCache(SystemInfoService.DEFAULT_CLUSTER, Tag.DEFAULT_BACKEND_TAG, TStorageMedium.SSD).get().put(3L, new Pair<>(null, -1L)); + m.getCache(SystemInfoService.DEFAULT_CLUSTER, Tag.DEFAULT_BACKEND_TAG, TStorageMedium.SSD).get().put(3L, Pair.of(null, -1L)); try { Thread.sleep(1000); m.maintain(); diff --git a/fe/fe-core/src/test/java/org/apache/doris/clone/TwoDimensionalGreedyRebalanceAlgoTest.java b/fe/fe-core/src/test/java/org/apache/doris/clone/TwoDimensionalGreedyRebalanceAlgoTest.java index e20392b796..090c15ae5d 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/clone/TwoDimensionalGreedyRebalanceAlgoTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/clone/TwoDimensionalGreedyRebalanceAlgoTest.java @@ -89,7 +89,7 @@ public class TwoDimensionalGreedyRebalanceAlgoTest { Set<Pair<Long, Long>> partitionIds = Sets.newHashSet(); for (TestClusterConfig.PartitionPerBeReplicas p : tcc.partitionReplicas) { Assert.assertEquals(tcc.beIds.size(), p.numReplicasByServer.size()); - partitionIds.add(new Pair<>(p.partitionId, p.indexId)); + partitionIds.add(Pair.of(p.partitionId, p.indexId)); } Assert.assertEquals(partitionIds.size(), tcc.partitionReplicas.size()); diff --git a/fe/fe-core/src/test/java/org/apache/doris/load/loadv2/SparkLoadJobTest.java b/fe/fe-core/src/test/java/org/apache/doris/load/loadv2/SparkLoadJobTest.java index 3bddffc26a..40b0262673 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/load/loadv2/SparkLoadJobTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/load/loadv2/SparkLoadJobTest.java @@ -464,7 +464,7 @@ public class SparkLoadJobTest { String filePath = String.format("hdfs://127.0.0.1:10000/doris/jobs/1/label6/9/V1.label6.%d.%d.%d.0.%d.parquet", tableId, partitionId, indexId, schemaHash); long fileSize = 6L; - tabletMetaToFileInfo.put(tabletMeta, Pair.create(filePath, fileSize)); + tabletMetaToFileInfo.put(tabletMeta, Pair.of(filePath, fileSize)); if (file.exists()) { file.delete(); diff --git a/fe/fe-core/src/test/java/org/apache/doris/load/routineload/KafkaRoutineLoadJobTest.java b/fe/fe-core/src/test/java/org/apache/doris/load/routineload/KafkaRoutineLoadJobTest.java index e88736c8e5..6b50e362bb 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/load/routineload/KafkaRoutineLoadJobTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/load/routineload/KafkaRoutineLoadJobTest.java @@ -251,7 +251,7 @@ public class KafkaRoutineLoadJobTest { List<Pair<Integer, Long>> partitionIdToOffset = Lists.newArrayList(); List<PartitionInfo> kafkaPartitionInfoList = Lists.newArrayList(); for (String s : kafkaPartitionString.split(",")) { - partitionIdToOffset.add(new Pair<>(Integer.valueOf(s), 0L)); + partitionIdToOffset.add(Pair.of(Integer.valueOf(s), 0L)); PartitionInfo partitionInfo = new PartitionInfo(topicName, Integer.valueOf(s), null, null, null); kafkaPartitionInfoList.add(partitionInfo); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomProjectTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomProjectTest.java index af8a0445f9..659b01fc05 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomProjectTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomProjectTest.java @@ -99,7 +99,7 @@ public class JoinLAsscomProjectTest { Assertions.assertEquals(1, transform.size()); Assertions.assertTrue(transform.get(0) instanceof LogicalJoin); LogicalJoin newTopJoin = (LogicalJoin) transform.get(0); - return new Pair<>(topJoin, newTopJoin); + return Pair.of(topJoin, newTopJoin); } @Test diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomTest.java index b6528f47d7..d4e96777b0 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/exploration/join/JoinLAsscomTest.java @@ -83,7 +83,7 @@ public class JoinLAsscomTest { Assertions.assertEquals(1, transform.size()); Assertions.assertTrue(transform.get(0) instanceof LogicalJoin); LogicalJoin newTopJoin = (LogicalJoin) transform.get(0); - return new Pair<>(topJoin, newTopJoin); + return Pair.of(topJoin, newTopJoin); } @Test diff --git a/fe/fe-core/src/test/java/org/apache/doris/planner/SingleNodePlannerTest.java b/fe/fe-core/src/test/java/org/apache/doris/planner/SingleNodePlannerTest.java index fd363ff504..893ec17c36 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/planner/SingleNodePlannerTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/planner/SingleNodePlannerTest.java @@ -166,8 +166,8 @@ public class SingleNodePlannerTest { } }; SingleNodePlanner singleNodePlanner = new SingleNodePlanner(context); - Pair<TableRef, PlanNode> pair1 = new Pair<>(tableRef1, scanNode1); - Pair<TableRef, PlanNode> pair2 = new Pair<>(tableRef2, scanNode2); + Pair<TableRef, PlanNode> pair1 = Pair.of(tableRef1, scanNode1); + Pair<TableRef, PlanNode> pair2 = Pair.of(tableRef2, scanNode2); List<Pair<TableRef, PlanNode>> refPlans = Lists.newArrayList(); refPlans.add(pair1); refPlans.add(pair2); @@ -198,8 +198,8 @@ public class SingleNodePlannerTest { @Injectable SlotRef eqSlot1, @Injectable SlotRef eqSlot2, @Tested ExprSubstitutionMap exprSubstitutionMap) { - Pair<TableRef, PlanNode> pair1 = new Pair<>(tableRef1, scanNode1); - Pair<TableRef, PlanNode> pair2 = new Pair<>(tableRef2, scanNode2); + Pair<TableRef, PlanNode> pair1 = Pair.of(tableRef1, scanNode1); + Pair<TableRef, PlanNode> pair2 = Pair.of(tableRef2, scanNode2); List<Pair<TableRef, PlanNode>> refPlans = Lists.newArrayList(); refPlans.add(pair1); refPlans.add(pair2); @@ -298,8 +298,8 @@ public class SingleNodePlannerTest { @Injectable SlotRef eqSlot1, @Injectable SlotRef eqSlot2, @Tested ExprSubstitutionMap exprSubstitutionMap) { - Pair<TableRef, PlanNode> pair1 = new Pair<>(tableRef1, scanNode1); - Pair<TableRef, PlanNode> pair2 = new Pair<>(tableRef2, scanNode2); + Pair<TableRef, PlanNode> pair1 = Pair.of(tableRef1, scanNode1); + Pair<TableRef, PlanNode> pair2 = Pair.of(tableRef2, scanNode2); List<Pair<TableRef, PlanNode>> refPlans = Lists.newArrayList(); refPlans.add(pair1); refPlans.add(pair2); @@ -404,9 +404,9 @@ public class SingleNodePlannerTest { @Injectable SlotRef eqT2Slot2, @Injectable SlotRef eqT3Slot3, @Tested ExprSubstitutionMap exprSubstitutionMap) { - Pair<TableRef, PlanNode> pair1 = new Pair<>(tableRef1, scanNode1); - Pair<TableRef, PlanNode> pair2 = new Pair<>(tableRef2, scanNode2); - Pair<TableRef, PlanNode> pair3 = new Pair<>(tableRef3, scanNode3); + Pair<TableRef, PlanNode> pair1 = Pair.of(tableRef1, scanNode1); + Pair<TableRef, PlanNode> pair2 = Pair.of(tableRef2, scanNode2); + Pair<TableRef, PlanNode> pair3 = Pair.of(tableRef3, scanNode3); List<Pair<TableRef, PlanNode>> refPlans = Lists.newArrayList(); refPlans.add(pair1); refPlans.add(pair2); @@ -566,9 +566,9 @@ public class SingleNodePlannerTest { @Injectable SlotRef eqT2Slot2, @Injectable SlotRef eqT3Slot3, @Tested ExprSubstitutionMap exprSubstitutionMap) { - Pair<TableRef, PlanNode> pair1 = new Pair<>(tableRef1, scanNode1); - Pair<TableRef, PlanNode> pair2 = new Pair<>(tableRef2, scanNode2); - Pair<TableRef, PlanNode> pair3 = new Pair<>(tableRef3, scanNode3); + Pair<TableRef, PlanNode> pair1 = Pair.of(tableRef1, scanNode1); + Pair<TableRef, PlanNode> pair2 = Pair.of(tableRef2, scanNode2); + Pair<TableRef, PlanNode> pair3 = Pair.of(tableRef3, scanNode3); List<Pair<TableRef, PlanNode>> refPlans = Lists.newArrayList(); refPlans.add(pair1); refPlans.add(pair2); @@ -744,13 +744,13 @@ public class SingleNodePlannerTest { @Injectable SlotRef eqT6Slot6, @Injectable SlotRef eqT7Slot7, @Tested ExprSubstitutionMap exprSubstitutionMap) { - Pair<TableRef, PlanNode> pair1 = new Pair<>(tableRef1, scanNode1); - Pair<TableRef, PlanNode> pair2 = new Pair<>(tableRef2, scanNode2); - Pair<TableRef, PlanNode> pair3 = new Pair<>(tableRef3, scanNode3); - Pair<TableRef, PlanNode> pair4 = new Pair<>(tableRef4, scanNode4); - Pair<TableRef, PlanNode> pair5 = new Pair<>(tableRef5, scanNode5); - Pair<TableRef, PlanNode> pair6 = new Pair<>(tableRef6, scanNode6); - Pair<TableRef, PlanNode> pair7 = new Pair<>(tableRef7, scanNode7); + Pair<TableRef, PlanNode> pair1 = Pair.of(tableRef1, scanNode1); + Pair<TableRef, PlanNode> pair2 = Pair.of(tableRef2, scanNode2); + Pair<TableRef, PlanNode> pair3 = Pair.of(tableRef3, scanNode3); + Pair<TableRef, PlanNode> pair4 = Pair.of(tableRef4, scanNode4); + Pair<TableRef, PlanNode> pair5 = Pair.of(tableRef5, scanNode5); + Pair<TableRef, PlanNode> pair6 = Pair.of(tableRef6, scanNode6); + Pair<TableRef, PlanNode> pair7 = Pair.of(tableRef7, scanNode7); List<Pair<TableRef, PlanNode>> refPlans = Lists.newArrayList(); refPlans.add(pair1); refPlans.add(pair2); @@ -1028,10 +1028,10 @@ public class SingleNodePlannerTest { @Injectable SlotRef eqT3Slot3, @Injectable SlotRef eqT4Slot4, @Tested ExprSubstitutionMap exprSubstitutionMap) { - Pair<TableRef, PlanNode> pair1 = new Pair<>(tableRef1, scanNode1); - Pair<TableRef, PlanNode> pair2 = new Pair<>(tableRef2, scanNode2); - Pair<TableRef, PlanNode> pair3 = new Pair<>(tableRef3, scanNode3); - Pair<TableRef, PlanNode> pair4 = new Pair<>(tableRef4, scanNode4); + Pair<TableRef, PlanNode> pair1 = Pair.of(tableRef1, scanNode1); + Pair<TableRef, PlanNode> pair2 = Pair.of(tableRef2, scanNode2); + Pair<TableRef, PlanNode> pair3 = Pair.of(tableRef3, scanNode3); + Pair<TableRef, PlanNode> pair4 = Pair.of(tableRef4, scanNode4); List<Pair<TableRef, PlanNode>> refPlans = Lists.newArrayList(); refPlans.add(pair3); refPlans.add(pair2); @@ -1210,10 +1210,10 @@ public class SingleNodePlannerTest { @Injectable SlotRef eqT3Slot3, @Injectable SlotRef eqT4Slot4, @Tested ExprSubstitutionMap exprSubstitutionMap) { - Pair<TableRef, PlanNode> pair1 = new Pair<>(tableRef1, scanNode1); - Pair<TableRef, PlanNode> pair2 = new Pair<>(tableRef2, scanNode2); - Pair<TableRef, PlanNode> pair3 = new Pair<>(tableRef3, scanNode3); - Pair<TableRef, PlanNode> pair4 = new Pair<>(tableRef4, scanNode4); + Pair<TableRef, PlanNode> pair1 = Pair.of(tableRef1, scanNode1); + Pair<TableRef, PlanNode> pair2 = Pair.of(tableRef2, scanNode2); + Pair<TableRef, PlanNode> pair3 = Pair.of(tableRef3, scanNode3); + Pair<TableRef, PlanNode> pair4 = Pair.of(tableRef4, scanNode4); List<Pair<TableRef, PlanNode>> refPlans = Lists.newArrayList(); refPlans.add(pair3); refPlans.add(pair2); diff --git a/fe/fe-core/src/test/java/org/apache/doris/system/HeartbeatMgrTest.java b/fe/fe-core/src/test/java/org/apache/doris/system/HeartbeatMgrTest.java index 55047b5762..943cf462bb 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/system/HeartbeatMgrTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/system/HeartbeatMgrTest.java @@ -55,7 +55,7 @@ public class HeartbeatMgrTest { { env.getSelfNode(); minTimes = 0; - result = Pair.create("192.168.1.3", 9010); // not self + result = Pair.of("192.168.1.3", 9010); // not self env.isReady(); minTimes = 0; diff --git a/fe/java-udf/src/main/java/org/apache/doris/udf/UdfUtils.java b/fe/java-udf/src/main/java/org/apache/doris/udf/UdfUtils.java index 537aa9aa0a..cb402b4802 100644 --- a/fe/java-udf/src/main/java/org/apache/doris/udf/UdfUtils.java +++ b/fe/java-udf/src/main/java/org/apache/doris/udf/UdfUtils.java @@ -87,7 +87,7 @@ public class UdfUtils { default: throw new InternalException("Return type " + node.getType() + " is not supported now!"); } - return new Pair<Type, Integer>(type, nodeIdx); + return Pair.of(type, nodeIdx); } protected static long getAddressAtOffset(long base, int offset) { @@ -140,9 +140,9 @@ public class UdfUtils { // the function definition. This happens when both of them map to the same primitive // type. if (retType.getPrimitiveType().toThrift() != javaType.getPrimitiveType()) { - return new Pair<Boolean, JavaUdfDataType>(false, javaType); + return Pair.of(false, javaType); } - return new Pair<Boolean, JavaUdfDataType>(true, javaType); + return Pair.of(true, javaType); } /** @@ -157,10 +157,10 @@ public class UdfUtils { for (int i = 0; i < parameterTypes.length; ++i) { inputArgTypes[i] = JavaUdfDataType.getType(udfArgTypes[i + firstPos]); if (inputArgTypes[i].getPrimitiveType() != parameterTypes[i].getPrimitiveType().toThrift()) { - return new Pair<Boolean, JavaUdfDataType[]>(false, inputArgTypes); + return Pair.of(false, inputArgTypes); } } - return new Pair<Boolean, JavaUdfDataType[]>(true, inputArgTypes); + return Pair.of(true, inputArgTypes); } /** --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org