You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "xuzifu666 (via GitHub)" <gi...@apache.org> on 2025/11/12 12:23:30 UTC

[PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

xuzifu666 opened a new pull request, #4628:
URL: https://github.com/apache/calcite/pull/4628

   jira:https://issues.apache.org/jira/browse/CALCITE-7287


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on PR #4628:
URL: https://github.com/apache/calcite/pull/4628#issuecomment-3560816118

   > ok, please squash the commits so we can merge this
   
   ok, had squased commits thanks @mihaibudiu 


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on PR #4628:
URL: https://github.com/apache/calcite/pull/4628#issuecomment-3550297305

   I see you've already approved this PR,is the current version OK? @mihaibudiu 


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu merged PR #4628:
URL: https://github.com/apache/calcite/pull/4628


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4628:
URL: https://github.com/apache/calcite/pull/4628#issuecomment-3559786642

   I asked the person who submitted the issue to approve if the PR solves the problem.


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on PR #4628:
URL: https://github.com/apache/calcite/pull/4628#issuecomment-3560090050

   ok, please squash the commits so we can merge this


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

Posted by "scarlin-cloudera (via GitHub)" <gi...@apache.org>.
scarlin-cloudera commented on PR #4628:
URL: https://github.com/apache/calcite/pull/4628#issuecomment-3560086142

   This does indeed solve my problem, thank you for the fix!


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4628:
URL: https://github.com/apache/calcite/pull/4628#discussion_r2544725430


##########
core/src/test/java/org/apache/calcite/rex/RexProgramTest.java:
##########
@@ -4039,6 +4039,13 @@ private void checkSarg(String message, Sarg sarg,
     checkSimplify(or(isNull(ref), like(ref, literal("%"), literal("#"))),
         "true");
     checkSimplifyUnchanged(like(ref, literal("%A")));
+
+    RexCall simplifyLike = (RexCall) simplify.simplify(like(ref, literalVarchar("%%A")));
+    assertThat(simplifyLike.getOperands().get(1).getType().getSqlTypeName().name(), is("VARCHAR"));

Review Comment:
   I added test case here,and before this modification, it would be a ```CHAR``` type here. @mihaibudiu 
   ```
   java.lang.AssertionError: 
   Expected: is "VARCHAR"
        but: was "CHAR"
   	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
   	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
   	at org.apache.calcite.rex.RexProgramTest.testSimplifyLike(RexProgramTest.java:4028)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
   
   ```



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on PR #4628:
URL: https://github.com/apache/calcite/pull/4628#issuecomment-3535738694

   > I think that simplify should always preserve the types of the original expression. There should even be an assertion for that. But I don't know if this was a design consideration initially - maybe simplify is used to remove nullability sometimes?
   
   Yes, this may have been the case when the design was first started. It is similar to the discussion in Jira. Let the user reported the problem try it, and the PR modification should be work.


-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4628:
URL: https://github.com/apache/calcite/pull/4628#discussion_r2544725430


##########
core/src/test/java/org/apache/calcite/rex/RexProgramTest.java:
##########
@@ -4039,6 +4039,13 @@ private void checkSarg(String message, Sarg sarg,
     checkSimplify(or(isNull(ref), like(ref, literal("%"), literal("#"))),
         "true");
     checkSimplifyUnchanged(like(ref, literal("%A")));
+
+    RexCall simplifyLike = (RexCall) simplify.simplify(like(ref, literalVarchar("%%A")));
+    assertThat(simplifyLike.getOperands().get(1).getType().getSqlTypeName().name(), is("VARCHAR"));

Review Comment:
   I added test case here,and before this modification, it would be determined as a ```CHAR``` type here. @mihaibudiu 



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [CALCITE-7287] In simplifyLike, the makeLiteral call does not preserve the RelDataType [calcite]

Posted by "xuzifu666 (via GitHub)" <gi...@apache.org>.
xuzifu666 commented on code in PR #4628:
URL: https://github.com/apache/calcite/pull/4628#discussion_r2544725430


##########
core/src/test/java/org/apache/calcite/rex/RexProgramTest.java:
##########
@@ -4039,6 +4039,13 @@ private void checkSarg(String message, Sarg sarg,
     checkSimplify(or(isNull(ref), like(ref, literal("%"), literal("#"))),
         "true");
     checkSimplifyUnchanged(like(ref, literal("%A")));
+
+    RexCall simplifyLike = (RexCall) simplify.simplify(like(ref, literalVarchar("%%A")));
+    assertThat(simplifyLike.getOperands().get(1).getType().getSqlTypeName().name(), is("VARCHAR"));

Review Comment:
   I added test case here,and before this modification, it would be a ```CHAR``` type here. @mihaibudiu 



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org