2014-10-24 8 views

답변

0

이 문제에 대한 하나의 jira가 아직 해결되지 않은 경우 해당 jira 링크는 https://issues.apache.org/jira/browse/SPARK-4131입니다. 그러나 다음과 같이 할 수 있습니다 :

JavaSchemaRDD employeeSchemaRDD = context.sql("SELECT * FROM employee"); 

    JavaRDD<String> strRDD=employeeSchemaRDD.map(new Function<Row, String>() { 

     public String call(Row row) throws Exception { 
      // TODO Auto-generated method stub 
      return row.get(1).toString(); 
     } 

    }); 
strRDD.saveAsTextFile("outputdir"); 

출력을 쓰고 싶은 HDFS URL로 바꿉니다. 희망 답변입니다.