private void convertValuesImpl(Blackboard bb,SqlCall values,RelDataType targetRowType){
  RelNode valuesRel=convertRowValues(bb,values,values.getOperandList(),true,targetRowType);
  if (valuesRel != null) {
    bb.setRoot(valuesRel,true);
    return;
  }
  final List<RelNode> unionRels=new ArrayList<>();
  for (  SqlNode rowConstructor1 : values.getOperandList()) {
    SqlCall rowConstructor=(SqlCall)rowConstructor1;
    Blackboard tmpBb=createBlackboard(bb.scope,null,false);
    replaceSubqueries(tmpBb,rowConstructor,RelOptUtil.Logic.TRUE_FALSE_UNKNOWN);
    final List<Pair<RexNode,String>> exps=new ArrayList<>();
    for (    Ord<SqlNode> operand : Ord.zip(rowConstructor.getOperandList())) {
      exps.add(Pair.of(tmpBb.convertExpression(operand.e),validator.deriveAlias(operand.e,operand.i)));
    }
    RelNode in=(null == tmpBb.root) ? LogicalValues.createOneRow(cluster) : tmpBb.root;
    unionRels.add(RelOptUtil.createProject(in,Pair.left(exps),Pair.right(exps),true));
  }
  if (unionRels.size() == 0) {
    throw Util.newInternal("empty values clause");
  }
 else   if (unionRels.size() == 1) {
    bb.setRoot(unionRels.get(0),true);
  }
 else {
    bb.setRoot(LogicalUnion.create(unionRels,true),true);
  }
}

private void convertValuesImpl ( Blackboard bb , SqlCall values , RelDataType targetRowType ) { RelNode valuesRel = convertRowValues ( bb , values , values . getOperandList ( ) , true , targetRowType ) ; if ( valuesRel != null ) { bb . setRoot ( valuesRel , true ) ; return ; } final List < RelNode > unionRels = new ArrayList < > ( ) ; for ( SqlNode rowConstructor1 : values . getOperandList ( ) ) { SqlCall rowConstructor = ( SqlCall ) rowConstructor1 ; Blackboard tmpBb = createBlackboard ( bb . scope , null , false ) ; replaceSubqueries ( tmpBb , rowConstructor , RelOptUtil . Logic . TRUE_FALSE_UNKNOWN ) ; final List < Pair < RexNode , String > > exps = new ArrayList < > ( ) ; for ( Ord < SqlNode > operand : Ord . zip ( rowConstructor . getOperandList ( ) ) ) { exps . add ( Pair . of ( tmpBb . convertExpression ( operand . e ) , validator . deriveAlias ( operand . e , operand . i ) ) ) ; } RelNode in = ( null == tmpBb . root ) ? LogicalValues . createOneRow ( cluster ) : tmpBb . root ; unionRels . add ( RelOptUtil . createProject ( in , Pair . left ( exps ) , Pair . right ( exps ) , true ) ) ; } if ( unionRels . size ( ) == 0 ) { throw Util . newInternal ( "empty values clause" ) ; } else if ( unionRels . size ( ) == 1 ) { bb . setRoot ( unionRels . get ( 0 ) , true ) ; } else { bb . setRoot ( LogicalUnion . create ( unionRels , true ) , true ) ; } }
converts a values clause ( as in " insert into t ( x , y ) values ( 1 , 2 ) " ) into a relational expression .
