Skip to content

Commit 1d87fe0

Browse files
authored
refactor: remove IDeviceID.isTableModel (#998)
1 parent d33e640 commit 1d87fe0

5 files changed

Lines changed: 2 additions & 25 deletions

File tree

‎java/tsfile/src/main/java/org/apache/tsfile/file/metadata/IDeviceID.java‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public interface IDeviceID extends Comparable<IDeviceID>, Accountable, Serializa
4646

4747
boolean isEmpty();
4848

49-
boolean isTableModel();
50-
5149
/**
5250
* @return the table name associated with the device. For a path-DeviceId, like "root.a.b.c.d", it
5351
* is converted according to a fixed rule, like assuming the first three levels ("root.a.b")

‎java/tsfile/src/main/java/org/apache/tsfile/file/metadata/PlainDeviceID.java‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ public boolean isEmpty() {
110110
return deviceID.isEmpty();
111111
}
112112

113-
@Override
114-
public boolean isTableModel() {
115-
return false;
116-
}
117-
118113
@Override
119114
public long ramBytesUsed() {
120115
long size = INSTANCE_SIZE;

‎java/tsfile/src/main/java/org/apache/tsfile/file/metadata/StringArrayDeviceID.java‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import java.util.Arrays;
3838
import java.util.Objects;
3939

40-
import static org.apache.tsfile.common.constant.TsFileConstant.PATH_ROOT;
4140
import static org.apache.tsfile.common.constant.TsFileConstant.PATH_SEPARATOR;
4241

4342
public class StringArrayDeviceID implements IDeviceID {
@@ -222,11 +221,6 @@ public boolean isEmpty() {
222221
return segments == null || segments.length == 0;
223222
}
224223

225-
@Override
226-
public boolean isTableModel() {
227-
return !segments[0].startsWith(PATH_ROOT + PATH_SEPARATOR);
228-
}
229-
230224
@Override
231225
public String toString() {
232226
return String.join(PATH_SEPARATOR, segments);

‎java/tsfile/src/main/java/org/apache/tsfile/write/writer/TsFileIOWriter.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ public void endCurrentChunk() {
447447
chunkMetadataCount++;
448448
if (recordTablePointCount
449449
&& currentChunkGroupDeviceId != null
450-
&& currentChunkGroupDeviceId.isTableModel()
450+
&& schema.getTableSchemaMap().containsKey(currentChunkGroupDeviceId.getTableName())
451451
&& (currentChunkMetadata.getMask() & TsFileConstant.TIME_COLUMN_MASK) == 0) {
452452
tablePointCountMap.merge(
453453
currentChunkGroupDeviceId.getTableName(),
@@ -956,7 +956,7 @@ private void updateTableSize(IDeviceID currentStartChunkGroupDeviceId) throws IO
956956
// endFile
957957
boolean endFile = currentStartChunkGroupDeviceId == null;
958958
if (endFile
959-
|| (currentStartChunkGroupDeviceId.isTableModel()
959+
|| (schema.getTableSchemaMap().containsKey(currentStartChunkGroupDeviceId.getTableName())
960960
&& !currentStartChunkGroupDeviceId.getTableName().equals(currentTable))) {
961961
if (currentTable != null) {
962962
long size = currentPosition - currentTableStartOffset;

‎java/tsfile/src/test/java/org/apache/tsfile/file/metadata/IDeviceIDTest.java‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,6 @@ public void testStartWith() {
6363
assertTrue(deviceID.startWith("root.a"));
6464
}
6565

66-
@Test
67-
public void testIsTableModel() {
68-
IDeviceID deviceID = Factory.DEFAULT_FACTORY.create("root.a.b.c.d");
69-
assertFalse(deviceID.isTableModel());
70-
deviceID = Factory.DEFAULT_FACTORY.create("root.b.c");
71-
assertFalse(deviceID.isTableModel());
72-
deviceID = Factory.DEFAULT_FACTORY.create("roota.b.c.d");
73-
assertTrue(deviceID.isTableModel());
74-
}
75-
7666
@Test
7767
public void testMatchDatabaseName() {
7868
IDeviceID deviceID = Factory.DEFAULT_FACTORY.create("root.a.b.c.d");

0 commit comments

Comments
 (0)