Class RelJsonWriter

  • All Implemented Interfaces:
    RelWriter

    public class RelJsonWriter
    extends java.lang.Object
    implements RelWriter
    Callback for a relational expression to dump itself as JSON.
    See Also:
    RelJsonReader
    • Constructor Summary

      Constructors 
      Constructor Description
      RelJsonWriter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String asString()
      Returns a JSON string describing the relational expressions that were just explained.
      RelWriter done​(RelNode node)
      Writes the completed explanation.
      void explain​(RelNode rel, java.util.List<Pair<java.lang.String,​java.lang.Object>> valueList)
      Prints an explanation of a node, with a list of (term, value) pairs.
      protected void explain_​(RelNode rel, java.util.List<Pair<java.lang.String,​java.lang.Object>> values)  
      private java.util.List<java.lang.Object> explainInputs​(java.util.List<RelNode> inputs)  
      SqlExplainLevel getDetailLevel()  
      private java.util.List<java.lang.Object> getList​(java.util.List<Pair<java.lang.String,​java.lang.Object>> values, java.lang.String tag)  
      RelWriter input​(java.lang.String term, RelNode input)
      Adds an input to the explanation of the current node.
      RelWriter item​(java.lang.String term, java.lang.Object value)
      Adds an attribute to the explanation of the current node.
      RelWriter itemIf​(java.lang.String term, java.lang.Object value, boolean condition)
      Adds an input to the explanation of the current node, if a condition holds.
      boolean nest()
      Returns whether the writer prefers nested values.
      private void put​(java.util.Map<java.lang.String,​java.lang.Object> map, java.lang.String name, java.lang.Object value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • relJson

        private final RelJson relJson
      • relIdMap

        private final java.util.Map<RelNode,​java.lang.String> relIdMap
      • relList

        private final java.util.List<java.lang.Object> relList
      • values

        private final java.util.List<Pair<java.lang.String,​java.lang.Object>> values
      • previousId

        private java.lang.String previousId
    • Constructor Detail

      • RelJsonWriter

        public RelJsonWriter()
    • Method Detail

      • explain_

        protected void explain_​(RelNode rel,
                                java.util.List<Pair<java.lang.String,​java.lang.Object>> values)
      • put

        private void put​(java.util.Map<java.lang.String,​java.lang.Object> map,
                         java.lang.String name,
                         java.lang.Object value)
      • explainInputs

        private java.util.List<java.lang.Object> explainInputs​(java.util.List<RelNode> inputs)
      • input

        public RelWriter input​(java.lang.String term,
                               RelNode input)
        Description copied from interface: RelWriter
        Adds an input to the explanation of the current node.
        Specified by:
        input in interface RelWriter
        Parameters:
        term - Term for input, e.g. "left" or "input #1".
        input - Input relational expression
      • item

        public RelWriter item​(java.lang.String term,
                              java.lang.Object value)
        Description copied from interface: RelWriter
        Adds an attribute to the explanation of the current node.
        Specified by:
        item in interface RelWriter
        Parameters:
        term - Term for attribute, e.g. "joinType"
        value - Attribute value
      • getList

        private java.util.List<java.lang.Object> getList​(java.util.List<Pair<java.lang.String,​java.lang.Object>> values,
                                                         java.lang.String tag)
      • itemIf

        public RelWriter itemIf​(java.lang.String term,
                                java.lang.Object value,
                                boolean condition)
        Description copied from interface: RelWriter
        Adds an input to the explanation of the current node, if a condition holds.
        Specified by:
        itemIf in interface RelWriter
      • nest

        public boolean nest()
        Description copied from interface: RelWriter
        Returns whether the writer prefers nested values. Traditional explain writers prefer flattened values.
        Specified by:
        nest in interface RelWriter
      • asString

        public java.lang.String asString()
        Returns a JSON string describing the relational expressions that were just explained.