[ 
https://issues.apache.org/jira/browse/FLINK-13224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16883545#comment-16883545
 ] 

forideal commented on FLINK-13224:
----------------------------------

if user type equals device type,the following code will get a wrong type
{code:java}
public final RelDataType validateOperands(SqlValidator validator, 
SqlValidatorScope scope, SqlCall call) { 
this.preValidateCall(validator, scope, call); this.checkOperandCount(validator, 
     this.operandTypeChecker, call); SqlCallBinding opBinding = new 
SqlCallBinding(validator,   scope, call); this.checkOperandTypes(opBinding, 
true); RelDataType ret = this.inferReturnType(opBinding); 
((SqlValidatorImpl)validator).setValidatedNodeType(call, ret); return ret; 
}
{code}
this code:
{code:java}
RelDataType ret = this.inferReturnType(opBinding);
{code}
 

> 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)

Reply via email to