private <I> void register(Class<? extends I> clazz, ArrayListMultimap<String, Class<? extends I>> methods) { Description desc = clazz.getAnnotation(Description.class); Stream<String> namesStream; if (desc != null) { namesStream = Stream.of(desc.name().split(",")) .map(String::trim); } else { namesStream = Stream.of(clazz) .map(Class::getName) .map(name -> name.replace('.', '_')); } // Checks specified array of function names whether they should be replaced // using FUNCTION_REPLACE_MAP map. namesStream.map(String::toLowerCase) .map(functionName -> FUNCTION_REPLACE_MAP.getOrDefault(functionName, functionName)) .forEach(name -> methods.put(name, clazz)); UDFType type = clazz.getAnnotation(UDFType.class); if (type != null && !type.deterministic()) { nonDeterministicUDFs.add(clazz); } }
/** * Returns whether a GenericUDF is deterministic or not. */ public static boolean isDeterministic(GenericUDF genericUDF) { if (isStateful(genericUDF)) { // stateful implies non-deterministic, regardless of whatever // the deterministic annotation declares return false; } UDFType genericUDFType = AnnotationUtils.getAnnotation(genericUDF.getClass(), UDFType.class); if (genericUDFType != null && genericUDFType.deterministic() == false) { return false; } if (genericUDF instanceof GenericUDFBridge) { GenericUDFBridge bridge = (GenericUDFBridge) (genericUDF); UDFType bridgeUDFType = AnnotationUtils.getAnnotation(bridge.getUdfClass(), UDFType.class); if (bridgeUDFType != null && bridgeUDFType.deterministic() == false) { return false; } } if (genericUDF instanceof GenericUDFMacro) { GenericUDFMacro macro = (GenericUDFMacro) (genericUDF); return macro.isDeterministic(); } return true; }
/** * Returns whether a GenericUDF is deterministic or not. */ public static boolean isDeterministic(GenericUDF genericUDF) { if (isStateful(genericUDF)) { // stateful implies non-deterministic, regardless of whatever // the deterministic annotation declares return false; } UDFType genericUDFType = AnnotationUtils.getAnnotation(genericUDF.getClass(), UDFType.class); if (genericUDFType != null && genericUDFType.deterministic() == false) { return false; } if (genericUDF instanceof GenericUDFBridge) { GenericUDFBridge bridge = (GenericUDFBridge) (genericUDF); UDFType bridgeUDFType = AnnotationUtils.getAnnotation(bridge.getUdfClass(), UDFType.class); if (bridgeUDFType != null && bridgeUDFType.deterministic() == false) { return false; } } if (genericUDF instanceof GenericUDFMacro) { GenericUDFMacro macro = (GenericUDFMacro) (genericUDF); return macro.isDeterministic(); } return true; }
udfType = ((GenericUDFBridge) udf).getUdfClass().getAnnotation(UDFType.class); if (udfType.deterministic() == false) { if (udf.getClass().equals(GenericUDFUnixTimeStamp.class) && children != null && children.size() > 0) {
/** * Returns whether a GenericUDF is deterministic or not. */ public static boolean isDeterministic(GenericUDF genericUDF) { UDFType genericUDFType = genericUDF.getClass().getAnnotation(UDFType.class); if (genericUDFType != null && genericUDFType.deterministic() == false) { return false; } if (genericUDF instanceof GenericUDFBridge) { GenericUDFBridge bridge = (GenericUDFBridge) (genericUDF); UDFType bridgeUDFType = bridge.getUdfClass().getAnnotation(UDFType.class); if (bridgeUDFType != null && bridgeUDFType.deterministic() == false) { return false; } } return true; }
@Override public boolean isDeterministic() { try { UDFType udfType = hiveFunctionWrapper.getUDFClass().getAnnotation(UDFType.class); return udfType != null && udfType.deterministic() && !udfType.stateful(); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } }
@Override public boolean isDeterministic() { try { UDFType udfType = hiveFunctionWrapper.getUDFClass().getAnnotation(UDFType.class); return udfType != null && udfType.deterministic() && !udfType.stateful(); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } } }
private <C,I> void register(Class<? extends I> clazz, ArrayListMultimap<String,Class<? extends I>> methods) { Description desc = clazz.getAnnotation(Description.class); String[] names; if (desc != null) { names = desc.name().split(","); for (int i=0; i<names.length; i++) { names[i] = names[i].trim(); } }else{ names = new String[]{clazz.getName().replace('.', '_')}; } UDFType type = clazz.getAnnotation(UDFType.class); if (type != null && !type.deterministic()) { nonDeterministicUDFs.add(clazz); } for(int i=0; i<names.length;i++) { methods.put(names[i].toLowerCase(), clazz); } }
/** * Returns whether a GenericUDF is deterministic or not. */ public static boolean isDeterministic(GenericUDF genericUDF) { if (isStateful(genericUDF)) { // stateful implies non-deterministic, regardless of whatever // the deterministic annotation declares return false; } UDFType genericUDFType = AnnotationUtils.getAnnotation(genericUDF.getClass(), UDFType.class); if (genericUDFType != null && genericUDFType.deterministic() == false) { return false; } if (genericUDF instanceof GenericUDFBridge) { GenericUDFBridge bridge = (GenericUDFBridge) (genericUDF); UDFType bridgeUDFType = AnnotationUtils.getAnnotation(bridge.getUdfClass(), UDFType.class); if (bridgeUDFType != null && bridgeUDFType.deterministic() == false) { return false; } } if (genericUDF instanceof GenericUDFMacro) { GenericUDFMacro macro = (GenericUDFMacro) (genericUDF); return macro.isDeterministic(); } return true; }
builder.setDeterministic(type.deterministic());
udfType = ((GenericUDFBridge) udf).getUdfClass().getAnnotation(UDFType.class); if (udfType.deterministic() == false) { return false;