Class InternalUtils

Object
io.delta.kernel.internal.util.InternalUtils

public class InternalUtils extends Object
  • Method Details

    • getSingularRow

      public static Optional<Row> getSingularRow(CloseableIterator<ColumnarBatch> dataIter) throws IOException
      Utility method to read at most one row from the given data ColumnarBatch iterator. If there is more than one row, an exception will be thrown.
      Parameters:
      dataIter -
      Returns:
      Throws:
      IOException
    • getSingularElement

      public static <T> Optional<T> getSingularElement(CloseableIterator<T> iter) throws IOException
      Utility method to read at most one element from a CloseableIterator. If there is more than element row, an exception will be thrown.
      Throws:
      IOException
    • daysSinceEpoch

      public static int daysSinceEpoch(Date date)
      Utility method to get the number of days since epoch this given date is.
    • microsSinceEpoch

      public static long microsSinceEpoch(Timestamp timestamp)
      Utility method to get the number of microseconds since the unix epoch for the given timestamp interpreted in UTC.
    • singletonStringColumnVector

      public static ColumnVector singletonStringColumnVector(String value)
      Utility method to create a singleton string ColumnVector
      Parameters:
      value - the string element to create the vector with
      Returns:
      A ColumnVector with a single element value
    • requireNonNull

      public static Row requireNonNull(Row row, int ordinal, String columnName)
    • requireNonNull

      public static ColumnVector requireNonNull(ColumnVector vector, int rowId, String columnName)
    • relativizePath

      public static Path relativizePath(Path child, URI root)
      Relativize the given child path with respect to the given root URI. If the child path is already a relative path, it is returned as is.
      Parameters:
      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.
      Returns:
    • toLowerCaseSet

      public static Set<String> toLowerCaseSet(Collection<String> set)