chaokunyang commented on code in PR #1663:
URL: https://github.com/apache/incubator-fury/pull/1663#discussion_r1623138835
##########
java/fury-core/src/main/java/org/apache/fury/config/FuryBuilder.java:
##########
@@ -251,6 +254,37 @@ public FuryBuilder withScopedMetaShare(boolean scoped) {
return this;
}
+ /**
+ * Set a compressor for meta compression. Note that the passed {@link
MetaCompressor} should be
+ * thread-safe. By default, a `Deflater` based compressor {@link
DeflaterMetaCompressor} will be
+ * used. Users can pass other compressor such as `zstd` for better
compression rate.
+ */
+ public FuryBuilder withMetaCompressor(MetaCompressor metaCompressor) {
+ Class<?> clz = metaCompressor.getClass();
+ if (clz != DeflaterMetaCompressor.class) {
+ while (clz != null) {
+ try {
+ clz.getDeclaredMethod("hashCode");
+ if (clz == Object.class) {
+ LOG.warn(
+ "{} should implement equals/hashCode method, "
+ + "otherwise compile cache may won't work. "
+ + "Use type to check MetaCompressor identity instead, but
this"
+ + "may be incorrect if different compressor instance of
same type "
+ + "indicates different compressor.",
+ metaCompressor);
+ metaCompressor =
MetaCompressor.typeEqualMetaCompressor(metaCompressor);
+ }
+ break;
+ } catch (NoSuchMethodException e) {
+ clz = clz.getSuperclass();
+ }
+ }
Review Comment:
good suggestion, updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]