761417898 commented on code in PR #542: URL: https://github.com/apache/tsfile/pull/542#discussion_r2206918529
########## cpp/src/encoding/decoder_factory.h: ########## @@ -53,47 +56,86 @@ class DecoderFactory { } } - static Decoder *alloc_value_decoder(common::TSEncoding encoding, + static Decoder* alloc_value_decoder(common::TSEncoding encoding, common::TSDataType data_type) { - if (encoding == common::PLAIN) { - ALLOC_AND_RETURN_DECODER(PlainDecoder); - } else if (encoding == common::GORILLA) { - if (data_type == common::INT32 || data_type == common::DATE) { - ALLOC_AND_RETURN_DECODER(IntGorillaDecoder); - } else if (data_type == common::INT64 || - data_type == common::TIMESTAMP) { - ALLOC_AND_RETURN_DECODER(LongGorillaDecoder); - } else if (data_type == common::FLOAT) { - ALLOC_AND_RETURN_DECODER(FloatGorillaDecoder); - } else if (data_type == common::DOUBLE) { - ALLOC_AND_RETURN_DECODER(DoubleGorillaDecoder); - } else { + using namespace common; + + switch (encoding) { + case PLAIN: + ALLOC_AND_RETURN_DECODER(PlainDecoder); + + case DICTIONARY: + switch (data_type) { + case STRING: + case TEXT: + ALLOC_AND_RETURN_DECODER(DictionaryDecoder); + default: + ASSERT(false); + } Review Comment: fixed. return nullptr and then return error code -- 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: notifications-unsubscr...@tsfile.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org