1. 如何“非正則”地遍歷一個目錄下某些特定的文件车猬?
在spark中newHadoopAPI()或者FSShell其實都是支持正則話輸入路徑的,不要怕輸入的路徑太長韩脏,一定要正則化輸入路徑赡矢;
- https://stackoverflow.com/questions/31782763/how-to-use-regex-to-include-exclude-some-input-files-in-sc-textfile
- https://stackoverflow.com/questions/24224392/why-does-spark-throw-notserializableexception-org-apache-hadoop-io-nullwritable
2. 在讀取->repartition->重新再寫入的過程中阅仔,遇到序列化失敗該如何處理?
盡量使用kyro序列化空民,兼容性還是比較好界轩;
同時注意null值的處理;
- http://apache-spark-developers-list.1001551.n3.nabble.com/NullWritable-not-serializable-td8412.html
- https://stackoverflow.com/questions/22592811/task-not-serializable-java-io-notserializableexception-when-calling-function-ou/22594142#22594142
- https://issues.apache.org/jira/browse/SPARK-2421
- https://spark.apache.org/docs/latest/tuning.html