Row readColumns(ParserRuleContext ctx, String conn, String table, HashMap<String, Row> map) {
    Row row = null;
    Conn.Type connType = exec.getConnectionType(conn); 
    if (connType == Conn.Type.HIVE) {
      String sql = "DESCRIBE " + table;
      QueryResult query = queryExecutor.executeQuery(sql, ctx);
      if (!query.error()) {
        try {
          while (query.next()) {
            String col = query.column(0, String.class);
            String typ = query.column(1, String.class);
            if (row == null) {
              row = new Row();
            }
            // Hive DESCRIBE outputs "empty_string NULL" row before partition information
            if (typ == null) {
              break;
            }
            row.addColumnDefinition(col.toUpperCase(), typ);
          } 
          map.put(table, row);
        } 
        catch (Exception e) {
          exec.signal(e);
        }
      }
      else {
        exec.signal(query.exception());
      }
      query.close();
    }
    else {
      QueryResult query = queryExecutor.executeQuery( "SELECT * FROM " + table, ctx);
      if (!query.error()) {
        try {
          Metadata rm = query.metadata();
          int cols = query.columnCount();
          for (int i = 1; i <= cols; i++) {
            String col = rm.columnName(i);
            String typ = rm.columnTypeName(i);
            if (row == null) {
              row = new Row();
            }
            row.addColumnDefinition(col.toUpperCase(), typ);
          }
          map.put(table, row);
        }
        catch (Exception e) {}
      }
      query.close();
    }
    return row;
  }
Read the column data from the database and cache it
hplsql/src/main/java/org/apache/hive/hplsql/Meta.java