Interface PushdownSpelling

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PushdownSpelling
How a function call is written in a backend that could evaluate it itself.

The engine keeps everything structural — walking the expression tree, resolving column references, quoting identifiers — and hands over the arguments already rendered as text. A spelling therefore does nothing but assemble a string:


 (target, args) -> target.isFamily(PushdownTarget.SQL)
         ? Optional.of("upper(" + args.get(0) + ")")
         : Optional.empty();
 

Returning empty declines, and declining is always safe: the engine evaluates the call itself instead. A spelling that cannot be written for one backend, or for one argument count, says so by returning empty for that case rather than emitting text the backend would misread.

The rendered arguments are already in the target's syntax, so a MongoDB spelling composes JSON fragments and a SQL one composes SQL. A function whose spelling differs per dialect branches on PushdownTarget.variant().

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final PushdownSpelling
    A spelling that declines every backend — the default for a function with none.
  • Method Summary

    Modifier and Type
    Method
    Description
    render(PushdownTarget target, List<String> renderedArguments)
    Renders a call for one backend.
  • Field Details

    • NONE

      static final PushdownSpelling NONE
      A spelling that declines every backend — the default for a function with none.
  • Method Details

    • render

      Optional<String> render(PushdownTarget target, List<String> renderedArguments)
      Renders a call for one backend.
      Parameters:
      target - the backend being rendered for
      renderedArguments - the call's arguments, already rendered in that backend's syntax, in call order
      Returns:
      the rendered call, or empty to decline — in which case the engine evaluates the call itself