元编程实现字符串搜索

想请教一下如何在元编程中实现以下的语句来搜索字符串,参数可能有多个,例如为2个时(“新能源”、“光伏”)为:
where (index_full_name like "%新能源%" or index_full_name like "%光伏%")

似乎报错为:

The where clause [any(index_full_name like:R ["%新能源%","%光伏%"])] of a distributed/partitioned sql shouldn't use any aggregate or order-sensitive function.
请先 登录 后评论

1 个回答

veryOrdinary

where 里可以用 rowOr( col like:R ["%新能源%", "%光伏%"]), 元编程可参考下述脚本

pattern = ["%新能源%", "%光伏%"]
colMeta = "flagName"
whereCond = makeCall(def(colMeta, pattern){return rowOr(colMeta like:R pattern)}, sqlCol(colMeta), pattern)
t = table(["新能源01", "新能源02", "电力01"] as flagName, 1 2 3 as val)
sql(sqlCol("val"), t, whereCond).eval()


请先 登录 后评论