2

我注意到,当只用一个操作启动这组代码时,我启动了三个作业。

from typing import List
from pyspark.sql import DataFrame
from pyspark.sql.types import StructType, StructField, StringType
from pyspark.sql.functions import avg

data: List = [("Diamant_1A", "TopDiamant", "300", "rouge"),
    ("Diamant_2B", "Diamants pour toujours", "45", "jaune"),
    ("Diamant_3C", "Mes diamants préférés", "78", "rouge"),
    ("Diamant_4D", "Diamants que j'aime", "90", "jaune"),
    ("Diamant_5E", "TopDiamant", "89", "bleu")
  ]

schema: StructType = StructType([ \
    StructField("reference", StringType(), True), \
    StructField("marque", StringType(), True), \
    StructField("prix", StringType(), True), \
    StructField("couleur", StringType(), True)
  ])

dataframe: DataFrame = spark.createDataFrame(data=data,schema=schema)

dataframe_filtree:DataFrame = dataframe.filter("prix > 50")

dataframe_filtree.show()

根据我的理解,我应该只得到一个。一项行动对应一项工作。我正在使用 Databricks。这可能是问题所在。我有 2 个问题:

  • 为什么我有 3 个工作而不是 1 个?
  • 我可以改变这种行为吗?

这是第一份工作: 第一天

这是第二个: 为第二份工作达格

最后一个: 为第三份工作而奋斗

4

0 回答 0