public static class DatasetDescriptor.Builder extends Object
DatasetDescriptor
s.Constructor and Description |
---|
DatasetDescriptor.Builder() |
DatasetDescriptor.Builder(DatasetDescriptor descriptor)
Creates a Builder configured to copy
descriptor , if it is not
modified. |
Modifier and Type | Method and Description |
---|---|
DatasetDescriptor |
build()
Build an instance of the configured dataset descriptor.
|
DatasetDescriptor.Builder |
columnMapping(ColumnMapping columnMappings)
Configure the dataset's column mapping descriptor (optional)
|
DatasetDescriptor.Builder |
columnMapping(File file)
Configure the dataset's column mapping descriptor from a File.
|
DatasetDescriptor.Builder |
columnMapping(InputStream in)
Configure the dataset's column mapping descriptor from an InputStream.
|
DatasetDescriptor.Builder |
columnMappingLiteral(String literal)
Configure the dataset's column mappings from a String literal.
|
DatasetDescriptor.Builder |
columnMappingUri(String uri)
Configure the dataset's column mappings from a String URI.
|
DatasetDescriptor.Builder |
columnMappingUri(URI uri)
Configure the dataset's column mappings from a URI.
|
DatasetDescriptor.Builder |
compressionType(CompressionType compressionType)
Configure the dataset's compression format (optional).
|
DatasetDescriptor.Builder |
compressionType(String compressionTypeName)
Configure the dataset's compression format (optional).
|
DatasetDescriptor.Builder |
format(Format format)
Configure the dataset's format (optional).
|
DatasetDescriptor.Builder |
format(String formatName)
Configure the dataset's format from a format name String (optional).
|
DatasetDescriptor.Builder |
location(Path uri)
Configure the dataset's location (optional).
|
DatasetDescriptor.Builder |
location(String uri)
Configure the dataset's location (optional).
|
DatasetDescriptor.Builder |
location(URI uri)
Configure the dataset's location (optional).
|
DatasetDescriptor.Builder |
partitionStrategy(File file)
Configure the dataset's partition strategy from a File.
|
DatasetDescriptor.Builder |
partitionStrategy(InputStream in)
Configure the dataset's partition strategy from an InputStream.
|
DatasetDescriptor.Builder |
partitionStrategy(PartitionStrategy partitionStrategy)
Configure the dataset's partitioning strategy (optional).
|
DatasetDescriptor.Builder |
partitionStrategyLiteral(String literal)
Configure the dataset's partition strategy from a String literal.
|
DatasetDescriptor.Builder |
partitionStrategyUri(String uri)
Configure the dataset's partition strategy from a String URI.
|
DatasetDescriptor.Builder |
partitionStrategyUri(URI uri)
Configure the dataset's partition strategy from a URI.
|
DatasetDescriptor.Builder |
property(String name,
String value)
Add a key-value property to the descriptor.
|
<T> DatasetDescriptor.Builder |
schema(Class<T> type)
Configure the dataset's schema via a Java class type.
|
DatasetDescriptor.Builder |
schema(File file)
Configure the dataset's schema from a
File . |
DatasetDescriptor.Builder |
schema(InputStream in)
Configure the dataset's schema from an
InputStream . |
DatasetDescriptor.Builder |
schema(Schema schema)
Configure the dataset's schema.
|
DatasetDescriptor.Builder |
schemaFromAvroDataFile(File file)
Configure the dataset's schema by using the schema from an existing Avro
data file.
|
DatasetDescriptor.Builder |
schemaFromAvroDataFile(InputStream in)
Configure the dataset's schema by using the schema from an existing Avro
data file.
|
DatasetDescriptor.Builder |
schemaFromAvroDataFile(URI uri)
Configure the dataset's schema by using the schema from an existing Avro
data file.
|
DatasetDescriptor.Builder |
schemaLiteral(String s)
Configure the dataset's schema from a
String . |
DatasetDescriptor.Builder |
schemaUri(String uri)
Configure the
Dataset 's schema from a String URI. |
DatasetDescriptor.Builder |
schemaUri(URI uri)
Configure the
Dataset 's schema from a URI. |
public DatasetDescriptor.Builder()
public DatasetDescriptor.Builder(DatasetDescriptor descriptor)
descriptor
, if it is not
modified. This is intended to help callers copy and update descriptors
even though they are Immutable
.descriptor
- A DatasetDescriptor
to copy settings frompublic DatasetDescriptor.Builder schema(Schema schema)
schema
, schemaLiteral
,
schemaUri
, or schemaFromAvroDataFile
.public DatasetDescriptor.Builder schema(File file) throws IOException
File
. A schema is required,
and can be set using one of the methods schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.IOException
public DatasetDescriptor.Builder schema(InputStream in) throws IOException
InputStream
. It is the
caller's responsibility to close the InputStream
. A schema is
required, and can be set using one of the methods schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.IOException
public DatasetDescriptor.Builder schemaUri(URI uri) throws IOException
Dataset
's schema from a URI. A schema is required,
and can be set using one of the methods schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.uri
- a URI object for the schema's location.IOException
public DatasetDescriptor.Builder schemaUri(String uri) throws IOException
Dataset
's schema from a String URI. A schema is
required, and can be set using one of the methods schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.uri
- a String URIIOException
public DatasetDescriptor.Builder schemaLiteral(String s)
String
. A schema is
required, and can be set using one of the methods schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.public <T> DatasetDescriptor.Builder schema(Class<T> type)
schema
,
schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.public DatasetDescriptor.Builder schemaFromAvroDataFile(File file) throws IOException
schema
, schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.IOException
public DatasetDescriptor.Builder schemaFromAvroDataFile(InputStream in) throws IOException
InputStream
. A schema is required, and can be set using one of
the methods schema
, schemaLiteral
, schemaUri
,
or schemaFromAvroDataFile
.IOException
public DatasetDescriptor.Builder schemaFromAvroDataFile(URI uri) throws IOException
schema
, schemaLiteral
, schemaUri
, or
schemaFromAvroDataFile
.IOException
public DatasetDescriptor.Builder format(Format format)
Formats.AVRO
is used by default.public DatasetDescriptor.Builder format(String formatName)
Formats.AVRO
is used by default.formatName
- a String format nameUnknownFormatException
- if the format name is not recognized.public DatasetDescriptor.Builder location(@Nullable URI uri)
uri
- A URI locationpublic DatasetDescriptor.Builder location(Path uri)
uri
- A location Pathpublic DatasetDescriptor.Builder location(String uri)
uri
- A location String URIpublic DatasetDescriptor.Builder property(String name, String value)
name
- the property namevalue
- the property valuepublic DatasetDescriptor.Builder partitionStrategy(@Nullable PartitionStrategy partitionStrategy)
public DatasetDescriptor.Builder partitionStrategy(File file)
PartitionStrategy.toString()
.file
- The FileValidationException
- If the file does not contain a valid JSON-encoded partition
strategyDatasetIOException
- If there is an IOException accessing the file contentspublic DatasetDescriptor.Builder partitionStrategy(InputStream in)
PartitionStrategy.toString()
.in
- The input streamValidationException
- If the stream does not contain a valid JSON-encoded partition
strategyDatasetIOException
- If there is an IOException accessing the InputStream contentspublic DatasetDescriptor.Builder partitionStrategyLiteral(String literal)
PartitionStrategy.toString()
.literal
- A partition strategy String literalValidationException
- If the literal is not a valid JSON-encoded partition strategypublic DatasetDescriptor.Builder partitionStrategyUri(URI uri) throws IOException
uri
- A URI to a partition strategy JSON file.ValidationException
- If the literal is not a valid JSON-encoded partition strategyIOException
public DatasetDescriptor.Builder partitionStrategyUri(String uri) throws IOException
uri
- A String URI to a partition strategy JSON file.ValidationException
- If the literal is not a valid JSON-encoded partition strategyIOException
public DatasetDescriptor.Builder columnMapping(@Nullable ColumnMapping columnMappings)
columnMappings
- A ColumnMappingpublic DatasetDescriptor.Builder columnMapping(File file)
ColumnMapping.toString()
.file
- The fileValidationException
- If the literal is not valid JSON-encoded column mappingsDatasetIOException
- If there is an IOException accessing the file contentspublic DatasetDescriptor.Builder columnMapping(InputStream in)
ColumnMapping.toString()
.in
- The input streamValidationException
- If the literal is not valid JSON-encoded column mappingsDatasetIOException
- If there is an IOException accessing the InputStream contentspublic DatasetDescriptor.Builder columnMappingLiteral(String literal)
ColumnMapping.toString()
.literal
- A column mapping String literalValidationException
- If the literal is not valid JSON-encoded column mappingspublic DatasetDescriptor.Builder columnMappingUri(URI uri) throws IOException
uri
- A URI to a column mapping JSON fileValidationException
- If the literal is not valid JSON-encoded column mappingsIOException
- If accessing the URI results in an IOExceptionpublic DatasetDescriptor.Builder columnMappingUri(String uri) throws IOException
uri
- A String URI to a column mapping JSON fileValidationException
- If the literal is not valid JSON-encoded column mappingsIOException
- If accessing the URI results in an IOExceptionpublic DatasetDescriptor.Builder compressionType(CompressionType compressionType)
CompressionType.Snappy
.compressionType
- the compression formatpublic DatasetDescriptor.Builder compressionType(String compressionTypeName)
CompressionType.Snappy
.compressionTypeName
- the name of the compression formatpublic DatasetDescriptor build()
Copyright © 2013–2015. All rights reserved.