[ 
https://issues.apache.org/jira/browse/PHOENIX-3347?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Lomore updated PHOENIX-3347:
---------------------------------
    Description: 
Current conformance settings do not allow SELECT statements without a FROM 
clause

According to the Calcite parser,
{{FROM is mandatory in standard SQL, optional in dialects such as MySQL, 
PostgreSQL. The parser allows SELECT without FROM, but the validator fails if 
conformance is, say, STRICT_2003.}}

{code:title=PhoenixCalciteEmbeddedDriver.java}         public Connection 
connect(String url, Properties info) throws SQLException {
        if (!acceptsURL(url)) {
            return null;
        }
        
        Properties info2 = new Properties(info);
        setPropertyIfNotSpecified(
                info2,
                CalciteConnectionProperty.TYPE_SYSTEM.camelName(),
                PhoenixRelDataTypeSystem.class.getName());
        setPropertyIfNotSpecified(
                info2,
                CalciteConnectionProperty.CONFORMANCE.camelName(),
                SqlConformance.ORACLE_10.toString());{code}

Note that the actual failure occurs when the SqlValidator rejects the statement
{{Caused by: org.apache.calcite.sql.validate.SqlValidatorException: SELECT must 
have a FROM clause}}

Either need to change conformance or stop supporting SELECT without FROM as 
Phoenix currently does.

  was:
Current conformance settings do not allow SELECT statements without a FROM 
clause

According to the Calcite parser,
{{FROM is mandatory in standard SQL, optional in dialects such as MySQL,
 * PostgreSQL. The parser allows SELECT without FROM, but the validator fails
 * if conformance is, say, STRICT_2003.}}

{code:title=PhoenixCalciteEmbeddedDriver.java}         public Connection 
connect(String url, Properties info) throws SQLException {
        if (!acceptsURL(url)) {
            return null;
        }
        
        Properties info2 = new Properties(info);
        setPropertyIfNotSpecified(
                info2,
                CalciteConnectionProperty.TYPE_SYSTEM.camelName(),
                PhoenixRelDataTypeSystem.class.getName());
        setPropertyIfNotSpecified(
                info2,
                CalciteConnectionProperty.CONFORMANCE.camelName(),
                SqlConformance.ORACLE_10.toString());{code}

Note that the actual failure occurs when the SqlValidator rejects the statement
{{Caused by: org.apache.calcite.sql.validate.SqlValidatorException: SELECT must 
have a FROM clause}}

Either need to change conformance or stop supporting SELECT without FROM as 
Phoenix currently does.


> Change conformance or remove SELECT statements without FROM clauses
> -------------------------------------------------------------------
>
>                 Key: PHOENIX-3347
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3347
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: Eric Lomore
>            Assignee: Eric Lomore
>
> Current conformance settings do not allow SELECT statements without a FROM 
> clause
> According to the Calcite parser,
> {{FROM is mandatory in standard SQL, optional in dialects such as MySQL, 
> PostgreSQL. The parser allows SELECT without FROM, but the validator fails if 
> conformance is, say, STRICT_2003.}}
> {code:title=PhoenixCalciteEmbeddedDriver.java}         public Connection 
> connect(String url, Properties info) throws SQLException {
>         if (!acceptsURL(url)) {
>             return null;
>         }
>         
>         Properties info2 = new Properties(info);
>         setPropertyIfNotSpecified(
>                 info2,
>                 CalciteConnectionProperty.TYPE_SYSTEM.camelName(),
>                 PhoenixRelDataTypeSystem.class.getName());
>         setPropertyIfNotSpecified(
>                 info2,
>                 CalciteConnectionProperty.CONFORMANCE.camelName(),
>                 SqlConformance.ORACLE_10.toString());{code}
> Note that the actual failure occurs when the SqlValidator rejects the 
> statement
> {{Caused by: org.apache.calcite.sql.validate.SqlValidatorException: SELECT 
> must have a FROM clause}}
> Either need to change conformance or stop supporting SELECT without FROM as 
> Phoenix currently does.



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

Reply via email to