Class JsonPathEvaluators


  • public final class JsonPathEvaluators
    extends Object
    Allows registration of a custom {@see JsonPathEvaluator} which can handle custom storage functionality also present in a plugin. A default evaluator which can handle all default storage types will be provided to delegate to when standard storage types are encountered. This is an evolving SPI and subject to change.
    • Constructor Detail

      • JsonPathEvaluators

        public JsonPathEvaluators()
    • Method Detail

      • registerProvider

        public static boolean registerProvider​(JsonPathEvaluatorProvider provider)
        Registration point to override how JSON paths are evaluated. This should be used when a Pinot plugin has special storage capabilities. For instance, imagine a plugin with a raw forward index which stores JSON in a binary format which pinot-core is unaware of and cannot evaluate JSON paths against (pinot-core only understands true JSON documents). Whenever JSON paths are evaluated against this custom storage, different storage access operations may be required, and the provided {@see JsonPathEvaluator} can inspect the provided {@see ForwardIndexReader} to determine whether it is the custom implementation and evaluate the JSON path against the binary JSON managed by the custom reader. If it is not the custom implementation, then the evaluation should be delegated to the provided delegate. This prevents the interface {@see ForwardIndexReader} from needing to be able to model any plugin storage format, which creates flexibility for the kinds of data structure plugins can employ.
        Parameters:
        provider - provides {@see JsonPathEvaluator}
        Returns:
        true if registration is successful, false otherwise
      • create

        public static JsonPathEvaluator create​(String jsonPath,
                                               Object defaultValue)
        pinot-core must construct {@see JsonPathEvaluator} via this method to ensure it uses the registered implementation. Using the registered implementation allows pinot-core to evaluate JSON paths against data structures it doesn't understand or model.
        Parameters:
        jsonPath - the JSON path
        defaultValue - the default value
        Returns:
        a JSON path evaluator which must understand all possible storage representations of JSON.