use of org.apache.iceberg.spark.SparkCatalog in project OpenLineage by OpenLineage.
the class IcebergHandlerTest method testGetDatasetIdentifierForHadoop.
@ParameterizedTest
@CsvSource({ "hdfs://namenode:8020/warehouse,hdfs://namenode:8020,/warehouse/database.schema.table", "/tmp/warehouse,file,/tmp/warehouse/database.schema.table" })
public void testGetDatasetIdentifierForHadoop(String warehouseConf, String namespace, String name) {
when(sparkSession.conf()).thenReturn(runtimeConfig);
when(runtimeConfig.getAll()).thenReturn(new Map.Map2<>("spark.sql.catalog.test.type", "hadoop", "spark.sql.catalog.test.warehouse", warehouseConf));
SparkCatalog sparkCatalog = mock(SparkCatalog.class);
when(sparkCatalog.name()).thenReturn("test");
DatasetIdentifier datasetIdentifier = icebergHandler.getDatasetIdentifier(sparkSession, sparkCatalog, Identifier.of(new String[] { "database", "schema" }, "table"), new HashMap<>());
assertEquals(name, datasetIdentifier.getName());
assertEquals(namespace, datasetIdentifier.getNamespace());
}
Aggregations