private int getIntoTableIndex(HplsqlParser.Select_stmtContext ctx, int idx) {
    HplsqlParser.Into_clauseContext into = getIntoClause(ctx);
    HplsqlParser.Table_rowContext row = into.table_row(idx);
    if (row == null) {
      throw new TypeException(ctx, "Missing into table index");
    }
    return Integer.parseInt(row.L_INT().getText());
  }
Get variable name assigned in INTO or var=col clause by index
hplsql/src/main/java/org/apache/hive/hplsql/Select.java