xigongxiaoche commented on issue #31236:
URL:
https://github.com/apache/shardingsphere/issues/31236#issuecomment-2116504088
I changed the select tag as follows, but it still failed.
```
<select sql-case-id="select_interval_with_subquery">
<projections start-index="7" stop-index="9">
<column-projection name="age" start-index="7" stop-index="9"/>
</projections>
<from>
<subquery-table>
<subquery>
<select>
<projections start-index="24" stop-index="64">
<expression-projection text="0-1岁"
start-index="24" stop-index="33" alias="age"/>
<aggregation-projection type="COUNT"
start-index="35" stop-index="51" expression="count(*)" alias="countNum"/>
<expression-projection text="0" start-index="54"
stop-index="64" alias="sortNum"/>
</projections>
<from start-index="71" stop-index="91">
<simple-table name="T_EMPI_PATIENT_INFO"
start-index="71" stop-index="91" alias="t"/>
</from>
<where start-index="93" stop-index="161">
<expr>
<binary-operation-expression
start-index="99" stop-index="161">
<operator>></operator>
<left>
<column name="birth"
start-index="99" stop-index="105">
<owner name="t" start-index="99"
stop-index="99"/>
</column>
</left>
<right>
<function text="to_char((sysdate -
interval '1' year(3)), 'yyyymmdd')" function-name="to_char" start-index="109"
stop-index="161">
<parameter>
<binary-operation-expression
start-index="117" stop-index="148">
<operator>-</operator>
<left>
<column
name="sysdate" start-index="118" stop-index="124"/>
</left>
<right>
<common-expression
text="interval '1' year(3)" start-index="128" stop-index="147"/>
</right>
</binary-operation-expression>
</parameter>
<parameter>
<literal-expression
value="yyyymmdd" start-index="152" stop-index="159"/>
</parameter>
</function>
</right>
</binary-operation-expression>
</expr>
</where>
</select>
</subquery>
</subquery-table>
</from>
</select>
<sql-case id="select_interval_with_subquery" value="select age from
(select '0-1岁' age,count(*) countNum, '0' sortNum from T_EMPI_PATIENT_INFO t
where t.birth > to_char((sysdate - interval '1' year(3)), 'yyyymmdd'))"
db-types="Oracle" />
```
console failed message:
```
java.lang.AssertionError:
SQL Case ID : select_interval_with_subquery
SQL : select age from (select '0-1岁' age,count(*) countNum, '0'
sortNum from T_EMPI_PATIENT_INFO t where t.birth > to_char((sysdate - interval
'1' year(3)), 'yyyymmdd'))
`SubqueryTableSegment`'s start index assertion error:
Expected: is <0>
but: was <16>
<Click to see difference>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert.assertStartIndex(SQLSegmentAssert.java:50)
at
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.SQLSegmentAssert.assertIs(SQLSegmentAssert.java:44)
at
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.table.TableAssert.assertIs(TableAssert.java:170)
at
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.segment.table.TableAssert.assertIs(TableAssert.java:81)
at
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dml.impl.SelectStatementAssert.assertTable(SelectStatementAssert.java:115)
at
org.apache.shardingsphere.test.it.sql.parser.internal.asserts.statement.dml.impl.SelectStatementAssert.assertIs(SelectStatementAssert.java:76)
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]