xiedeyantu commented on code in PR #4854:
URL: https://github.com/apache/calcite/pull/4854#discussion_r3004351584


##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -3692,11 +3692,30 @@ private SqlDialect nonOrdinalDialect() {
     sql(query1).withClickHouse().ok(expected1);
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-7316";>[CALCITE-7316]
+   * The POSITION function in SQLite is missing the FROM clause</a>. */
   @Test void testPositionFunctionForSqlite() {
     final String query = "select position('A' IN 'ABC') from \"product\"";
     final String expected = "SELECT INSTR('ABC', 'A')\n"
         + "FROM \"foodmart\".\"product\"";
     sql(query).withSQLite().ok(expected);
+
+    final String query1 = "select position('C' IN 'ABCABC' FROM 4) from 
\"product\"";
+    final String expected1 =

Review Comment:
   I’m not sure if we need to make such complex rewrites. Honestly, I haven’t 
even figured out how to approach the rewrite in the Jira issue.



##########
core/src/main/java/org/apache/calcite/sql/dialect/SqliteSqlDialect.java:
##########
@@ -32,6 +41,17 @@
  * A <code>SqliteSqlDialect</code> implementation for the SQLite database.
  */
 public class SqliteSqlDialect extends SqlDialect {
+  // Use plain function nodes here so the SQLite POSITION rewrite does not
+  // re-enter dialect-specific operator handling during unparsing.
+  private static final SqlFunction INSTR =

Review Comment:
   Why do we need to add additional function definitions in the dialect?



-- 
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]

Reply via email to