sqoop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Qian Xu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SQOOP-2011) Schema should expose columns in array or list and not both
Date Fri, 16 Jan 2015 03:17:34 GMT

    [ https://issues.apache.org/jira/browse/SQOOP-2011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14279760#comment-14279760

Qian Xu commented on SQOOP-2011:

I propose SQOOP-1976, which will revert back to {{List<Column> getColumns()}} (instead
of having {{getColumnsList}} and {{getColumnsArray}}).

Here is the facts:
# If it's implementation is done with an ArrayList and the get operation is O(1).
# If it's implementation is done with an LinkedList and the get operation is O(n).

As IDF (and other classes) will read schema columns very frequently, choose ArrayList as internal
implementition is no doubt better than LinkedList. 

If you think using array is better than ArrayList, do you agree we first resolve SQOOP-1976?

> Schema should expose columns in array or list and not both
> ----------------------------------------------------------
>                 Key: SQOOP-2011
>                 URL: https://issues.apache.org/jira/browse/SQOOP-2011
>             Project: Sqoop
>          Issue Type: Sub-task
>            Reporter: Veena Basavaraj
>             Fix For: 2.0.0
> it is asking for trouble to store the schema columns in array and expose a list. the
matching code currently uses LIST and it can completely use the array and work with it. In
all places in IDF code we use the column array via the index.
> Array is preferred since it is easier to walk thorugh the object array format, there
is one-one correspondence between the two with indexes
> http://eclipsesource.com/blogs/2014/04/11/3-good-reasons-to-avoid-arrays-in-java-interfaces/
> Please read the UPDATE section in the above link:) We really do not need the abilities
of a list, we know the only reason we will use  schema columns is read only.

This message was sent by Atlassian JIRA

View raw message