sqlCol和sqlColAlias的区别

code=`000905

sql((sqlCol(`date),sqlCol(code,ratios, `ret)),table ).eval()

sql((sqlCol(`date),sqlColAlias(<ratios(code)>,`ret)),table).eval()

这两个表达应该是等价的吧,可是第一句解析正常,第二句报错是为什么呢。sqlCol和sqlColAlias的内在区别是什么呢?

Server response: '::evaluate(sql((sqlCol("date"), sqlColAlias(< ratios(code) >, "ret")), table)) => Usage: rati
os(X). X can't be string or symbol type.'
请先 登录 后评论

1 个回答

Polly

sql((sqlCol(`date),sqlCol(code,ratios, `ret)),table ).eval()

sqlCol 第一个参数为列名字符串,因此上述语句计算的是 table 中列名为 `000905 这列的 ratios。


sql((sqlCol(`date),sqlColAlias(<ratios(code)>,`ret)),table).eval()

sqlColAlias 第一个参数以 metaCode 传入,根据表达式计算的是 table 中列名为 `code 这列的 ratios, 如果您的 code 列是 SYMBOL 或 STRING 类型,则不能进行数值化运算的,因此报错 X can't be string or symbol type.

请先 登录 后评论
  • 1 关注
  • 0 收藏,587 浏览
  • Gaxia320 提出于 2023-05-31 10:48

相似问题