docs: void resolveColumnReferencesInGroupBy() {
          if (unresolvedExpressions == null || unresolvedExpressions.isEmpty()) {
              return;
          }
  
          /**
           * Hsql HashSet does not work properly to remove duplicates, I doubt the hash
           * function or equal function on expression work properly or something else
           * is wrong. So use list
           *
           */
          // resolve GROUP BY columns/expressions
          HsqlList newUnresolvedExpressions = new ArrayListIdentity();
  
          int size = unresolvedExpressions.size();
          for (int i = 0; i < size; i++) {
              Object obj = unresolvedExpressions.get(i);
              newUnresolvedExpressions.add(obj);
              if (i + 1 < size && obj == unresolvedExpressions.get(i+1)) {
                  // unresolvedExpressions is a public member that can be accessed from anywhere and
                  // I (xin) am 90% percent sure about the hsql adds the unresolved expression twice
                  // together for our targeted GROUP BY alias case.
                  // so we want to skip the repeated expression also.
                  // For other unresolved expression, it may differs.
                  i += 1;
              }
              if (obj instanceof ExpressionColumn == false) {
                  continue;
              }
              ExpressionColumn element = (ExpressionColumn) obj;
              if (element.tableName != null) {
                  // this alias does not belong to any table
                  continue;
              }
  
              // group by alias which is thought as an column
              if (element.getType() != OpTypes.COLUMN) {
                  continue;
              }
  
              // find the unsolved expression in the groupBy list
              int k = indexLimitVisible;
              int endGroupbyIndex = indexLimitVisible + groupByColumnCount;
              for (; k < endGroupbyIndex; k++) {
                  if (element == exprColumns[k]) {
                      break;
                  }
              }
              if (k == endGroupbyIndex) {
                  // not found in selected list
                  continue;
              }
              assert(exprColumns[k].getType() == OpTypes.COLUMN);
  
              ExpressionColumn exprCol = (ExpressionColumn) exprColumns[k];
              String alias = exprCol.getColumnName();
              if (alias == null) {
                  // we should not handle this case (group by constants)
                  continue;
              }
  
              // Find it in the SELECT list.  We need to look at all
              // the select list elements to see if there are more
              // than one.
              int matchcount = 0;
              for (int j = 0; j < indexLimitVisible; j++) {
                  Expression selectCol = exprColumns[j];
                  if (selectCol.alias == null) {
                      // columns referenced by their alias must have an alias
                      continue;
                  }
                  if (alias.equals(selectCol.alias.name)) {
                      matchcount += 1;
                      // This may be an alias to an aggregate
                      // column.  But we'll find that later, so
                      // don't check for it here.
                      exprColumns[k] = selectCol;
                      exprColumnList.set(k, selectCol);
                      if (matchcount == 1) {
                          newUnresolvedExpressions.remove(element);
                      }
                  }
              }
              if (matchcount > 1) {
                  throw new HsqlException(String.format("Group by expression \"%s\" is ambiguous", alias), "", 0);
              }
          }
          unresolvedExpressions = newUnresolvedExpressions;
      }