-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to the notice and refactor the createAzureFs
- Loading branch information
1 parent
5c57c5c
commit 3ab85bf
Showing
9 changed files
with
92 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,6 @@ | |
import org.apache.flink.runtime.fs.hdfs.HadoopFileSystem; | ||
import org.apache.flink.runtime.util.HadoopConfigLoader; | ||
|
||
import org.apache.hadoop.fs.azure.NativeAzureFileSystem; | ||
import org.apache.hadoop.fs.azurebfs.AzureBlobFileSystem; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
|
@@ -73,30 +71,14 @@ public void configure(Configuration config) { | |
configLoader.setFlinkConfig(config); | ||
} | ||
|
||
abstract org.apache.hadoop.fs.FileSystem createAzureFS( | ||
URI fsUri, org.apache.hadoop.conf.Configuration hadoopConfig) throws IOException; | ||
|
||
@Override | ||
public FileSystem create(URI fsUri) throws IOException { | ||
checkNotNull(fsUri, "passed file system URI object should not be null"); | ||
LOG.info("Trying to load and instantiate Azure File System for {}", fsUri); | ||
return new HadoopFileSystem(createInitializedAzureFS(fsUri, flinkConfig)); | ||
} | ||
|
||
// uri is of the form: wasb(s)://[email protected]/testDir (or) | ||
// abfs(s):////[email protected]/testDir | ||
private org.apache.hadoop.fs.FileSystem createInitializedAzureFS( | ||
URI fsUri, Configuration flinkConfig) throws IOException { | ||
org.apache.hadoop.conf.Configuration hadoopConfig = configLoader.getOrLoadHadoopConfig(); | ||
String scheme = fsUri.getScheme(); | ||
|
||
if (scheme.startsWith("wasb")) { | ||
LOG.info("Trying to initialize hadoop filesystem for {}.", scheme); | ||
org.apache.hadoop.fs.FileSystem azureFS = new NativeAzureFileSystem(); | ||
azureFS.initialize(fsUri, hadoopConfig); | ||
return azureFS; | ||
} else { | ||
LOG.info("Trying to initialize hadoop filesystem for {}.", scheme); | ||
org.apache.hadoop.fs.FileSystem azureFS = new AzureBlobFileSystem(); | ||
azureFS.initialize(fsUri, hadoopConfig); | ||
return azureFS; | ||
} | ||
return new HadoopFileSystem(createAzureFS(fsUri, hadoopConfig)); | ||
} | ||
} |
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
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
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