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

scala.googleapis.bigquery.MaterializedView.scala Maven / Gradle / Ivy

There is a newer version: 0.6.1-v2-20241111
Show newest version
package googleapis.bigquery

import io.circe._
import io.circe.syntax._

final case class MaterializedView(
    /** Whether the materialized view is chosen for the query. A materialized view can be chosen to rewrite multiple parts of the same query. If a materialized view is chosen to rewrite any part of the query, then this field is true, even if the materialized view was not chosen to rewrite others parts.
      */
    chosen: Option[Boolean] = None,
    /** If present, specifies a best-effort estimation of the bytes saved by using the materialized view rather than its base tables.
      */
    estimatedBytesSaved: Option[Long] = None,
    /** If present, specifies the reason why the materialized view was not chosen for the query.
      */
    rejectedReason: Option[MaterializedViewRejectedReason] = None,
    /** The candidate materialized view.
      */
    tableReference: Option[TableReference] = None,
)
object MaterializedView {
  implicit val encoder: Encoder[MaterializedView] = Encoder.instance { x =>
    Json.obj(
      "chosen" := x.chosen,
      "estimatedBytesSaved" := x.estimatedBytesSaved,
      "rejectedReason" := x.rejectedReason,
      "tableReference" := x.tableReference,
    )
  }
  implicit val decoder: Decoder[MaterializedView] = Decoder.instance { c =>
    for {
      v0 <- c.get[Option[Boolean]]("chosen")
      v1 <- c.get[Option[Long]]("estimatedBytesSaved")
      v2 <- c.get[Option[MaterializedViewRejectedReason]]("rejectedReason")
      v3 <- c.get[Option[TableReference]]("tableReference")
    } yield MaterializedView(v0, v1, v2, v3)
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy