通过一些键对javascript对象进行排序

时间:2019-04-15 12:41:10

标签: javascript

如何对看起来像这样的对象进行排序:

val df = sparkSession
      .readStream
      .format("kafka")
      .option("kafka.bootstrap.servers", "localhost:9092")
      .option("kafkfa.offset.strategy","latest")
      .option("subscribe", "mytopic")
      .load()
      df.printSchema()

      val tdf = df.selectExpr("CAST(value AS STRING)").as[String].select("value").writeStream.format("console")
    .option("truncate","false")
    .start()


    tdf.map(record =>  {//do something})

      sparkSession.streams.awaitAnyTermination

仅按课程名称。因此,它看起来像

 data = [{'Name': 'Peter', 'Chemistry': 10, 'Math': 9, 'Geography': 5},
         {'Name': 'Bob', 'Math': 6, 'Chemistry': 10, 'Geography': 5}]

0 个答案:

没有答案