@Override public Object[] evaluate(Input[] args) { DataType innerType = ((ArrayType) this.info().returnType()).innerType(); Set<Object> uniqueSet = new LinkedHashSet<>(); for (Input array : args) { if (array == null || array.value() == null) { continue; } Object[] arg = (Object[]) array.value(); for (Object element : arg) { uniqueSet.add(innerType.value(element)); } } return uniqueSet.toArray(); }
public static PartitionName toPartitionName( TableIdent tableIdent, @Nullable DocTableInfo docTableInfo, List<Assignment> partitionProperties, Object[] parameters) { if (docTableInfo != null) { return toPartitionName(docTableInfo, partitionProperties, parameters); } // Because only TableIdent is available, types of partitioned columns must be guessed Map<ColumnIdent, Object> properties = assignmentsToMap(partitionProperties, parameters); BytesRef[] values = new BytesRef[properties.size()]; int idx = 0; for (Map.Entry<ColumnIdent, Object> entry : properties.entrySet()) { DataType guessedType = DataTypes.guessType(entry.getValue(), false); Object value = guessedType.value(entry.getValue()); values[idx++] = DataTypes.STRING.value(value); } return new PartitionName(tableIdent, Arrays.asList(values)); }