Search in sources :

Example 1 with PublicAPIMethod

use of org.apache.hudi.PublicAPIMethod in project hudi by apache.

the class BuiltinKeyGenerator method getPartitionPath.

/**
 * Fetch partition path from {@link InternalRow}.
 *
 * @param internalRow {@link InternalRow} instance from which partition path needs to be fetched from.
 * @param structType  schema of the internalRow.
 * @return the partition path.
 */
@Override
@PublicAPIMethod(maturity = ApiMaturityLevel.EVOLVING)
public String getPartitionPath(InternalRow internalRow, StructType structType) {
    try {
        initDeserializer(structType);
        Row row = sparkRowSerDe.deserializeRow(internalRow);
        return getPartitionPath(row);
    } catch (Exception e) {
        throw new HoodieIOException("Conversion of InternalRow to Row failed with exception " + e);
    }
}
Also used : HoodieIOException(org.apache.hudi.exception.HoodieIOException) InternalRow(org.apache.spark.sql.catalyst.InternalRow) Row(org.apache.spark.sql.Row) HoodieKeyException(org.apache.hudi.exception.HoodieKeyException) HoodieIOException(org.apache.hudi.exception.HoodieIOException) PublicAPIMethod(org.apache.hudi.PublicAPIMethod)

Aggregations

PublicAPIMethod (org.apache.hudi.PublicAPIMethod)1 HoodieIOException (org.apache.hudi.exception.HoodieIOException)1 HoodieKeyException (org.apache.hudi.exception.HoodieKeyException)1 Row (org.apache.spark.sql.Row)1 InternalRow (org.apache.spark.sql.catalyst.InternalRow)1