@@ -156,7 +156,7 @@ public void renameColumn_Db2_ForPrimaryOrIndexKeyColumn_ShouldThrowUnsupportedOp
156156 try (DistributedStorage storage = storageFactory .getStorage ()) {
157157 // Arrange
158158 Map <String , String > options = getCreationOptions ();
159- TableMetadata . Builder currentTableMetadataBuilder =
159+ TableMetadata currentTableMetadata =
160160 TableMetadata .newBuilder ()
161161 .addColumn (getColumnName1 (), DataType .INT )
162162 .addColumn (getColumnName2 (), DataType .INT )
@@ -169,12 +169,10 @@ public void renameColumn_Db2_ForPrimaryOrIndexKeyColumn_ShouldThrowUnsupportedOp
169169 .addColumn (getColumnName9 (), DataType .DATE )
170170 .addColumn (getColumnName10 (), DataType .TIME )
171171 .addColumn (getColumnName11 (), DataType .TIMESTAMPTZ )
172+ .addColumn (getColumnName12 (), DataType .TIMESTAMP )
172173 .addPartitionKey (getColumnName1 ())
173- .addClusteringKey (getColumnName2 (), Scan .Ordering .Order .ASC );
174- if (isTimestampTypeSupported ()) {
175- currentTableMetadataBuilder .addColumn (getColumnName12 (), DataType .TIMESTAMP );
176- }
177- TableMetadata currentTableMetadata = currentTableMetadataBuilder .build ();
174+ .addClusteringKey (getColumnName2 (), Scan .Ordering .Order .ASC )
175+ .build ();
178176 admin .createTable (getNamespace1 (), getTable4 (), currentTableMetadata , options );
179177 PutBuilder .Buildable put =
180178 Put .newBuilder ()
@@ -190,10 +188,8 @@ public void renameColumn_Db2_ForPrimaryOrIndexKeyColumn_ShouldThrowUnsupportedOp
190188 .blobValue (getColumnName8 (), "6" .getBytes (StandardCharsets .UTF_8 ))
191189 .dateValue (getColumnName9 (), LocalDate .now (ZoneId .of ("UTC" )))
192190 .timeValue (getColumnName10 (), LocalTime .now (ZoneId .of ("UTC" )))
193- .timestampTZValue (getColumnName11 (), Instant .now ());
194- if (isTimestampTypeSupported ()) {
195- put .timestampValue (getColumnName12 (), LocalDateTime .now (ZoneOffset .UTC ));
196- }
191+ .timestampTZValue (getColumnName11 (), Instant .now ())
192+ .timestampValue (getColumnName12 (), LocalDateTime .now (ZoneOffset .UTC ));
197193 storage .put (put .build ());
198194 storage .close ();
199195
@@ -243,13 +239,11 @@ public void renameColumn_Db2_ForPrimaryOrIndexKeyColumn_ShouldThrowUnsupportedOp
243239 admin .alterColumnType (
244240 getNamespace1 (), getTable4 (), getColumnName11 (), DataType .TEXT ))
245241 .isInstanceOf (UnsupportedOperationException .class );
246- if (isTimestampTypeSupported ()) {
247- assertThatCode (
248- () ->
249- admin .alterColumnType (
250- getNamespace1 (), getTable4 (), getColumnName12 (), DataType .TEXT ))
251- .isInstanceOf (UnsupportedOperationException .class );
252- }
242+ assertThatCode (
243+ () ->
244+ admin .alterColumnType (
245+ getNamespace1 (), getTable4 (), getColumnName12 (), DataType .TEXT ))
246+ .isInstanceOf (UnsupportedOperationException .class );
253247 } finally {
254248 admin .dropTable (getNamespace1 (), getTable4 (), true );
255249 }
@@ -263,7 +257,7 @@ public void renameColumn_Db2_ForPrimaryOrIndexKeyColumn_ShouldThrowUnsupportedOp
263257 try (DistributedStorage storage = storageFactory .getStorage ()) {
264258 // Arrange
265259 Map <String , String > options = getCreationOptions ();
266- TableMetadata . Builder currentTableMetadataBuilder =
260+ TableMetadata currentTableMetadata =
267261 TableMetadata .newBuilder ()
268262 .addColumn (getColumnName1 (), DataType .INT )
269263 .addColumn (getColumnName2 (), DataType .INT )
@@ -276,14 +270,12 @@ public void renameColumn_Db2_ForPrimaryOrIndexKeyColumn_ShouldThrowUnsupportedOp
276270 .addColumn (getColumnName9 (), DataType .DATE )
277271 .addColumn (getColumnName10 (), DataType .TIME )
278272 .addColumn (getColumnName11 (), DataType .TIMESTAMPTZ )
273+ .addColumn (getColumnName12 (), DataType .TIMESTAMP )
279274 .addPartitionKey (getColumnName1 ())
280- .addClusteringKey (getColumnName2 (), Scan .Ordering .Order .ASC );
281- if (isTimestampTypeSupported ()) {
282- currentTableMetadataBuilder .addColumn (getColumnName12 (), DataType .TIMESTAMP );
283- }
284- TableMetadata currentTableMetadata = currentTableMetadataBuilder .build ();
275+ .addClusteringKey (getColumnName2 (), Scan .Ordering .Order .ASC )
276+ .build ();
285277 admin .createTable (getNamespace1 (), getTable4 (), currentTableMetadata , options );
286- PutBuilder . Buildable put =
278+ Put put =
287279 Put .newBuilder ()
288280 .namespace (getNamespace1 ())
289281 .table (getTable4 ())
@@ -297,11 +289,10 @@ public void renameColumn_Db2_ForPrimaryOrIndexKeyColumn_ShouldThrowUnsupportedOp
297289 .blobValue (getColumnName8 (), "6" .getBytes (StandardCharsets .UTF_8 ))
298290 .dateValue (getColumnName9 (), LocalDate .now (ZoneId .of ("UTC" )))
299291 .timeValue (getColumnName10 (), LocalTime .now (ZoneId .of ("UTC" )))
300- .timestampTZValue (getColumnName11 (), Instant .now ());
301- if (isTimestampTypeSupported ()) {
302- put .timestampValue (getColumnName12 (), LocalDateTime .now (ZoneOffset .UTC ));
303- }
304- storage .put (put .build ());
292+ .timestampTZValue (getColumnName11 (), Instant .now ())
293+ .timestampValue (getColumnName12 (), LocalDateTime .now (ZoneOffset .UTC ))
294+ .build ();
295+ storage .put (put );
305296 storage .close ();
306297
307298 // Act Assert
@@ -350,15 +341,13 @@ public void renameColumn_Db2_ForPrimaryOrIndexKeyColumn_ShouldThrowUnsupportedOp
350341 admin .alterColumnType (
351342 getNamespace1 (), getTable4 (), getColumnName11 (), DataType .TEXT ))
352343 .doesNotThrowAnyException ();
353- if (isTimestampTypeSupported ()) {
354- assertThatCode (
355- () ->
356- admin .alterColumnType (
357- getNamespace1 (), getTable4 (), getColumnName12 (), DataType .TEXT ))
358- .doesNotThrowAnyException ();
359- }
344+ assertThatCode (
345+ () ->
346+ admin .alterColumnType (
347+ getNamespace1 (), getTable4 (), getColumnName12 (), DataType .TEXT ))
348+ .doesNotThrowAnyException ();
360349
361- TableMetadata . Builder expectedTableMetadataBuilder =
350+ TableMetadata expectedTableMetadata =
362351 TableMetadata .newBuilder ()
363352 .addColumn (getColumnName1 (), DataType .INT )
364353 .addColumn (getColumnName2 (), DataType .INT )
@@ -372,11 +361,9 @@ public void renameColumn_Db2_ForPrimaryOrIndexKeyColumn_ShouldThrowUnsupportedOp
372361 .addColumn (getColumnName10 (), DataType .TEXT )
373362 .addColumn (getColumnName11 (), DataType .TEXT )
374363 .addPartitionKey (getColumnName1 ())
375- .addClusteringKey (getColumnName2 (), Scan .Ordering .Order .ASC );
376- if (isTimestampTypeSupported ()) {
377- expectedTableMetadataBuilder .addColumn (getColumnName12 (), DataType .TEXT );
378- }
379- TableMetadata expectedTableMetadata = expectedTableMetadataBuilder .build ();
364+ .addClusteringKey (getColumnName2 (), Scan .Ordering .Order .ASC )
365+ .addColumn (getColumnName12 (), DataType .TEXT )
366+ .build ();
380367 assertThat (admin .getTableMetadata (getNamespace1 (), getTable4 ()))
381368 .isEqualTo (expectedTableMetadata );
382369 } finally {
0 commit comments