|
17 | 17 | package za.co.absa.pramen.core.metastore.persistence |
18 | 18 |
|
19 | 19 | import org.apache.hadoop.fs.Path |
| 20 | +import org.apache.iceberg.Table |
20 | 21 | import org.apache.iceberg.hadoop.HadoopTables |
21 | 22 | import org.scalatest.Assertion |
22 | 23 | import org.scalatest.wordspec.AnyWordSpec |
@@ -89,10 +90,7 @@ class MetastorePersistenceIcebergLongSuite extends AnyWordSpec |
89 | 90 | assert(partitionColumns.head == "info_date") |
90 | 91 |
|
91 | 92 | // Get all snapshot properties from the Iceberg table |
92 | | - val location = new Path(hadoopTempDir, s"pramen/iceberg_catalog/default/$tableName").toString |
93 | | - val ht = new HadoopTables |
94 | | - val table = ht.load(location) |
95 | | - val snapshotProperties = table.currentSnapshot().summary().asScala |
| 93 | + val snapshotProperties = loadIcebergTable(tableName).currentSnapshot().summary().asScala |
96 | 94 |
|
97 | 95 | assert(snapshotProperties("info_date") == infoDate2.toString) |
98 | 96 | assert(snapshotProperties("pramen_batchid") == "0") |
@@ -193,10 +191,13 @@ class MetastorePersistenceIcebergLongSuite extends AnyWordSpec |
193 | 191 | } |
194 | 192 | } |
195 | 193 |
|
196 | | - def getTablePartitions(tableName: String): Seq[String] = { |
| 194 | + def loadIcebergTable(tableName: String): Table = { |
197 | 195 | val location = new Path(hadoopTempDir, s"pramen/iceberg_catalog/default/$tableName").toString |
198 | | - val ht = new HadoopTables |
199 | | - val table = ht.load(location) |
| 196 | + new HadoopTables().load(location) |
| 197 | + } |
| 198 | + |
| 199 | + def getTablePartitions(tableName: String): Seq[String] = { |
| 200 | + val table = loadIcebergTable(tableName) |
200 | 201 |
|
201 | 202 | table.spec() |
202 | 203 | .fields() |
|
0 commit comments