public static DeltaLakeTable convertDeltaToSRTable(String catalog, String dbName, String tblName, String path,
                                                       Engine deltaEngine, long createTime) {
        SnapshotImpl snapshot;

        try (Timer ignored = Tracers.watchScope(EXTERNAL, "DeltaLake.getSnapshot")) {
            Table deltaTable = Table.forPath(deltaEngine, path);
            snapshot = (SnapshotImpl) deltaTable.getLatestSnapshot(deltaEngine);
        } catch (TableNotFoundException e) {
            LOG.error("Failed to find Delta table for {}.{}.{}, {}", catalog, dbName, tblName, e.getMessage());
            throw new SemanticException("Failed to find Delta table for " + catalog + "." + dbName + "." + tblName);
        } catch (Exception e) {
            LOG.error("Failed to get latest snapshot for {}.{}.{}, {}", catalog, dbName, tblName, e.getMessage());
            throw new SemanticException("Failed to get latest snapshot for " + catalog + "." + dbName + "." + tblName);
        }

        StructType deltaSchema = snapshot.getSchema(deltaEngine);
        if (deltaSchema == null) {
            throw new IllegalArgumentException(String.format("Unable to find Schema information in Delta log for " +
                    "%s.%s.%s", catalog, dbName, tblName));
        }

        List<Column> fullSchema = Lists.newArrayList();
        for (StructField field : deltaSchema.fields()) {
            DataType dataType = field.getDataType();
            Type type;
            try {
                type = ColumnTypeConverter.fromDeltaLakeType(dataType);
            } catch (InternalError | Exception e) {
                LOG.error("Failed to convert delta type {} on {}.{}.{}", dataType.toString(), catalog, dbName, tblName, e);
                type = Type.UNKNOWN_TYPE;
            }
            Column column = new Column(field.getName(), type, true);
            fullSchema.add(column);
        }

        return new DeltaLakeTable(CONNECTOR_ID_GENERATOR.getNextId().asInt(), catalog, dbName, tblName,
                fullSchema, Lists.newArrayList(snapshot.getMetadata().getPartitionColNames()), snapshot, path,
                deltaEngine, createTime);
    }
@Test
    public void testConvertDeltaToSRTableWithException1() {
        expectedEx.expect(SemanticException.class);
        expectedEx.expectMessage("Failed to find Delta table for catalog.db.tbl");

        new MockUp<Table>() {
            @mockit.Mock
            public Table forPath(Engine deltaEngine, String path) throws TableNotFoundException {
                throw new TableNotFoundException("Table not found");
            }
        };

        DeltaUtils.convertDeltaToSRTable("catalog", "db", "tbl", "path",
                DeltaLakeEngine.create(new Configuration()), 0);
    }