@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 < 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 < 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; }