oozie - 运行 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:整数除法或以零为模
解决方案
推荐阅读
- ios - 如何快速将图像从一个视图控制器传递到另一个视图控制器?
- php - 缺少 php-fpm.sock:CentOS 7 上的 php7.2
- r - 使用 mutate() 和 srvyr 包计算权重调查中的百分比 - 为什么 R 会返回错误?
- android - 我在使用最新的 Android Studio Gradle 更新 3.3.1 时遇到问题
- ssas - SSAS多维立方体 - 分区的并行处理
- java - 在多个文件上使用 groupingBy 条件后获取计数
- haxe - HaxeFlixel 意外和(amp)字符
- c# - 大数据下载报告时挂起问题
- java - Java 输入流读取两次
- python-2.7 - 如何将 Powershell 函数转换为在 Python 脚本中工作?