You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-user@hadoop.apache.org by Sai Sai <sa...@yahoo.in> on 2013/03/27 12:11:40 UTC

Storage Block vs File Block

Hadoop splits large files into file blocks of size 64MB. Are these same as storage blocks or r they different. 

Thanks
Sai

Re: Storage Block vs File Block

Posted by Harsh J <ha...@cloudera.com>.
> Are these same as storage blocks or r they different.
They are different. HDFS blocks are simply files on a provided filesystem.

On Wed, Mar 27, 2013 at 4:41 PM, Sai Sai <sa...@yahoo.in> wrote:
> Hadoop splits large files into file blocks of size 64MB. Are these same as
> storage blocks or r they different.
> Thanks
> Sai



-- 
Harsh J

Re: CompareTo vs equals

Posted by Ted Yu <yu...@gmail.com>.
>From http://www.javapractices.com/topic/TopicAction.do?Id=10 :

consistency with equals is required for ensuring sorted collections (such
as TreeSet) are well-behaved.

On Wed, Mar 27, 2013 at 8:16 PM, Sai Sai <sa...@yahoo.in> wrote:

> IntPair  class has these 2 methods, i understand that compareTo is used
> for comparing but when is equals method used and is it necessary to write
> it when we alread have implemented compareTo method.
>
> @Override
> public int compareTo(IntPair that) {
> int cmp = first.compareTo(that.first);
> if(cmp==0){
> cmp = second.compareTo(that.second);
> }
> return cmp;
> }
> @Override
> public boolean equals(Object obj) {
>  if (obj instanceof IntPair){
> IntPair that = (IntPair)obj;
> return (first.equals(that.first) && second.equals(that.second));
> }
>  return false;
> }
>
> Thanks
> Sai
>
>
>

Re: CompareTo vs equals

Posted by Ted Yu <yu...@gmail.com>.
>From http://www.javapractices.com/topic/TopicAction.do?Id=10 :

consistency with equals is required for ensuring sorted collections (such
as TreeSet) are well-behaved.

On Wed, Mar 27, 2013 at 8:16 PM, Sai Sai <sa...@yahoo.in> wrote:

> IntPair  class has these 2 methods, i understand that compareTo is used
> for comparing but when is equals method used and is it necessary to write
> it when we alread have implemented compareTo method.
>
> @Override
> public int compareTo(IntPair that) {
> int cmp = first.compareTo(that.first);
> if(cmp==0){
> cmp = second.compareTo(that.second);
> }
> return cmp;
> }
> @Override
> public boolean equals(Object obj) {
>  if (obj instanceof IntPair){
> IntPair that = (IntPair)obj;
> return (first.equals(that.first) && second.equals(that.second));
> }
>  return false;
> }
>
> Thanks
> Sai
>
>
>

Re: CompareTo vs equals

Posted by Ted Yu <yu...@gmail.com>.
>From http://www.javapractices.com/topic/TopicAction.do?Id=10 :

consistency with equals is required for ensuring sorted collections (such
as TreeSet) are well-behaved.

On Wed, Mar 27, 2013 at 8:16 PM, Sai Sai <sa...@yahoo.in> wrote:

> IntPair  class has these 2 methods, i understand that compareTo is used
> for comparing but when is equals method used and is it necessary to write
> it when we alread have implemented compareTo method.
>
> @Override
> public int compareTo(IntPair that) {
> int cmp = first.compareTo(that.first);
> if(cmp==0){
> cmp = second.compareTo(that.second);
> }
> return cmp;
> }
> @Override
> public boolean equals(Object obj) {
>  if (obj instanceof IntPair){
> IntPair that = (IntPair)obj;
> return (first.equals(that.first) && second.equals(that.second));
> }
>  return false;
> }
>
> Thanks
> Sai
>
>
>

Re: CompareTo vs equals

Posted by Ted Yu <yu...@gmail.com>.
>From http://www.javapractices.com/topic/TopicAction.do?Id=10 :

consistency with equals is required for ensuring sorted collections (such
as TreeSet) are well-behaved.

On Wed, Mar 27, 2013 at 8:16 PM, Sai Sai <sa...@yahoo.in> wrote:

> IntPair  class has these 2 methods, i understand that compareTo is used
> for comparing but when is equals method used and is it necessary to write
> it when we alread have implemented compareTo method.
>
> @Override
> public int compareTo(IntPair that) {
> int cmp = first.compareTo(that.first);
> if(cmp==0){
> cmp = second.compareTo(that.second);
> }
> return cmp;
> }
> @Override
> public boolean equals(Object obj) {
>  if (obj instanceof IntPair){
> IntPair that = (IntPair)obj;
> return (first.equals(that.first) && second.equals(that.second));
> }
>  return false;
> }
>
> Thanks
> Sai
>
>
>

Re: CompareTo vs equals

Posted by Sai Sai <sa...@yahoo.in>.
IntPair  class has these 2 methods, i understand that compareTo is used for comparing but when is equals method used and is it necessary to write it when we alread have implemented compareTo method.

@Override
public int compareTo(IntPair that) {
int cmp = first.compareTo(that.first);
if(cmp==0){
cmp = second.compareTo(that.second);
}
return cmp;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof IntPair){
IntPair that = (IntPair)obj;
return (first.equals(that.first) && second.equals(that.second));
}
return false;
}

Thanks

Sai

Re: CompareTo vs equals

Posted by Sai Sai <sa...@yahoo.in>.
IntPair  class has these 2 methods, i understand that compareTo is used for comparing but when is equals method used and is it necessary to write it when we alread have implemented compareTo method.

@Override
public int compareTo(IntPair that) {
int cmp = first.compareTo(that.first);
if(cmp==0){
cmp = second.compareTo(that.second);
}
return cmp;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof IntPair){
IntPair that = (IntPair)obj;
return (first.equals(that.first) && second.equals(that.second));
}
return false;
}

Thanks

Sai

Re: CompareTo vs equals

Posted by Sai Sai <sa...@yahoo.in>.
IntPair  class has these 2 methods, i understand that compareTo is used for comparing but when is equals method used and is it necessary to write it when we alread have implemented compareTo method.

@Override
public int compareTo(IntPair that) {
int cmp = first.compareTo(that.first);
if(cmp==0){
cmp = second.compareTo(that.second);
}
return cmp;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof IntPair){
IntPair that = (IntPair)obj;
return (first.equals(that.first) && second.equals(that.second));
}
return false;
}

Thanks

Sai

Re: Storage Block vs File Block

Posted by Harsh J <ha...@cloudera.com>.
> Are these same as storage blocks or r they different.
They are different. HDFS blocks are simply files on a provided filesystem.

On Wed, Mar 27, 2013 at 4:41 PM, Sai Sai <sa...@yahoo.in> wrote:
> Hadoop splits large files into file blocks of size 64MB. Are these same as
> storage blocks or r they different.
> Thanks
> Sai



-- 
Harsh J

Re: Storage Block vs File Block

Posted by Harsh J <ha...@cloudera.com>.
> Are these same as storage blocks or r they different.
They are different. HDFS blocks are simply files on a provided filesystem.

On Wed, Mar 27, 2013 at 4:41 PM, Sai Sai <sa...@yahoo.in> wrote:
> Hadoop splits large files into file blocks of size 64MB. Are these same as
> storage blocks or r they different.
> Thanks
> Sai



-- 
Harsh J

Re: Storage Block vs File Block

Posted by Harsh J <ha...@cloudera.com>.
> Are these same as storage blocks or r they different.
They are different. HDFS blocks are simply files on a provided filesystem.

On Wed, Mar 27, 2013 at 4:41 PM, Sai Sai <sa...@yahoo.in> wrote:
> Hadoop splits large files into file blocks of size 64MB. Are these same as
> storage blocks or r they different.
> Thanks
> Sai



-- 
Harsh J

Re: CompareTo vs equals

Posted by Sai Sai <sa...@yahoo.in>.
IntPair  class has these 2 methods, i understand that compareTo is used for comparing but when is equals method used and is it necessary to write it when we alread have implemented compareTo method.

@Override
public int compareTo(IntPair that) {
int cmp = first.compareTo(that.first);
if(cmp==0){
cmp = second.compareTo(that.second);
}
return cmp;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof IntPair){
IntPair that = (IntPair)obj;
return (first.equals(that.first) && second.equals(that.second));
}
return false;
}

Thanks

Sai