[
https://issues.apache.org/jira/browse/HIVE-26314?focusedWorklogId=782079&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-782079
]
ASF GitHub Bot logged work on HIVE-26314:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 16/Jun/22 15:22
Start Date: 16/Jun/22 15:22
Worklog Time Spent: 10m
Work Description: wecharyu commented on code in PR #3360:
URL: https://github.com/apache/hive/pull/3360#discussion_r899205805
##########
parser/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g:
##########
@@ -1613,10 +1613,10 @@ resourceType
createFunctionStatement
@init { pushMsg("create function statement", state); }
@after { popMsg(state); }
- : KW_CREATE (temp=KW_TEMPORARY)? KW_FUNCTION functionIdentifier KW_AS
StringLiteral
+ : KW_CREATE (temp=KW_TEMPORARY)? KW_FUNCTION orReplace? ifNotExists?
functionIdentifier KW_AS StringLiteral
Review Comment:
@nrg4878 The reason I use "create function or replace" is that “create or
replace" can only be used for one statement, I will get error like below when I
use "create or replace function":
```bash
org.apache.hadoop.hive.ql.parse.ParseException: line 3:18 mismatched input
'function' expecting KW_VIEW near 'replace' in create view statement
```
I am not sure if `antlr3` does not support this syntax in two statements, if
you have any idea please let me know.
Issue Time Tracking
-------------------
Worklog Id: (was: 782079)
Time Spent: 1h (was: 50m)
> Support alter function in Hive DDL
> ----------------------------------
>
> Key: HIVE-26314
> URL: https://issues.apache.org/jira/browse/HIVE-26314
> Project: Hive
> Issue Type: Task
> Components: Hive
> Affects Versions: 4.0.0-alpha-1
> Reporter: Wechar
> Assignee: Wechar
> Priority: Minor
> Labels: pull-request-available
> Fix For: 4.0.0-alpha-2
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Hive SQL does not support {{*ALTER FUNCTION*}} yet, we can refer to the
> {{*CREATE [OR REPLACE] FUNCTION*}} of
> [Spark|https://spark.apache.org/docs/3.1.2/sql-ref-syntax-ddl-create-function.html]
> to implement the alter function .
> {code:sql}
> CREATE [ TEMPORARY ] FUNCTION [ OR REPLACE ] [IF NOT EXISTS ]
> [db_name.]function_name AS class_name
> [USING JAR|FILE|ARCHIVE 'file_uri' [, JAR|FILE|ARCHIVE 'file_uri'] ];
> {code}
> * *OR REPLACE*
> If specified, the resources for the function are reloaded. This is mainly
> useful to pick up any changes made to the implementation of the function.
> This parameter is mutually exclusive to {{*IF NOT EXISTS*}} and can not be
> specified together.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)