public class InternalUtils
extends Object
| Modifier and Type | Method and Description |
|---|---|
static int |
daysSinceEpoch(java.sql.Date date)
Utility method to get the number of days since epoch this given date is.
|
static <T> java.util.Optional<T> |
getSingularElement(CloseableIterator<T> iter)
Utility method to read at most one element from a
CloseableIterator. |
static java.util.Optional<Row> |
getSingularRow(CloseableIterator<ColumnarBatch> dataIter)
Utility method to read at most one row from the given data
ColumnarBatch iterator. |
static long |
microsSinceEpoch(java.sql.Timestamp timestamp)
Utility method to get the number of microseconds since the unix epoch for the given timestamp
interpreted in UTC.
|
static Path |
relativizePath(Path child,
java.net.URI root)
Relativize the given child path with respect to the given root URI.
|
static ColumnVector |
requireNonNull(ColumnVector vector,
int rowId,
String columnName) |
static Row |
requireNonNull(Row row,
int ordinal,
String columnName) |
static ColumnVector |
singletonStringColumnVector(String value)
Utility method to create a singleton string
ColumnVector |
static java.util.Set<String> |
toLowerCaseSet(java.util.Collection<String> set) |
public static java.util.Optional<Row> getSingularRow(CloseableIterator<ColumnarBatch> dataIter) throws java.io.IOException
ColumnarBatch iterator. If
there is more than one row, an exception will be thrown.dataIter - java.io.IOExceptionpublic static <T> java.util.Optional<T> getSingularElement(CloseableIterator<T> iter) throws java.io.IOException
CloseableIterator. If there is more
than element row, an exception will be thrown.java.io.IOExceptionpublic static int daysSinceEpoch(java.sql.Date date)
public static long microsSinceEpoch(java.sql.Timestamp timestamp)
public static ColumnVector singletonStringColumnVector(String value)
ColumnVectorvalue - the string element to create the vector withColumnVector with a single element valuepublic static ColumnVector requireNonNull(ColumnVector vector, int rowId, String columnName)
public static Path relativizePath(Path child, java.net.URI root)
child - root - Root directory as URI. Relativization is done with respect to this root. The
relativize operation requires conversion to URI, so the caller is expected to convert the
root directory to URI once and use it for relativizing for multiple child paths.public static java.util.Set<String> toLowerCaseSet(java.util.Collection<String> set)