Source:
<code>public static void input( @AggregationState DifferentialEntropyState state, @SqlType(StandardTypes.BIGINT) long size, @SqlType(StandardTypes.DOUBLE) double sample, @SqlType(StandardTypes.DOUBLE) double weight, @SqlType(StandardTypes.VARCHAR) Slice method, @SqlType(StandardTypes.DOUBLE) double min, @SqlType(StandardTypes.DOUBLE) double max) { <START> String requestedMethod = method == null ? null : method.toStringUtf8(); <END> DifferentialEntropyStateStrategy strategy = state.getStrategy(); if (strategy == null) { if (requestedMethod.equalsIgnoreCase(FIXED_HISTOGRAM_MLE_METHOD_NAME)) { strategy = new FixedHistogramMleStateStrategy(size, min, max); } else if (requestedMethod.equalsIgnoreCase(FIXED_HISTOGRAM_JACKNIFE_METHOD_NAME)) { strategy = new FixedHistogramJacknifeStateStrategy(size, min, max); } else { throw new PrestoException( INVALID_FUNCTION_ARGUMENT, format("Invalid method in differential_entropy: %s", requestedMethod)); } state.setStrategy(strategy); } else { switch (requestedMethod.toLowerCase(ENGLISH)) { case FIXED_HISTOGRAM_MLE_METHOD_NAME: verify(strategy instanceof FixedHistogramMleStateStrategy, format("Strategy class is not compatible with entropy method: %s %s", strategy.getClass().getSimpleName(), method)); break; case FIXED_HISTOGRAM_JACKNIFE_METHOD_NAME: verify(strategy instanceof FixedHistogramJacknifeStateStrategy, format("Strategy class is not compatible with entropy method: %s %s", strategy.getClass().getSimpleName(), method)); break; default: verify(false, format("Unknown entropy method %s", method)); } } strategy.validateParameters(size, sample, weight, min, max); strategy.add(sample, weight); }</code><technical_language>Is Ok for method null? I code throw NPE if requestedMethod is null</technical_language>

Target:
public static void input( @AggregationState DifferentialEntropyState state, @SqlType(StandardTypes.BIGINT) long size, @SqlType(StandardTypes.DOUBLE) double sample, @SqlType(StandardTypes.DOUBLE) double weight, @SqlType(StandardTypes.VARCHAR) Slice method, @SqlType(StandardTypes.DOUBLE) double min, @SqlType(StandardTypes.DOUBLE) double max) { String requestedMethod = method.toStringUtf8().toLowerCase(ENGLISH); DifferentialEntropyStateStrategy strategy = state.getStrategy(); if (strategy == null) { switch (requestedMethod) { case FIXED_HISTOGRAM_MLE_METHOD_NAME: strategy = new FixedHistogramMleStateStrategy(size, min, max); break; case FIXED_HISTOGRAM_JACKNIFE_METHOD_NAME: strategy = new FixedHistogramJacknifeStateStrategy(size, min, max); break; default: throw new PrestoException( INVALID_FUNCTION_ARGUMENT, format("In differential_entropy UDF, invalid method: %s", requestedMethod)); } state.setStrategy(strategy); } else { switch (requestedMethod.toLowerCase(ENGLISH)) { case FIXED_HISTOGRAM_MLE_METHOD_NAME: verify(strategy instanceof FixedHistogramMleStateStrategy, format("Strategy class is not compatible with entropy method: %s %s", strategy.getClass().getSimpleName(), method)); break; case FIXED_HISTOGRAM_JACKNIFE_METHOD_NAME: verify(strategy instanceof FixedHistogramJacknifeStateStrategy, format("Strategy class is not compatible with entropy method: %s %s", strategy.getClass().getSimpleName(), method)); break; default: verify(false, format("Unknown entropy method %s", method)); } } strategy.validateParameters(size, sample, weight, min, max); strategy.add(sample, weight); }