[ 
https://issues.apache.org/jira/browse/DRILL-1441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14143650#comment-14143650
 ] 

Julian Hyde commented on DRILL-1441:
------------------------------------

For the record, REPLACE is not in the SQL standard. It is in Oracle and MSSQL, 
however, and there is no equivalent in the standard.

http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions134.htm

REPLACE is a non-reserved SQL keyword -- Drill uses it in CREATE OR REPLACE 
VIEW. You can use a keyword as an identifier as long as it is not reserved. You 
need to add REPLACE to the {{NonReservedKeyWord()}} rule in the parser.

> Replace sql function requires backticks to avoid parse error
> ------------------------------------------------------------
>
>                 Key: DRILL-1441
>                 URL: https://issues.apache.org/jira/browse/DRILL-1441
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Functions - Drill
>            Reporter: Krystal
>
> git.commit.id.abbrev=f8d38b6
> Currently the "replace" function requires to be enclosed within backticks 
> (ie. `replace`); otherwise it would fail during the parsing.
> For example the following query fails:
> 0: jdbc:drill:schema=M7> select replace(substring(name,1,10), 'or', 'EA') 
> from `dfs.default`.voter where name like 'victor%';
> Query failed: Failure while parsing sql. Encountered "replace" at line 1, 
> column 8.
> Was expecting one of:
>     "UNION" ...
>     "INTERSECT" ...
>     "EXCEPT" ...
> .
> .
> .
> The following modified query succeeds:
> 0: jdbc:drill:schema=M7> select `replace`(substring(name,1,10), 'or', 'EA') 
> from `dfs.default`.voter where name like 'victor%';
> +------------+
> |   EXPR$0   |
> +------------+
> | victEA tho |
> | victEA you |
> | victEA rob |
> | victEA van |
> | victEA rob |
> .
> .
> .
> The parse error was originally filed in this jira: 
> https://issues.apache.org/jira/browse/DRILL-738.  We should find a way to 
> avoid requiring backticks as this is a standard sql function.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to