crunch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chao Shi (JIRA)" <>
Subject [jira] [Commented] (CRUNCH-346) Don't deep-copy immutable Writable PTypes
Date Sun, 16 Feb 2014 16:51:19 GMT


Chao Shi commented on CRUNCH-346:

Hi [~gabriel.reid], I haven't started yet. Please feel free to attach your patch.

bq.  but apparently that's only the case with Avro.
I don't quite understand. Could you explain more why writable PTypes cannot?
As far as I understand, we do deep-copy because
1) we don't want DoFn modifying its input affects others (e.g. deep-copy in IntermediateEmitter)
2) the content of Writable input to mapper or reducer is changed over each run, so it becomes
invalid out-of-scope of the mapper/reducer function

In crunch world, we use PTypes built from writables. If the PType is immutable (e.g. java
String), it does not reference to the writable type MR pass to us. Please correct me if I
was wrong.

> Don't deep-copy immutable Writable PTypes
> -----------------------------------------
>                 Key: CRUNCH-346
>                 URL:
>             Project: Crunch
>          Issue Type: Improvement
>            Reporter: Chao Shi
> I found getDetachedValue() appears quite often when jstack on one of my pipeline. A piece
of stacktrace is shown below. In the pipeline, most of types we used are immutable (e.g. java
primitives, strings, protobuf). I think we can avoid deep-copy overhead here.
> "main" prio=10 tid=0x00007f0de801d800 nid=0x7ef runnable [0x00007f0dee66c000]
>    java.lang.Thread.State: RUNNABLE
> 	at<init>(
> 	at<init>(
> 	at sun.reflect.GeneratedConstructorAccessor9.newInstance(Unknown Source)
> 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
> 	at java.lang.reflect.Constructor.newInstance(
> 	at java.lang.Class.newInstance0(
> 	at java.lang.Class.newInstance(
> 	at org.apache.crunch.types.writable.WritableDeepCopier.deepCopy(
> 	at org.apache.crunch.types.writable.WritableDeepCopier.deepCopy(
> 	at org.apache.crunch.types.writable.WritableType.getDetachedValue(
> 	at

This message was sent by Atlassian JIRA

View raw message