Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adapt Spark 3.x #905

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions rocketmq-spark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<rocketmq.version>4.9.4</rocketmq.version>
<spark.version>2.3.0</spark.version>
<scala.version>2.11.8</scala.version>
<scala.binary.version>2.11</scala.binary.version>
<spark.version>3.3.1</spark.version>
<scala.version>2.12.10</scala.version>
<scala.binary.version>2.12</scala.binary.version>
<commons-lang.version>2.5</commons-lang.version>
</properties>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ private class RocketMQSource(
if (content(0) == 'v') {
val indexOfNewLine = content.indexOf("\n")
if (indexOfNewLine > 0) {
val version = parseVersion(content.substring(0, indexOfNewLine), VERSION)
RocketMQSourceOffset(SerializedOffset(content.substring(indexOfNewLine + 1)))
} else {
throw new IllegalStateException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
package org.apache.spark.sql.rocketmq

import org.apache.rocketmq.common.message.MessageQueue
import org.apache.spark.sql.connector.read.streaming.PartitionOffset
import org.apache.spark.sql.execution.streaming.{Offset, SerializedOffset}
import org.apache.spark.sql.sources.v2.reader.streaming.{PartitionOffset, Offset => OffsetV2}

/**
* An [[Offset]] for the [[RocketMQSource]]. This one tracks all partitions of subscribed topics and
* their offsets.
*/
private[rocketmq]
case class RocketMQSourceOffset(queueToOffsets: Map[MessageQueue, Long]) extends OffsetV2 {
case class RocketMQSourceOffset(queueToOffsets: Map[MessageQueue, Long]) extends Offset {
override val json = JsonUtils.partitionOffsets(queueToOffsets)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private[rocketmq] class RocketMQSourceRDD(
}
}
// Release consumer, either by removing it or indicating we're no longer using it
context.addTaskCompletionListener { _ =>
context.addTaskCompletionListener[Unit] { _ =>
underlying.closeIfNeeded()
}
underlying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class RocketMqRDD (
logDebug(s"Computing topic ${part.topic}, queueId ${part.queueId} " +
s"offsets ${part.partitionOffsetRanges.mkString(",")}")

context.addTaskCompletionListener{ context => closeIfNeeded() }
context.addTaskCompletionListener[Unit]{ context => closeIfNeeded() }


val consumer = if (useConsumerCache) {
Expand Down