Skip to content

Commit 78c215e

Browse files
committed
Delete unuseful code.
1 parent 16c8e1b commit 78c215e

2 files changed

Lines changed: 18 additions & 144 deletions

File tree

integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBAlterColumnTypeIT.java

Lines changed: 11 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -120,58 +120,26 @@ public void testWriteAndAlter()
120120
Collections.addAll(typesToTest, TSDataType.values());
121121
typesToTest.remove(TSDataType.VECTOR);
122122
typesToTest.remove(TSDataType.UNKNOWN);
123-
// typesToTest.remove(TSDataType.STRING);
124-
// typesToTest.remove(TSDataType.TEXT);
125-
// typesToTest.remove(TSDataType.DATE);
126-
// typesToTest.remove(TSDataType.TIMESTAMP); // start
127-
// typesToTest.remove(TSDataType.BLOB);
128-
// typesToTest.remove(TSDataType.BOOLEAN);
129-
130-
// doWriteAndAlter(TSDataType.INT32, TSDataType.FLOAT, false);
131-
// doWriteAndAlter(TSDataType.INT32, TSDataType.FLOAT, true);
132-
133-
// for (TSDataType from : typesToTest) {
134-
// for (TSDataType to : typesToTest) {
135-
// TSDataType from = TSDataType.INT32;
136-
// TSDataType to = TSDataType.STRING;
137-
// if (from == TSDataType.DATE && to == TSDataType.DATE) {
138-
// continue;
139-
// }
140-
141-
TSDataType from = TSDataType.DATE;
142-
TSDataType to = TSDataType.STRING;
143-
144-
/***@todo tmp test***/
145-
// System.out.printf("testing %s to %s%n", from, to);
146-
// doWriteAndAlter(from, to);
147-
// if (from == TSDataType.DATE && to == TSDataType.DATE) {
148-
// continue;
149-
// }
150-
// if (to.isCompatible(from)) {
151-
// testAlignDeviceSequenceDataQuery(from, to);
152-
// testAlignDeviceUnSequenceDataQuery(from, to);
153-
// }
154-
/***@todo tmp test***/
155-
156-
if (from != to && to.isCompatible(from)) {
157-
System.out.printf("testing %s to %s%n", from, to);
158-
doWriteAndAlter(from, to);
159-
testAlignDeviceSequenceDataQuery(from, to);
160-
testAlignDeviceUnSequenceDataQuery(from, to);
123+
124+
for (TSDataType from : typesToTest) {
125+
for (TSDataType to : typesToTest) {
126+
if (from != to && to.isCompatible(from)) {
127+
System.out.printf("testing %s to %s%n", from, to);
128+
doWriteAndAlter(from, to);
129+
testAlignDeviceSequenceDataQuery(from, to);
130+
testAlignDeviceUnSequenceDataQuery(from, to);
131+
}
132+
}
161133
}
162-
// }
163-
// }
164134
}
165135

166136
private void doWriteAndAlter(TSDataType from, TSDataType to)
167137
throws IoTDBConnectionException, StatementExecutionException {
168138
try (ITableSession session = EnvFactory.getEnv().getTableSessionConnectionWithDB("test")) {
169-
/***@todo add new test***/
170139
session.executeNonQueryStatement("SET CONFIGURATION enable_unseq_space_compaction='false'");
171140
if (from == TSDataType.DATE && !to.isCompatible(from)) {
172141
throw new NotSupportedException("Not supported DATE type.");
173142
}
174-
/***@todo end***/
175143

176144
// create a table with type of "from"
177145
session.executeNonQueryStatement(
@@ -245,10 +213,6 @@ private void doWriteAndAlter(TSDataType from, TSDataType to)
245213
// session.executeNonQueryStatement("FLUSH");
246214

247215
SessionDataSet dataSet =
248-
// @todo tmp test
249-
// session.executeQueryStatement("select * from write_and_alter_column_type order
250-
// by time");
251-
// @todo tmp test
252216
session.executeQueryStatement(
253217
"select time, s1 from write_and_alter_column_type order by time");
254218
RowRecord rec;
@@ -362,11 +326,6 @@ public void testAlterWithoutWrite() throws IoTDBConnectionException, StatementEx
362326

363327
for (TSDataType from : typesToTest) {
364328
for (TSDataType to : typesToTest) {
365-
/**
366-
* @todo tmp test/ System.out.printf("testing %s to %s%n", from, to);
367-
* doAlterWithoutWrite(from, to, false); doAlterWithoutWrite(from, to, true); /***@todo
368-
* end**
369-
*/
370329
if (from != to && to.isCompatible(from)) {
371330
System.out.printf("testing %s to %s%n", from, to);
372331
doAlterWithoutWrite(from, to, false);
@@ -379,11 +338,9 @@ public void testAlterWithoutWrite() throws IoTDBConnectionException, StatementEx
379338
private void doAlterWithoutWrite(TSDataType from, TSDataType to, boolean flush)
380339
throws IoTDBConnectionException, StatementExecutionException {
381340
try (ITableSession session = EnvFactory.getEnv().getTableSessionConnectionWithDB("test")) {
382-
/***@todo tmp**/
383341
if (from == TSDataType.DATE && !to.isCompatible(from)) {
384342
throw new NotSupportedException("Not supported DATE type.");
385343
}
386-
/***@todo end**/
387344

388345
// create a table with type of "from"
389346
session.executeNonQueryStatement(
@@ -1364,28 +1321,6 @@ public void testAlignDeviceSequenceDataQuery(TSDataType from, TSDataType to)
13641321
}
13651322
dataSet.close();
13661323

1367-
// SessionDataSet dataSet1 =
1368-
// session.executeQueryStatement(
1369-
//// "select cast(s1 as TEXT), cast(s2 as TEXT), s1, s2 from
1370-
// construct_and_alter_column_type where cast(s1 as TEXT) >= '1' and cast(s2 as TEXT) > '2'
1371-
// order by time");
1372-
// "select cast(s1 as INT64), cast(s2 as INT64), s1, s2 from
1373-
// construct_and_alter_column_type where cast(s1 as INT64) > 1 and cast(s2 as INT64) > 2 order
1374-
// by time limit 10");
1375-
// RowRecord rec1 = dataSet1.next();
1376-
// while (rec1 != null) {
1377-
// System.out.println(rec1.getFields().toString());
1378-
// rec1 = dataSet1.next();
1379-
// }
1380-
// dataSet1.close();
1381-
// System.exit(0);
1382-
1383-
/**
1384-
* @todo tmp test*
1385-
*/
1386-
// standardSelectTest(from, session);
1387-
// standardAccumulatorQueryTest(session, from);
1388-
/** end* */
13891324
try {
13901325
standardSelectTest(session, from, to);
13911326
standardAccumulatorQueryTest(session, from);
@@ -1409,24 +1344,14 @@ public void testAlignDeviceSequenceDataQuery(TSDataType from, TSDataType to)
14091344
}
14101345
}
14111346

1412-
// @todo tmp test
14131347
System.out.println("[testAlignDeviceSequenceDataQuery] AFTER ALTER COLUMN s1 SET DATA TYPE ");
14141348

14151349
// If don't execute the flush" operation, verify if result can get valid value, not be null
14161350
// when query memtable.
14171351
// session.executeNonQueryStatement("FLUSH");
14181352

14191353
TSDataType newType = isCompatible ? to : from;
1420-
/**
1421-
* @todo tmp test*
1422-
*/
1423-
// standardSelectTestAfterAlterColumnType(from, session, newType);
1424-
//
1425-
// // Accumulator query test
1426-
// standardAccumulatorQueryTest(session, newType);
1427-
/**
1428-
* @todo end*
1429-
*/
1354+
14301355
try {
14311356
standardSelectTestAfterAlterColumnType(from, session, newType);
14321357
// Accumulator query test
@@ -1467,7 +1392,6 @@ public void testAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to)
14671392
Arrays.asList(from, from),
14681393
Arrays.asList(ColumnCategory.FIELD, ColumnCategory.FIELD));
14691394

1470-
// @todo tmp test
14711395
System.out.println(tablet.getSchemas().toString());
14721396

14731397
for (int i = 513; i <= 1024; i++) {
@@ -1489,7 +1413,6 @@ public void testAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to)
14891413
session.insert(tablet);
14901414
tablet.reset();
14911415
}
1492-
// @todo tmp test if delete?
14931416
// session.executeNonQueryStatement("FLUSH");
14941417

14951418
SessionDataSet dataSet =
@@ -1502,31 +1425,6 @@ public void testAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to)
15021425
}
15031426
dataSet.close();
15041427

1505-
// SessionDataSet dataSet1 =
1506-
// session.executeQueryStatement(
1507-
//// "select cast(s1 as TEXT), cast(s2 as TEXT), s1, s2 from
1508-
// construct_and_alter_column_type where cast(s1 as TEXT) >= '1' and cast(s2 as TEXT) > '2'
1509-
// order by time");
1510-
// "select cast(s1 as INT64), cast(s2 as INT64), s1, s2 from
1511-
// construct_and_alter_column_type where cast(s1 as INT64) > 1 and cast(s2 as INT64) > 2 order
1512-
// by time limit 10");
1513-
// RowRecord rec1 = dataSet1.next();
1514-
// while (rec1 != null) {
1515-
// System.out.println(rec1.getFields().toString());
1516-
// rec1 = dataSet1.next();
1517-
// }
1518-
// dataSet1.close();
1519-
// System.exit(0);
1520-
1521-
/**
1522-
* @todo tmp test*
1523-
*/
1524-
// standardSelectTest(from, session);
1525-
// standardAccumulatorQueryTest(session, from);
1526-
/**
1527-
* @todo end*
1528-
*/
1529-
15301428
/**
15311429
* @todo tmp test*
15321430
*/
@@ -1556,7 +1454,6 @@ public void testAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to)
15561454
}
15571455
}
15581456

1559-
// @todo tmp test
15601457
System.out.println(
15611458
"[testAlignDeviceUnSequenceDataQuery] AFTER ALTER COLUMN s1 SET DATA TYPE ");
15621459

@@ -1565,16 +1462,7 @@ public void testAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to)
15651462
// session.executeNonQueryStatement("FLUSH");
15661463

15671464
TSDataType newType = isCompatible ? to : from;
1568-
/**
1569-
* @todo tmp test*
1570-
*/
1571-
// standardSelectTestAfterAlterColumnType(from, session, newType);
15721465

1573-
// Accumulator query test
1574-
// standardAccumulatorQueryTest(session, newType);
1575-
/**
1576-
* @todo end*
1577-
*/
15781466
try {
15791467
standardSelectTestAfterAlterColumnType(from, session, newType);
15801468
// Accumulator query test
@@ -1602,16 +1490,9 @@ public void testAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to)
16021490
private static void standardSelectTestAfterAlterColumnType(
16031491
TSDataType from, ITableSession session, TSDataType newType)
16041492
throws StatementExecutionException, IoTDBConnectionException {
1605-
/**
1606-
* @todo tmp test*
1607-
*/
1608-
// if (from == TSDataType.DATE && newType.isCompatible(from)) {
16091493
if (from == TSDataType.DATE) {
16101494
throw new NotSupportedException("Not supported DATE type.");
16111495
}
1612-
/**
1613-
* @todo test*
1614-
*/
16151496

16161497
// Value Filter Test
16171498
// 1.satisfy the condition of value filter completely
@@ -2374,11 +2255,4 @@ public void testUsingSameColumn() {
23742255
assertEquals(true, SchemaUtils.isUsingSameColumn(TSDataType.STRING, TSDataType.BLOB));
23752256
assertEquals(true, SchemaUtils.isUsingSameColumn(TSDataType.STRING, TSDataType.TEXT));
23762257
}
2377-
2378-
public static String getDateStringValue(int value) {
2379-
// if (value < 19700101) {
2380-
// return String.valueOf(value);
2381-
// }
2382-
return String.format("%04d-%02d-%02d", value / 10000, (value % 10000) / 100, value % 100);
2383-
}
23842258
}

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/SchemaUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
import org.apache.iotdb.db.queryengine.plan.statement.component.Ordering;
2525
import org.apache.iotdb.db.utils.constant.SqlConstant;
2626

27-
import org.apache.commons.lang3.tuple.Pair;
2827
import org.apache.tsfile.enums.TSDataType;
2928
import org.apache.tsfile.file.metadata.AbstractAlignedChunkMetadata;
3029
import org.apache.tsfile.file.metadata.AbstractAlignedTimeSeriesMetadata;
3130
import org.apache.tsfile.file.metadata.ChunkMetadata;
3231
import org.apache.tsfile.file.metadata.IChunkMetadata;
3332
import org.apache.tsfile.file.metadata.TimeseriesMetadata;
3433
import org.apache.tsfile.file.metadata.enums.TSEncoding;
34+
import org.apache.tsfile.utils.Pair;
3535
import org.slf4j.Logger;
3636
import org.slf4j.LoggerFactory;
3737

@@ -52,13 +52,13 @@ public class SchemaUtils {
5252
static {
5353
SAME_TYPE_PAIRS = new HashSet<>();
5454

55-
// INT相关的配对
55+
// related pair about INT
5656
addSymmetricPairs(SAME_TYPE_PAIRS, TSDataType.DATE, TSDataType.INT32);
5757

58-
// LONG相关的配对
58+
// related pair about LONG
5959
addSymmetricPairs(SAME_TYPE_PAIRS, TSDataType.TIMESTAMP, TSDataType.INT64);
6060

61-
// TEXT相关的配对
61+
// related pair about TEXT
6262
addSymmetricPairs(SAME_TYPE_PAIRS, TSDataType.STRING, TSDataType.BLOB, TSDataType.TEXT);
6363
}
6464

@@ -288,8 +288,8 @@ private static void addSymmetricPairs(
288288
Set<Pair<TSDataType, TSDataType>> set, TSDataType... dataTypes) {
289289
for (int i = 0; i < dataTypes.length; i++) {
290290
for (int j = i + 1; j < dataTypes.length; j++) {
291-
set.add(Pair.of(dataTypes[i], dataTypes[j]));
292-
set.add(Pair.of(dataTypes[j], dataTypes[i]));
291+
set.add(new Pair<>(dataTypes[i], dataTypes[j]));
292+
set.add(new Pair<>(dataTypes[j], dataTypes[i]));
293293
}
294294
}
295295
}
@@ -298,7 +298,7 @@ public static boolean isUsingSameColumn(TSDataType originalDataType, TSDataType
298298
if (originalDataType == dataType) {
299299
return true;
300300
}
301-
return SAME_TYPE_PAIRS.contains(Pair.of(originalDataType, dataType));
301+
return SAME_TYPE_PAIRS.contains(new Pair<>(originalDataType, dataType));
302302
}
303303

304304
public static void changeMetadataModified(

0 commit comments

Comments
 (0)