[
https://issues.apache.org/jira/browse/FLINK-13224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16883492#comment-16883492
]
forideal commented on FLINK-13224:
----------------------------------
[~twalthr] thank you for your reply!
Yes ,this is a problem of the RowTypeInfo.
I use this type to describe struct , the following code is my example
{code:java}
Schema appSchema = new Schema()
.field("timestamp", Types.SQL_TIMESTAMP)
.field("user", Types.ROW_NAMED(
new String[]{"user_id", "user_name"},
Types.INT, Types.STRING
))
.field("device",Types.ROW_NAMED(
new String[]{"device_id", "device_type"},
Types.INT, Types.STRING
)));
{code}
if user type equals device type ,my flink sql app will get uncorrect typeinfo.
> TupleTypeInfoBase equals function can't distinguish different struct type
> -------------------------------------------------------------------------
>
> Key: FLINK-13224
> URL: https://issues.apache.org/jira/browse/FLINK-13224
> Project: Flink
> Issue Type: Bug
> Affects Versions: 1.8.0
> Environment: flink 1.8.0
> Reporter: forideal
> Priority: Major
>
> Hi
> i have two struct type
> one is
> {code:java}
> // code placeholder
> Types.ROW_NAMED(
> new String[]{"device"},
> Types.PRIMITIVE_ARRAY(Types.BYTE)
> )
> {code}
> the other is
>
> {code:java}
> // code placeholder
> Types.ROW_NAMED(
> new String[]{"app"},
> Types.PRIMITIVE_ARRAY(Types.BYTE)
> )
> {code}
> when i compare those two types ,the equals function returns true.
> there are some code in TupleTypeInfoBase
> {code:java}
> // code placeholder
> return other.canEqual(this) &&
> super.equals(other) &&
> Arrays.equals(types, other.types) &&
> totalFields == other.totalFields;
> {code}
> i think,The equals function should compare field names.
> eg:
> {code:java}
> // code placeholder
> if (totalFields == other.totalFields) {
> String[] otherFieldNames = other.getFieldNames();
> String[] fieldNames = this.getFieldNames();
> for (int i = 0; i < totalFields; i++) {
> if (!otherFieldNames[i].equals(fieldNames[i])) {
> return false;
> }
> }
> } else{
> return false;
> }
> return other.canEqual(this) &&
> super.equals(other) &&
> Arrays.equals(types, other.types);
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)