private String getStoredProcedure(String functionName) throws TException {
    SessionState sessionState = SessionState.get();
    StoredProcedure storedProcedure = getMsc().getStoredProcedure(
            new StoredProcedureRequest(
                    sessionState != null ? sessionState.getCurrentCatalog() : hplSqlSession.currentCatalog(),
                    sessionState != null ? sessionState.getCurrentDatabase() : hplSqlSession.currentDatabase(),
                    functionName));
    return storedProcedure != null ? storedProcedure.getSource() : null;
  }
Get stored procedure from HMS

@param functionName name of the procedure
@return procedure
hplsql/src/main/java/org/apache/hive/hplsql/Exec.java