首页 > 解决方案 > 运行 oozie 工作流并遇到以下错误

问题描述

我正在创建一个工作流来监视我的规则表中的一些空值,其中要监视的列之一是检查从昨天到今天的表的百分比变化,以便我编写我的 pyscript 如下

def calculate_size_increase(tblname):
df = None
q_last_run_date = "select scvcju_run_time_s as last_run_date,   \
scvcju_total_records_in_column_r as last_count from " + db_name \
+ "." + master_table + " where scvcju_rules_table_name_x = '" + tblname + "'"
df = spark.sql(q_last_run_date)
if df.count() == 0:
    return 100
else:
    last_run_date= df.sort(df.last_run_date.desc()).first().last_run_date
    last_count=df.sort(df.last_run_date.desc()).first().last_count

q_todays_count = "select count(1) as c from " + db_name + "." + tblname
df = spark.sql(q_todays_count)
todays_count = df.first().c

return 100 * ((todays_count - last_count) / last_count)

运行工作流程时出现此错误

ZeroDivisionError:整数除法或以零为模

标签: oozieoozie-workflow

解决方案


推荐阅读