>
> You should test that getSlicePredicate(conf).equals(originalPredicate)
>
>
That's it! The byte arrays are slightly different after setting it on the
Hadoop config. Below is a simple test which demonstrates the bug -- it
should print "true" but instead prints "false". Please let me know if a bug
gets raised so I can track it.
Thanks
Mark
import org.apache.cassandra.hadoop.ConfigHelper;
import org.apache.cassandra.thrift.SlicePredicate;
import org.apache.hadoop.conf.Configuration;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
/**
* A class which demonstrates a bug in Cassandra's ConfigHelper.
*/
public class SlicePredicateTest {
public static void main(String[] args) {
long columnValue = 1271253600000l;
byte[] columnBytes = getBytes(columnValue);
List<byte[]> columnNames = new ArrayList<byte[]>();
columnNames.add(columnBytes);
SlicePredicate originalPredicate = new SlicePredicate();
originalPredicate.setColumn_names(columnNames);
Configuration conf = new Configuration();
ConfigHelper.setSlicePredicate(conf, originalPredicate);
System.out.println(ConfigHelper.getSlicePredicate(conf).equals(originalPredicate));
}
private static byte[] getBytes(long l) {
byte[] bytes = new byte[8];
ByteBuffer.wrap(bytes).putLong(l);
return bytes;
}
}