protected void collectInsertTargets(SqlInsert call,final RexNode sourceRef,final List<String> targetColumnNames,List<RexNode> columnExprs){
  final RelOptTable targetTable=getTargetTable(call);
  final RelDataType targetRowType=targetTable.getRowType();
  SqlNodeList targetColumnList=call.getTargetColumnList();
  if (targetColumnList == null) {
    targetColumnNames.addAll(targetRowType.getFieldNames());
  }
 else {
    for (int i=0; i < targetColumnList.size(); i++) {
      SqlIdentifier id=(SqlIdentifier)targetColumnList.get(i);
      targetColumnNames.add(id.getSimple());
    }
  }
  for (int i=0; i < targetColumnNames.size(); i++) {
    final RexNode expr=rexBuilder.makeFieldAccess(sourceRef,i);
    columnExprs.add(expr);
  }
}

protected void collectInsertTargets ( SqlInsert call , final RexNode sourceRef , final List < String > targetColumnNames , List < RexNode > columnExprs ) { final RelOptTable targetTable = getTargetTable ( call ) ; final RelDataType targetRowType = targetTable . getRowType ( ) ; SqlNodeList targetColumnList = call . getTargetColumnList ( ) ; if ( targetColumnList == null ) { targetColumnNames . addAll ( targetRowType . getFieldNames ( ) ) ; } else { for ( int i = 0 ; i < targetColumnList . size ( ) ; i ++ ) { SqlIdentifier id = ( SqlIdentifier ) targetColumnList . get ( i ) ; targetColumnNames . add ( id . getSimple ( ) ) ; } } for ( int i = 0 ; i < targetColumnNames . size ( ) ; i ++ ) { final RexNode expr = rexBuilder . makeFieldAccess ( sourceRef , i ) ; columnExprs . add ( expr ) ; } }
given an insert statement , collects the list of names to be populated and the expressions to put in them .
