mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 19:50:29 +08:00
Merge pull request #93 from windpiger/orc-columncount
change the logic of getting orc column count in DFSUtil.java
This commit is contained in:
commit
068b1db928
@ -486,15 +486,10 @@ public class DFSUtil {
|
||||
}
|
||||
|
||||
private int getAllColumnsCount(String filePath) {
|
||||
int columnsCount;
|
||||
final String colFinal = "_col";
|
||||
Path path = new Path(filePath);
|
||||
try {
|
||||
Reader reader = OrcFile.createReader(path, OrcFile.readerOptions(hadoopConf));
|
||||
String type_struct = reader.getObjectInspector().getTypeName();
|
||||
columnsCount = (type_struct.length() - type_struct.replace(colFinal, "").length())
|
||||
/ colFinal.length();
|
||||
return columnsCount;
|
||||
return reader.getTypes().get(0).getSubtypesCount();
|
||||
} catch (IOException e) {
|
||||
String message = "读取orcfile column列数失败,请联系系统管理员";
|
||||
throw DataXException.asDataXException(HdfsReaderErrorCode.READ_FILE_ERROR, message);
|
||||
|
Loading…
Reference in New Issue
Block a user