Skip to content

Commit

Permalink
fix hdfs datasource storage path empty bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ywy2090 committed Nov 7, 2024
1 parent 6378d0d commit e699a8f
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.webank.wedpr.common.protocol.StorageType;
import com.webank.wedpr.common.utils.Common;
import com.webank.wedpr.common.utils.ObjectMapperFactory;
import com.webank.wedpr.components.dataset.config.DatasetConfig;
import com.webank.wedpr.components.dataset.datasource.DataSourceMeta;
import com.webank.wedpr.components.dataset.datasource.category.HdfsDataSource;
Expand All @@ -15,6 +16,7 @@
import java.io.File;
import java.util.Arrays;
import java.util.List;
import lombok.SneakyThrows;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -101,10 +103,13 @@ public void prepareData() throws DatasetException {
endTimeMillis - startTimeMillis);
}

@SneakyThrows
@Override
public void analyzeData() throws DatasetException {
String cvsFilePath = dataSourceProcessorContext.getCvsFilePath();
Dataset dataset = dataSourceProcessorContext.getDataset();
HdfsDataSource hdfsDataSource =
(HdfsDataSource) dataSourceProcessorContext.getDataSourceMeta();

long startTimeMillis = System.currentTimeMillis();

Expand Down Expand Up @@ -132,6 +137,15 @@ public void analyzeData() throws DatasetException {
this.dataSourceProcessorContext.getDataset().setDatasetVersionHash(md5Hash);
this.dataSourceProcessorContext.getDataset().setDatasetSize(fileSize);

HDFSStoragePath storagePath = new HDFSStoragePath(hdfsDataSource.getFilePath());
String storagePathStr =
ObjectMapperFactory.getObjectMapper().writeValueAsString(storagePath);
this.dataSourceProcessorContext
.getDataset()
.setDatasetStorageType(storagePath.getStorageType());
this.dataSourceProcessorContext.getDataset().setDatasetStoragePath(storagePathStr);
this.dataSourceProcessorContext.setStoragePath(storagePath);

String datasetId = dataset.getDatasetId();

long endTimeMillis = System.currentTimeMillis();
Expand Down

0 comments on commit e699a8f

Please sign in to comment.