[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17814503#comment-17814503 ] Julian Hyde commented on CALCITE-6237: -- +1 [~asolimando] [~caicancai], Often the hardest problem is to describe the problem correctly. This is why we do a lot of our work in jira (and why creating a PR too early can create confusion). You will notice that I asked a question above, "Do you understand why I closed CALCITE-6232 as invalid?", and also "Why would you expect fractions to have a special behavior in Log functions?" in CALCITE-6232. Those questions are my invitation to start a discussion. The main thing I think you can do better is to engage in discussion. > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813889#comment-17813889 ] Alessandro Solimando commented on CALCITE-6237: --- Calcite is a powerful but complex SW, there will always be weak spots in your knowledge: see how many times committers and PMC members ask for a second opinion or admit they are not very familiar with a certain area. Knowledge will increase over time, but there is much more to it, like describing your problem clearly and at the right abstraction level, providing the needed context for others to understand your proposal/bug, backing up your hypotheses with facts, being able to look up in the history if anything is related and take it into consideration, splitting complex issues into simpler ones (and creating minimal reproducers), how to interact with people, and I am surely forgetting something along the way. At first, one thinks that only contributing code matters, but it's way easier to build those skills by a mix of contributions, reviews of work from others and carefully following discussions on Jira and the ML. No need to be anxious, all feedback is precious and meant to help you becoming a better contributor. In a volunteer-based project nobody invests time providing feedback if they don't see enough effort or the chance to improve, so don't lose your motivation and keep and keep pushing. Hth, Alessandro > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813873#comment-17813873 ] Caican Cai commented on CALCITE-6237: - I don't understand many aspects of calcite, and I have to admit that I am a little anxious. I will learn this knowledge and fix this jira. I am sorry for causing trouble to all committers in the process. Thank you for your guidance > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813853#comment-17813853 ] Caican Cai commented on CALCITE-6237: - [~tanclary] [~mbudiu] Thanks both for the discussion and suggestions, I will fix it > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813852#comment-17813852 ] Caican Cai commented on CALCITE-6237: - [~julianhyde] Okay, I'm very sorry for the inconvenience caused to you. Maybe there is something wrong with my way, I should think about it, thank you very much for pointing out my problem > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813815#comment-17813815 ] Julian Hyde commented on CALCITE-6237: -- [~caicancai], Do you understand why I closed CALCITE-6232 as invalid? This issue has the same problems. I have noticed that, compared to other contributors, your contributions to Calcite require a lot of time to review. And the time of our committers – who are all volunteers – is limited. One way you can improve is by addressing the feedback you receive. In the other case I said "Closing as invalid; you can reopen if you make it about either log functions or division, but not both" but you ignored that advice. > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813785#comment-17813785 ] Mihai Budiu commented on CALCITE-6237: -- MySQL has two different operators: https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html DIV is for integer division / uses DECIMALs. The default scale is 4. That's why the results are different from Calcite. > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813775#comment-17813775 ] Tanner Clary commented on CALCITE-6237: --- This isn't really any different from the last bug you filed. I think this is more about 0 not returning the correct result since fractions are just getting resolved to 0. > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813599#comment-17813599 ] Caican Cai commented on CALCITE-6237: - It seems that it only appears when the parameter is a fraction, decimals have no effect > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813520#comment-17813520 ] Caican Cai commented on CALCITE-6237: - [~julianhyde] [~mbudiu] [~tanclary] ** > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813518#comment-17813518 ] Caican Cai commented on CALCITE-6237: - Personally, I think this is a bug, but I have doubts about whether this bug is being fixed. [CALCITE-6224] Add LOG2 function (enabled in Mysql, Spark library) - ASF JIRA (apache.org) > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (CALCITE-6237) Using fractions in LOG function does not return correct results
[ https://issues.apache.org/jira/browse/CALCITE-6237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17813514#comment-17813514 ] Caican Cai commented on CALCITE-6237: - [[CALCITE-6224] Add LOG2 function (enabled in Mysql, Spark library) by caicancai · Pull Request #3648 · apache/calcite (github.com)|https://github.com/apache/calcite/pull/3648] > Using fractions in LOG function does not return correct results > --- > > Key: CALCITE-6237 > URL: https://issues.apache.org/jira/browse/CALCITE-6237 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.36.0 >Reporter: Caican Cai >Priority: Major > Fix For: 1.37.0 > > > {code:java} > mysql> SELECT LOG10(2/3) AS result; > +-+ > | result | > +-+ > | -0.1760912594899757 | > +-+ > 1 row in set (0.00 sec) > mysql> SELECT LOG2(0) AS result; > ++ > | result | > ++ > | NULL | > ++ > 1 row in set, 1 warning (0.01 sec) > mysql> SELECT LOG2(2/3) AS result; > +-+ > | result | > +-+ > | -0.5849625021638512 | > +-+ > 1 row in set (0.00 sec) > {code} > When using Calcite's Log2 and Log10 functions, if the parameter is a > fraction, the integer digits will be retained by default. I think this is > wrong. Several decimal places (such as tens) should be retained by default. -- This message was sent by Atlassian Jira (v8.20.10#820010)