public class Utils
extends java.lang.Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeCloseables(java.io.Closeable... closeables)
Close the given one or more
Closeables. |
static void |
closeCloseablesSilently(java.io.Closeable... closeables)
Close the given list of
Closeable objects. |
static java.lang.String |
getColumnMappingMode(Row scanState)
Get the column mapping mode from the scan state
Row returned by
Scan.getScanState(TableClient). |
static FileStatus |
getFileStatus(Row scanFileInfo)
Get the
FileStatus from given scan file Row. |
static StructType |
getLogicalSchema(TableClient tableClient,
Row scanState)
Utility method to get the logical schema from the scan state
Row returned by
Scan.getScanState(TableClient). |
static java.util.List<java.lang.String> |
getPartitionColumns(Row scanState)
Get the list of partition column names from the scan state
Row returned by
Scan.getScanState(TableClient). |
static java.util.Map<java.lang.String,java.lang.String> |
getPartitionValues(Row scanFileInfo)
Get the partition columns and value belonging to the given scan file row.
|
static StructType |
getPhysicalSchema(TableClient tableClient,
Row scanState)
Utility method to get the physical schema from the scan state
Row returned by
Scan.getScanState(TableClient). |
static Row |
requireNonNull(Row row,
int ordinal,
java.lang.String columnName) |
static <T> CloseableIterator<T> |
singletonCloseableIterator(T elem)
Utility method to create a singleton
CloseableIterator. |
static ColumnVector |
singletonColumnVector(java.lang.String value)
Utility method to create a singleton string
ColumnVector |
static <T> CloseableIterator<T> |
toCloseableIterator(java.util.Iterator<T> iter)
Convert a
Iterator to CloseableIterator. |
public static <T> CloseableIterator<T> singletonCloseableIterator(T elem)
CloseableIterator.T - Element type.elem - Element to create iterator with.CloseableIterator with just one element.public static <T> CloseableIterator<T> toCloseableIterator(java.util.Iterator<T> iter)
Iterator to CloseableIterator. Useful when passing normal iterators
for arguments that require CloseableIterator type.T - Element typeiter - Iterator instanceCloseableIterator wrapping the given Iteratorpublic static ColumnVector singletonColumnVector(java.lang.String value)
ColumnVectorvalue - the string element to create the vector withColumnVector with a single element valuepublic static StructType getLogicalSchema(TableClient tableClient, Row scanState)
Row returned by
Scan.getScanState(TableClient).tableClient - instance of TableClient to use.scanState - Scan state Rowpublic static StructType getPhysicalSchema(TableClient tableClient, Row scanState)
Row returned by
Scan.getScanState(TableClient).tableClient - instance of TableClient to use.scanState - Scan state Rowpublic static java.util.List<java.lang.String> getPartitionColumns(Row scanState)
Row returned by
Scan.getScanState(TableClient).scanState - Scan state Rowpublic static java.lang.String getColumnMappingMode(Row scanState)
Row returned by
Scan.getScanState(TableClient).public static FileStatus getFileStatus(Row scanFileInfo)
FileStatus from given scan file Row. The FileStatus contains
file metadata about the scan file.scanFileInfo - Row representing one scan file.FileStatus object created from the given scan file row.public static java.util.Map<java.lang.String,java.lang.String> getPartitionValues(Row scanFileInfo)
scanFileInfo - Row representing one scan file.public static void closeCloseables(java.io.Closeable... closeables)
Closeables. Closeable.close()
will be called on all given non-null closeables. Will throw unchecked
RuntimeException if an error occurs while closing. If multiple closeables causes
exceptions in closing, the exceptions will be added as suppressed to the main exception
that is thrown.closeables - public static void closeCloseablesSilently(java.io.Closeable... closeables)
Closeable objects. Any exception thrown is silently ignored.closeables -