Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/10937#discussion_r51027925
--- Diff:
common/sketch/src/main/java/org/apache/spark/util/sketch/BloomFilterImpl.java
---
@@ -63,55 +65,90 @@ public long bitSize() {
return bits.bitSize();
}
- private static long hashObjectToLong(Object item) {
- if (item instanceof String) {
- try {
- byte[] bytes = ((String) item).getBytes("utf-8");
- return hashBytesToLong(bytes);
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException("Only support utf-8 string", e);
- }
+ private byte[] getBytesFromUTF8String(Object s) {
+ try {
+ return ((String) s).getBytes("utf-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException("Only support utf-8 string", e);
+ }
+ }
+
+ private long integralToLong(Object i) {
+ long longValue;
+
+ if (i instanceof Long) {
+ longValue = (Long) i;
+ } else if (i instanceof Integer) {
+ longValue = ((Integer) i).longValue();
+ } else if (i instanceof Short) {
+ longValue = ((Short) i).longValue();
+ } else if (i instanceof Byte) {
+ longValue = ((Byte) i).longValue();
} else {
- long longValue;
-
- if (item instanceof Long) {
- longValue = (Long) item;
- } else if (item instanceof Integer) {
- longValue = ((Integer) item).longValue();
- } else if (item instanceof Short) {
- longValue = ((Short) item).longValue();
- } else if (item instanceof Byte) {
- longValue = ((Byte) item).longValue();
- } else {
- throw new IllegalArgumentException(
- "Support for " + item.getClass().getName() + " not implemented"
- );
- }
+ throw new IllegalArgumentException(
+ "Support for " + i.getClass().getName() + " not implemented"
--- End diff --
"Unsupported data type " + i.getClass().getName()
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]