calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yuzhao Chen <>
Subject Re: Parsing DB2 sql statements
Date Thu, 06 Jun 2019 12:31:14 GMT
Another choice is just like you said, you can add Date as UDF but because
Date is a reserved word, you may need to quote the function name like
`Date`(col1) based on what quoting character you use.

Andrew O <> 于2019年6月6日周四 下午7:07写道:

> I'm doing a project trying to parse some IBM DB2 sql expressions (to
> analyze table / column usages).
> To note,
> 1) these are existing ad-hoc user queries so I can't change their syntax
> 2)  I don't have a connection / schema for the database,  but my
> understanding is that this shouldn't be required by Calcite for this
> kind of work.
> Currently I'm hitting some parsing issues with queries like
>     select Date(x.col1), x.col2 from myTable x
> It fails parse at the point of the Date function call. This is trying to
> use the function to convert the value of col1 to a date (almost similar to
> a cast/convert).
> My current thinking would be that this  may need changes to the parser
> grammar (through an extension?). Or perhaps this could be registered as a
> custom User Defined Function of some kind (although Date seems like a
> reserved word)?
> Is this the right thinking,  or is there another approach I could look at?
> Thanks in advance
> Andrew

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message