Skip to content

Commit

Permalink
Fixed unit test case failures
Browse files Browse the repository at this point in the history
  • Loading branch information
AnuragKDwivedi committed Jan 30, 2025
1 parent 2e19034 commit 17509da
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public void testSessionProperties()

ClientOptions options = console.clientOptions;
assertEquals(options.sessionProperties, ImmutableList.of(
new ClientSessionProperty(Optional.of("catalogName"), "system", "system-value"),
new ClientSessionProperty(Optional.of("catalogName"), "name", "catalog-property")));
new ClientSessionProperty(Optional.empty(), "system", "system-value"),
new ClientSessionProperty(Optional.of("catalog"), "name", "catalog-property")));

// special characters are allowed in the value
assertEquals(new ClientSessionProperty("foo=bar:=baz"), new ClientSessionProperty(Optional.empty(), "foo", "bar:=baz"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ public abstract class AbstractTestHiveClient
protected static final String INVALID_COLUMN = "totally_invalid_column_name";

protected static final String TEST_SERVER_VERSION = "test_version";
private static final String TEST_CATALOG_NAME = "hive";

protected static final Executor EXECUTOR = Executors.newFixedThreadPool(5);
protected static final PageSinkContext TEST_HIVE_PAGE_SINK_CONTEXT = PageSinkContext.builder().setCommitRequired(false).setConnectorMetadataUpdater(new HiveMetadataUpdater(EXECUTOR)).build();
Expand Down Expand Up @@ -1044,7 +1043,7 @@ protected final void setup(String databaseName, HiveClientConfig hiveClientConfi
new HiveFileRenamer(),
DEFAULT_COLUMN_CONVERTER_PROVIDER,
new QuickStatsProvider(metastoreClient, HDFS_ENVIRONMENT, DO_NOTHING_DIRECTORY_LISTER, new HiveClientConfig(), new NamenodeStats(), ImmutableList.of()),
new HiveTableWritabilityChecker(false), TEST_CATALOG_NAME);
new HiveTableWritabilityChecker(false), "catalogName");

transactionManager = new HiveTransactionManager();
encryptionInformationProvider = new HiveEncryptionInformationProvider(ImmutableList.of());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public class TestHiveCommitHandleOutput
{
private static final String TEST_SCHEMA = "test_schema";
private static final String TEST_TABLE = "test_table";
private static final String TEST_CATALOG_NAME = "hive";

private static final Map<String, Object> testTableProperties;
private static ConnectorTableMetadata testTableMetadata;
Expand Down Expand Up @@ -261,7 +260,7 @@ private HiveMetadata getHiveMetadata(TestingExtendedHiveMetastore metastore, Hiv
new HiveFileRenamer(),
HiveColumnConverterProvider.DEFAULT_COLUMN_CONVERTER_PROVIDER,
new QuickStatsProvider(metastore, HDFS_ENVIRONMENT, DO_NOTHING_DIRECTORY_LISTER, new HiveClientConfig(), new NamenodeStats(), ImmutableList.of()),
new HiveTableWritabilityChecker(false), TEST_CATALOG_NAME);
new HiveTableWritabilityChecker(false), "catalogName");

return hiveMetadataFactory.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public class TestHiveMetadataFileFormatEncryptionSettings
{
private static final String TEST_SERVER_VERSION = "test_version";
private static final String TEST_DB_NAME = "test_db";
private static final String TEST_CATALOG_NAME = "hive";
private static final JsonCodec<PartitionUpdate> PARTITION_CODEC = jsonCodec(PartitionUpdate.class);
private static final ConnectorSession SESSION = new TestingConnectorSession(
new HiveSessionProperties(new HiveClientConfig(), new OrcFileWriterConfig(), new ParquetFileWriterConfig(), new CacheConfig()).getSessionProperties(),
Expand Down Expand Up @@ -142,7 +141,7 @@ public void setup()
new HiveFileRenamer(),
HiveColumnConverterProvider.DEFAULT_COLUMN_CONVERTER_PROVIDER,
new QuickStatsProvider(metastore, HDFS_ENVIRONMENT, HiveTestUtils.DO_NOTHING_DIRECTORY_LISTER, new HiveClientConfig(), new NamenodeStats(), ImmutableList.of()),
new HiveTableWritabilityChecker(false), TEST_CATALOG_NAME);
new HiveTableWritabilityChecker(false), "catalogName");

metastore.createDatabase(METASTORE_CONTEXT, Database.builder()
.setDatabaseName(TEST_DB_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public class TestHiveSplitManager
private static final Table TEST_TABLE = createTestTable(VIEW_STORAGE_FORMAT, ImmutableMap.of());

private ListeningExecutorService executor;
private static final String TEST_CATALOG_NAME = "hive";
private static final String TEST_CATALOG_NAME = "catalogName";

@BeforeClass
public void setUp()
Expand All @@ -163,7 +163,7 @@ public void shutdown()

private static Table createTestTable(StorageFormat storageFormat, Map<String, String> parameters)
{
return new Table(Optional.of("catalogName"),
return new Table(Optional.of(TEST_CATALOG_NAME),
"test_db",
"test_table",
"test_owner",
Expand Down Expand Up @@ -475,7 +475,7 @@ private void assertRedundantColumnDomains(Range predicateRange, PartitionStatist
// Prepare partition with stats
PartitionWithStatistics partitionWithStatistics = new PartitionWithStatistics(
new Partition(
Optional.of("catalogName"),
Optional.of(TEST_CATALOG_NAME),
"test_db",
"test_table",
ImmutableList.of(PARTITION_VALUE),
Expand Down Expand Up @@ -622,7 +622,7 @@ public void testEncryptionInformation()
DWRF_ENCRYPTION_PROVIDER_KEY, testEncryptionProvider));
PartitionWithStatistics partitionWithStatistics = new PartitionWithStatistics(
new Partition(
Optional.of("catalogName"),
Optional.of(TEST_CATALOG_NAME),
"test_db",
"test_table",
ImmutableList.of(PARTITION_VALUE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected Table loadTable(String tableName)
getHdfsEnvironment(),
new IcebergHiveTableOperationsConfig(),
getQueryRunner().getDefaultSession().toConnectorSession(connectorId),
SchemaTableName.valueOf("tpch." + tableName), "hive");
SchemaTableName.valueOf("tpch." + tableName), null);
}

protected ExtendedHiveMetastore getFileHiveMetastore()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ private Table loadTable(String tableName)
getHdfsEnvironment(),
new IcebergHiveTableOperationsConfig(),
getQueryRunner().getDefaultSession().toConnectorSession(connectorId),
SchemaTableName.valueOf("tpch." + tableName), "hive");
SchemaTableName.valueOf("tpch." + tableName), null);
}

protected ExtendedHiveMetastore getFileHiveMetastore()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ protected Table getIcebergTable(ConnectorSession session, String schema, String
getHdfsEnvironment(),
new IcebergHiveTableOperationsConfig(),
session,
SchemaTableName.valueOf(schema + "." + tableName), "hive");
SchemaTableName.valueOf(schema + "." + tableName), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Table createTable(String tableName, String targetPath, Map<String, String> table
getHdfsEnvironment(),
hdfsContext,
new IcebergHiveTableOperationsConfig(),
"hive",
null,
"tpch",
tableName,
session.getUser(),
Expand All @@ -93,7 +93,7 @@ Table loadTable(String tableName)
getHdfsEnvironment(),
new IcebergHiveTableOperationsConfig(),
getQueryRunner().getDefaultSession().toConnectorSession(connectorId),
SchemaTableName.valueOf("tpch." + tableName), "hive");
SchemaTableName.valueOf("tpch." + tableName), null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void testGetViews()
QualifiedObjectName key = new QualifiedObjectName("hive", "tpch", "eric");
actualViewsMap.put(key, new ViewDefinition(
"SELECT name\nFROM\n tpch.sf1.nation\n",
Optional.of("catalogName"),
Optional.of("hive"),
Optional.of("tpch"),
new ArrayList<>(),
Optional.of("ericn576"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ public class TestPrestoQuerySourceQuerySupplier
" ('Q2', 'INSERT INTO test_table SELECT 1', 'T2')\n" +
") queries(name, query, query_id)";
private static final QueryConfiguration CONTROL_CONFIGURATION = new QueryConfiguration(
"hive", "schema", Optional.of("user"), Optional.empty(), Optional.of(ImmutableMap.of("a", "b")), Optional.of(ImmutableList.of("x")), Optional.empty());
"catalogName", "schema", Optional.of("user"), Optional.empty(), Optional.of(ImmutableMap.of("a", "b")), Optional.of(ImmutableList.of("x")), Optional.empty());
private static final QueryConfiguration TEST_CONFIGURATION = new QueryConfiguration(
"hive", "schema", Optional.of("user"), Optional.empty(), Optional.of(ImmutableMap.of("c", "d")), Optional.of(ImmutableList.of("y")), Optional.empty());
"catalogName", "schema", Optional.of("user"), Optional.empty(), Optional.of(ImmutableMap.of("c", "d")), Optional.of(ImmutableList.of("y")), Optional.empty());
private static final List<SourceQuery> SOURCE_QUERIES = ImmutableList.of(
new SourceQuery("test", "Q1", "SELECT 1", "SELECT 1", Optional.of("T1"), Optional.of("T1"), CONTROL_CONFIGURATION, TEST_CONFIGURATION),
new SourceQuery("test", "Q2", "INSERT INTO test_table SELECT 1", "INSERT INTO test_table SELECT 1", Optional.of("T2"), Optional.of("T2"), CONTROL_CONFIGURATION,
Expand Down

0 comments on commit 17509da

Please sign in to comment.