public static StructType convertFrameSchemaToDFSchema(ValueType[] fschema,boolean containsID){
  List<StructField> fields=new ArrayList<StructField>();
  if (containsID)   fields.add(DataTypes.createStructField(RDDConverterUtils.DF_ID_COLUMN,DataTypes.DoubleType,true));
  int col=1;
  for (  ValueType schema : fschema) {
    DataType dt=null;
switch (schema) {
case STRING:
      dt=DataTypes.StringType;
    break;
case DOUBLE:
  dt=DataTypes.DoubleType;
break;
case INT:
dt=DataTypes.LongType;
break;
case BOOLEAN:
dt=DataTypes.BooleanType;
break;
default :
dt=DataTypes.StringType;
LOG.warn("Using default type String for " + schema.toString());
}
fields.add(DataTypes.createStructField("C" + col++,dt,true));
}
return DataTypes.createStructType(fields);
}

public static StructType convertFrameSchemaToDFSchema ( ValueType [ ] fschema , boolean containsID ) { List < StructField > fields = new ArrayList < StructField > ( ) ; if ( containsID ) fields . add ( DataTypes . createStructField ( RDDConverterUtils . DF_ID_COLUMN , DataTypes . DoubleType , true ) ) ; int col = 1 ; for ( ValueType schema : fschema ) { DataType dt = null ; switch ( schema ) { case STRING : dt = DataTypes . StringType ; break ; case DOUBLE : dt = DataTypes . DoubleType ; break ; case INT : dt = DataTypes . LongType ; break ; case BOOLEAN : dt = DataTypes . BooleanType ; break ; default : dt = DataTypes . StringType ; LOG . warn ( "Using default type String for " + schema . toString ( ) ) ; } fields . add ( DataTypes . createStructField ( "C" + col ++ , dt , true ) ) ; } return DataTypes . createStructType ( fields ) ; }
this function will convert frame schema into dataframe schema
