hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Douglas (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HADOOP-4151) Add a memcmp-compatible interface for key types
Date Wed, 10 Sep 2008 22:26:44 GMT

     [ https://issues.apache.org/jira/browse/HADOOP-4151?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Chris Douglas updated HADOOP-4151:

    Attachment: 4151-1.patch

*nod* I thought about making it extend Comparable- because the type does imply that the instance
can be ordered and permuted relative to these bytes- but that would force each implementor
to write a (likely redundant) compare(T).

What would you think of making it an abstract class, like:
public abstract class MemComparable implements Comparable<MemComparable> {
  public abstract int getLength();
  public abstract byte[] getBytes();
  public int compareTo(MemComparable other) {
    if (this == other)
      return 0;
    return WritableComparator.compareBytes(getBytes(), 0, getLength(),
             other.getBytes(), 0, other.getLength());

> Add a memcmp-compatible interface for key types
> -----------------------------------------------
>                 Key: HADOOP-4151
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4151
>             Project: Hadoop Core
>          Issue Type: Improvement
>            Reporter: Chris Douglas
>            Assignee: Chris Douglas
>            Priority: Minor
>             Fix For: 0.19.0
>         Attachments: 4151-0.patch, 4151-1.patch
> Sometimes it's beneficial to treat types (like BytesWritable and Text) as byte arrays,
agnostic to their type. Adding an interface to tag key types as amenable to this treatment
can permit optimizations and reuse for that subset of types in tools and libraries.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message