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 @@ -112,8 +112,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 @@ -191,8 +191,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 @@ -2648,7 +2648,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 @@ -2879,7 +2879,7 @@ private void insertRelationalTabletWithLeaderCache(Tablet tablet)
(k, v) -> {
if (v == null) {
List<String> measurements = new ArrayList<>(tablet.getSchemas().size());
List<TSDataType> dataTypes = new ArrayList<>();
List<TSDataType> dataTypes = new ArrayList<>(tablet.getSchemas().size());
tablet
.getSchemas()
.forEach(
Expand Down Expand Up @@ -3289,8 +3289,8 @@ private void updateTSInsertTabletsReq(
return;
}
request.addToPrefixPaths(filtered.getDeviceId());
List<String> measurements = new ArrayList<>();
List<Integer> dataTypes = new ArrayList<>();
List<String> measurements = new ArrayList<>(filtered.getSchemas().size());
List<Integer> dataTypes = new ArrayList<>(filtered.getSchemas().size());
request.setIsAligned(isAligned);
for (IMeasurementSchema measurementSchema : filtered.getSchemas()) {
if (measurementSchema.getMeasurementName() == null) {
Expand Down Expand Up @@ -3980,9 +3980,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 @@ -1341,7 +1341,7 @@ private String logForReconnectionFailure() {
if (endPointList == null) {
return MSG_RECONNECTION_FAIL;
}
List<String> urls = new ArrayList<>();
List<String> urls = new ArrayList<>(endPointList.size());
for (TEndPoint end : endPointList) {
urls.add(UrlUtils.convertTEndPointIpv4AndIpv6Url(end));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public static List<TEndPoint> parseSeedNodeUrls(List<String> nodeUrls) {
if (nodeUrls == null) {
throw new NumberFormatException(SessionMessages.NODE_URLS_IS_NULL);
}
List<TEndPoint> endPointsList = new ArrayList<>();
List<TEndPoint> endPointsList = new ArrayList<>(nodeUrls.size());
for (String nodeUrl : nodeUrls) {
try {
endPointsList.add(UrlUtils.parseTEndPointIpv4AndIpv6Url(nodeUrl));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class SimpleTsBlockWithPositionComparator implements TsBlockWithPositionC

public SimpleTsBlockWithPositionComparator(
List<TSDataType> types, List<Integer> sortChannels, List<SortOrder> sortOrders) {
List<TSDataType> sortedTypes = new ArrayList<>();
List<TSDataType> sortedTypes = new ArrayList<>(sortChannels.size());
for (Integer sortChannel : sortChannels) {
sortedTypes.add(types.get(sortChannel));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ private TsBlock getFilterTsBlock(TsBlock input) {
// reuse this builder
filterTsBlockBuilder.reset();

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 @@ -268,7 +270,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 @@ -117,7 +117,7 @@ public PatternRecognitionOperator(
// Partition Part
this.partitionChannels = ImmutableList.copyOf(partitionChannels);
// Acquire partition channels' data types
List<TSDataType> partitionDataTypes = new ArrayList<>();
List<TSDataType> partitionDataTypes = new ArrayList<>(partitionChannels.size());
for (Integer channel : partitionChannels) {
partitionDataTypes.add(inputDataTypes.get(channel));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public PatternPartitionExecutor(
this.matchNumber = 1;

// Prepare for peer group comparing
List<TSDataType> sortDataTypes = new ArrayList<>();
List<TSDataType> sortDataTypes = new ArrayList<>(sortChannels.size());
for (int channel : sortChannels) {
TSDataType dataType = dataTypes.get(channel);
sortDataTypes.add(dataType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private static Computation parse(
return new BinaryComputation(left, right, op);
} else if (expression instanceof LogicalExpression) {
LogicalExpression logicalExpr = (LogicalExpression) expression;
List<Computation> computations = new ArrayList<>();
List<Computation> computations = new ArrayList<>(logicalExpr.getTerms().size());
for (Expression term : logicalExpr.getTerms()) {
computations.add(parse(term, counter, symbolToIndex));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public NaryComputation(List<Computation> terms, NaryOperator operator) {

@Override
public Object evaluate(List<Object> values) {
List<Object> operandValues = new ArrayList<>();
List<Object> operandValues = new ArrayList<>(terms.size());
for (Computation term : terms) {
operandValues.add(term.evaluate(values));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected AbstractCaseWhenThenColumnTransformer(
whenTransformers.size() == thenTransformers.size(),
CalcMessages
.EXCEPTION_THE_SIZE_BETWEEN_WHENTRANSFORMERS_AND_THENTRANSFORMERS_NEEDS_TO_BE_SAME_AC796883);
this.whenThenTransformers = new ArrayList<>();
this.whenThenTransformers = new ArrayList<>(whenTransformers.size());
for (int i = 0; i < whenTransformers.size(); i++) {
this.whenThenTransformers.add(new Pair<>(whenTransformers.get(i), thenTransformers.get(i)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void evaluateWithSelection(boolean[] selection) {
boolean[] selectionCopy = selection.clone();
boolean[] hasNull = new boolean[selection.length];

List<Column> childrenColumns = new ArrayList<>();
List<Column> childrenColumns = new ArrayList<>(columnTransformerList.size());
for (ColumnTransformer child : columnTransformerList) {
child.evaluateWithSelection(selectionCopy);
Column childColumn = child.getColumn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void evaluateWithSelection(boolean[] selection) {
boolean[] selectionCopy = selection.clone();
boolean[] hasNull = new boolean[selection.length];

List<Column> childColumns = new ArrayList<>();
List<Column> childColumns = new ArrayList<>(columnTransformerList.size());
for (ColumnTransformer child : columnTransformerList) {
child.evaluateWithSelection(selectionCopy);
Column childColumn = child.getColumn();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void evaluate() {

@Override
public void evaluateWithSelection(boolean[] selection) {
List<Column> childrenColumns = new ArrayList<>();
List<Column> childrenColumns = new ArrayList<>(columnTransformerList.size());

for (ColumnTransformer child : columnTransformerList) {
child.evaluateWithSelection(selection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public boolean hasSpilledData() {
}

private List<String> getFilePaths() {
List<String> filePaths = new ArrayList<>();
List<String> filePaths = new ArrayList<>(fileIndex);
for (int i = 0; i < fileIndex; i++) {
filePaths.add(filePrefix + String.format("%05d", i) + FILE_SUFFIX);
}
Expand All @@ -164,7 +164,7 @@ private List<String> getFilePaths() {

public List<SortReader> getReaders(SortBufferManager sortBufferManager) throws IoTDBException {
List<String> filePaths = getFilePaths();
List<SortReader> sortReaders = new ArrayList<>();
List<SortReader> sortReaders = new ArrayList<>(filePaths.size());
try {
for (String filePath : filePaths) {
sortReaders.add(new FileSpillerReader(filePath, sortBufferManager, serde));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
import org.apache.iotdb.commons.utils.BasicStructureSerDeUtil;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;

import com.google.common.collect.Sets;
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.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
Expand Down Expand Up @@ -244,7 +244,7 @@ protected void deserializeImpl(ByteBuffer buffer) {
this.permissions = null;
} else {
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 @@ -25,13 +25,13 @@
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan;
import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType;

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(final DataOutputStream stream) throws IOException {
@Override
protected void deserializeImpl(final ByteBuffer buffer) throws IOException {
final int size = ReadWriteIOUtils.readInt(buffer);
templateSetInfo = new HashMap<>();
templateSetInfo = Maps.newHashMapWithExpectedSize(size);
for (int i = 0; i < size; i++) {
final PartialPath pattern = (PartialPath) PathDeserializeUtil.deserialize(buffer);
final int templateNum = ReadWriteIOUtils.readInt(buffer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,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++) {
final boolean isLastSubPlan = i == size - 1;
short type = ReadWriteIOUtils.readShort(buffer);
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 @@ -49,6 +49,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 @@ -384,7 +385,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 @@ -220,7 +220,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 @@ -88,7 +88,8 @@ public synchronized int size() {
}

public synchronized Collection<SubscriptionWalRetentionPolicy> getRetentionPolicies() {
final Collection<SubscriptionWalRetentionPolicy> retentionPolicies = new ArrayList<>();
final Collection<SubscriptionWalRetentionPolicy> retentionPolicies =
new ArrayList<>(queues.size());
for (final SubscriptionQueueRegistration registration : queues.values()) {
retentionPolicies.add(registration.retentionPolicy);
}
Expand All @@ -103,7 +104,7 @@ public Collection<Long> getRetainedMinVersionIds() {
}
}

final Collection<Long> retainedMinVersionIds = new ArrayList<>();
final Collection<Long> retainedMinVersionIds = new ArrayList<>(suppliers.size());
for (final LongSupplier supplier : suppliers) {
retainedMinVersionIds.add(supplier.getAsLong());
}
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 @@ -166,19 +166,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 @@ -288,7 +288,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 @@ -110,7 +110,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 @@ -305,7 +305,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
Loading
Loading