// Path: src/main/java/com/google/cloud/solutions/datalineage/converter/ResolvedColumnToColumnEntityConverter.java
// public static ColumnEntity convertToColumnEntity(ResolvedColumn resolvedColumn) {
//   return
//       ColumnEntity.newBuilder()
//           .setTable(identifyDataEntity(resolvedColumn))
//           .setColumn(resolvedColumn.getName())
//           .build();
// }


import static com.google.cloud.solutions.datalineage.converter.ResolvedColumnToColumnEntityConverter.convertToColumnEntity;
import com.google.cloud.solutions.datalineage.model.LineageMessages.ColumnEntity;
import com.google.cloud.solutions.datalineage.model.LineageMessages.ColumnLineage;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.zetasql.resolvedast.ResolvedNodes;
import com.google.zetasql.resolvedast.ResolvedNodes.ResolvedAggregateScan;
import com.google.zetasql.resolvedast.ResolvedNodes.ResolvedColumnRef;
import com.google.zetasql.resolvedast.ResolvedNodes.Visitor;
  }

  @Override
  public ImmutableMap<ColumnEntity, ColumnLineage> extract() {
    ImmutableMap.Builder<ColumnEntity, ColumnLineage> lineageBuilder = ImmutableMap.builder();
    resolvedStatement.accept(
        new Visitor() {

          @Override
          public void visit(ResolvedAggregateScan aggScan) {

            aggScan
                .getGroupByList()
                .forEach(
                    grpCol -> {
                      ImmutableSet.Builder<ColumnEntity> sources = ImmutableSet
                          .builder();

                      grpCol
                          .getExpr()
                          .accept(
                              new Visitor() {
                                @Override
                                public void visit(
                                    ResolvedColumnRef columnRef) {
                                  sources
                                      .add(convertToColumnEntity(columnRef.getColumn()));
                                }
                              });

// Path: src/main/java/com/google/cloud/solutions/datalineage/converter/ResolvedColumnToColumnEntityConverter.java
// public static ColumnEntity convertToColumnEntity(ResolvedColumn resolvedColumn) {
//   return
//       ColumnEntity.newBuilder()
//           .setTable(identifyDataEntity(resolvedColumn))
//           .setColumn(resolvedColumn.getName())
//           .build();
// }


// Path: src/main/java/com/google/cloud/solutions/datalineage/extractor/GroupByExtractor.java
import static com.google.cloud.solutions.datalineage.converter.ResolvedColumnToColumnEntityConverter.convertToColumnEntity;
import com.google.cloud.solutions.datalineage.model.LineageMessages.ColumnEntity;
import com.google.cloud.solutions.datalineage.model.LineageMessages.ColumnLineage;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.zetasql.resolvedast.ResolvedNodes;
import com.google.zetasql.resolvedast.ResolvedNodes.ResolvedAggregateScan;
import com.google.zetasql.resolvedast.ResolvedNodes.ResolvedColumnRef;
import com.google.zetasql.resolvedast.ResolvedNodes.Visitor;

  }

  @Override
  public ImmutableMap<ColumnEntity, ColumnLineage> extract() {
    ImmutableMap.Builder<ColumnEntity, ColumnLineage> lineageBuilder = ImmutableMap.builder();
    resolvedStatement.accept(
        new Visitor() {

          @Override
          public void visit(ResolvedAggregateScan aggScan) {

            aggScan
                .getGroupByList()
                .forEach(
                    grpCol -> {
                      ImmutableSet.Builder<ColumnEntity> sources = ImmutableSet
                          .builder();

                      grpCol
                          .getExpr()
                          .accept(
                              new Visitor() {
                                @Override
                                public void visit(
                                    ResolvedColumnRef columnRef) {
                                  sources
                                      .add(convertToColumnEntity(columnRef.getColumn()));
                                }
                              });

                      ColumnEntity col = convertToColumnEntity(grpCol.getColumn());