I changed the subject of the email to make it easier to find in the archives.

> On Jan 25, 2016, at 2:00 AM, Sharma, Sandeep <[email protected]> 
> wrote:
> 
> I am trying to evaluate apache calcite for one of our upcoming assignment to 
> convert SQL queries from Teradata to Spark, there are around sixty thousand 
> queries to convert so we are thinking to use calcite SQL builder APIs to 
> build the converted query using HIVE dialect. In this regard I see few 
> problems with calcite SQL builder

Building ASTs (i.e. SqlNodes) should work as long as you mainly have syntactic 
differences. If there are deeper semantic differences you could consider 
building RelNodes using RelBuilder.

> 1)      How do I add "OUTER" while constructing join? I am using SqlJoin 
> class to construct join however I didn't find any way to specify "OUTER" 
> keyword, please suggest best method how can I achieve this.

The "SqlLiteral joinType” field represents the join type (inner, left, right, 
full). For example pass in "JoinType.LEFT.symbol(SqlParserPosition.ZERO)” to 
represent a left outer join.

> 2)      CAST function does not FROMAT keyword, Calcite parser throws 
> exception to parser for example statements which has CAST(col1 AS DATE FORMAT 
> 'dd-mm-yyyy)

I just looked up CAST FORMAT and it seems to be a Teradata-specific SQL 
extension. We don’t plan to support it. You could modify Calcite’s parser 
yourself, or maybe you can write a sed or awk script to remove ‘AS DATE FORMAT’ 
before parsing.

Julian

Reply via email to