Skip to content

Commit

Permalink
Build: Fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nk1506 committed Oct 10, 2023
1 parent 82e0a56 commit 9be6804
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ public void testExceptionThrownInConcurrentCommit() {
ops.current().schema().columns().size());
}

@SuppressWarnings("unchecked")
private void concurrentCommitAndThrowException(
GlueTableOperations realOps, GlueTableOperations spyOperations, Table table) {
// Simulate a communication error after a successful commit
Expand Down Expand Up @@ -492,6 +493,7 @@ private TableMetadata updateTable(Table table, GlueTableOperations ops) {
return metadataV2;
}

@SuppressWarnings("unchecked")
private void commitAndThrowException(GlueTableOperations realOps, GlueTableOperations spyOps) {
Mockito.doAnswer(
i -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public void testGetClient() {
}

/** Azurite does not support ADLSv2 directory operations yet so use mocks here. */
@SuppressWarnings("unchecked")
@Test
public void testListPrefixOperations() {
String prefix = "abfs://[email protected]/dir";
Expand Down Expand Up @@ -136,6 +137,7 @@ public void testListPrefixOperations() {
}

/** Azurite does not support ADLSv2 directory operations yet so use mocks here. */
@SuppressWarnings("unchecked")
@Test
public void testDeletePrefixOperations() {
String prefix = "abfs://[email protected]/dir";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class GCSFileIOTest {
private final Storage storage = spy(LocalStorageHelper.getOptions().getService());
private GCSFileIO io;

@SuppressWarnings("unchecked")
@BeforeEach
public void before() {
// LocalStorageHelper doesn't support batch operations, so mock that here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public static String translateToIcebergProp(String hmsProp) {
private final FileIO fileIO;
private final ClientPool<IMetaStoreClient, TException> metaClients;

@SuppressWarnings("unchecked")
protected HiveTableOperations(
Configuration conf,
ClientPool metaClients,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class JdbcSnowflakeClientTest {

private JdbcSnowflakeClient snowflakeClient;

@SuppressWarnings("unchecked")
@BeforeEach
public void before() throws SQLException, InterruptedException {
snowflakeClient = new JdbcSnowflakeClient(mockClientPool);
Expand All @@ -83,6 +84,7 @@ public void testNullClientPoolInConstructor() {
.withMessageContaining("JdbcClientPool must be non-null");
}

@SuppressWarnings("unchecked")
@Test
public void testDatabaseExists() throws SQLException {
when(mockResultSet.next()).thenReturn(true).thenReturn(false);
Expand Down Expand Up @@ -134,6 +136,7 @@ public void testDatabaseFailureWithOtherException() throws SQLException {
.withCause(injectedException);
}

@SuppressWarnings("unchecked")
@Test
public void testDatabaseFailureWithInterruptedException()
throws SQLException, InterruptedException {
Expand All @@ -146,6 +149,7 @@ public void testDatabaseFailureWithInterruptedException()
.withCause(injectedException);
}

@SuppressWarnings("unchecked")
@Test
public void testSchemaExists() throws SQLException {
when(mockResultSet.next())
Expand Down Expand Up @@ -231,6 +235,7 @@ public void testSchemaFailureWithOtherException() throws SQLException {
.withCause(injectedException);
}

@SuppressWarnings("unchecked")
@Test
public void testSchemaFailureWithInterruptedException()
throws SQLException, InterruptedException {
Expand All @@ -244,6 +249,7 @@ public void testSchemaFailureWithInterruptedException()
.withCause(injectedException);
}

@SuppressWarnings("unchecked")
@Test
public void testListDatabasesInAccount() throws SQLException {
when(mockResultSet.next()).thenReturn(true).thenReturn(true).thenReturn(true).thenReturn(false);
Expand All @@ -268,6 +274,7 @@ public void testListDatabasesInAccount() throws SQLException {
* Any unexpected SQLException from the underlying connection will propagate out as a
* UncheckedSQLException when listing databases at Root level.
*/
@SuppressWarnings("unchecked")
@Test
public void testListDatabasesSQLExceptionAtRootLevel() throws SQLException, InterruptedException {
Exception injectedException =
Expand All @@ -284,6 +291,7 @@ public void testListDatabasesSQLExceptionAtRootLevel() throws SQLException, Inte
* Any unexpected SQLException from the underlying connection will propagate out as an
* UncheckedSQLException when listing databases if there is no error code.
*/
@SuppressWarnings("unchecked")
@Test
public void testListDatabasesSQLExceptionWithoutErrorCode()
throws SQLException, InterruptedException {
Expand All @@ -300,6 +308,7 @@ public void testListDatabasesSQLExceptionWithoutErrorCode()
* Any unexpected InterruptedException from the underlying connection will propagate out as an
* UncheckedInterruptedException when listing databases.
*/
@SuppressWarnings("unchecked")
@Test
public void testListDatabasesInterruptedException() throws SQLException, InterruptedException {
Exception injectedException = new InterruptedException("Fake interrupted exception");
Expand All @@ -315,6 +324,7 @@ public void testListDatabasesInterruptedException() throws SQLException, Interru
* For the root scope, expect an underlying query to list schemas at the ACCOUNT level with no
* query parameters.
*/
@SuppressWarnings("unchecked")
@Test
public void testListSchemasInAccount() throws SQLException {
when(mockResultSet.next()).thenReturn(true).thenReturn(true).thenReturn(true).thenReturn(false);
Expand Down Expand Up @@ -348,6 +358,7 @@ public void testListSchemasInAccount() throws SQLException {
* For a DATABASE scope, expect an underlying query to list schemas at the DATABASE level and
* supply the database as a query param in an IDENTIFIER.
*/
@SuppressWarnings("unchecked")
@Test
public void testListSchemasInDatabase() throws SQLException {
when(mockResultSet.next()).thenReturn(true).thenReturn(true).thenReturn(false);
Expand All @@ -374,6 +385,7 @@ public void testListSchemasInDatabase() throws SQLException {
* Any unexpected SQLException from the underlying connection will propagate out as an
* UncheckedSQLException when listing schemas at Root level.
*/
@SuppressWarnings("unchecked")
@Test
public void testListSchemasSQLExceptionAtRootLevel() throws SQLException, InterruptedException {
Exception injectedException =
Expand All @@ -390,6 +402,7 @@ public void testListSchemasSQLExceptionAtRootLevel() throws SQLException, Interr
* Any unexpected SQLException with specific error codes from the underlying connection will
* propagate out as a NoSuchNamespaceException when listing schemas at Database level.
*/
@SuppressWarnings("unchecked")
@Test
public void testListSchemasSQLExceptionAtDatabaseLevel()
throws SQLException, InterruptedException {
Expand Down Expand Up @@ -425,6 +438,7 @@ public void testListSchemasAtSchemaLevel() {
* Any unexpected SQLException from the underlying connection will propagate out as an
* UncheckedSQLException when listing schemas if there is no error code.
*/
@SuppressWarnings("unchecked")
@Test
public void testListSchemasSQLExceptionWithoutErrorCode()
throws SQLException, InterruptedException {
Expand All @@ -441,6 +455,7 @@ public void testListSchemasSQLExceptionWithoutErrorCode()
* Any unexpected InterruptedException from the underlying connection will propagate out as an
* UncheckedInterruptedException when listing schemas.
*/
@SuppressWarnings("unchecked")
@Test
public void testListSchemasInterruptedException() throws SQLException, InterruptedException {
Exception injectedException = new InterruptedException("Fake interrupted exception");
Expand All @@ -456,6 +471,7 @@ public void testListSchemasInterruptedException() throws SQLException, Interrupt
* For the root/empty scope, expect an underlying query to list tables at the ACCOUNT level with
* no query parameters.
*/
@SuppressWarnings("unchecked")
@Test
public void testListIcebergTablesInAccount() throws SQLException {
when(mockResultSet.next())
Expand Down Expand Up @@ -502,6 +518,7 @@ public void testListIcebergTablesInAccount() throws SQLException {
* For a DATABASE scope, expect an underlying query to list tables at the DATABASE level and
* supply the database as a query param in an IDENTIFIER.
*/
@SuppressWarnings("unchecked")
@Test
public void testListIcebergTablesInDatabase() throws SQLException {
when(mockResultSet.next()).thenReturn(true).thenReturn(true).thenReturn(true).thenReturn(false);
Expand Down Expand Up @@ -539,6 +556,7 @@ public void testListIcebergTablesInDatabase() throws SQLException {
* For a SCHEMA scope, expect an underlying query to list tables at the SCHEMA level and supply
* the schema as a query param in an IDENTIFIER.
*/
@SuppressWarnings("unchecked")
@Test
public void testListIcebergTablesInSchema() throws SQLException {
when(mockResultSet.next()).thenReturn(true).thenReturn(true).thenReturn(false);
Expand Down Expand Up @@ -566,6 +584,7 @@ public void testListIcebergTablesInSchema() throws SQLException {
* Any unexpected SQLException from the underlying connection will propagate out as an
* UncheckedSQLException when listing tables at Root level
*/
@SuppressWarnings("unchecked")
@Test
public void testListIcebergTablesSQLExceptionAtRootLevel()
throws SQLException, InterruptedException {
Expand All @@ -583,6 +602,7 @@ public void testListIcebergTablesSQLExceptionAtRootLevel()
* Any unexpected SQLException with specific error codes from the underlying connection will
* propagate out as a NoSuchNamespaceException when listing tables at Database level
*/
@SuppressWarnings("unchecked")
@Test
public void testListIcebergTablesSQLExceptionAtDatabaseLevel()
throws SQLException, InterruptedException {
Expand Down Expand Up @@ -610,6 +630,7 @@ public void testListIcebergTablesSQLExceptionAtDatabaseLevel()
* Any unexpected SQLException with specific error codes from the underlying connection will
* propagate out as a NoSuchNamespaceException when listing tables at Schema level
*/
@SuppressWarnings("unchecked")
@Test
public void testListIcebergTablesSQLExceptionAtSchemaLevel()
throws SQLException, InterruptedException {
Expand Down Expand Up @@ -639,6 +660,7 @@ public void testListIcebergTablesSQLExceptionAtSchemaLevel()
* Any unexpected SQLException without error code from the underlying connection will propagate
* out as an UncheckedSQLException when listing tables.
*/
@SuppressWarnings("unchecked")
@Test
public void testListIcebergTablesSQLExceptionWithoutErrorCode()
throws SQLException, InterruptedException {
Expand All @@ -655,6 +677,7 @@ public void testListIcebergTablesSQLExceptionWithoutErrorCode()
* Any unexpected InterruptedException from the underlying connection will propagate out as an
* UncheckedInterruptedException when listing tables.
*/
@SuppressWarnings("unchecked")
@Test
public void testListIcebergTablesInterruptedException()
throws SQLException, InterruptedException {
Expand All @@ -671,6 +694,7 @@ public void testListIcebergTablesInterruptedException()
* Test parsing of table metadata JSON from a GET_ICEBERG_TABLE_INFORMATION call, with the S3 path
* unaltered between snowflake/iceberg path representations.
*/
@SuppressWarnings("unchecked")
@Test
public void testGetS3TableMetadata() throws SQLException {
when(mockResultSet.next()).thenReturn(true);
Expand Down Expand Up @@ -702,6 +726,7 @@ public void testGetS3TableMetadata() throws SQLException {
* Test parsing of table metadata JSON from a GET_ICEBERG_TABLE_INFORMATION call, with the Azure
* path translated from an azure:// format to a wasbs:// format.
*/
@SuppressWarnings("unchecked")
@Test
public void testGetAzureTableMetadata() throws SQLException {
when(mockResultSet.next()).thenReturn(true);
Expand Down Expand Up @@ -733,6 +758,7 @@ public void testGetAzureTableMetadata() throws SQLException {
* Test parsing of table metadata JSON from a GET_ICEBERG_TABLE_INFORMATION call, with the GCS
* path translated from a gcs:// format to a gs:// format.
*/
@SuppressWarnings("unchecked")
@Test
public void testGetGcsTableMetadata() throws SQLException {
when(mockResultSet.next()).thenReturn(true);
Expand Down Expand Up @@ -777,6 +803,7 @@ public void testGetTableMetadataMalformedJson() throws SQLException {
* Any unexpected SQLException with specific error codes from the underlying connection will
* propagate out as a NoSuchTableException when getting table metadata.
*/
@SuppressWarnings("unchecked")
@Test
public void testGetTableMetadataSQLException() throws SQLException, InterruptedException {
for (Integer errorCode : TABLE_NOT_FOUND_ERROR_CODES) {
Expand Down Expand Up @@ -805,6 +832,7 @@ public void testGetTableMetadataSQLException() throws SQLException, InterruptedE
* Any unexpected SQLException from the underlying connection will propagate out as an
* UncheckedSQLException when getting table metadata.
*/
@SuppressWarnings("unchecked")
@Test
public void testGetTableMetadataSQLExceptionWithoutErrorCode()
throws SQLException, InterruptedException {
Expand All @@ -824,6 +852,7 @@ public void testGetTableMetadataSQLExceptionWithoutErrorCode()
* Any unexpected InterruptedException from the underlying connection will propagate out as an
* UncheckedInterruptedException when getting table metadata.
*/
@SuppressWarnings("unchecked")
@Test
public void testGetTableMetadataInterruptedException() throws SQLException, InterruptedException {
Exception injectedException = new InterruptedException("Fake interrupted exception");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ protected Configuration initHadoopConf() {
return new Configuration();
}

@SuppressWarnings("unchecked")
protected final void initTable() {
Schema schema =
new Schema(
Expand Down

0 comments on commit 9be6804

Please sign in to comment.