[prev in list] [next in list] [prev in thread] [next in thread] 

List:       avro-commits
Subject:    svn commit: r1495109 - in /avro/trunk: CHANGES.txt lang/c++/impl/Compiler.cc lang/c++/test/SchemaTes
From:       thiru () apache ! org
Date:       2013-06-20 17:17:23
Message-ID: 20130620171723.BE8EC23889EB () eris ! apache ! org
[Download RAW message or body]

Author: thiru
Date: Thu Jun 20 17:17:23 2013
New Revision: 1495109

URL: http://svn.apache.org/r1495109
Log:
AVRO-1346. C++: schema parser cannot parse verbose primitive types

Modified:
    avro/trunk/CHANGES.txt
    avro/trunk/lang/c++/impl/Compiler.cc
    avro/trunk/lang/c++/test/SchemaTests.cc

Modified: avro/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/avro/trunk/CHANGES.txt?rev=1495109&r1=1495108&r2=1495109&view=diff
 ==============================================================================
--- avro/trunk/CHANGES.txt (original)
+++ avro/trunk/CHANGES.txt Thu Jun 20 17:17:23 2013
@@ -102,6 +102,8 @@ Trunk (not yet released)
 
     AVRO-1181. compileJsonSchemaFromString(std::string) declared in Compiler.hh but \
not defined (Daniel Russel via thiru)  
+    AVRO-1346. C++: schema parser cannot parse verbose primitive types (Skye \
Wanderman-Milne via thiru) +
 Avro 1.7.4 (22 February 2012)
 
   NEW FEATURES

Modified: avro/trunk/lang/c++/impl/Compiler.cc
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c%2B%2B/impl/Compiler.cc?rev=1495109&r1=1495108&r2=1495109&view=diff
 ==============================================================================
--- avro/trunk/lang/c++/impl/Compiler.cc (original)
+++ avro/trunk/lang/c++/impl/Compiler.cc Thu Jun 20 17:17:23 2013
@@ -225,13 +225,7 @@ static NodePtr makeNode(const Entity& e,
 {
     const string& type = getField<string>(e, m, "type");
     if (NodePtr result = makePrimitive(type)) {
-        if (m.size() > 1) {
-            throw Exception(boost::format(
-                "Unknown additional Json fields: %1%")
-                % e.toString());
-        } else {
-            return result;
-        }
+        return result;
     } else if (type == "record" || type == "error" ||
         type == "enum" || type == "fixed") {
         Name nm = getName(e, m, ns);

Modified: avro/trunk/lang/c++/test/SchemaTests.cc
URL: http://svn.apache.org/viewvc/avro/trunk/lang/c%2B%2B/test/SchemaTests.cc?rev=1495109&r1=1495108&r2=1495109&view=diff
 ==============================================================================
--- avro/trunk/lang/c++/test/SchemaTests.cc (original)
+++ avro/trunk/lang/c++/test/SchemaTests.cc Thu Jun 20 17:17:23 2013
@@ -83,6 +83,17 @@ const char* basicSchemas[] = {
         "\"namespace\": \"org.apache.hadoop.avro\", \"size\": 1}",
     "{ \"type\": \"fixed\", \"name\": \"Test\", \"size\": 1}",
     "{ \"type\": \"fixed\", \"name\": \"Test\", \"size\": 1}",
+
+    // Extra attributes (should be ignored)
+    "{\"type\": \"null\", \"extra attribute\": \"should be ignored\"}",
+    "{\"type\": \"boolean\", \"extra1\": 1, \"extra2\": 2, \"extra3\": 3}",
+    "{\"type\": \"record\",\"name\": \"Test\",\"fields\": "
+        "[{\"name\": \"f\",\"type\": \"long\"}], \"extra attribute\": 1}",
+    "{\"type\": \"enum\", \"name\": \"Test\", \"symbols\": [\"A\", \"B\"],"
+        "\"extra attribute\": 1}",
+    "{\"type\": \"array\", \"items\": \"long\", \"extra attribute\": 1}",
+    "{\"type\": \"map\", \"values\": \"long\", \"extra attribute\": 1}",
+    "{\"type\": \"fixed\", \"name\": \"Test\", \"size\": 1, \"extra attribute\": \
1}",  };
 
 const char* basicSchemaErrors[] = {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic