lszskye commented on code in PR #490:
URL: https://github.com/apache/paimon-cpp/pull/490#discussion_r4466723169


##########
src/paimon/common/file_index/file_index_format.cpp:
##########
@@ -108,13 +108,14 @@ class FileIndexFormatReaderImpl : public 
FileIndexFormat::Reader {
     Result<std::shared_ptr<FileIndexReader>> GetFileIndexReader(
         const std::string& column_name, const std::shared_ptr<arrow::Schema>& 
arrow_schema,
         const std::string& index_type, const std::pair<int64_t, int64_t>& 
offset_and_length) const {
-        if (offset_and_length.first == FileIndexFormat::EMPTY_INDEX_FLAG) {
-            return std::make_shared<EmptyFileIndexReader>();
-        }
         const std::map<std::string, std::string>& indexer_options =
             options_.GetIndexerOptions(column_name, index_type);
         PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<FileIndexer> file_indexer,
                                FileIndexerFactory::Get(index_type, 
indexer_options));
+        if (offset_and_length.first == FileIndexFormat::EMPTY_INDEX_FLAG) {
+            return file_indexer ? file_indexer->CreateEmptyReader()
+                                : std::make_shared<EmptyFileIndexReader>();

Review Comment:
   FileIndexerFactory::Get() explicitly returns a successful result containing 
nullptr when no matching file indexer factory is registered. For example, the 
file may contain an index whose backend is unavailable in the current runtime.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to