String getIntoVariable(HplsqlParser.Select_stmtContext ctx, int idx) {
    HplsqlParser.Into_clauseContext into = getIntoClause(ctx);
    if (into != null) {
      return into.table_row(idx) != null ? into.table_row(idx).ident().getText() : into.ident(idx).getText();
    }
    HplsqlParser.Select_list_itemContext sl = ctx.fullselect_stmt().fullselect_stmt_item(0).subselect_stmt().select_list().select_list_item(idx); 
    if (sl != null) {
      return sl.qident().getText();
    }
    return null;
  }
Get variable name assigned in INTO or var=col clause by index
hplsql/src/main/java/org/apache/hive/hplsql/Select.java