This is an automated email from the ASF dual-hosted git repository. jt2594838 pushed a commit to branch insert_numeric_row in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit ce6707187dc38676e14c65aa06dd639870b010aa Author: Tian Jiang <[email protected]> AuthorDate: Thu Sep 17 17:33:39 2026 +0800 remove unused method --- .../apache/iotdb/session/PreparedNumericRowBufferTest.java | 12 ++++++------ .../iotdb/db/protocol/session/PreparedNumericRowInfo.java | 4 ---- .../java/org/apache/iotdb/db/utils/NumericRowValues.java | 14 -------------- .../db/protocol/session/PreparedNumericRowInfoTest.java | 4 ++-- .../db/queryengine/plan/parser/NumericTableRowTest.java | 2 +- .../memtable/AlignedWritableMemChunkNumericTest.java | 7 +++++-- 6 files changed, 14 insertions(+), 29 deletions(-) diff --git a/iotdb-client/session/src/test/java/org/apache/iotdb/session/PreparedNumericRowBufferTest.java b/iotdb-client/session/src/test/java/org/apache/iotdb/session/PreparedNumericRowBufferTest.java index 500e4a7b088..7a44a165361 100644 --- a/iotdb-client/session/src/test/java/org/apache/iotdb/session/PreparedNumericRowBufferTest.java +++ b/iotdb-client/session/src/test/java/org/apache/iotdb/session/PreparedNumericRowBufferTest.java @@ -51,14 +51,14 @@ public class PreparedNumericRowBufferTest { Session session = mock(Session.class); SessionConnection connection = mock(SessionConnection.class); when(session.getDefaultSessionConnection()).thenReturn(connection); + when(connection.prepareNumericRow(any())).thenReturn(1L); TableSession tableSession = new TableSession(session); NumericRowPreparedStatement prepared = - new NumericRowPreparedStatement( + tableSession.prepareInsertNumericRow( "t", List.of("a", "b", "c"), List.of(TSDataType.INT64, TSDataType.INT64, TSDataType.INT64), List.of(ColumnCategory.FIELD, ColumnCategory.FIELD, ColumnCategory.FIELD)); - prepared.bind(1, connection, () -> {}); List<ByteBuffer> bitmaps = new ArrayList<>(); List<ByteBuffer> payloads = new ArrayList<>(); int[] masks = {2, 7, 0}; @@ -105,9 +105,10 @@ public class PreparedNumericRowBufferTest { Session session = mock(Session.class); SessionConnection connection = mock(SessionConnection.class); when(session.getDefaultSessionConnection()).thenReturn(connection); + when(connection.prepareNumericRow(any())).thenReturn(1L); TableSession tableSession = new TableSession(session); NumericRowPreparedStatement prepared = - new NumericRowPreparedStatement( + tableSession.prepareInsertNumericRow( "t", List.of("tag", "flag", "count", "value"), List.of(TSDataType.STRING, TSDataType.BOOLEAN, TSDataType.INT32, TSDataType.DOUBLE), @@ -116,7 +117,6 @@ public class PreparedNumericRowBufferTest { ColumnCategory.FIELD, ColumnCategory.FIELD, ColumnCategory.FIELD)); - prepared.bind(1, connection, () -> {}); List<ByteBuffer> tagBuffers = new ArrayList<>(); List<ByteBuffer> valueBuffers = new ArrayList<>(); String[] tags = {"x", "long-tag-\u4e2d\u6587", "", null, "retry"}; @@ -168,6 +168,7 @@ public class PreparedNumericRowBufferTest { Session session = mock(Session.class); SessionConnection connection = mock(SessionConnection.class); when(session.getDefaultSessionConnection()).thenReturn(connection); + when(connection.prepareNumericRow(any())).thenReturn(0L, 1L); TableSession tableSession = new TableSession(session); List<ByteBuffer> buffers = new ArrayList<>(); doAnswer( @@ -186,9 +187,8 @@ public class PreparedNumericRowBufferTest { anyLong(), anyLong(), any(ByteBuffer.class), any(ByteBuffer.class)); for (int i = 0; i < 2; i++) { NumericRowPreparedStatement prepared = - new NumericRowPreparedStatement( + tableSession.prepareInsertNumericRow( "t", List.of("v"), List.of(TSDataType.INT64), List.of(ColumnCategory.FIELD)); - prepared.bind(i, connection, () -> {}); tableSession.executePreparedInsertNumericRow(prepared, 0, new long[] {42}, new String[0]); } assertNotSame(buffers.get(0), buffers.get(2)); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/PreparedNumericRowInfo.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/PreparedNumericRowInfo.java index 7d3003276ee..0b4259f2fa9 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/PreparedNumericRowInfo.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/session/PreparedNumericRowInfo.java @@ -232,10 +232,6 @@ public final class PreparedNumericRowInfo { return version; } - public InsertNumericRowStatement bind(long timestamp, ByteBuffer tags, ByteBuffer values) { - return bind(timestamp, tags, values, null); - } - public InsertNumericRowStatement bind( long timestamp, ByteBuffer tags, ByteBuffer values, ByteBuffer nullBitmap) { if (tags == null) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/NumericRowValues.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/NumericRowValues.java index 1638f0fd00d..c1b3b14bca6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/NumericRowValues.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/NumericRowValues.java @@ -19,7 +19,6 @@ package org.apache.iotdb.db.utils; -import org.apache.iotdb.commons.utils.TestOnly; import org.apache.iotdb.db.i18n.DataNodeQueryMessages; import org.apache.tsfile.common.conf.TSFileConfig; @@ -47,11 +46,6 @@ public final class NumericRowValues { private final int size; private int tagCount; - @TestOnly - public NumericRowValues(int size) { - this(0, size); - } - public NumericRowValues(int tagLength, int valueLength) { this.values = new long[valueLength]; this.nulls = new BitSet(tagLength + valueLength); @@ -60,14 +54,6 @@ public final class NumericRowValues { this.tagCount = tagLength; } - @TestOnly - public NumericRowValues(long[] values, BitSet nulls) { - this.values = values; - this.nulls = nulls; - this.size = values.length; - this.tagCount = 0; - } - public int size() { return size; } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/protocol/session/PreparedNumericRowInfoTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/protocol/session/PreparedNumericRowInfoTest.java index 45cb991615f..cf3533296b1 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/protocol/session/PreparedNumericRowInfoTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/protocol/session/PreparedNumericRowInfoTest.java @@ -235,7 +235,7 @@ public class PreparedNumericRowInfoTest { req.setDataTypes(Arrays.asList(TSDataType.STRING.ordinal(), TSDataType.INT64.ordinal())); assertNull( new PreparedNumericRowInfo(DATABASE, req) - .bind(1, tagBuffer(1), ByteBuffer.allocate(8)) + .bind(1, tagBuffer(1), ByteBuffer.allocate(8), null) .getPreparedTableVersion()); table.addProp(TreeViewSchema.TREE_PATH_PATTERN, "root.sg.**"); assertNull( @@ -364,6 +364,6 @@ public class PreparedNumericRowInfoTest { private static InsertNumericRowStatement bind(PreparedNumericRowInfo info, int tags) { ByteBuffer values = ByteBuffer.allocate(8); values.putDouble(2.5D).flip(); - return info.bind(1, tagBuffer(tags), values); + return info.bind(1, tagBuffer(tags), values, null); } } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/NumericTableRowTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/NumericTableRowTest.java index 0541ecd2173..70c39d90072 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/NumericTableRowTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/parser/NumericTableRowTest.java @@ -248,7 +248,7 @@ public class NumericTableRowTest { @Test public void testNumericCastsKeepPrimitiveStorage() { // Widen INT32 to DOUBLE in place; reject STRING coercion while accepting an inserted null TAG. - NumericRowValues values = new NumericRowValues(2); + NumericRowValues values = new NumericRowValues(0, 2); values.getValues()[0] = Integer.MIN_VALUE; values.setNull(1); assertTrue(values.cast(0, TSDataType.INT32, TSDataType.DOUBLE)); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunkNumericTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunkNumericTest.java index 8620f17f71b..cb8d2a15207 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunkNumericTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunkNumericTest.java @@ -30,7 +30,6 @@ import org.junit.Test; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; -import java.util.BitSet; import java.util.Collections; import java.util.List; @@ -122,7 +121,11 @@ public class AlignedWritableMemChunkNumericTest { } private static NumericRowValues row(long... values) { - return new NumericRowValues(values, new BitSet()); + NumericRowValues row = new NumericRowValues(0, values.length); + for (int i = 0; i < values.length; i++) { + row.setRawValue(i, values[i]); + } + return row; } private static int[] mapping(AlignedWritableMemChunk chunk) throws Exception {
