@Override
  public int execute() throws HiveException {
    // write the results in the file
    try (DataOutputStream outStream = ShowUtils.getOutputStream(new Path(desc.getResFile()), context)) {
      List<FieldSchema> columns = getColumnsByPattern();
      writeColumns(outStream, columns);
    } catch (IOException e) {
      throw new HiveException(e, ErrorMsg.GENERIC_ERROR);
    }

    return 0;
  }
Operation process of showing the columns.
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/column/show/ShowColumnsOperation.java