0
我有一个字符串变量dest
,它保存了一定的值。我需要检查这个变量是否存在于已注册的临时表中。我使用下面的查询来找到它。如何将数据框与字符串变量进行比较
terminatecheck = sqlContext.sql("""
SELECT 1 as op from known where node = """+dest +""" and 1=1
""")
现在我需要将terminatecheck的值与“1”进行比较并终止循环。 我检查并发现terminatecheck是一个行对象。我究竟如何比较呢?
if terminatecheck.op =="1":
不起作用
我解决了它,通过检查.count()它也工作 – mhn