0

I'm a newbie to SQL. I'm trying to create a function from this post in Hue impala. I've change [dbo].[Split] to dbo.split as there was error. But now, I'm getting a different error:

AnalysisException: Syntax error in line49:undefined: create function dbo.split(@input varchar(max), @delimi... ^ Encountered: Unexpected character Expected: ARRAY, BIGINT, BINARTY, BOOLEAN, CHAR, DATE, DATETIME, DECIMAL, REAL, FLOAT, INTEGER, MAP, SMALLINT, STING, STRUCT, TIMESTAMP, TINYINT, VARCHAR CAUSED BY: Exception: Syntax error

and in the code editor, I'm getting a red line under varchar among create function dbo.split(@string varchar(max), @delimiter char(1))

I'm not sure what's wrong with my create function code.

Any help would be appreciated!

user3415167
  • 1,013
  • 2
  • 13
  • 23

1 Answers1

2

You can refer to below link for how to create functions in Impala. Creating user-defined functions are not very common in impala.
https://impala.apache.org/docs/build/html/topics/impala_create_function.html
You can also use in-built split functions like split_part.
split_part(string source, string delimiter, bigint n)
select split_part('x,y,z',',',1) out; +-----------------------------+ | out | +-----------------------------+ | x | +-----------------------------+

Koushik Roy
  • 6,868
  • 2
  • 12
  • 33