class ViewTransformation implements TableTransformation {

  @Override
  public Table transform(Table table) {
    if (!MetaStoreUtils.isView(table)) {
      return table;
    }

    LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName());
    String tableQualifiedName = Warehouse.getQualifiedName(table);
    String hql = hqlTranslator.translate(tableQualifiedName, table.getViewOriginalText());
    String expandedHql = hqlTranslator.translate(tableQualifiedName, table.getViewExpandedText());

    Table transformedView = new Table(table);
    transformedView.setViewOriginalText(hql);
    transformedView.setViewExpandedText(expandedHql);

    if (!replicaHiveConf.getBoolean(SKIP_TABLE_EXIST_CHECKS, false)) {
      LOG
          .info("Validating that tables used by the view {}.{} exist in the replica catalog", table.getDbName(),
              table.getTableName());
      validateReferencedTables(transformedView);
    }

    return transformedView;
  }

  @Autowired public  ViewTransformation(
      HiveConf replicaHiveConf,
      HqlTranslator hqlTranslator,
      Supplier<CloseableMetaStoreClient> replicaMetaStoreClientSupplier);

}