简体   繁体   English

色调黑斑羚中的 SQL 创建 function 语法错误

[英]SQL create function syntax error in hue impala

I'm a newbie to SQL.我是 SQL 的新手。 I'm trying to create a function from this post in Hue impala.我正在尝试从 Hue impala 的这篇文章中创建一个 function。 I've change [dbo].[Split] to dbo.split as there was error.由于出现错误,我已将[dbo].[Split]更改为dbo.split 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))在代码编辑器中,我在varchar下有一条红线create function dbo.split(@string varchar(max), @delimiter char(1))

I'm not sure what's wrong with my create function code.我不确定我创建的 function 代码有什么问题。

Any help would be appreciated!任何帮助,将不胜感激!

You can refer to below link for how to create functions in Impala.您可以参考以下链接了解如何在 Impala 中创建函数。 Creating user-defined functions are not very common in impala.在 impala 中创建用户定义的函数并不常见。
https://impala.apache.org/docs/build/html/topics/impala_create_function.html 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。
split_part(string source, string delimiter, bigint n)
select split_part('x,y,z',',',1) out; +-----------------------------+ | out | +-----------------------------+ | x | +-----------------------------+

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM