-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-22660][BUILD] Use position() and limit() to fix ambiguity issue in scala-2.12 #19854
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of change is fine as it's backwards-compatible, if it resolves a real compiler issues later. But collect as many of this type of problem in this PR rather than across several.
Test build #4001 has finished for PR 19854 at commit
|
ok to test |
Test build #84344 has finished for PR 19854 at commit
|
Let's fix the title to |
@@ -99,7 +99,7 @@ private[spark] class TorrentBroadcast[T: ClassTag](obj: T, id: Long) | |||
private def calcChecksum(block: ByteBuffer): Int = { | |||
val adler = new Adler32() | |||
if (block.hasArray) { | |||
adler.update(block.array, block.arrayOffset + block.position, block.limit - block.position) | |||
adler.update(block.array, block.arrayOffset + block.position(), block.limit() - block.position()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exceeds 100 character length limit. See the logs in Jenkins tests.
cleanerField.set(buffer, cleaner); | ||
// sun.misc.Cleaner is not used in JDK9(see SPARK-22659), we can use CleanUtil in HADOOP-12760 to solve it | ||
// Cleaner cleaner = Cleaner.create(buffer, () -> freeMemory(memory)); | ||
// cleanerField.set(buffer, cleaner); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change isn't valid and isn't related
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure I can remove the comment like " sun.misc.Cleaner is not used in JDK9(see SPARK-22659), we can use CleanUtil in HADOOP-12760 to solve it"
sun.misc.Cleaner has moved to a new location in OpenJDK 9. If uncommenting code about Cleaner, compile will fail. Cleaner is used to release memory. If commenting code about cleaner, there maybe some function lost. Can you give me some suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srowen : have deleted changes about Platform.java. So current pr is only for solving problems met in scala-2.12 and can not fix the problem about JDK9.
properties.putAll(propsMap.asJava) | ||
// properties.putAll(propsMap.asJava) | ||
// see https://github.com/apache/kafka/pull/3647 | ||
propsMap.foreach{ case (k, v) => properties.put(k, v) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: space before brace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the direct reference should be scala/bug#10418.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we should not leave commented code.
@@ -296,7 +296,8 @@ class KafkaTestUtils(withBrokerProps: Map[String, Object] = Map.empty) extends L | |||
props.put("replica.socket.timeout.ms", "1500") | |||
props.put("delete.topic.enable", "true") | |||
props.put("offsets.topic.num.partitions", "1") | |||
props.putAll(withBrokerProps.asJava) | |||
// props.putAll(withBrokerProps.asJava) | |||
withBrokerProps.foreach{ case (k, v) => props.put(k, v) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this related?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scala/bug#10418. I see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the change to the putAll is similar as the solution provided in scala/bug#10418
@@ -424,7 +426,9 @@ case class HiveScriptIOSchema ( | |||
recordReaderClass.map { klass => | |||
val instance = Utils.classForName(klass).newInstance().asInstanceOf[RecordReader] | |||
val props = new Properties() | |||
props.putAll(outputSerdeProps.toMap.asJava) | |||
// props.putAll(outputSerdeProps.toMap.asJava) | |||
// see https://github.com/apache/kafka/pull/3647 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto. I think it is better to remove commented code and refer to scala/bug#10418.
Ping @kellyzly |
Test build #84525 has finished for PR 19854 at commit
|
@@ -296,7 +296,8 @@ class KafkaTestUtils(withBrokerProps: Map[String, Object] = Map.empty) extends L | |||
props.put("replica.socket.timeout.ms", "1500") | |||
props.put("delete.topic.enable", "true") | |||
props.put("offsets.topic.num.partitions", "1") | |||
props.putAll(withBrokerProps.asJava) | |||
// props.putAll(withBrokerProps.asJava) | |||
withBrokerProps.foreach{ case (k, v) => props.put(k, v) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: h{
-> h {
Test build #84540 has finished for PR 19854 at commit
|
Please fix the title and also fulfill the PR description. |
thanks @HyukjinKwon ,@srowen, @viirya 's review |
Merged to master |
…a-2.12 and JDK9
What changes were proposed in this pull request?
Some compile error after upgrading to scala-2.12
The limit method was moved from ByteBuffer to the superclass Buffer and it can no longer be called without (). The same reason for position method.
This is because the key type is Object instead of String which is unsafe.
How was this patch tested?
running tests
Please review http://spark.apache.org/contributing.html before opening a pull request.