static void aggregateDependencies(MySQLStorage storage, List<zipkin2.Span> spans)
    throws SQLException {
    try (Connection conn = storage.datasource.getConnection()) {
      DSLContext context = storage.context.get(conn);

      // batch insert the rows at timestamp midnight
      List<Query> inserts = new ArrayList<>();
      aggregateLinks(spans).forEach((midnight, links) -> {

        LocalDate day = Instant.ofEpochMilli(midnight)
          .atZone(ZoneId.of("UTC"))
          .toLocalDate();

        for (DependencyLink link : links) {
          inserts.add(context.insertInto(ZIPKIN_DEPENDENCIES)
            .set(ZIPKIN_DEPENDENCIES.DAY, day)
            .set(ZIPKIN_DEPENDENCIES.PARENT, link.parent())
            .set(ZIPKIN_DEPENDENCIES.CHILD, link.child())
            .set(ZIPKIN_DEPENDENCIES.CALL_COUNT, link.callCount())
            .set(ZIPKIN_DEPENDENCIES.ERROR_COUNT, link.errorCount())
            .onDuplicateKeyIgnore());
        }
      });
      context.batch(inserts).execute();
    }
  }
The current implementation does not include dependency aggregation. It includes retrieval of
pre-aggregated links, usually made via zipkin-dependencies
zipkin-storage/mysql-v1/src/test/java/zipkin2/storage/mysql/v1/ITMySQLStorage.java