想问一下这样去空值为什么是无效的呢?ColName是一个字符串。
def f1(t,ColName){ return sql(select = sqlCol("*"), from = t, where = [< parseExpr(ColName) is not null >])}
可以改成这样 where=[parseExpr(ColName+" is not null")] parseExpr 将字符串转成元代码,<>是声明元代码的,< parseExpr(ColName) is not null > 相当于把这个函数包在元代码里,是不会被执行的,where 这里主要是填一个条件元代码,所以可以直接拼接字符串让 parseExpr 转成元代码。