Hi,
Dear developers,

I am working on a SQL engine based on Calcite.
I defined a AbstractTable which provides a getRowType() method to tell its 
columns look like: NAME char, AGE integer

Then I override the scan(DataContext, java.util.List<RexNode>) method to 
implement the searching function.
When I sent a SQL command like

select * from PERSONS where NAME=‘bluejoe’ and AGE>30

In the scan(DataContext, java.util.List<RexNode>) method,
I found the filter on column `AGE` is parsed properly like `>($2, 30)`

While the filter on column `NAME` is parsed as:

=(CAST($1):CHAR(7) CHARACTER SET "ISO-8859-1" COLLATE 
"ISO-8859-1$en_US$primary" NOT NULL, 'bluejoe’)

To make my program work, I have to unwrap the CastFunction Object to get the 
inner $1 value, ignoring extra information, CHAR(7), for example. You know, 
this way looks very strange and easy to crash.

I am wonder if there is a more robust way to get the inline `NAME` column name?
Or if I define the column type in a wrong way?

I need your kind help!
Many thanks!

Best regards,
shen, from China 

Reply via email to