【问题标题】:Pyspark error: SparkException: Exception thrown in Future.get:Pyspark 错误:SparkException:Future.get 中抛出的异常:
【发布时间】:2021-04-14 16:37:03
【问题描述】:

我有以下代码:

fact_item = (
  spark.table('nn_team7_es.fact_table')
  .union(spark.table('nn_squad7_cs.fact_table'))
  .filter((f.col('date_key').between(start_py, end_py)) | (f.col('date_key').between(start_cy, end_cy)))
  .filter(f.col('source') == 'tickets')
  .filter(f.col('subtype') == 'item')
  .filter(f.col('is_trx_ok') == 1)
  .filter(f.col('is_return_item') == 0)
  .groupby('iso_country_code',
           'store_id',
           'date_key',
           'ticket_id',
           'customer_id',
           'item_id')
  .agg(f.sum('item_quantity').alias('item_quantity'),
       f.sum(f.col('item_extended_amount') - f.col('item_vat_amount')).alias('item_net_amount'))
  .join(dim_dates, on=['date_key'], how='inner')
  .join(dim_stores, on=['store_id'], how='inner')
  .join(dim_products, on=['iso_country_code', 'item_id'], how='left')
  .fillna(value='undefined', subset=['item_description', 'WGI', 'UWG', 'Family', 'Brand'])
)

display(fact_item)

当我运行此代码时,我收到以下错误:

SparkException:Future.get 中抛出异常:

如果我在没有最后一次显示的情况下运行代码,我不会收到任何错误。因为我以前在运行代码时从未见过它,所以我不明白为什么会得到它。有什么想法吗?

【问题讨论】:

标签: python dataframe pyspark


【解决方案1】:

检查连接列的数据类型。 此外,您只会在使用 display()count() 时看到错误,查询会按预期运行。

P.S:我遇到了同样的问题,一旦我解决了数据类型不匹配的问题,它就可以正常工作了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-24
    • 2018-02-27
    • 2012-08-26
    • 1970-01-01
    • 2017-10-07
    • 1970-01-01
    相关资源
    最近更新 更多