-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[query] Add RouterFS to scala to permit local file system IO in QoB (#…
…12667) * [query] Add RouterFS to scala to permit local file system IO in QoB * erasure * scala is stupid * override open/create cached * fix cast
- Loading branch information
Showing
4 changed files
with
50 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package is.hail.io.fs | ||
|
||
class RouterFS(schemes: Map[String, FS], default: String) extends FS { | ||
|
||
def lookupFS(path: String): FS = { | ||
val uri = new java.net.URI(path) | ||
schemes.getOrElse(uri.getScheme, schemes(default)) | ||
} | ||
|
||
override def openCachedNoCompression(filename: String): SeekableDataInputStream = lookupFS(filename).openCachedNoCompression(filename) | ||
|
||
override def createCachedNoCompression(filename: String): PositionedDataOutputStream = lookupFS(filename).createCachedNoCompression(filename) | ||
|
||
def openNoCompression(filename: String, _debug: Boolean = false): SeekableDataInputStream = lookupFS(filename).openNoCompression(filename, _debug) | ||
|
||
def createNoCompression(filename: String): PositionedDataOutputStream = lookupFS(filename).createNoCompression(filename) | ||
|
||
override def mkDir(dirname: String): Unit = lookupFS(dirname).mkDir(dirname) | ||
|
||
def delete(filename: String, recursive: Boolean) = lookupFS(filename).delete(filename, recursive) | ||
|
||
def listStatus(filename: String): Array[FileStatus] = lookupFS(filename).listStatus(filename) | ||
|
||
def glob(filename: String): Array[FileStatus] = lookupFS(filename).glob(filename) | ||
|
||
def fileStatus(filename: String): FileStatus = lookupFS(filename).fileStatus(filename) | ||
|
||
def makeQualified(path: String): String = lookupFS(path).makeQualified(path) | ||
|
||
def getConfiguration(): Any = schemes.map { case (k, v) => (k, v.getConfiguration()) } | ||
|
||
def setConfiguration(config: Any): Unit = { | ||
config.asInstanceOf[Map[_, _]].foreach { case (k: String, v: Any) => schemes(k).setConfiguration(v) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters