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

marquez.db.models.ColumnLineageNodeData Maven / Gradle / Ivy

There is a newer version: 0.49.0
Show newest version
/*
 * Copyright 2018-2023 contributors to the Marquez project
 * SPDX-License-Identifier: Apache-2.0
 */

package marquez.db.models;

import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.function.Function;
import javax.annotation.Nullable;
import lombok.Getter;
import lombok.NonNull;
import marquez.service.models.ColumnLineageInputField;
import marquez.service.models.NodeData;

@Getter
public class ColumnLineageNodeData implements NodeData {
  @NonNull String namespace;
  @NonNull String dataset;
  @Nullable UUID datasetVersion;
  @NonNull String field;
  @Nullable String fieldType;
  @Nullable String transformationDescription;
  @Nullable String transformationType;
  @NonNull List inputFields;

  public ColumnLineageNodeData(
      String namespace,
      String dataset,
      UUID datasetVersion,
      String field,
      String fieldType,
      ImmutableList inputFields) {
    this.namespace = namespace;
    this.dataset = dataset;
    this.datasetVersion = datasetVersion;
    this.field = field;
    this.fieldType = fieldType;
    this.inputFields = inputFields;
  }

  /**
   * @deprecated Moved into {@link ColumnLineageInputField} to support multiple jobs writing to a
   *     single dataset. This method is scheduled to be removed in release {@code 0.30.0}.
   */
  public String getTransformationDescription() {
    return Optional.ofNullable(inputFields).map(List::stream).stream()
        .flatMap(Function.identity())
        .findAny()
        .map(d -> d.getTransformationDescription())
        .orElse(null);
  }

  /**
   * @deprecated Moved into {@link ColumnLineageInputField} to support multiple jobs writing to a
   *     single dataset. This method is scheduled to be removed in release {@code 0.30.0}.
   */
  public String getTransformationType() {
    return Optional.ofNullable(inputFields).map(List::stream).stream()
        .flatMap(Function.identity())
        .findAny()
        .map(d -> d.getTransformationType())
        .orElse(null);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy