VERIFIED SOLUTION i

Spectrum error: RuntimeException "java.lang.Double cannot be cast to java.lang.String"

Issue

Spectrum dataflow has a Transformer Stage using the ConstructField option to concatenate two values and store it in a variable. During the execution of a job, an error is thrown "java.lang.Double cannot be cast to java.lang.String"

Details of error in wrapper log:

ERROR [ServiceGateway] Gateway exception: java.lang.RuntimeException: Exception thrown by Stage:Party Rec Key in dataflow sBulkScrWNew: com.g1.dcg.stage.StageException: com.g1.dcg.server.dataflow.stages.transformer.InvalidTransformDefinitionException: 'Template' failed: java.lang.Double cannot be cast to java.lang.String
INFO | jvm 1 | com.pb.spectrum.platform.server.runtime.api.service.ServiceGatewayException: java.lang.RuntimeException: Exception thrown by Stage:Party Rec Key in dataflow sBulkScrWNew: com.g1.dcg.stage.StageException: com.g1.dcg.server.dataflow.stages.transformer.InvalidTransformDefinitionException: 'Template' failed: java.lang.Double cannot be cast to java.lang.String
INFO | jvm 1 | at com.pb.spectrum.platform.server.runtime.core.service.impl.LocalMessageProcessor.process(LocalMessageProcessor.java:35)
INFO | jvm 1 | at com.pb.spectrum.platform.server.runtime.core.service.impl.ServiceRouter.process(ServiceRouter.java:131)
INFO | jvm 1 |Caused by: java.lang.RuntimeException: Exception thrown by Stage:Party Rec Key in dataflow sBulkScrWNew: com.g1.dcg.stage.StageException: com.g1.dcg.server.dataflow.stages.transformer.InvalidTransformDefinitionException: 'Template' failed: java.lang.Double cannot be cast to java.lang.String
INFO | jvm 1 | at com.pb.spectrum.platform.server.runtime.core.dataflow.engine.impl.DataflowImpl.run_aroundBody0(DataflowImpl.java:370)
INFO | jvm 1 | Caused by: com.g1.dcg.stage.StageException: com.g1.dcg.server.dataflow.stages.transformer.InvalidTransformDefinitionException: 'Template' failed: java.lang.Double cannot be cast to java.lang.String
INFO | jvm 1 |at com.g1.dcg.server.dataflow.stages.transformer.Transformer.execute(Transformer.java:75)
INFO | jvm 1 | at com.pb.spectrum.platform.server.runtime.core.dataflow.engine.impl.StageRunner.call_aroundBody0(StageRunner.java:187)
INFO | jvm 1 | at com.pb.spectrum.platform.server.runtime.core.dataflow.engine.impl.StageRunner.call_aroundBody1$advice(StageRunner.java:135)
INFO | jvm 1 | at com.pb.spectrum.platform.server.runtime.core.dataflow.engine.impl.StageRunner.call(StageRunner.java:1)
INFO | jvm 1 | at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:178)
INFO | jvm 1 |at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
INFO | jvm 1 |at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
INFO | jvm 1 | at java.lang.Thread.run(Thread.java:662)
INFO | jvm 1 | Caused by: com.g1.dcg.server.dataflow.stages.transformer.InvalidTransformDefinitionException: 'Template' failed: java.lang.Double cannot be cast to java.lang.String
INFO | jvm 1 | at com.g1.dcg.server.dataflow.stages.transformer.ScriptTransform.transform(ScriptTransform.java:103)
INFO | jvm 1 | at com.g1.dcg.server.dataflow.stages.transformer.CompositeTransform.transform(CompositeTransform.java:31)
INFO | jvm 1 | at com.g1.dcg.server.dataflow.stages.transformer.Transformer.execute(Transformer.java:69)
INFO | jvm 1 | Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String
INFO | jvm 1 | at com.g1.dcg.server.dataflow.stages.transformer.DataMapDataRow.get(DataMapDataRow.java:33)
INFO | jvm 1 | at sun.reflect.GeneratedMethodAccessor416.invoke(Unknown Source)
INFO | jvm 1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
INFO | jvm 1 | at java.lang.reflect.Method.invoke(Method.java:597)
INFO | jvm 1 | at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
INFO | jvm 1 | at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
INFO | jvm 1 | at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
INFO | jvm 1 | at script1374182079183.run(script1374182079183.groovy:1)
INFO | jvm 1 | at com.g1.cdq.util.script.GroovyScript.run(GroovyScript.java:22)
INFO | jvm 1 | at com.g1.dcg.server.dataflow.stages.transformer.ScriptTransform.transform(ScriptTransform.java:95)

Cause

The Construct Transform does not handle non-string data types well and one of the input fields being used is a number.

Resolution

UPDATED: March 31, 2017
Use a custom transform instead.
 
Environment Details
Product Feature: Installation / Upgrade

Operating System: Windows, Linux, Unix

Version: 8,9