Hi Thomas,
   That is my bad - a carry over from the debugging. However the error
still persists even with the following query:

*SELECT Purchase.Purchase_Date, Products.Product_Name FROM Purchase JOIN
Products ON Purchase.Product_ID = Products.ID WHERE Purchase.Quantity > 10*

This is what I see:

*from: org.apache.calcite.sql.SqlNode  =
{org.apache.calcite.sql.SqlJoin@2039} Method threw
'java.lang.RuntimeException' exception. Cannot evaluate
org.apache.calcite.sql.SqlJoin.toString()* left:
org.apache.calcite.sql.SqlNode  = {org.apache.calcite.sql.SqlIdentifier@2141}
"PURCHASE"
 natural: org.apache.calcite.sql.SqlLiteral  =
{org.apache.calcite.sql.SqlLiteral@2142} "FALSE"
 joinType: org.apache.calcite.sql.SqlLiteral  =
{org.apache.calcite.sql.SqlLiteral@2143} "INNER"
 right: org.apache.calcite.sql.SqlNode  =
{org.apache.calcite.sql.SqlIdentifier@2144} "PRODUCTS"
 conditionType: org.apache.calcite.sql.SqlLiteral  =
{org.apache.calcite.sql.SqlLiteral@2145} "ON"
 condition: org.apache.calcite.sql.SqlNode  =
{org.apache.calcite.sql.SqlBasicCall@2146} "`PURCHASE`.`PRODUCT_ID` =
`PRODUCTS`.`ID`"
 pos: org.apache.calcite.sql.parser.SqlParserPos  =
{org.apache.calcite.sql.parser.SqlParserPos@2147} "line 1, column 68"

That said, a more directed error text might definitely be more helpful.

Regards,
Viraj Purang

On Tue, Aug 17, 2021 at 1:27 AM Thomas Rebele <treb...@tibco.com> wrote:

> Hi Jariv,
>
> are you sure you want to join two columns of Purchase: *Purchase.Product_ID
> = Purchase.ID*?
> If that's the cause of the exception, the error message could be improved.
>
> Cordialement / Best Regards,
> *Thomas Rebele, PhD* | R&D Developer | Germany | www.tibco.com
>
>
> On Mon, Aug 16, 2021 at 10:58 PM Jariv Narup <jariv.g.na...@gmail.com>
> wrote:
>
>> Hi Team,
>>    I am getting the following exception while trying to parse a SQL
>> statement into its tokens. Is this expected behavior? If not, what would
>> you suggest to work around this problem. The particulars are given below:
>>
>> *Issue:*
>> *Method threw 'java.lang.RuntimeException' exception. Cannot evaluate
>> org.apache.calcite.sql.SqlJoin.toString().*
>>
>> *Where:*
>> This happens when I use the following API (it is visible on the "from"
>> value):
>>
>>         SqlParser.Config parserConfig = SqlParser.config();
>>         parserConfig
>>                 .withCaseSensitive(false)
>>                 .withLex(Lex.ORACLE);
>>         SqlParser parser = SqlParser.create(sqlString, parserConfig);
>> >>> [Line with the issue]        *SqlNode sqlNode = parser.parseStmt();*
>>
>>
>> *Debugger Image:*
>> [image: image.png]
>> *Version In Use:*
>> I am using the following maven GAVs
>> -org.apache.calcite:calcite-babel:1.27.0, so my assumption is that I am at
>> the latest.
>>
>> *SQL Statement with the issue:*
>>
>> *SELECT Purchase.Purchase_Date, Products.Product_Name FROM Purchase JOIN
>> Products ON Purchase.Product_ID = Purchase.ID WHERE Purchase.Quantity > 10*
>>
>> I would appreciate any help on this.
>>
>> Thanks - Jariv
>>
>

Reply via email to