Source:
<code>private static SqlScalarFunction parseParametricScalar(ScalarHeaderAndMethods scalar, Optional<Constructor<?>> constructor) { ParametricImplementationsGroup.Builder<ParametricScalarImplementation> implementationsBuilder = ParametricImplementationsGroup.builder(); ScalarImplementationHeader header = scalar.getHeader(); checkArgument(!header.getName().isEmpty()); Map<Signature, ParametricScalarImplementation> signatures = new HashMap<Signature, ParametricScalarImplementation>(); for (Method method : scalar.getMethods()) { ParametricScalarImplementation implementation = ParametricScalarImplementation.Parser.parseImplementation(header.getName(), method, constructor); <START> if (!signatures.containsKey(implementation.getSignature())) { <END> signatures.put(implementation.getSignature(), implementation); implementationsBuilder.addImplementation(implementation); } else { ParametricScalarImplementation currentImplementation = signatures.get(implementation.getSignature()); if (!currentImplementation.getArgumentNativeContainerTypes().equals(implementation.getArgumentNativeContainerTypes())) { implementationsBuilder.addImplementation(implementation); } else if (!currentImplementation.getSpecializedTypeParameters().equals(implementation.getSpecializedTypeParameters())) { implementationsBuilder.addImplementation(implementation); } else { currentImplementation.updateChoices(implementation); } } } ParametricImplementationsGroup<ParametricScalarImplementation> implementations = implementationsBuilder.build(); Signature scalarSignature = implementations.getSignature(); header.getOperatorType().ifPresent(operatorType -> validateOperator(operatorType, scalarSignature.getReturnType(), scalarSignature.getArgumentTypes())); return new ParametricScalar(scalarSignature, header.getHeader(), implementations); }</code><technical_language>Originally, thought Signature distinguish PSI. Signature hash key. Signature is enough distinguish PSI, argument native container + specialize native container type required. current implementation is incorrect ParametricScalarImplementation put signature. Lets put Signature, argument return native container type, type parameter specialization native container type class SpecializedSignature, key</technical_language>

Target:
private static SqlScalarFunction parseParametricScalar(ScalarHeaderAndMethods scalar, Optional<Constructor<?>> constructor) { ScalarImplementationHeader header = scalar.getHeader(); checkArgument(!header.getName().isEmpty()); Map<SpecializedSignature, ParametricScalarImplementation.Builder> signatures = new HashMap<>(); for (Method method : scalar.getMethods()) { ParametricScalarImplementation implementation = ParametricScalarImplementation.Parser.parseImplementation(header.getName(), method, constructor); if (!signatures.containsKey(implementation.getSpecializedSignature())) { ParametricScalarImplementation.Builder builder = new ParametricScalarImplementation.Builder( implementation.getSignature(), implementation.getArgumentNativeContainerTypes(), implementation.getSpecializedTypeParameters(), implementation.getReturnNativeContainerType()); signatures.put(implementation.getSpecializedSignature(), builder); builder.addChoices(implementation); } else { ParametricScalarImplementation.Builder builder = signatures.get(implementation.getSpecializedSignature()); builder.addChoices(implementation); } } ParametricImplementationsGroup.Builder<ParametricScalarImplementation> implementationsBuilder = ParametricImplementationsGroup.builder(); for (ParametricScalarImplementation.Builder implementation : signatures.values()) { implementationsBuilder.addImplementation(implementation.build()); } ParametricImplementationsGroup<ParametricScalarImplementation> implementations = implementationsBuilder.build(); Signature scalarSignature = implementations.getSignature(); header.getOperatorType().ifPresent(operatorType -> validateOperator(operatorType, scalarSignature.getReturnType(), scalarSignature.getArgumentTypes())); return new ParametricScalar(scalarSignature, header.getHeader(), implementations); }