Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> C++ sample in 1.7.6 fails with EOF reached using a record containing a filed with a string


Copy link to this message
-
C++ sample in 1.7.6 fails with EOF reached using a record containing a filed with a string
If I have a schema that looks like this:

{"namespace": "Dummy",
"type": "record",
"name": "String",
"fields": [
    {"name": "name",
    "type": "string",
    "default": "NONE",
    "doc": "The Name"
    }
]
}

With a program to set and retrieve the value of the name based on generated.cc found in the C++ documentation:

#include <cstdlib>              // for EXIT_SUCCESS
#include <stdexcept>

#include <Dummy.hpp>

#include <avro/Encoder.hh>
#include <avro/Decoder.hh>

int
main(int argc,
    char **argv)
{
  std::auto_ptr<avro::OutputStream> out = avro::memoryOutputStream();
  avro::EncoderPtr e = avro::binaryEncoder();
  e->init(*out);

  Mine::String anInput;
  anInput.name = "This is a name";

  std::auto_ptr<avro::InputStream> in = avro::memoryInputStream(*out);
  avro::DecoderPtr d = avro::binaryDecoder();
  d->init(*in);

  Mine::String anOutput;

  try
  {
     avro::decode(*d, anOutput);
  }
  catch (std::exception& e)
  {
     std::cerr << e.what()
               << std::endl;

     exit (EXIT_FAILURE);
  }

  return EXIT_SUCCESS;
}

On O X 10.9.1 using clang version 3.3 (tags/RELEASE_33/final), I receive the following exception when the program is run:

EOF reached

Is this a known issue with the C++ bindings in avro 1.7.6?
 
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB