Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-10746

Support Stream FormatSpecification in Spark

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.4.0
    • Component/s: Pipeline Plugins, Pipelines
    • Labels:
      None
    • Release Notes:
      Added support for FormatSpecification in Spark when consuming data from Stream
    • Rank:
      1|hzz9if:

      Description

      If you use the StreamBatchSource with a format and schema, it does not work using the Spark engine.

      It seems like the format spec from:

        @Beta
        public StreamBatchReadable(String streamName, long startTime,
                                   long endTime, FormatSpecification bodyFormatSpec) {
          this(createStreamURI(streamName, createArguments(START_TIME_KEY, startTime,
                                                           END_TIME_KEY, endTime,
                                                           BODY_FORMAT_KEY, encodeFormatSpec(bodyFormatSpec))));
        }
      

      is not used in spark, but is in mapreduce.

      As a result, we get an exception like:

      java.lang.ClassCastException: java.nio.HeapByteBuffer cannot be cast to co.cask.cdap.api.data.format.StructuredRecord at co.cask.hydrator.plugin.batch.source.StreamBatchSource.transform(StreamBatchSource.java:147) at co.cask.hydrator.plugin.batch.source.StreamBatchSource.transform(StreamBatchSource.java:54) at co.cask.cdap.etl.common.TrackedTransform.transform(TrackedTransform.java:43) at co.cask.cdap.etl.common.TransformExecutor.executeTransformation(TransformExecutor.java:85) at co.cask.cdap.etl.common.TransformExecutor.runOneIteration(TransformExecutor.java:49) at co.cask.cdap.etl.batch.spark.ETLSparkProgram$TransformExecutorFunction.call(ETLSparkProgram.java:159) at co.cask.cdap.etl.batch.spark.ETLSparkProgram$TransformExecutorFunction.call(ETLSparkProgram.java:129) at org.apache.spark.api.java.JavaRDDLike$$anonfun$fn$3$1.apply(JavaRDDLike.scala:134) at org.apache.spark.api.java.JavaRDDLike$$anonfun$fn$3$1.apply(JavaRDDLike.scala:134) at scala.collection.Iterator$$anon$13.hasNext(Iterator.scala:371) at 
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                terence Terence Yim
                Reporter:
                ashau Albert Shau
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: