Skip to content

Commit

Permalink
[hotfix][test] Initializing MiniDFSCluster avoid using deprecated met…
Browse files Browse the repository at this point in the history
…hods.
  • Loading branch information
slfan1989 committed May 5, 2024
1 parent 978194b commit 93a5f4c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,8 @@ public void testHBaseSerDeWithAvroSchemaUrl() throws SerDeException, IOException

try {
// MiniDFSCluster litters files and folders all over the place.
miniDfs = new MiniDFSCluster(new Configuration(), 1, true, null);
miniDfs = new MiniDFSCluster.Builder(new Configuration()).numDataNodes(1).
format(true).racks(null).build();

miniDfs.getFileSystem().mkdirs(new Path("/path/to/schema"));
FSDataOutputStream out = miniDfs.getFileSystem().create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ private void setupMiniDfsAndMrClusters() {
if(System.getProperty("hadoop.log.dir") == null) {
System.setProperty("hadoop.log.dir", "target/tmp/logs/");
}
m_dfs = new MiniDFSCluster(config, dataNodes, true, null);
m_dfs = new MiniDFSCluster.Builder(config).numDataNodes(dataNodes).format(true)
.racks(null).build();

m_fileSys = m_dfs.getFileSystem();
m_mr = new MiniMRCluster(taskTrackers, m_fileSys.getUri().toString(), 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public void setUp() throws Exception {
// Initialize second mocked filesystem (implement only necessary stuff)
// Physical files are resides in local file system in the similar location
jobConf = new HiveConf(conf);
miniDfs = new MiniDFSCluster(new Configuration(), 1, true, null);
miniDfs = new MiniDFSCluster.Builder(new Configuration()).numDataNodes(1).format(true)
.racks(null).build();
fs2 = miniDfs.getFileSystem();
try {
fs2.delete(tmppathFs2, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ public void determineSchemaCanReadSchemaFromHDFS() throws IOException, AvroSerde
MiniDFSCluster miniDfs = null;
try {
// MiniDFSCluster litters files and folders all over the place.
miniDfs = new MiniDFSCluster(new Configuration(), 1, true, null);
miniDfs = new MiniDFSCluster.Builder(new Configuration()).numDataNodes(1).format(true)
.racks(null).build();

miniDfs.getFileSystem().mkdirs(new Path("/path/to/schema"));
FSDataOutputStream out = miniDfs.getFileSystem()
Expand Down

0 comments on commit 93a5f4c

Please sign in to comment.