【发布时间】:2021-09-03 20:54:10
【问题描述】:
我想返回sql计数结果,如果计数大于0我想诱导一个失败函数。
但是,我遇到了一个错误。我认为这是因为 id_of_zero_count 是一个字符串,不能与整数进行比较?
id_of_zero_count = sql(""" SELECT count(*) cnt FROM schema.table where ID = 0 """.format(val))
#BU.collect[0][0] returns the value of the first row & first column
display(id_of_zero_count)
if id_of_zero_count > 0:
print("Quality check not passed")
induce_fail_func()
这是返回的错误:
TypeError: '>' not supported between instances of 'DataFrame' and 'int'
TypeError Traceback (most recent call last)
<command-873419207778593> in <module>
----> 1 if id_of_zero_count > 0:
2 print("Quality check not passed")
3 induce_fail_func()
TypeError: '>' not supported between instances of 'DataFrame' and 'int'
【问题讨论】:
标签: python apache-spark-sql databricks