public Table getTable(final String dbName, final String tableName, String tableMetaRef, boolean throwException,
                        boolean checkTransactional, boolean getColumnStats) throws HiveException {

    if (tableName == null || tableName.equals("")) {
      throw new HiveException("empty table creation??");
    }

    // Get the table from metastore
    org.apache.hadoop.hive.metastore.api.Table tTable = null;
    try {
      // Note: this is currently called w/true from StatsOptimizer only.
      GetTableRequest request = new GetTableRequest(dbName, tableName);
      request.setCatName(getDefaultCatalog(conf));
      request.setGetColumnStats(getColumnStats);
      request.setEngine(Constants.HIVE_ENGINE);
      if (checkTransactional) {
        ValidWriteIdList validWriteIdList = null;
        long txnId = SessionState.get() != null && SessionState.get().getTxnMgr() != null ?
            SessionState.get().getTxnMgr().getCurrentTxnId() : 0;
        if (txnId > 0) {
          validWriteIdList = AcidUtils.getTableValidWriteIdListWithTxnList(conf, dbName, tableName);
        }
        request.setValidWriteIdList(validWriteIdList != null ? validWriteIdList.toString() : null);
      }
      tTable = getMSC().getTable(request);
    } catch (NoSuchObjectException e) {
      if (throwException) {
        throw new InvalidTableException(tableName);
      }
      return null;
    } catch (Exception e) {
      throw new HiveException("Unable to fetch table " + tableName + ". " + e.getMessage(), e);
    }

    // For non-views, we need to do some extra fixes
    if (!TableType.VIRTUAL_VIEW.toString().equals(tTable.getTableType())) {
      // Fix the non-printable chars
      Map<String, String> parameters = tTable.getSd().getParameters();
      String sf = parameters!=null?parameters.get(SERIALIZATION_FORMAT) : null;
      if (sf != null) {
        char[] b = sf.toCharArray();
        if ((b.length == 1) && (b[0] < 10)) { // ^A, ^B, ^C, ^D, \t
          parameters.put(SERIALIZATION_FORMAT, Integer.toString(b[0]));
        }
      }

      // Use LazySimpleSerDe for MetadataTypedColumnsetSerDe.
      // NOTE: LazySimpleSerDe does not support tables with a single column of
      // col
      // of type "array<string>". This happens when the table is created using
      // an
      // earlier version of Hive.
      if (org.apache.hadoop.hive.serde2.MetadataTypedColumnsetSerDe.class
          .getName().equals(
            tTable.getSd().getSerdeInfo().getSerializationLib())
          && tTable.getSd().getColsSize() > 0
          && tTable.getSd().getCols().get(0).getType().indexOf('<') == -1) {
        tTable.getSd().getSerdeInfo().setSerializationLib(
            org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.class.getName());
      }
    }

    Table t = new Table(tTable);
    if (tableMetaRef != null) {
      if (t.getStorageHandler() == null || !t.getStorageHandler().isTableMetaRefSupported()) {
        throw new SemanticException(ErrorMsg.TABLE_META_REF_NOT_SUPPORTED, t.getTableName());
      }
      t = t.getStorageHandler().checkAndSetTableMetaRef(t, tableMetaRef);
    }
    return t;
  }
Returns metadata of the table.

@param dbName
         the name of the database
@param tableName
         the name of the table
@param tableMetaRef
         the name of the table meta ref, e.g. iceberg metadata table or branch
@param throwException
         controls whether an exception is thrown or a returns a null
@param checkTransactional
         checks whether the metadata table stats are valid (or
         compilant with the snapshot isolation of) for the current transaction.
@param getColumnStats
         get column statistics if available
@return the table or if throwException is false a null value.
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java