Re: How to rewrite a query using calcite. Any Example?

2021-01-05 Thread JiaTao Tao
Hi
Try this:  SqlParser.create(expr).parseExpression();

Regards!

Aron Tao


kant kodali  于2021年1月5日周二 上午9:34写道:

> Hi All,
>
> is there a way to parse only the where clause using calcite (any sample
> code)? meaning,  for example, assume the input is something like
>
> view1.col1 = value1 or view2.col2 = value2 and view3.col3 = value3
>
> I want to parse this expression and replace view1.col1 with a, view2.col2
> with b and view3.col3 = c such that the output should be
>
> a = value1 or b = value2 and c = value3.
>
> This is just an example but I can get more complex boolean expressions as
> input.
>
> Thanks!
>


[jira] [Created] (CALCITE-4456) Allows all the value expressions for explicit row value constructor

2021-01-05 Thread Danny Chen (Jira)
Danny Chen created CALCITE-4456:
---

 Summary: Allows all the value expressions for explicit row value 
constructor
 Key: CALCITE-4456
 URL: https://issues.apache.org/jira/browse/CALCITE-4456
 Project: Calcite
  Issue Type: Task
  Components: core
Affects Versions: 1.26.0
Reporter: Danny Chen
Assignee: Danny Chen
 Fix For: 1.27.0


In SQL standard 2011 part 7 value expression, it defines the SQL syntax for 
explicit ROW value constructor to allows all the valid value expreesion:

{code:sql}
 ::=

  | 
  | 

 ::=

  | 
  | 
  | 
  | 
  | 
  | 


 ::=
  
 
  | ROW   
  | 

 ::=
  
{code}

I also tried the PostgreSQL 9.6 for the query:

{code:sql}
create table t1(
  f0 int,
  f1 varchar(20)
);

insert into t1 values(1, 'abc');

-- select row(t1.f0 + 1, t1.f1) from t1; -- outputs (2, abc)
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)