xigongxiaoche commented on issue #31236:
URL:
https://github.com/apache/shardingsphere/issues/31236#issuecomment-2114738576
sql not parse successfully in master,
this is test case:
```
<sql-case id="select_interval_with_subquery" value="SELECT age
FROM(SELECT '0-1岁' age FROM T_EMPI_PATIENT_INFO t WHERE t.birth >
TO_CHAR((SYSDATE - INTERVAL '1' YEAR(3)), 'yyyymmdd'))" db-types="Oracle" />
<select sql-case-id="select_interval_with_subquery">
<from>
<subquery-table>
<subquery>
<select>
<projections start-index="23" stop-index="32">
<expression-projection text="'0-1岁'" alias="age"
start-index="23" stop-index="32" />
</projections>
<from>
<simple-table name="T_EMPI_PATIENT_INFO"
start-index="39" stop-index="57" alias="t"/>
</from>
</select>
</subquery>
</subquery-table>
</from>
<projections start-index="7" stop-index="9">
<column-projection name="age" start-index="7" stop-index="9" />
</projections>
<where>
<expr>
<binary-operation-expression>
<left>
<column name="t.birth" start-index="67"
stop-index="73"></column>
</left>
<operator>></operator>
<right>
<function function-name="TO_CHAR" start-index="77"
stop-index="129" literal-text="TO_CHAR((SYSDATE - INTERVAL '1' YEAR(3)),
'yyyymmdd')"/>
</right>
</binary-operation-expression>
</expr>
</where>
</select>
```
console output:
```
org.opentest4j.AssertionFailedError:
SQL Case ID : select_interval_with_subquery
SQL : SELECT age FROM(SELECT '0-1岁' age FROM T_EMPI_PATIENT_INFO t
WHERE t.birth > TO_CHAR((SYSDATE - INTERVAL '1' YEAR(3)), 'yyyymmdd'))
Actual where segment should exist.
==>
Expected :true
Actual :false
<Click to see difference>
at
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dml.impl.SelectStatementAssert.assertWhereClause(SelectStatementAssert.java:132)
at
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dml.impl.SelectStatementAssert.assertIs(SelectStatementAssert.java:70)
at
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dml.DMLStatementAssert.assertIs(DMLStatementAssert.java:71)
at
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.SQLStatementAssert.assertIs(SQLStatementAssert.java:70)
at
org.apache.shardingsphere.test.it.sql.parser.internal.InternalSQLParserIT.assertSupportedSQL(InternalSQLParserIT.java:58)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at
java.base/java.util.concurrent.RecursiveAction.exec(RecursiveAction.java:194)
at
java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at
java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at
java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at
java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at
java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]