Open WenyXu opened 12 months ago
It's not a bug too.
If you want to call script by HTTP API, the name is the script name you pass when saving the scripts. If you want to call the function in SQL, you must use the function name in script. Sorry for the misunderstood, I will clarify it in the documentation.
Some more subtle manner:
If we don't support multiple @coprocessor
in one file, what if we always infer the name from script?
If the database is closed and restart, you should execute via HTTP or register a new script to trigger the scripts function load for SQL.
recompile_register_udf
seems indicate that we don't auto reload scripts on restart.
cc @discord9
What type of bug is this?
Unexpected error
What subsystems are affected?
Datanode
What happened?
Mentioned in https://docs.greptime.com/user-guide/python-scripts/data-types
Notes: the function name is
query_numbers
// file query_numbers.py
curl --data-binary "@query_numbers.py" -XPOST "http://localhost:4000/v1/scripts?name=query_number&db=public"
Execute sql
select query_number();
Output:
However, it works via http.
If you change
?name=query_number
to?name=query_numbers
, everything works.What operating system did you use?
Ubuntu 23.04
Relevant log output and stack trace
No response
How can we reproduce the bug?
Mentioned in https://docs.greptime.com/user-guide/python-scripts/data-types
Notes: the function name is
query_numbers
// file query_numbers.py
curl --data-binary "@query_numbers.py" -XPOST "http://localhost:4000/v1/scripts?name=query_number&db=public"
Execute sql
select query_number();