[
https://issues.apache.org/jira/browse/TAJO-551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13882252#comment-13882252
]
DaeMyung Kang commented on TAJO-551:
------------------------------------
[~jihoonson] Thank you for your review.
but. It is not compare with Array. It is right that you mentioned about
Array.(It needs Arrays.equals.)
This is operation of List. so It is internally compared for semantic equality.
below are source code for List equals()
{noformat}
public boolean More ...equals(Object o) {
if (o == this)
return true;
if (!(o instanceof List))
return false;
ListIterator<E> e1 = listIterator();
ListIterator e2 = ((List) o).listIterator();
while(e1.hasNext() && e2.hasNext()) {
E o1 = e1.next();
Object o2 = e2.next();
if (!(o1==null ? o2==null : o1.equals(o2)))
return false;
}
return !(e1.hasNext() || e2.hasNext());
}
{noformat}
and Array's equals and Arrays.equals works like you mentioned.
Array's equals
{noformat}
public boolean equals(Object obj) {
return (this == obj);
}
{noformat}
Arrays.equals
{noformat}
public static boolean equals(Object[] a, Object[] a2) {
if (a==a2)
return true;
if (a==null || a2==null)
return false;
int length = a.length;
if (a2.length != length)
return false;
for (int i=0; i<length; i++) {
Object o1 = a[i];
Object o2 = a2[i];
if (!(o1==null ? o2==null : o1.equals(o2)))
return false;
}
return true;
}
{noformat}
Thank you for your review. I understand deeply about Array and List's equals.
> Fix bug getFunction can get wrong function that have invalid parameters
> -----------------------------------------------------------------------
>
> Key: TAJO-551
> URL: https://issues.apache.org/jira/browse/TAJO-551
> Project: Tajo
> Issue Type: Bug
> Components: function/udf
> Reporter: DaeMyung Kang
> Assignee: DaeMyung Kang
> Attachments: TAJO-551.patch
>
>
> currently, containFunction and getFunction can get a function that has
> invalid parameter
> {noformat}
> FunctionDesc meta = new FunctionDesc("test10", TestFunc2.class,
> FunctionType.GENERAL,
> CatalogUtil.newSimpleDataType(Type.INT4),
> CatalogUtil.newSimpleDataTypeArray(Type.INT4, Type.BLOB));
> catalog.createFunction(meta);
> assertTrue(catalog.containFunction("test10",
> CatalogUtil.newSimpleDataTypeArray(Type.INT4, Type.BLOB)));
> assertTrue(catalog.containFunction("test10",
> CatalogUtil.newSimpleDataTypeArray(Type.BLOB, Type.INT4)));
> {noformat}
> when containFunction is called with same parameter types but not order is
> same. it just returns true or function.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)