public long addMonthsToNanosUtc(long nanos, int months) { long result = addMonthsToMillisUtc(nanos / 1000000, months) * 1000000 + (nanos % 1000000); return result; }
public boolean add(Timestamp ts, HiveIntervalYearMonth interval, Timestamp result) { if (ts == null || interval == null) { return false; } // Attempt to match Oracle semantics for timestamp arithmetic, // where timestamp arithmetic is done in UTC, then converted back to local timezone long resultMillis = addMonthsToMillisUtc(ts.getTime(), interval.getTotalMonths()); result.setTime(resultMillis); result.setNanos(ts.getNanos()); return true; }
public boolean add(HiveIntervalYearMonth interval, Timestamp ts, Timestamp result) { if (ts == null || interval == null) { return false; } // Attempt to match Oracle semantics for timestamp arithmetic, // where timestamp arithmetic is done in UTC, then converted back to local timezone long resultMillis = addMonthsToMillisUtc(ts.getTime(), interval.getTotalMonths()); result.setTime(resultMillis); result.setNanos(ts.getNanos()); return true; }
public long addMonthsToNanosUtc(long nanos, int months) { long result = addMonthsToMillisUtc(nanos / 1000000, months) * 1000000 + (nanos % 1000000); return result; }
public Timestamp add(Timestamp ts, HiveIntervalYearMonth interval) { if (ts == null || interval == null) { return null; } // Attempt to match Oracle semantics for timestamp arithmetic, // where timestamp arithmetic is done in UTC, then converted back to local timezone long resultMillis = addMonthsToMillisUtc(ts.getTime(), interval.getTotalMonths()); Timestamp tsResult = new Timestamp(resultMillis); tsResult.setNanos(ts.getNanos()); return tsResult; }