@Override
  public void runInternal() throws HiveSQLException {
    setState(OperationState.RUNNING);
    LOG.info("Fetching primary key metadata");
    try {
      IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient();
      PrimaryKeysRequest sqlReq = new PrimaryKeysRequest(schemaName, tableName);
      List<SQLPrimaryKey> pks = metastoreClient.getPrimaryKeys(sqlReq);
      if (pks == null) {
        return;
      }
      for (SQLPrimaryKey pk : pks) {
        Object[] rowData = new Object[] {
            catalogName,
            pk.getTable_db(),
            pk.getTable_name(),
            pk.getColumn_name(),
            pk.getKey_seq(),
            pk.getPk_name()
        };
        rowSet.addRow(rowData);
        if (LOG.isDebugEnabled()) {
          String debugMessage = getDebugMessage("primary key", RESULT_SET_SCHEMA);
          LOG.debug(debugMessage, rowData);
        }
      }
      if (LOG.isDebugEnabled() && rowSet.numRows() == 0) {
        LOG.debug("No primary key metadata has been returned.");
      }
      setState(OperationState.FINISHED);
      LOG.info("Fetching primary key metadata has been successfully finished");
    } catch (Exception e) {
      setState(OperationState.ERROR);
      throw new HiveSQLException(e);
    }
  }
TABLE_CAT String => table catalog (may be null)
TABLE_SCHEM String => table schema (may be null)
TABLE_NAME String => table name
COLUMN_NAME String => column name
KEY_SEQ short => sequence number within primary key( a value of 1 represents the first column of the primary key, a value of 2 would represent the second column within the primary key).
PK_NAME String => primary key name (may be null)
service/src/java/org/apache/hive/service/cli/operation/GetPrimaryKeysOperation.java