public static boolean doesDataFrameLookLikeMatrix(DataFrame df){
  StructType schema=df.schema();
  StructField[] fields=schema.fields();
  if (fields == null) {
    return true;
  }
  for (  StructField field : fields) {
    DataType dataType=field.dataType();
    if ((dataType != DataTypes.DoubleType) && (dataType != DataTypes.IntegerType) && (dataType != DataTypes.LongType)&& (!(dataType instanceof VectorUDT))) {
      return false;
    }
  }
  return true;
}

public static boolean doesDataFrameLookLikeMatrix ( DataFrame df ) { StructType schema = df . schema ( ) ; StructField [ ] fields = schema . fields ( ) ; if ( fields == null ) { return true ; } for ( StructField field : fields ) { DataType dataType = field . dataType ( ) ; if ( ( dataType != DataTypes . DoubleType ) && ( dataType != DataTypes . IntegerType ) && ( dataType != DataTypes . LongType ) && ( ! ( dataType instanceof VectorUDT ) ) ) { return false ; } } return true ; }
examine the dataframe schema to determine whether the data appears to be a matrix .
