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

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

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

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

heuermh opened this issue Jan 19, 2017 · 2 comments

Comments

@heuermh
Copy link
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
Copy link
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.

@heuermh
Copy link
Member Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants