[fix][refactor] fix bugs and refactor some code by lint (#7871)

1. Fix some `passedByValue` issues.
2. Fix some `dereferenceBeforeCheck` issues.
3. Fix some `uninitMemberVar` issues.
4. Fix some iterator `eraseDereference` issues.
5. Fix compile issue introduced from #7923 #7905 #7848
This commit is contained in:
Mingyu Chen
2022-02-01 14:31:14 +08:00
committed by GitHub
parent 82f421a019
commit c0e59e59aa
38 changed files with 92 additions and 86 deletions

View File

@ -2717,7 +2717,7 @@ show_param ::=
{:
RESULT = new ShowAlterStmt(type, db, parser.where, orderByClause, limitClause);
:}
| KW_SHOW KW_DATA KW_SKEW KW_FROM base_table_ref:table_ref
| KW_DATA KW_SKEW KW_FROM base_table_ref:table_ref
{:
RESULT = new ShowDataSkewStmt(table_ref);
:}

View File

@ -3933,7 +3933,7 @@ public class Catalog {
long totalReplicaNum = 0;
for (Map.Entry<String, Long> entry : partitionNameToId.entrySet()) {
long indexNum = olapTable.getIndexIdToMeta().size();
long bucketNum = distributionInfo.getBucketNum();
long bucketNum = defaultDistributionInfo.getBucketNum();
long replicaNum = partitionInfo.getReplicaAllocation(entry.getValue()).getTotalReplicaNum();
totalReplicaNum += indexNum * bucketNum * replicaNum;
}

View File

@ -40,6 +40,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

View File

@ -18,6 +18,7 @@ package org.apache.doris.mysql.nio;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.qe.ConnectProcessor;
import org.xnio.StreamConnection;
import java.io.IOException;
@ -59,4 +60,10 @@ public class NConnectContext extends ConnectContext {
public void stopAcceptQuery() throws IOException {
mysqlChannel.stopAcceptQuery();
}
@Override
public String toString() {
return "[remote ip: " + mysqlChannel.getRemoteIp() + "]";
}
}

View File

@ -133,6 +133,7 @@ public class CatalogOperationTest {
Assert.assertEquals(AlterJobV2.JobState.FINISHED, alterJobV2.getJobState());
}
Thread.sleep(1000);
renameTblStmt = "alter table test.newNewTest rename r1";
alterTableStmt = (AlterTableStmt)UtFrameUtils.parseAndAnalyzeStmt(renameTblStmt, connectContext);
try {