Coder Social home page Coder Social logo

Comments (6)

proddata avatar proddata commented on June 27, 2024

Seems to be an issue with determining scale

SELECT
    txt,
    SUM(val) AS val,
    SUM(val :: NUMERIC(10, 2)) AS val2
FROM
    t01
GROUP BY
    txt;
+-----+-----+------+
| txt | val | val2 |
+-----+-----+------+
| a   | 1.0 |  100 |
+-----+-----+------+

+-----+-----+------+
| txt | val | val2 |
+-----+-----+------+
| a   | 1.0 |  1.0 |
+-----+-----+------+

from crate.

matriv avatar matriv commented on June 27, 2024

Fails systematically with:

    @Test
    public void test_numeric_agg() {
        execute("CREATE TABLE IF NOT EXISTS t01 (txt TEXT, val DOUBLE PRECISION)");
        execute("INSERT INTO t01 VALUES ('a', 1.0), ('a', null)");
        execute("REFRESH TABLE t01");
        execute(
            """
                SELECT
                    txt,
                SUM(val) AS val,
                SUM(val :: NUMERIC(10, 2)) AS val2
                FROM t01
                GROUP BY txt
            """);
        assertThat(response).hasRows(
            "a| 1.0| 1.0"
        );
    }

and minimum 2 data nodes. you can annotate the test class with:

@IntegTestCase.ClusterScope(numDataNodes = 2, supportsDedicatedMasters = false, numClientNodes = 0)

from crate.

romseygeek avatar romseygeek commented on June 27, 2024

The assertion needs to be:

assertThat(response).hasRows(
            "a| 1.0| 1.00"
        );

at which point the test fails 50% of the time. Changing the insert statement to add a single document, INSERT INTO t01 VALUES ('a', 1.0), also makes no difference. So it looks as though this is explicitly something to do with how the cast statement gets moved around between nodes.

from crate.

matriv avatar matriv commented on June 27, 2024

Yep, from a quick debug, I saw that NumericType is streamed with null scale and precision, so the write/read value doesn't work correctly afterwards.

from crate.

romseygeek avatar romseygeek commented on June 27, 2024

I think the bug is somewhere in SignatureBinder - even if a type with parameters gets passed in to bind() then the output BoundSignature has no parameters on its return type.

from crate.

romseygeek avatar romseygeek commented on June 27, 2024

Thanks a lot for reporting @proddata! This issue has been fixed and will be available with the next hotfix release

from crate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.