Skip to content

MetadataBuilder

MetadataBuilder is used to describe how to create a Metadata (using Fluent API).

Fluent API

Learn more about Fluent interface design pattern in Wikipedia, the free encyclopedia.

import org.apache.spark.sql.types.MetadataBuilder

val newMetadata = new MetadataBuilder()
  .withMetadata(attr.metadata)
  .putNull("__is_duplicate")
  .build()

Creating Metadata

build(): Metadata

build creates a Metadata (for the internal map).

withMetadata

withMetadata(
  metadata: Metadata): this.type

withMetadata adds the map of the given Metadata to the internal map.

In the end, withMetadata returns this MetadataBuilder.


withMetadata is used when: