cassandra-analytics-spark-converter/src/main/scala-2.12-spark-3/org/apache/cassandra/spark/utils/SparkTypeUtils.java [28:48]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public final class SparkTypeUtils
{
    private SparkTypeUtils()
    {
        throw new IllegalStateException(getClass() + " is static utility class and shall not be instantiated");
    }

    public static final Comparator<CalendarInterval> CALENDAR_INTERVAL_COMPARATOR =
    Comparator.<CalendarInterval>comparingInt(interval -> interval.months)
              .thenComparingInt(interval -> interval.days)
              .thenComparingLong(interval -> interval.microseconds);

    public static CalendarInterval convertDuration(InternalDuration duration)
    {
        // Unfortunately, it loses precision when converting to the spark data type.
        return new CalendarInterval(duration.months, duration.days, TimeUnit.NANOSECONDS.toMicros(duration.nanoseconds));
    }

    public static InternalDuration convertDuration(CalendarInterval interval)
    {
        return new InternalDuration(interval.months, interval.days, TimeUnit.MICROSECONDS.toNanos(interval.microseconds));
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



cassandra-analytics-spark-converter/src/main/scala-2.13-spark-3/org/apache/cassandra/spark/utils/SparkTypeUtils.java [28:48]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
public final class SparkTypeUtils
{
    private SparkTypeUtils()
    {
        throw new IllegalStateException(getClass() + " is static utility class and shall not be instantiated");
    }

    public static final Comparator<CalendarInterval> CALENDAR_INTERVAL_COMPARATOR =
    Comparator.<CalendarInterval>comparingInt(interval -> interval.months)
              .thenComparingInt(interval -> interval.days)
              .thenComparingLong(interval -> interval.microseconds);

    public static CalendarInterval convertDuration(InternalDuration duration)
    {
        // Unfortunately, it loses precision when converting to the spark data type.
        return new CalendarInterval(duration.months, duration.days, TimeUnit.NANOSECONDS.toMicros(duration.nanoseconds));
    }

    public static InternalDuration convertDuration(CalendarInterval interval)
    {
        return new InternalDuration(interval.months, interval.days, TimeUnit.MICROSECONDS.toNanos(interval.microseconds));
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



