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

Increase visibility for ADAMContext.sc and/or getFs... methods #1356

Closed
heuermh opened this Issue Jan 19, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@heuermh
Member

heuermh commented Jan 19, 2017

The Hadoop configuration from the SparkContext associated with an ADAMContext needs to be accessible for subclasses to access the FileSystem

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] .../org/dishevelled/bio/adam/BiojavaAdamContext.java:[136,52]
  sc has private access in org.bdgenomics.adam.rdd.ADAMContext

Alternately, we could increase the visibility of the getFs... methods from private[rdd] to protected.

@fnothaft

This comment has been minimized.

Show comment
Hide comment
@fnothaft

fnothaft Jan 19, 2017

Member

Ah, I hadn't thought of the Java access patterns here. I think we should just make the sc field of ADAMContext public again.

Member

fnothaft commented Jan 19, 2017

Ah, I hadn't thought of the Java access patterns here. I think we should just make the sc field of ADAMContext public again.

@heuermh

This comment has been minimized.

Show comment
Hide comment
@heuermh

heuermh Jan 19, 2017

Member

The workaround is not so bad, I wrap sc in the constructor into a JavaSparkContext field

public class MyAdamContext extends ADAMContext {
  private final transient JavaSparkContext javaSparkContext;

  public MyAdamContext(final SparkContext sc) {
    super(sc);
    javaSparkContext = new JavaSparkContext(sc);
  }

  //...

  FileSystem fileSystem = path.getFileSystem(javaSparkContext.hadoopConfiguration());

https://github.com/heuermh/dishevelled-bio/blob/master/adam/src/main/java/org/dishevelled/bio/adam/BiojavaAdamContext.java#L133

What do you think about the getFs... methods?

Member

heuermh commented Jan 19, 2017

The workaround is not so bad, I wrap sc in the constructor into a JavaSparkContext field

public class MyAdamContext extends ADAMContext {
  private final transient JavaSparkContext javaSparkContext;

  public MyAdamContext(final SparkContext sc) {
    super(sc);
    javaSparkContext = new JavaSparkContext(sc);
  }

  //...

  FileSystem fileSystem = path.getFileSystem(javaSparkContext.hadoopConfiguration());

https://github.com/heuermh/dishevelled-bio/blob/master/adam/src/main/java/org/dishevelled/bio/adam/BiojavaAdamContext.java#L133

What do you think about the getFs... methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment