private AbstractSerDe getSerDe() throws SQLException {
    if (serde == null) {
      try {
        this.serde = new LazySimpleSerDe();

        final Schema mResultSchema = driver.getSchema();
        final List<FieldSchema> fieldSchemas = mResultSchema.getFieldSchemas();
        final Properties props = new Properties();

        if (!fieldSchemas.isEmpty()) {

          final String names = fieldSchemas.stream().map(i -> i.getName()).collect(Collectors.joining(","));
          final String types = fieldSchemas.stream().map(i -> i.getType()).collect(Collectors.joining(","));

          log.debug("Column names: {}", names);
          log.debug("Column types: {}", types);

          props.setProperty(serdeConstants.LIST_COLUMNS, names);
          props.setProperty(serdeConstants.LIST_COLUMN_TYPES, types);
        }

        serde.initialize(queryState.getConf(), props, null);
      } catch (Exception ex) {
        throw new SQLException("Could not create ResultSet: " + ex.getMessage(), ex);
      }
    }
    return serde;
  }
Returns the current UGI on the stack

@return UserGroupInformation

@throws HiveSQLException
service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java