Github user manishgupta88 commented on the issue:
https://github.com/apache/carbondata/pull/2503
@ravipesala ...Please correct me if my understanding is not correct.
SegmentFileName != null check was introduced at the time when partition
feature was developed to distinguish between partition and non partition table.
Now segment file is written even if is a normal table. So using this check is
not correct.
I think better we can write one generic method and pass carbonTable
instance as argument to it and check for hive partiton
table/supportFlatFolder/non transactional table. On this condition we can use
if and else block and call the respective methods

---