Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public IoTDBJDBCDataSet(
this.zoneId = zoneId;
columnSize = columnNameList.size();

this.columnNameList = new ArrayList<>();
this.columnTypeList = new ArrayList<>();
this.columnNameList = new ArrayList<>(columnSize + (ignoreTimeStamp ? 0 : 1));
this.columnTypeList = new ArrayList<>(columnSize + (ignoreTimeStamp ? 0 : 1));
if (!ignoreTimeStamp) {
this.columnNameList.add(TIMESTAMP_STR);
this.columnTypeList.add(String.valueOf(TSDataType.INT64));
Expand Down Expand Up @@ -222,8 +222,8 @@ public IoTDBJDBCDataSet(
this.zoneId = zoneId;
columnSize = columnNameList.size();

this.columnNameList = new ArrayList<>();
this.columnTypeList = new ArrayList<>();
this.columnNameList = new ArrayList<>(columnSize + (ignoreTimeStamp ? 0 : 1));
this.columnTypeList = new ArrayList<>(columnSize + (ignoreTimeStamp ? 0 : 1));
if (!ignoreTimeStamp) {
this.columnNameList.add(TIMESTAMP_STR);
this.columnTypeList.add(String.valueOf(TSDataType.INT64));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public IoTDBRpcDataSet(
this.moreData = moreData;
columnSize = columnNameList.size();

this.columnNameList = new ArrayList<>();
this.columnTypeList = new ArrayList<>();
this.columnNameList = new ArrayList<>(columnSize + (ignoreTimeStamp ? 0 : 1));
this.columnTypeList = new ArrayList<>(columnSize + (ignoreTimeStamp ? 0 : 1));
if (!ignoreTimeStamp) {
this.columnNameList.add(TIMESTAMP_STR);
this.columnTypeList.add(String.valueOf(TSDataType.INT64));
Expand Down Expand Up @@ -205,8 +205,8 @@ public IoTDBRpcDataSet(
this.moreData = moreData;
columnSize = columnNameList.size();

this.columnNameList = new ArrayList<>();
this.columnTypeList = new ArrayList<>();
this.columnNameList = new ArrayList<>(columnSize + (ignoreTimeStamp ? 0 : 1));
this.columnTypeList = new ArrayList<>(columnSize + (ignoreTimeStamp ? 0 : 1));
if (!ignoreTimeStamp) {
this.columnNameList.add(TIMESTAMP_STR);
this.columnTypeList.add(String.valueOf(TSDataType.INT64));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2531,7 +2531,7 @@ private List<ByteBuffer> objectValuesListToByteBufferList(
List<List<TSDataType>> typesList,
List<List<String>> measurementsList)
throws IoTDBConnectionException {
List<ByteBuffer> buffersList = new ArrayList<>();
List<ByteBuffer> buffersList = new ArrayList<>(valuesList.size());
for (int i = 0; i < valuesList.size(); i++) {
ByteBuffer buffer =
SessionUtils.getValueBuffer(typesList.get(i), valuesList.get(i), measurementsList.get(i));
Expand Down Expand Up @@ -2870,8 +2870,8 @@ private void updateTSInsertTabletsReq(
sortTablet(tablet);
}
request.addToPrefixPaths(tablet.deviceId);
List<String> measurements = new ArrayList<>();
List<Integer> dataTypes = new ArrayList<>();
List<String> measurements = new ArrayList<>(tablet.getSchemas().size());
List<Integer> dataTypes = new ArrayList<>(tablet.getSchemas().size());
request.setIsAligned(isAligned);
for (IMeasurementSchema measurementSchema : tablet.getSchemas()) {
if (measurementSchema.getMeasurementId() == null) {
Expand Down Expand Up @@ -3530,9 +3530,9 @@ public void createSchemaTemplate(
List<List<TSEncoding>> encodings,
List<CompressionType> compressors)
throws IoTDBConnectionException, StatementExecutionException {
List<String> flatMeasurements = new ArrayList<>();
List<TSDataType> flatDataTypes = new ArrayList<>();
List<TSEncoding> flatEncodings = new ArrayList<>();
List<String> flatMeasurements = new ArrayList<>(measurements.size());
List<TSDataType> flatDataTypes = new ArrayList<>(measurements.size());
List<TSEncoding> flatEncodings = new ArrayList<>(measurements.size());
for (int idx = 0; idx < measurements.size(); idx++) {
flatMeasurements.add(measurements.get(idx).get(0));
flatDataTypes.add(dataTypes.get(idx).get(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public static List<TEndPoint> parseSeedNodeUrls(List<String> nodeUrls) {
if (nodeUrls == null) {
throw new NumberFormatException("nodeUrls is null");
}
List<TEndPoint> endPointsList = new ArrayList<>();
List<TEndPoint> endPointsList = new ArrayList<>(nodeUrls.size());
for (String nodeUrl : nodeUrls) {
TEndPoint endPoint = UrlUtils.parseTEndPointIpv4AndIpv6Url(nodeUrl);
endPointsList.add(endPoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;

import com.google.common.collect.Sets;
import org.apache.tsfile.utils.ReadWriteIOUtils;
import org.slf4j.Logger;

import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -181,7 +181,7 @@ protected void deserializeImpl(ByteBuffer buffer) {
this.permissions = null;
} else {
final int permissionsSize = buffer.getInt();
this.permissions = new HashSet<>();
this.permissions = Sets.newHashSetWithExpectedSize(permissionsSize);
for (int i = 0; i < permissionsSize; i++) {
permissions.add(buffer.getInt());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected void deserializeImpl(ByteBuffer buffer) throws IOException {
this.modelName = ReadWriteIOUtils.readString(buffer);
this.modelInformation = ModelInformation.deserialize(buffer);
int size = ReadWriteIOUtils.readInt(buffer);
this.nodeIds = new ArrayList<>();
this.nodeIds = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
this.nodeIds.add(ReadWriteIOUtils.readInt(buffer));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;
import org.apache.iotdb.db.schemaengine.template.Template;

import com.google.common.collect.Maps;
import org.apache.tsfile.utils.ReadWriteIOUtils;

import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -69,7 +69,7 @@ protected void serializeImpl(DataOutputStream stream) throws IOException {
@Override
protected void deserializeImpl(ByteBuffer buffer) throws IOException {
int size = ReadWriteIOUtils.readInt(buffer);
templateSetInfo = new HashMap<>();
templateSetInfo = Maps.newHashMapWithExpectedSize(size);
for (int i = 0; i < size; i++) {
PartialPath pattern = (PartialPath) PathDeserializeUtil.deserialize(buffer);
int templateNum = ReadWriteIOUtils.readInt(buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ protected void serializeImpl(DataOutputStream stream) throws IOException {
@Override
protected void deserializeImpl(ByteBuffer buffer) throws IOException {
if (ReadWriteIOUtils.readBool(buffer)) {
subPlans = new ArrayList<>();
int size = ReadWriteIOUtils.readInt(buffer);
subPlans = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
short type = ReadWriteIOUtils.readShort(buffer);
if (type == ConfigPhysicalPlanType.CreatePipeV2.getPlanType()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ protected void serializeImpl(DataOutputStream stream) throws IOException {
@Override
protected void deserializeImpl(ByteBuffer buffer) throws IOException {
if (ReadWriteIOUtils.readBool(buffer)) {
subPlans = new ArrayList<>();
int size = ReadWriteIOUtils.readInt(buffer);
subPlans = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
// This will read the type of the plan (AlterTopicPlan), which will be ignored
ReadWriteIOUtils.readShort(buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.apache.iotdb.pipe.api.exception.PipeException;
import org.apache.iotdb.rpc.TSStatusCode;

import com.google.common.collect.Maps;
import org.apache.tsfile.utils.ReadWriteIOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -378,7 +379,7 @@ public void deserialize(ByteBuffer byteBuffer) {
super.deserialize(byteBuffer);
queryId = ReadWriteIOUtils.readString(byteBuffer);
int size = ReadWriteIOUtils.readInt(byteBuffer);
Map<PartialPath, List<Template>> templateSetInfo = new HashMap<>();
Map<PartialPath, List<Template>> templateSetInfo = Maps.newHashMapWithExpectedSize(size);
for (int i = 0; i < size; i++) {
PartialPath pattern = (PartialPath) PathDeserializeUtil.deserialize(byteBuffer);
int templateNum = ReadWriteIOUtils.readInt(byteBuffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void serialize(DataOutputStream stream) throws IOException {
public void deserialize(ByteBuffer byteBuffer) {
super.deserialize(byteBuffer);
int size = ReadWriteIOUtils.readInt(byteBuffer);
this.datanodes = new ArrayList<>();
this.datanodes = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
TDataNodeConfiguration datanode =
ThriftCommonsSerDeUtils.deserializeTDataNodeConfiguration(byteBuffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ private FetchCombineResultRequest convertToTPipeTransferReq(
private FetchCombineResultRequest translateFromTPipeTransferReq(TPipeTransferReq transferReq) {
pipeName = ReadWriteIOUtils.readString(transferReq.body);
creationTime = ReadWriteIOUtils.readLong(transferReq.body);
combineIdList = new ArrayList<>();
final int combineIdListSize = ReadWriteIOUtils.readInt(transferReq.body);
combineIdList = new ArrayList<>(combineIdListSize);
for (int i = 0; i < combineIdListSize; i++) {
combineIdList.add(ReadWriteIOUtils.readString(transferReq.body));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.iotdb.db.queryengine.common.schematree.IMeasurementSchemaInfo;
import org.apache.iotdb.db.schemaengine.schemaregion.utils.MetaUtils;

import com.google.common.collect.Maps;
import org.apache.tsfile.utils.Pair;
import org.apache.tsfile.utils.ReadWriteIOUtils;

Expand Down Expand Up @@ -389,7 +390,8 @@ public static TimeseriesContext deserialize(ByteBuffer buffer) {
int activeCountMultiplier = ReadWriteIOUtils.readInt(buffer);
boolean logicalView = ReadWriteIOUtils.readBool(buffer);
int activeLogicalViewContextMapSize = ReadWriteIOUtils.readInt(buffer);
Map<String, TimeseriesContext> activeLogicalViewContextMap = new HashMap<>();
Map<String, TimeseriesContext> activeLogicalViewContextMap =
Maps.newHashMapWithExpectedSize(activeLogicalViewContextMapSize);
for (int i = 0; i < activeLogicalViewContextMapSize; i++) {
activeLogicalViewContextMap.put(
ReadWriteIOUtils.readString(buffer), TimeseriesContext.deserialize(buffer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,19 @@ public void serialize(DataOutputStream outputStream) throws IOException {
public static FragmentInstanceFailureInfo deserialize(ByteBuffer byteBuffer) {
final String message = ReadWriteIOUtils.readString(byteBuffer);
FragmentInstanceFailureInfo cause;
List<FragmentInstanceFailureInfo> suppressed = new ArrayList<>();
List<String> stack = new ArrayList<>();
int flag = ReadWriteIOUtils.readInt(byteBuffer);
if (flag == 0) {
cause = null;
} else {
cause = deserialize(byteBuffer);
}
int suppressedSize = ReadWriteIOUtils.readInt(byteBuffer);
List<FragmentInstanceFailureInfo> suppressed = new ArrayList<>(suppressedSize);
for (int i = 0; i < suppressedSize; i++) {
suppressed.add(deserialize(byteBuffer));
}
int stackSize = ReadWriteIOUtils.readInt(byteBuffer);
List<String> stack = new ArrayList<>(stackSize);
for (int i = 0; i < stackSize; i++) {
stack.add(ReadWriteIOUtils.readString(byteBuffer));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ private TsBlock getFilterTsBlock(TsBlock input) {
final TimeColumnBuilder timeBuilder = filterTsBlockBuilder.getTimeColumnBuilder();
final ColumnBuilder[] columnBuilders = filterTsBlockBuilder.getValueColumnBuilders();

List<Column> resultColumns = new ArrayList<>();
List<Column> resultColumns =
new ArrayList<>(
input.getValueColumnCount() + (hasNonMappableUDF ? 0 : commonTransformerList.size()));
for (int i = 0, n = input.getValueColumnCount(); i < n; i++) {
resultColumns.add(input.getColumn(i));
}
Expand Down Expand Up @@ -213,7 +215,7 @@ private TsBlock getTransformedTsBlock(TsBlock input) {
leafColumnTransformer.initFromTsBlock(input);
}

List<Column> resultColumns = new ArrayList<>();
List<Column> resultColumns = new ArrayList<>(projectOutputTransformerList.size());
for (ColumnTransformer columnTransformer : projectOutputTransformerList) {
columnTransformer.tryEvaluate();
resultColumns.add(columnTransformer.getColumn());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public TsBlock next() throws Exception {

protected void prepareTsBlockBuilder(TsBlockBuilder tsBlockBuilder) {
if (outputDataTypes == null) {
outputDataTypes = new ArrayList<>();
outputDataTypes = new ArrayList<>(transformers.length);
for (LayerReader reader : transformers) {
outputDataTypes.add(reader.getDataTypes()[0]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,14 @@ public void serialize(DataOutputStream stream) throws IOException {
public static TemplatedInfo deserialize(ByteBuffer byteBuffer) {

int measurementSize = ReadWriteIOUtils.readInt(byteBuffer);
List<String> measurementList = new ArrayList<>();
List<String> measurementList = new ArrayList<>(measurementSize);
int cnt = measurementSize;
while (cnt-- > 0) {
measurementList.add(ReadWriteIOUtils.readString(byteBuffer));
}

cnt = measurementSize;
List<IMeasurementSchema> measurementSchemaList = new ArrayList<>();
List<IMeasurementSchema> measurementSchemaList = new ArrayList<>(measurementSize);
while (cnt-- > 0) {
// MeasurementSchema is ok?
measurementSchemaList.add(MeasurementSchema.deserializeFrom(byteBuffer));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.iotdb.db.queryengine.plan.analyze;

import com.google.common.collect.Maps;
import org.apache.tsfile.enums.TSDataType;
import org.apache.tsfile.utils.ReadWriteIOUtils;
import org.apache.tsfile.write.schema.IMeasurementSchema;
Expand Down Expand Up @@ -109,7 +110,7 @@ public void serialize(DataOutputStream stream) throws IOException {

public static TypeProvider deserialize(ByteBuffer byteBuffer) {
int mapSize = ReadWriteIOUtils.readInt(byteBuffer);
Map<String, TSDataType> typeMap = new HashMap<>();
Map<String, TSDataType> typeMap = Maps.newHashMapWithExpectedSize(mapSize);
while (mapSize > 0) {
typeMap.put(
ReadWriteIOUtils.readString(byteBuffer),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public FunctionExpression(ByteBuffer byteBuffer) {
functionAttributes = ReadWriteIOUtils.readLinkedHashMap(byteBuffer);

int expressionSize = ReadWriteIOUtils.readInt(byteBuffer);
expressions = new ArrayList<>();
expressions = new ArrayList<>(expressionSize);
for (int i = 0; i < expressionSize; i++) {
expressions.add(Expression.deserialize(byteBuffer));
}
Expand Down Expand Up @@ -304,7 +304,7 @@ public boolean isMappable(Map<NodeRef<Expression>, TSDataType> expressionTypes)

public List<PartialPath> getPaths() {
if (paths == null) {
paths = new ArrayList<>();
paths = new ArrayList<>(expressions.size());
for (Expression expression : expressions) {
paths.add(
expression instanceof TimeSeriesOperand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,10 @@ public ColumnTransformer visitCaseWhenThenExpression(
context.inputDataTypes.add(context.getType(caseWhenThenExpression));
context.cache.put(caseWhenThenExpression, identity);
} else {
List<ColumnTransformer> whenList = new ArrayList<>();
List<ColumnTransformer> thenList = new ArrayList<>();
List<ColumnTransformer> whenList =
new ArrayList<>(caseWhenThenExpression.getWhenThenExpressions().size());
List<ColumnTransformer> thenList =
new ArrayList<>(caseWhenThenExpression.getWhenThenExpressions().size());
for (WhenThenExpression whenThenExpression :
caseWhenThenExpression.getWhenThenExpressions()) {
whenList.add(this.process(whenThenExpression.getWhen(), context));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Expression visitTernaryExpression(
public Expression visitFunctionExpression(
FunctionExpression functionExpression, ISchemaTree schemaTree) {
List<Expression> children = functionExpression.getExpressions();
List<Expression> replacedChildren = new ArrayList<>();
List<Expression> replacedChildren = new ArrayList<>(children.size());
for (Expression child : children) {
replacedChildren.add(this.process(child, schemaTree));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,8 @@ private UDFQueryTransformer getUdfTransformer(

private IntermediateLayer constructUdfInputIntermediateLayer(
FunctionExpression functionExpression, IntermediateLayerVisitorContext context) {
List<IntermediateLayer> intermediateLayers = new ArrayList<>();
List<IntermediateLayer> intermediateLayers =
new ArrayList<>(functionExpression.getExpressions().size());
for (Expression expression : functionExpression.getExpressions()) {
intermediateLayers.add(this.process(expression, context));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
import org.apache.iotdb.db.queryengine.plan.planner.plan.node.PlanNodeType;
import org.apache.iotdb.db.schemaengine.template.Template;

import com.google.common.collect.Maps;
import org.apache.tsfile.utils.ReadWriteIOUtils;

import jakarta.validation.constraints.NotNull;

import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -150,7 +150,7 @@ public static PlanNode deserialize(ByteBuffer buffer) {
SchemaFilter schemaFilter = SchemaFilter.deserialize(buffer);
boolean includeSystemDatabase = ReadWriteIOUtils.readBool(buffer);
int templateNum = ReadWriteIOUtils.readInt(buffer);
Map<Integer, Template> templateMap = new HashMap<>();
Map<Integer, Template> templateMap = Maps.newHashMapWithExpectedSize(templateNum);
Template template;
for (int i = 0; i < templateNum; i++) {
template = new Template();
Expand Down
Loading
Loading