E - The type of entities stored in this Dataset.@Immutable public abstract class AbstractDataset<E> extends Object implements Dataset<E>, RefinableView<E>
| Modifier and Type | Field and Description |
|---|---|
protected Schema |
schema |
protected Class<E> |
type |
| Constructor and Description |
|---|
AbstractDataset(Class<E> type,
Schema schema) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract RefinableView<E> |
asRefinableView() |
View<GenericRecord> |
asSchema(Schema schema)
Creates a copy of this
View that projects entities to the given
Schema. |
<T> Dataset<T> |
asType(Class<T> type)
Creates a copy of this
Dataset that reads and writes entities of
the given type class. |
boolean |
deleteAll()
Deletes the entities included in this
View or throws an
UnsupportedOperationException. |
boolean |
equals(Object obj) |
abstract AbstractRefinableView<E> |
filter(Constraints c) |
RefinableView<E> |
from(String name,
Comparable value)
Creates a sub-
View, restricted to entities whose name
field is greater than or equal to the given value. |
RefinableView<E> |
fromAfter(String name,
Comparable value)
Creates a sub-
View, restricted to entities whose name
field is greater than the given value. |
Iterable<PartitionView<E>> |
getCoveringPartitions()
|
Dataset<E> |
getDataset()
Returns the underlying
Dataset for the
View. |
Schema |
getSchema()
Get the schema of entities contained in this
View. |
Class<E> |
getType()
Get the runtime type of entities contained in this
View. |
int |
hashCode() |
boolean |
includes(E entity)
|
DatasetReader<E> |
newReader()
Get an appropriate
DatasetReader implementation based on this
View of the underlying Dataset implementation. |
DatasetWriter<E> |
newWriter()
Get an appropriate
DatasetWriter implementation based on this
View of the underlying Dataset implementation. |
RefinableView<E> |
to(String name,
Comparable value)
Creates a sub-
View, restricted to entities whose name
field is less than or equal to the given value. |
RefinableView<E> |
toBefore(String name,
Comparable value)
Creates a sub-
View, restricted to entities whose name
field is less than the given value. |
RefinableView<E> |
with(String name,
Object... values)
Creates a sub-
View, restricted to entities whose name
field is equal to any of the given values. |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetDescriptor, getName, getNamespace, getUriprotected abstract RefinableView<E> asRefinableView()
public Dataset<E> getDataset()
ViewDataset for the
View.getDataset in interface View<E>Datasetpublic abstract AbstractRefinableView<E> filter(Constraints c)
public <T> Dataset<T> asType(Class<T> type)
Dataset that reads and writes entities of
the given type class.asType in interface View<E>T - The type of entities that will be read or written by this
dataset.type - an entity class to useIncompatibleSchemaException - If the given type is incompatible with the underlying
dataset.public DatasetWriter<E> newWriter()
ViewDatasetWriter implementation based on this
View of the underlying Dataset implementation.
Implementations are free to return different types of writers depending on
the disposition of the data. For example, a partitioned dataset may use a
different writer than that of a non-partitioned dataset. Clients should not
make any assumptions about the returned implementations: implementations
are free to change their internal structure at any time.public DatasetReader<E> newReader()
ViewDatasetReader implementation based on this
View of the underlying Dataset implementation.
Implementations are free to return different types of readers, depending on
the disposition of the data. For example, a partitioned dataset can use a
different reader than that of a non-partitioned dataset. Clients should not
make any assumptions about the returned implementations: implementations
are free to change their internal structure at any time.public Iterable<PartitionView<E>> getCoveringPartitions()
ViewIterable of non-overlapping View objects that
partition the underlying Dataset and cover this View.
The returned View objects are implementation-specific, but should
represent reasonable partitions of the underlying Dataset based on
its layout.
The data contained by the union of each View in the
Iterable must be a super-set of this View.
Note that partitions are actual partitions under which data is stored.
Implementations should omit any View that is empty.getCoveringPartitions in interface View<E>View that cover this View.public Class<E> getType()
ViewView.public Schema getSchema()
ViewView.public RefinableView<E> with(String name, Object... values)
RefinableViewView, restricted to entities whose name
field is equal to any of the given values. If you specify no
values, the view is restricted to entities whose
name field is non-null.with in interface RefinableView<E>name - the field name of the entitypublic RefinableView<E> from(String name, Comparable value)
RefinableViewView, restricted to entities whose name
field is greater than or equal to the given value.from in interface RefinableView<E>name - the field name of the entitypublic RefinableView<E> fromAfter(String name, Comparable value)
RefinableViewView, restricted to entities whose name
field is greater than the given value.fromAfter in interface RefinableView<E>name - the field name of the entitypublic RefinableView<E> to(String name, Comparable value)
RefinableViewView, restricted to entities whose name
field is less than or equal to the given value.to in interface RefinableView<E>name - the field name of the entitypublic RefinableView<E> toBefore(String name, Comparable value)
RefinableViewView, restricted to entities whose name
field is less than the given value.toBefore in interface RefinableView<E>name - the field name of the entitypublic View<GenericRecord> asSchema(Schema schema)
ViewView that projects entities to the given
Schema.
This method always returns a View with type GenericRecord.
public boolean deleteAll()
ViewView or throws an
UnsupportedOperationException.
Implementations are allowed to throw UnsupportedOperationException
if the View could require additional work to delete. For example,
if some but not all of the data in an underlying data file must be removed,
then the implementation is allowed to reject the deletion rather than
copy the remaining records to a new file. Implementations must document
what deletes are supported and under what conditions deletes are rejected.Copyright © 2013–2015. All rights reserved.