Class NestedBlockBuilderImpl
- java.lang.Object
-
- org.apache.calcite.adapter.enumerable.NestedBlockBuilderImpl
-
- All Implemented Interfaces:
NestedBlockBuilder
- Direct Known Subclasses:
AggResetContextImpl
public class NestedBlockBuilderImpl extends java.lang.Object implements NestedBlockBuilder
Allows to build nested code blocks with tracking of current context and the nullability of particularRexNode
expressions.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<BlockBuilder>
blocks
private java.util.List<java.util.Map<RexNode,java.lang.Boolean>>
nullables
-
Constructor Summary
Constructors Constructor Description NestedBlockBuilderImpl(BlockBuilder block)
Constructs nested block builders starting of a given code block.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BlockBuilder
currentBlock()
Returns the current code blockjava.util.Map<RexNode,java.lang.Boolean>
currentNullables()
Returns the current nullability state of rex nodes.void
exitBlock()
Leaves the current code block.BlockBuilder
nestBlock()
Starts nested code block.void
nestBlock(BlockBuilder block)
Uses given block as the new code context.void
nestBlock(BlockBuilder block, java.util.Map<RexNode,java.lang.Boolean> nullables)
Uses given block as the new code context and the map of nullability.
-
-
-
Field Detail
-
blocks
private final java.util.List<BlockBuilder> blocks
-
nullables
private final java.util.List<java.util.Map<RexNode,java.lang.Boolean>> nullables
-
-
Constructor Detail
-
NestedBlockBuilderImpl
public NestedBlockBuilderImpl(BlockBuilder block)
Constructs nested block builders starting of a given code block.- Parameters:
block
- root code block
-
-
Method Detail
-
nestBlock
public final BlockBuilder nestBlock()
Starts nested code block. The resulting block can optimize expressions and reuse already calculated values from the parent blocks.- Specified by:
nestBlock
in interfaceNestedBlockBuilder
- Returns:
- new code block that can optimize expressions and reuse already calculated values from the parent blocks.
-
nestBlock
public final void nestBlock(BlockBuilder block)
Uses given block as the new code context. The current block will be restored afterexitBlock()
call.- Specified by:
nestBlock
in interfaceNestedBlockBuilder
- Parameters:
block
- new code block- See Also:
exitBlock()
-
nestBlock
public final void nestBlock(BlockBuilder block, java.util.Map<RexNode,java.lang.Boolean> nullables)
Uses given block as the new code context and the map of nullability. The current block will be restored afterexitBlock()
call.- Specified by:
nestBlock
in interfaceNestedBlockBuilder
- Parameters:
block
- new code blocknullables
- map of expression to its nullability state- See Also:
exitBlock()
-
currentBlock
public final BlockBuilder currentBlock()
Returns the current code block- Specified by:
currentBlock
in interfaceNestedBlockBuilder
- Returns:
- current code block
-
currentNullables
public final java.util.Map<RexNode,java.lang.Boolean> currentNullables()
Returns the current nullability state of rex nodes. The resulting value is the summary of all the maps in the block hierarchy.- Specified by:
currentNullables
in interfaceNestedBlockBuilder
- Returns:
- current nullability state of rex nodes
-
exitBlock
public final void exitBlock()
Leaves the current code block.- Specified by:
exitBlock
in interfaceNestedBlockBuilder
- See Also:
nestBlock()
-
-