Skip to content

Feature: Better display of retained identity #19027

@KKould

Description

@KKould

Summary

In this case, when creating the UDF, the inability to parse it is reasonable because the ident: stage field in the returns table is preserved(src/query/ast/src/parser/token.rs:1762). However, the reason for the error is difficult to understand.

root@localhost:8000/default/default> CREATE OR 
REPLACE FUNCTION ai_list_files (data_stage STAGE_LOCATION, l INT) RETURNS TABLE (
stage VARCHAR,
relative_path VARCHAR,
path VARCHAR,
is_dir BOOLEAN,
size BIGINT,
mode VARCHAR,
content_type VARCHAR,
etag VARCHAR,
truncated BOOLEAN
) LANGUAGE python HANDLER='ai_list_files' address='https://api.bendml.com';
error: APIError: QueryFailed: [1005]error: 
  --> SQL:3:1
  |
1 | CREATE OR 
  | ------ while parsing `CREATE [OR REPLACE] FUNCTION [IF NOT EXISTS] <udf_name> <udf_definition> [DESC = <description>]`
2 | REPLACE FUNCTION ai_list_files (data_stage STAGE_LOCATION, l INT) RETURNS TABLE (
  |                                -                                          ----- while parsing TABLE (<return_type>, ...)
  |                                |                                           
  |                                while parsing (<arg_name arg_type>, ...) RETURNS <return body> { AS <sql> | LANGUAGE <language> HANDLER=<handler> ADDRESS=<udf_server_address> } }
3 | stage VARCHAR,
  | ^^^^^ unexpected `stage`, expecting <LiteralString>, <Ident>, `IDENTIFIER`, or `)`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions