@Override
    public void open(FunctionContext context) {
        userAgentAnalyzer = UserAgentAnalyzer
            .newBuilder()
            .withFields(extractedFields)
            .withCache(cacheSize)
            .immediateInitialization()
            .build();

        if (extractedFields.isEmpty()) {
            extractedFields.addAll(userAgentAnalyzer.getAllPossibleFieldNamesSorted());
        }
        allAllowedHeaders.add(USERAGENT_HEADER);
        allAllowedHeaders.addAll(userAgentAnalyzer.supportedClientHintHeaders());
    }
Create a UserAgentAnalyzer that extracts only the specified fields
@param cacheSize The desired size of the cache.
@param desiredFields The list of desired field names.
udfs/flink-table/src/main/java/nl/basjes/parse/useragent/flink/table/AnalyzeUseragentFunction.java