Skip to content

[SPARK-24093][DStream][Minor]Make some fields of KafkaStreamWriter/In… - #21455

Closed
merlintang wants to merge 1 commit into
apache:masterfrom
merlintang:“Spark-24093”

Hidden character warning

The head ref may contain hidden characters: "\u201cSpark-24093\u201d"
Closed

[SPARK-24093][DStream][Minor]Make some fields of KafkaStreamWriter/In…#21455
merlintang wants to merge 1 commit into
apache:masterfrom
merlintang:“Spark-24093”

Conversation

@merlintang

@merlintangmerlintang commented May 29, 2018

Copy link
Copy Markdown

…ternalRowMicroBatchWriter visible to outside of the classes

What changes were proposed in this pull request?

This PR is created to make relevant fields of KafkaStreamWriter and InternalRowMicroBatchWriter visible to outside of the classes.

How was this patch tested?

manual tests

…ternalRowMicroBatchWriter visible to outside of the classes
@merlintang

Copy link
Copy Markdown
Author

@jerryshao can you review this minor update ?

@jerryshao

Copy link
Copy Markdown
Contributor

Simply making these fields publicly accessible seems a little weird from Spark's side. Maybe we can use reflection instead.

@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

@merlintang

Copy link
Copy Markdown
Author

@jerryshao Actually, we can not use reflection to get this field information.

@gaborgsomogyi

Copy link
Copy Markdown
Contributor

Why is it required at all? Making things visible without proper reason is not a good idea.

@merlintang

merlintang commented Jun 26, 2018 via email

Copy link
Copy Markdown
Author

@gaborgsomogyi

Copy link
Copy Markdown
Contributor

Sounds weird. The topic names are available when the streaming app submitted. Why this can't be reused? Second option is reflection as jerryshao suggested.

@srowensrowen mentioned this pull request Jul 18, 2018
@HyukjinKwon

HyukjinKwon commented Dec 13, 2018

Copy link
Copy Markdown
Member

BTW, fields in class constructors is not visible without val. For instance,

classA(fieldA: String) { }

generates:

$ javap -private A.class
Compiled from "A.scala"
public class A {
public A(java.lang.String);
}

FYI, when val is added:

$ javap -private A.class
Compiled from "A.scala"
public class A {
private final java.lang.String fieldA;
public java.lang.String fieldA();
public A(java.lang.String);
}

@HeartSaVioR

Copy link
Copy Markdown
Contributor

Yeah, that's what also I found interestingly on Scala. Constructor parameters can be used like fields in class but they're not exposed as fields, even private accessor. For case class we can pick up values in constructor parameters but it doesn't work with normal class.

zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@merlintang@jerryshao@AmplabJenkins@gaborgsomogyi@HyukjinKwon@HeartSaVioR