I’m encountering an error when defining a query function in DolphinDB. Here’s my scenario:
Table Definition:
dt = 2025.01.01T01:01:51.100 2025.01.02T01:01:51.000 2025.01.03T04:01:51.900
sym = ["IBM", "MSFTN", "GOOGS"]
value = 1..3
t = table(dt, sym, value)
Successful Direct Query:
day = "20250101"
date = temporalParse(day, "yyyyMMdd")
select * from t where date(dt) = date // Works correctly
/*
dt sym value
2025.01.01T01:01:51.100 IBM 1
*/
Function Implementation (Causing Error):
def myFunc(day, t) {
date = temporalParse(day, "yyyyMMdd")
return select * from t where date(dt) == date
}
myFunc("20250101", t) // The object '2025.01.01' is neither a XDB connection nor a function definition. RefId: S06006
Error Details:
Error code S06006 indicates calling a non-callable object.
User manual confirms only functions/XDB connections are callable.
What I Tried:
Verified direct query works outside the function.
Confirmed temporalParse correctly returns a DATE type (e.g., 2025.01.01).
Checked for typos/syntax issues in the function.
Question: Why does the same logic fail when encapsulated in a function? How should I modify myFunc to avoid the non-callable object error?
Environment:
DolphinDB version: 3.00.2.4 2025.02.26 WIN_JIT x86_64
OS: win10