1717 * under the License.
1818 */
1919
20- package org .apache .iotdb .relational .it .schema ;
20+ package org .apache .iotdb .db .it .schema ;
2121
2222import org .apache .iotdb .commons .utils .MetadataUtils ;
2323import org .apache .iotdb .db .utils .SchemaUtils ;
@@ -100,25 +100,15 @@ public class IoTDBAlterTimeSeriesTypeIT {
100100 public static void setUp () throws Exception {
101101 EnvFactory .getEnv ().getConfig ().getDataNodeConfig ().setCompactionScheduleInterval (1000 );
102102 EnvFactory .getEnv ().initClusterEnvironment ();
103- try (ISession session = EnvFactory .getEnv ().getSessionConnection ()) {
104- // session.createDatabase(database);
105- }
106103 }
107104
108105 @ AfterClass
109106 public static void tearDown () throws Exception {
110- try (ISession session = EnvFactory .getEnv ().getSessionConnection ()) {
111- // session.deleteDatabase(database);
112- }
113107 EnvFactory .getEnv ().cleanClusterEnvironment ();
114108 }
115109
116110 @ Test
117- public void testWriteAndAlter ()
118- throws IoTDBConnectionException ,
119- StatementExecutionException ,
120- IOException ,
121- WriteProcessException {
111+ public void testWriteAndAlter () throws Exception {
122112 Set <TSDataType > typesToTest = new HashSet <>();
123113 Collections .addAll (typesToTest , TSDataType .values ());
124114 typesToTest .remove (TSDataType .VECTOR );
@@ -1080,11 +1070,7 @@ public void testLoadAndAccumulator()
10801070 }
10811071 }
10821072
1083- public void testNonAlignDeviceSequenceDataQuery (TSDataType from , TSDataType to )
1084- throws IoTDBConnectionException ,
1085- StatementExecutionException ,
1086- IOException ,
1087- WriteProcessException {
1073+ public void testNonAlignDeviceSequenceDataQuery (TSDataType from , TSDataType to ) throws Exception {
10881074 try (ISession session = EnvFactory .getEnv ().getSessionConnection ()) {
10891075 session .executeNonQueryStatement ("SET CONFIGURATION 'enable_unseq_space_compaction'='false'" );
10901076
@@ -1200,8 +1186,11 @@ public void testNonAlignDeviceSequenceDataQuery(TSDataType from, TSDataType to)
12001186 standardSelectTestAfterAlterColumnType (from , session , newType );
12011187 // Accumulator query test
12021188 standardAccumulatorQueryTest (session , from , newType );
1189+ } catch (NotSupportedException e ) {
1190+ log .info (e .getMessage ());
12031191 } catch (Exception e ) {
12041192 log .info (e .getMessage ());
1193+ throw new Exception (e );
12051194 }
12061195
12071196 if (from == TSDataType .DATE ) {
@@ -1223,11 +1212,7 @@ public void testNonAlignDeviceSequenceDataQuery(TSDataType from, TSDataType to)
12231212 }
12241213 }
12251214
1226- public void testAlignDeviceSequenceDataQuery (TSDataType from , TSDataType to )
1227- throws IoTDBConnectionException ,
1228- StatementExecutionException ,
1229- IOException ,
1230- WriteProcessException {
1215+ public void testAlignDeviceSequenceDataQuery (TSDataType from , TSDataType to ) throws Exception {
12311216 try (ISession session = EnvFactory .getEnv ().getSessionConnection ()) {
12321217 session .executeNonQueryStatement ("SET CONFIGURATION 'enable_unseq_space_compaction'='false'" );
12331218
@@ -1308,8 +1293,11 @@ public void testAlignDeviceSequenceDataQuery(TSDataType from, TSDataType to)
13081293 try {
13091294 standardSelectTest (session , from , to );
13101295 standardAccumulatorQueryTest (session , from );
1296+ } catch (NotSupportedException e ) {
1297+ log .info (e .getMessage ());
13111298 } catch (Exception e ) {
13121299 log .info (e .getMessage ());
1300+ throw new Exception (e );
13131301 }
13141302
13151303 // alter the type to "to"
@@ -1347,8 +1335,11 @@ public void testAlignDeviceSequenceDataQuery(TSDataType from, TSDataType to)
13471335 standardSelectTestAfterAlterColumnType (from , session , newType );
13481336 // Accumulator query test
13491337 standardAccumulatorQueryTest (session , from , newType );
1338+ } catch (NotSupportedException e ) {
1339+ log .info (e .getMessage ());
13501340 } catch (Exception e ) {
13511341 log .info (e .getMessage ());
1342+ throw new Exception (e );
13521343 }
13531344
13541345 if (from == TSDataType .DATE ) {
@@ -1371,10 +1362,7 @@ public void testAlignDeviceSequenceDataQuery(TSDataType from, TSDataType to)
13711362 }
13721363
13731364 public void testNonAlignDeviceUnSequenceDataQuery (TSDataType from , TSDataType to )
1374- throws IoTDBConnectionException ,
1375- StatementExecutionException ,
1376- IOException ,
1377- WriteProcessException {
1365+ throws Exception {
13781366 try (ISession session = EnvFactory .getEnv ().getSessionConnection ()) {
13791367 session .executeNonQueryStatement ("SET CONFIGURATION 'enable_unseq_space_compaction'='false'" );
13801368
@@ -1444,8 +1432,11 @@ public void testNonAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to
14441432 try {
14451433 standardSelectTest (session , from , to );
14461434 standardAccumulatorQueryTest (session , from );
1435+ } catch (NotSupportedException e ) {
1436+ log .info (e .getMessage ());
14471437 } catch (Exception e ) {
14481438 log .info (e .getMessage ());
1439+ throw new Exception (e );
14491440 }
14501441
14511442 // alter the type to "to"
@@ -1483,8 +1474,11 @@ public void testNonAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to
14831474 standardSelectTestAfterAlterColumnType (from , session , newType );
14841475 // Accumulator query test
14851476 standardAccumulatorQueryTest (session , from , newType );
1477+ } catch (NotSupportedException e ) {
1478+ log .info (e .getMessage ());
14861479 } catch (Exception e ) {
14871480 log .info (e .getMessage ());
1481+ throw new Exception (e );
14881482 }
14891483
14901484 if (from == TSDataType .DATE ) {
@@ -1506,11 +1500,7 @@ public void testNonAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to
15061500 }
15071501 }
15081502
1509- public void testAlignDeviceUnSequenceDataQuery (TSDataType from , TSDataType to )
1510- throws IoTDBConnectionException ,
1511- StatementExecutionException ,
1512- IOException ,
1513- WriteProcessException {
1503+ public void testAlignDeviceUnSequenceDataQuery (TSDataType from , TSDataType to ) throws Exception {
15141504 try (ISession session = EnvFactory .getEnv ().getSessionConnection ()) {
15151505 session .executeNonQueryStatement ("SET CONFIGURATION 'enable_unseq_space_compaction'='false'" );
15161506
@@ -1584,8 +1574,11 @@ public void testAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to)
15841574 try {
15851575 standardSelectTest (session , from , to );
15861576 standardAccumulatorQueryTest (session , from );
1577+ } catch (NotSupportedException e ) {
1578+ log .info (e .getMessage ());
15871579 } catch (Exception e ) {
15881580 log .info (e .getMessage ());
1581+ throw new Exception (e );
15891582 }
15901583
15911584 // alter the type to "to"
@@ -1623,8 +1616,11 @@ public void testAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to)
16231616 standardSelectTestAfterAlterColumnType (from , session , newType );
16241617 // Accumulator query test
16251618 standardAccumulatorQueryTest (session , from , newType );
1619+ } catch (NotSupportedException e ) {
1620+ log .info (e .getMessage ());
16261621 } catch (Exception e ) {
16271622 log .info (e .getMessage ());
1623+ throw new Exception (e );
16281624 }
16291625
16301626 if (from == TSDataType .DATE ) {
@@ -1647,10 +1643,7 @@ public void testAlignDeviceUnSequenceDataQuery(TSDataType from, TSDataType to)
16471643 }
16481644
16491645 public void testNonAlignDeviceUnSequenceOverlappedDataQuery (TSDataType from , TSDataType to )
1650- throws IoTDBConnectionException ,
1651- StatementExecutionException ,
1652- IOException ,
1653- WriteProcessException {
1646+ throws Exception {
16541647 try (ISession session = EnvFactory .getEnv ().getSessionConnection ()) {
16551648 session .executeNonQueryStatement ("SET CONFIGURATION 'enable_unseq_space_compaction'='false'" );
16561649
@@ -1720,8 +1713,11 @@ public void testNonAlignDeviceUnSequenceOverlappedDataQuery(TSDataType from, TSD
17201713 try {
17211714 standardSelectTest (session , from , to );
17221715 standardAccumulatorQueryTest (session , from );
1716+ } catch (NotSupportedException e ) {
1717+ log .info (e .getMessage ());
17231718 } catch (Exception e ) {
17241719 log .info (e .getMessage ());
1720+ throw new Exception (e );
17251721 }
17261722
17271723 // alter the type to "to"
@@ -1759,8 +1755,11 @@ public void testNonAlignDeviceUnSequenceOverlappedDataQuery(TSDataType from, TSD
17591755 standardSelectTestAfterAlterColumnType (from , session , newType );
17601756 // Accumulator query test
17611757 standardAccumulatorQueryTest (session , from , newType );
1758+ } catch (NotSupportedException e ) {
1759+ log .info (e .getMessage ());
17621760 } catch (Exception e ) {
17631761 log .info (e .getMessage ());
1762+ throw new Exception (e );
17641763 }
17651764
17661765 if (from == TSDataType .DATE ) {
@@ -1783,10 +1782,7 @@ public void testNonAlignDeviceUnSequenceOverlappedDataQuery(TSDataType from, TSD
17831782 }
17841783
17851784 public void testAlignDeviceUnSequenceOverlappedDataQuery (TSDataType from , TSDataType to )
1786- throws IoTDBConnectionException ,
1787- StatementExecutionException ,
1788- IOException ,
1789- WriteProcessException {
1785+ throws Exception {
17901786 try (ISession session = EnvFactory .getEnv ().getSessionConnection ()) {
17911787 session .executeNonQueryStatement ("SET CONFIGURATION 'enable_unseq_space_compaction'='false'" );
17921788
@@ -1860,8 +1856,11 @@ public void testAlignDeviceUnSequenceOverlappedDataQuery(TSDataType from, TSData
18601856 try {
18611857 standardSelectTest (session , from , to );
18621858 standardAccumulatorQueryTest (session , from );
1859+ } catch (NotSupportedException e ) {
1860+ log .info (e .getMessage ());
18631861 } catch (Exception e ) {
18641862 log .info (e .getMessage ());
1863+ throw new Exception (e );
18651864 }
18661865
18671866 // alter the type to "to"
@@ -2348,7 +2347,7 @@ private static void standardAccumulatorQueryTest(ISession session, TSDataType ne
23482347 RowRecord rec ;
23492348 if (!UNSUPPORT_ACCUMULATOR_QUERY_DATA_TYPE_LIST .contains (newType )) {
23502349 int [] expectedValue ;
2351-
2350+ int max = 4 ;
23522351 if (DATA_TYPE_LIST .contains (newType )) {
23532352 dataSet =
23542353 session .executeQueryStatement (
@@ -2364,6 +2363,7 @@ private static void standardAccumulatorQueryTest(ISession session, TSDataType ne
23642363 } else if (newType == TSDataType .BOOLEAN ) {
23652364 expectedValue = new int [] {19700102 , 19721021 };
23662365 }
2366+ max = 2 ;
23672367 } else {
23682368 dataSet =
23692369 session .executeQueryStatement (
@@ -2382,7 +2382,7 @@ private static void standardAccumulatorQueryTest(ISession session, TSDataType ne
23822382 }
23832383
23842384 if (newType != TSDataType .BOOLEAN ) {
2385- for (int i = 0 ; i < 4 ; i ++) {
2385+ for (int i = 0 ; i < max ; i ++) {
23862386 if (newType == TSDataType .BLOB ) {
23872387 assertEquals (genValue (newType , expectedValue [i ]), rec .getFields ().get (i ).getBinaryV ());
23882388 } else if (newType == TSDataType .DATE ) {
@@ -2459,13 +2459,15 @@ private static void standardAccumulatorQueryTest(
24592459 } else {
24602460 SessionDataSet dataSet ;
24612461 int [] expectedValue ;
2462+ int max = 4 ;
24622463 if (DATA_TYPE_LIST .contains (newType )) {
24632464 dataSet =
24642465 session .executeQueryStatement (
24652466 "select first_value(s1),last_value(s1) from "
24662467 + database
24672468 + ".construct_and_alter_column_type" );
24682469 expectedValue = new int [] {1 , 1024 };
2470+ max = 2 ;
24692471 } else {
24702472 dataSet =
24712473 session .executeQueryStatement (
@@ -2486,7 +2488,7 @@ private static void standardAccumulatorQueryTest(
24862488 // expectedValue = new int[] {19700102, 19721021, 19700102, 19721021};
24872489 // }
24882490 if (newType != TSDataType .BOOLEAN ) {
2489- for (int i = 0 ; i < 4 ; i ++) {
2491+ for (int i = 0 ; i < max ; i ++) {
24902492 if (newType == TSDataType .BLOB ) {
24912493 assertEquals (genValue (newType , expectedValue [i ]), rec .getFields ().get (i ).getBinaryV ());
24922494 } else if (newType == TSDataType .DATE ) {
0 commit comments