I am using Teiid's query parser. For the sql used in my below given code, although the identifiers are ansi-quoted, query parser is not splitting them into schema, tableName and FieldName correctly.
Here is my Code:
String sqlToParse = "Select "dbo.mydbo"."employee.info".id from "dbo.mydbo"."employee.info""
Query query = (Query)QueryParser.getQueryParser().parseCommand(sqlToParse, new ParseInfo());
In the above sql:
Schema name is dbo.mydbo
Table name is employee.info
Field name is id
During parsing, it looks like Teiid Parser is first removing the double quotes after which the fully qualified field name will become dbo.mydbo.employee.info.id. After this it splits based on dot(.)
String before first dot is taken as GroupSymbol.qualifier(schema name): dbo
String after last dot is taken as the ElementSymbol.shortName(field name): id
And rest of the string between first and last dot is taken as GroupSymbol.shortName(table name): mydbo.employee.info
The above split is giving incorrect results. The split should consider the quotes when identifiers are quoted.
Am I missing something in my code or is there some setting missing in ParseInfo due to which Teiid parser is not considering the quotes while splitting the identifiers.