You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "dylanhz (Jira)" <ji...@apache.org> on 2025/07/23 07:30:00 UTC

[jira] [Created] (FLINK-38135) Non-existent method for RAW type hashing

dylanhz created FLINK-38135:
-------------------------------

             Summary: Non-existent method for RAW type hashing
                 Key: FLINK-38135
                 URL: https://issues.apache.org/jira/browse/FLINK-38135
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
            Reporter: dylanhz


There is a broken code path for generating hash codes for {{RAW}} types in {{CodeGenUtils#hashCodeForType}}.

During a previous refactoring, a call to the legacy method {{getJavaObjectFromBinaryGeneric}} was renamed to {{getJavaObjectFromRawValueData}} to align with the new {{BinaryRawValueData}} class.

However, this new method was never declared or implemented in the {{BinaryRawValueData}} class or any of its superclasses. 
{code:java}
// MRE
public class RawHashTest {
    public static void main(String[] args) throws Exception {
        TableEnvironment tableEnv = TableEnvironment.create(EnvironmentSettings.inBatchMode());

        tableEnv.createTemporarySystemFunction("MyUDF", new MyUDF());

        String sql =
                "SELECT str, COUNT(1) FROM ("
                        + "SELECT MyUDF(id) AS str FROM (VALUES (0), (1), (2)) AS t(id)"
                        + ") GROUP BY str"; // group by RAW type

        tableEnv.sqlQuery(sql).execute().await();
    }

    public static class MyUDF extends ScalarFunction {
        @DataTypeHint(value = "RAW", bridgedTo = String.class)
        public String eval(Integer x) {
            return x.toString();
        }
    }
}
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)