Advanced Analytics: Hands-On Exercise 1

JCA
Contributor

Hello I am new to Exasol and I´m doing the "Advanced Analytics" course.

In the first Hands On exercise i get the following error:

SQL Error [22002]: VM error: F-UDF-CL-LIB-1125: F-UDF-CL-SL-R-1000: F-UDF-CL-SL-R-1015: Error in parse(text = code, encoding = "UTF-8") :
<text>:1:23: unexpected input
1: run <- function(ctx) {
^
(Session: 1706973137039392768)

The script code is taken from the exasol generator:

--/
CREATE OR REPLACE R SCALAR SCRIPT random_password()
RETURNS CHAR(16) AS
run <- function(ctx) {
## TODO: implement script
"TEST"
}
/

and the select querry is the following:

SELECT random_password();

1 ACCEPTED SOLUTION
6 REPLIES 6

exa-Uwe
Moderator
Moderator

Hi JCA,

when I just copy your code and run it, it works for me:

exaUwe_0-1627902375105.png

So I cannot reproduce your error. I'm using DbVisualizer as a SQL client, running against an Exasol Community Edition 7.1.rc1. What's your environment like?

Could you check if it works as a Lua UDF:

--/
CREATE OR REPLACE LUA SCALAR SCRIPT random_password()
RETURNS VARCHAR(2000000) AS
function run(ctx)
-- TODO: implement script
return 'TEST'
end
/

SELECT random_password();

Best regards

Uwe

JCA
Contributor

Hi,

with LUA works.


I´m using DBeaver  Version 21.1.1.202106210824
The exasol version is 7.0.10

 

Charlie
Xpert

DBeaver does not support --/ for setting command separator.

 

CREATE OR REPLACE LUA SCALAR SCRIPT random_password() 
RETURNS VARCHAR(2000000) AS 
function run(ctx)
-- TODO: implement script
return 'TEST'
end
;

SELECT random_password();

JCA
Contributor

Hello Charlie,

The Script in R does not work.

From the generator:

CREATE OR REPLACE R SCALAR SCRIPT random_passwort()
RETURNS CHAR(20) AS
run <- function(ctx){
## TODO: implement script
NA
}
;

 

it still does not work. I changed, as you suggested, the "/" with ";" but nothing. Same error:

 

"SQL Error [22002]: VM error: F-UDF-CL-LIB-1125: F-UDF-CL-SL-R-1000: F-UDF-CL-SL-R-1015: Error in parse(text = code, encoding = "UTF-8") :
<text>:1:22: unexpected input
1: run <- function(ctx){"

 

exa-Uwe
Moderator
Moderator

Of course! I forgot that I've done a similar fix for dbVisualizer already - we don't see R scripts so often, therefore this is easily overlooked.