Github user xuchuanyin commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2324#discussion_r189797915 --- Diff: datamap/bloom/src/main/java/org/apache/carbondata/datamap/bloom/BloomDataMapCache.java --- @@ -133,15 +132,14 @@ private int validateAndGetCacheSize() { */ private List<BloomDMModel> loadBloomDataMapModel(CacheKey cacheKey) { DataInputStream dataInStream = null; - ObjectInputStream objectInStream = null; List<BloomDMModel> bloomDMModels = new ArrayList<BloomDMModel>(); try { String indexFile = getIndexFileFromCacheKey(cacheKey); dataInStream = FileFactory.getDataInputStream(indexFile, FileFactory.getFileType(indexFile)); - objectInStream = new ObjectInputStream(dataInStream); try { - BloomDMModel model = null; - while ((model = (BloomDMModel) objectInStream.readObject()) != null) { + while (dataInStream.available() > 0) { --- End diff -- It seems that you use `dataInStream.available()== 0` to indicate that all the content of the stream has been consumed, however it only means that you have only consumed all the available content with non-blocking, there may be leftover content in the stream which will be reached for the next blocking call.
---