Skip to content

Commit

Permalink
Correctly call string.Finalize() in REVERSE function (fixes #535)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mytherin committed Apr 12, 2020
1 parent 1866e91 commit 03eafe5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/function/scalar/string/reverse.cpp
Expand Up @@ -44,6 +44,7 @@ static void reverse_chunk_function(DataChunk &args, ExpressionState &state, Vect

auto target = StringVector::EmptyString(result, input_length);
strreverse(input_data, input_length, target.GetData());
target.Finalize();
return target;
});
}
Expand Down
8 changes: 8 additions & 0 deletions test/rigger/test_rigger.cpp
Expand Up @@ -421,4 +421,12 @@ TEST_CASE("Tests found by Rigger", "[rigger]") {
REQUIRE(CHECK_COLUMN(result, 0, {"0"}));
REQUIRE(CHECK_COLUMN(result, 1, {0}));
}
SECTION("535") {
REQUIRE_NO_FAIL(con.Query("CREATE TABLE t0(c0 NUMERIC);"));
REQUIRE_NO_FAIL(con.Query("INSERT INTO t0(c0) VALUES (-515965088);"));
REQUIRE_NO_FAIL(con.Query("INSERT INTO t0(c0) VALUES (1), (-5.15965088E8);"));
REQUIRE_NO_FAIL(con.Query("CREATE INDEX i0 ON t0(c0);"));
result = con.Query("SELECT t0.c0 FROM t0 GROUP BY t0.c0, REVERSE(t0.c0) ORDER BY 1;");
REQUIRE(CHECK_COLUMN(result, 0, {-515965088, 1}));
}
}

0 comments on commit 03eafe5

Please sign in to comment.