How to read specific lines from sparkContext
问题 Hi I am trying to read specific lines from a text file using spark. SparkConf conf = new SparkConf().setAppName(appName).setMaster(master); sc = new JavaSparkContext(conf); JavaRDD<String> lines = sc.textFile("data.txt"); String firstLine = lines.first(); It can used the .first() command to fetch the first line of the data.text document. How can I access Nth line of the document? I need java solution. 回答1: Apache Spark RDDs are not meant to be used for lookups. The most "efficient" way to get