(SettableDateObjectInspector) outputOI); case TIMESTAMP: return new PrimitiveObjectInspectorConverter.TimestampConverter( inputOI, (SettableTimestampObjectInspector) outputOI);
case TIMESTAMP: Timestamp ts = ((TimestampWritable) timestampConverter.convert(arguments[0].get())).getTimestamp(); date = ts; break;
(SettableDateObjectInspector) outputOI); case TIMESTAMP: return new PrimitiveObjectInspectorConverter.TimestampConverter( inputOI, (SettableTimestampObjectInspector) outputOI);
(SettableDateObjectInspector) outputOI); case TIMESTAMP: return new PrimitiveObjectInspectorConverter.TimestampConverter( inputOI, (SettableTimestampObjectInspector) outputOI);
(SettableDateObjectInspector) outputOI); case TIMESTAMP: return new PrimitiveObjectInspectorConverter.TimestampConverter( inputOI, (SettableTimestampObjectInspector) outputOI);
(SettableDateObjectInspector) outputOI); case TIMESTAMP: return new PrimitiveObjectInspectorConverter.TimestampConverter( inputOI, (SettableTimestampObjectInspector) outputOI);
break; case TIMESTAMP: dateConverter = new TimestampConverter((PrimitiveObjectInspector) arguments[0], PrimitiveObjectInspectorFactory.writableTimestampObjectInspector); break;
break; case TIMESTAMP: dateConverter = new TimestampConverter((PrimitiveObjectInspector) arguments[0], PrimitiveObjectInspectorFactory.writableTimestampObjectInspector); break;
break; case TIMESTAMP: timestampConverter = new TimestampConverter((PrimitiveObjectInspector) arguments[0], PrimitiveObjectInspectorFactory.writableTimestampObjectInspector); break;
Timestamp ts = ((TimestampWritable) timestampConverter.convert(arguments[0].get())) .getTimestamp(); date = ts;
break; case TIMESTAMP: timestampConverter = new TimestampConverter(argumentOI, PrimitiveObjectInspectorFactory.writableTimestampObjectInspector); break;
break; case TIMESTAMP: converter = new TimestampConverter((PrimitiveObjectInspector) arguments[i], PrimitiveObjectInspectorFactory.writableTimestampObjectInspector); break;
break; case TIMESTAMP: Timestamp ts = ((TimestampWritable) timestampConverter.convert(arguments[0].get())) .getTimestamp(); output.set(formatter.format(ts));
@Override public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException { if (arguments.length < 1) { throw new UDFArgumentLengthException( "The function TIMESTAMP requires at least one argument, got " + arguments.length); } SessionState ss = SessionState.get(); if (ss != null) { intToTimestampInSeconds = ss.getConf().getBoolVar(ConfVars.HIVE_INT_TIMESTAMP_CONVERSION_IN_SECONDS); } try { argumentOI = (PrimitiveObjectInspector) arguments[0]; } catch (ClassCastException e) { throw new UDFArgumentException( "The function TIMESTAMP takes only primitive types"); } tc = new TimestampConverter(argumentOI, PrimitiveObjectInspectorFactory.writableTimestampObjectInspector); tc.setIntToTimestampInSeconds(intToTimestampInSeconds); return PrimitiveObjectInspectorFactory.writableTimestampObjectInspector; }
@Override public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException { if (arguments.length != 2) { throw new UDFArgumentLengthException("The function " + getName() + " requires two " + "argument, got " + arguments.length); } try { argumentOIs = new PrimitiveObjectInspector[2]; argumentOIs[0] = (PrimitiveObjectInspector) arguments[0]; argumentOIs[1] = (PrimitiveObjectInspector) arguments[1]; } catch (ClassCastException e) { throw new UDFArgumentException( "The function " + getName() + " takes only primitive types"); } timestampConverter = new TimestampConverter(argumentOIs[0], PrimitiveObjectInspectorFactory.writableTimestampObjectInspector); textConverter = new TextConverter(argumentOIs[1]); return PrimitiveObjectInspectorFactory.javaTimestampObjectInspector; }
@Override public Object evaluate(DeferredObject[] arguments) throws HiveException { Object o0 = arguments[0].get(); if (o0 == null) { return null; } Object o1 = arguments[1].get(); if (o1 == null) { return null; } String tzStr = textConverter.convert(o1).toString(); TimeZone timezone = TimeZone.getTimeZone(tzStr); Timestamp timestamp = ((TimestampWritable) timestampConverter.convert(o0)) .getTimestamp(); int offset = timezone.getOffset(timestamp.getTime()); if (invert()) { offset = -offset; } return applyOffset(offset, timestamp); }
@Override public Object evaluate(DeferredObject[] arguments) throws HiveException { Object o0 = arguments[0].get(); if (o0 == null) { return null; } return tc.convert(o0); }
break; case TIMESTAMP: dateConverter = new TimestampConverter((PrimitiveObjectInspector) arguments[0], PrimitiveObjectInspectorFactory.writableTimestampObjectInspector); break;
break; case TIMESTAMP: timestampConverter = new TimestampConverter((PrimitiveObjectInspector) arguments[0], PrimitiveObjectInspectorFactory.writableTimestampObjectInspector); break;
break; case TIMESTAMP: dateConverter = new TimestampConverter((PrimitiveObjectInspector) arguments[0], PrimitiveObjectInspectorFactory.writableTimestampObjectInspector); break;