public Object convert(Object input) { if (input == null) { return null; } return outputOI.set(r, PrimitiveObjectInspectorUtils.getDate(input, inputOI)); } }
@Override public boolean isDistanceGreater(Object v1, Object v2, int amt) { Date l1 = PrimitiveObjectInspectorUtils.getDate(v1, (PrimitiveObjectInspector) expressionDef.getOI()); Date l2 = PrimitiveObjectInspectorUtils.getDate(v2, (PrimitiveObjectInspector) expressionDef.getOI()); if (l1 != null && l2 != null) { return (double)(l1.getTime() - l2.getTime())/1000 > (long)amt * 24 * 3600; // Converts amt days to milliseconds } return l1 != l2; // True if only one date is null }
@Override public boolean isEqual(Object v1, Object v2) { Date l1 = PrimitiveObjectInspectorUtils.getDate(v1, (PrimitiveObjectInspector) expressionDef.getOI()); Date l2 = PrimitiveObjectInspectorUtils.getDate(v2, (PrimitiveObjectInspector) expressionDef.getOI()); return (l1 == null && l2 == null) || (l1 != null && l1.equals(l2)); } }
@Override public boolean isEqual(Object v1, Object v2) { Date l1 = PrimitiveObjectInspectorUtils.getDate(v1, (PrimitiveObjectInspector) expressionDef.getOI()); Date l2 = PrimitiveObjectInspectorUtils.getDate(v2, (PrimitiveObjectInspector) expressionDef.getOI()); return (l1 == null && l2 == null) || (l1 != null && l1.equals(l2)); } }
@Override public boolean isDistanceGreater(Object v1, Object v2, int amt) { Date l1 = PrimitiveObjectInspectorUtils.getDate(v1, (PrimitiveObjectInspector) expressionDef.getOI()); Date l2 = PrimitiveObjectInspectorUtils.getDate(v2, (PrimitiveObjectInspector) expressionDef.getOI()); if (l1 != null && l2 != null) { return (double)(l1.toEpochMilli() - l2.toEpochMilli())/1000 > (long)amt * 24 * 3600; // Converts amt days to milliseconds } return l1 != l2; // True if only one date is null }
@Override public void evaluate(VectorizedRowBatch batch) throws HiveException { if (!initialized) { Object lVal = leftDynamicValue.getValue(); Object rVal = rightDynamicValue.getValue(); if (lVal == null || rVal == null) { isLeftOrRightNull = true; } else { long min = DateWritableV2.dateToDays(PrimitiveObjectInspectorUtils.getDate( lVal, leftDynamicValue.getObjectInspector())); setLeftValue(min); long max = DateWritableV2.dateToDays(PrimitiveObjectInspectorUtils.getDate( rVal, rightDynamicValue.getObjectInspector())); setRightValue(max); } initialized = true; } // Special case for dynamic values - min/max can be null if (isLeftOrRightNull) { // Entire batch is filtered out batch.size = 0; } super.evaluate(batch); } }
@Override public void evaluate(VectorizedRowBatch batch) { if (!initialized) { Object lVal = leftDynamicValue.getValue(); Object rVal = rightDynamicValue.getValue(); if (lVal == null || rVal == null) { isLeftOrRightNull = true; } else { long min = DateWritable.dateToDays(PrimitiveObjectInspectorUtils.getDate( lVal, leftDynamicValue.getObjectInspector())); setLeftValue(min); long max = DateWritable.dateToDays(PrimitiveObjectInspectorUtils.getDate( rVal, rightDynamicValue.getObjectInspector())); setRightValue(max); } initialized = true; } // Special case for dynamic values - min/max can be null if (isLeftOrRightNull) { // Entire batch is filtered out batch.size = 0; } super.evaluate(batch); } }
break; case DATE: longValue = DateWritable.dateToDays(PrimitiveObjectInspectorUtils.getDate(val, poi)); case TIMESTAMP: timestampValue = PrimitiveObjectInspectorUtils.getTimestamp(val, poi);
break; case DATE: longValue = DateWritableV2.dateToDays(PrimitiveObjectInspectorUtils.getDate(val, poi)); case TIMESTAMP: timestampValue = PrimitiveObjectInspectorUtils.getTimestamp(val, poi).toSqlTimestamp();
return PrimitiveObjectInspectorUtils.getHiveChar(input, (HiveCharObjectInspector) argumentOI); case DATE: return PrimitiveObjectInspectorUtils.getDate(input, (DateObjectInspector) argumentOI); case TIMESTAMP: return PrimitiveObjectInspectorUtils.getTimestamp(input, (TimestampObjectInspector) argumentOI);
case DATE: final Date date = PrimitiveObjectInspectorUtils.getDate( object, sourcePrimitiveOI); if (date == null) {
case DATE: Date date = PrimitiveObjectInspectorUtils.getDate( object, convertSourcePrimitiveObjectInspectors[logicalColumnIndex]); if (date == null) {
HiveIntervalYearMonth iym1 = PrimitiveObjectInspectorUtils.getHiveIntervalYearMonth( arguments[intervalArg1Idx].get(), inputOIs[intervalArg1Idx]); Date dt1 = PrimitiveObjectInspectorUtils.getDate( arguments[dtArgIdx].get(), inputOIs[dtArgIdx]); return handleDateResult(dtm.add(dt1, iym1)); int intVal = PrimitiveObjectInspectorUtils.getInt(arguments[intervalArg1Idx].get(), inputOIs[intervalArg1Idx]); Date dt1 = PrimitiveObjectInspectorUtils.getDate( arguments[dtArgIdx].get(), inputOIs[dtArgIdx]); return handleDateResult(dtm.add(dt1, intVal));
HiveIntervalYearMonth iym1 = PrimitiveObjectInspectorUtils.getHiveIntervalYearMonth( arguments[intervalArg1Idx].get(), inputOIs[intervalArg1Idx]); Date dt1 = PrimitiveObjectInspectorUtils.getDate( arguments[dtArg1Idx].get(), inputOIs[dtArg1Idx]); return handleDateResult(dtm.subtract(dt1, iym1)); int intVal = PrimitiveObjectInspectorUtils.getInt(arguments[intervalArg1Idx].get(), inputOIs[intervalArg1Idx]); Date dt1 = PrimitiveObjectInspectorUtils.getDate( arguments[dtArg1Idx].get(), inputOIs[dtArg1Idx]); return handleDateResult(dtm.add(dt1, -intVal));
HiveIntervalYearMonth iym1 = PrimitiveObjectInspectorUtils.getHiveIntervalYearMonth( arguments[intervalArg1Idx].get(), inputOIs[intervalArg1Idx]); Date dt1 = PrimitiveObjectInspectorUtils.getDate( arguments[dtArgIdx].get(), inputOIs[dtArgIdx]); return handleDateResult(dtm.add(dt1, iym1));
HiveIntervalYearMonth iym1 = PrimitiveObjectInspectorUtils.getHiveIntervalYearMonth( arguments[intervalArg1Idx].get(), inputOIs[intervalArg1Idx]); Date dt1 = PrimitiveObjectInspectorUtils.getDate( arguments[dtArg1Idx].get(), inputOIs[dtArg1Idx]); return handleDateResult(dtm.subtract(dt1, iym1));
public Object convert(Object input) { if (input == null) { return null; } return outputOI.set(r, PrimitiveObjectInspectorUtils.getDate(input, inputOI)); } }
public Object convert(Object input) { if (input == null) { return null; } return outputOI.set(r, PrimitiveObjectInspectorUtils.getDate(input, inputOI)); } }
public Object convert(Object input) { if (input == null) { return null; } return outputOI.set(r, PrimitiveObjectInspectorUtils.getDate(input, inputOI)); } }
public Object convert(Object input) { if (input == null) { return null; } Object r = outputOI.create(new Date(0)); return outputOI.set(r, PrimitiveObjectInspectorUtils.getDate(input, inputOI)); } }