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

kate commented on CALCITE-6480:
-------------------------------

[~julianhyde] Maybe I can write the code like this?
{code:java}
@Override public void unparseBoolLiteral(SqlWriter writer,
    SqlLiteral literal, int leftPrec, int rightPrec) {
  Boolean value = (Boolean) literal.getValue();
  if (value == null || majorVersion >= 23) {
    super.unparseBoolLiteral(writer, literal, leftPrec, rightPrec);
    return;
  }
  // low version oracle not support bool literal
  final SqlWriter.Frame frame = writer.startList("(", ")");
  writer.literal("1");
  writer.setNeedWhitespace(true);
  writer.sep(SqlStdOperatorTable.EQUALS.getName());
  writer.setNeedWhitespace(true);
  writer.literal(value ? "1" : "0");
  writer.endList(frame);
}{code}

> OracleDialect does not support CASE WHEN returning boolean
> ----------------------------------------------------------
>
>                 Key: CALCITE-6480
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6480
>             Project: Calcite
>          Issue Type: Wish
>          Components: core
>            Reporter: kate
>            Priority: Minor
>
> Our requirement is to use Calcite to translate queries into different 
> dialects. During validation in the TPC-DS scenario, we found that {{Oracle}} 
> does not support SQL statements like
> {code:java}
> SELECT * FROM xxx
> WHERE CASE WHEN a > 10 THEN b < 5 ELSE c > 0 END;{code}
> Therefore, we hope to remove such predicates at the dialect like Oracle.
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to