public static Type convertDataType(DataType fieldType, SummaryTransform transform, boolean rawAsBase64) {
        FieldValue fval = fieldType.createFieldValue();
        if (fval instanceof StringFieldValue) {
            if (transform != null && transform.equals(SummaryTransform.RANKFEATURES)) {
                return Type.FEATUREDATA;
            } else if (transform != null && transform.equals(SummaryTransform.SUMMARYFEATURES)) {
                return Type.FEATUREDATA;
            } else if (transform != null && transform.equals(SummaryTransform.TOKENS)) {
                return Type.JSONSTRING;
            } else if (transform != null && transform.equals(SummaryTransform.ATTRIBUTE_TOKENS)) {
                return Type.JSONSTRING;
            } else {
                return Type.LONGSTRING;
            }
        } else if (fval instanceof IntegerFieldValue) {
            return Type.INTEGER;
        } else if (fval instanceof LongFieldValue) {
            return Type.INT64;
        } else if (fval instanceof Float16FieldValue) {
            return Type.FLOAT16;
        } else if (fval instanceof FloatFieldValue) {
            return Type.FLOAT;
        } else if (fval instanceof DoubleFieldValue) {
            return Type.DOUBLE;
        } else if (fval instanceof BoolFieldValue) {
            return Type.BOOL;
        } else if (fval instanceof ByteFieldValue) {
            return Type.BYTE;
        } else if (fval instanceof Raw) {
            return rawAsBase64 ? Type.RAW : Type.DATA;
        } else if (fval instanceof Struct) {
            return Type.JSONSTRING;
        } else if (fval instanceof PredicateFieldValue) {
            return Type.STRING;
        } else if (fval instanceof TensorFieldValue) {
            return Type.TENSOR;
        } else if (fieldType instanceof CollectionDataType) {
            if (transform != null && transform.equals(SummaryTransform.POSITIONS)) {
                return Type.XMLSTRING;
            } else {
                return Type.JSONSTRING;
            }
        } else if (fieldType instanceof MapDataType) {
            return Type.JSONSTRING;
        } else if (fieldType instanceof NewDocumentReferenceDataType) {
            return Type.LONGSTRING;
        } else {
            throw new IllegalArgumentException("Don't know which summary type to convert " + fieldType + " to");
        }
    }
Converts to the right summary field type from a field datatype and a transform
config-model/src/main/java/com/yahoo/schema/derived/SummaryClassField.java