All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.openlineage.sql.SqlMeta Maven / Gradle / Ivy

There is a newer version: 1.26.0
Show newest version
/*
/* Copyright 2018-2024 contributors to the OpenLineage project
/* SPDX-License-Identifier: Apache-2.0
*/

package io.openlineage.sql;

import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public class SqlMeta {
  private final List inTables;
  private final List outTables;
  private final List columnLineage;
  private final List errors;

  public SqlMeta(
      List in,
      List out,
      List columnLineage,
      List errors) {
    this.inTables = in;
    this.outTables = out;
    this.columnLineage = columnLineage;
    this.errors = errors;
  }

  public List inTables() {
    return inTables;
  }

  public List outTables() {
    return outTables;
  }

  public List columnLineage() {
    return columnLineage;
  }

  public List errors() {
    return errors;
  }

  @Override
  public String toString() {
    return String.format(
        "{\"inTables\": %s, \"outTables\": %s, \"columnLineage\": %s, \"errors\": %s}",
        Arrays.toString(inTables.toArray()),
        Arrays.toString(outTables.toArray()),
        Arrays.toString(columnLineage.toArray()),
        Arrays.toString(errors.toArray()));
  }

  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }

    if (!(o instanceof SqlMeta)) {
      return false;
    }

    SqlMeta other = (SqlMeta) o;
    return other.inTables.equals(inTables)
        && other.outTables.equals(outTables)
        && other.columnLineage.equals(columnLineage)
        && other.errors.equals(errors);
  }

  @Override
  public int hashCode() {
    return new HashCodeBuilder()
        .append(inTables)
        .append(outTables)
        .append(columnLineage)
        .append(errors)
        .toHashCode();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy