In recent ClickHouse versions (21.3) Avro format for kafka does not work at all.
In ClickHouse 20.3 one Avro formatted kafka message can read, than stall forever.
Reportedly in ClickHouse prior 20.3 Avro formatted kafka messages work Ok while contain only single record
#include <Poco/URI.h>
namespace DB
{
namespace ErrorCodes
{
    extern const int BAD_ARGUMENTS;
    extern const int THERE_IS_NO_COLUMN;
    extern const int INCORRECT_DATA;
    extern const int ILLEGAL_COLUMN;
    extern const int TYPE_MISMATCH;
    extern const int CANNOT_PARSE_UUID;
    extern const int CANNOT_READ_ALL_DATA;
}
class InputStreamReadBufferAdapter : public avro::InputStream
{
public:
    explicit InputStreamReadBufferAdapter(ReadBuffer & in_) : in(in_) {}
    bool next(const uint8_t ** data, size_t * len) override
    {
        if (in.eof())
        {
            *len = 0;
            return false;
        }
        *data = reinterpret_cast<const uint8_t *>(in.position());
        *len = in.available();
        in.position() += in.available();
        return true;
    }
    void backup(size_t len) override { in.position() -= len; }