avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhod...@apache.org
Subject svn commit: r951267 - in /avro/branches/branch-1.3: ./ lang/ruby/lib/avro/io.rb lang/ruby/test/test_datafile.rb
Date Fri, 04 Jun 2010 05:25:18 GMT
Author: jmhodges
Date: Fri Jun  4 05:25:18 2010
New Revision: 951267

URL: http://svn.apache.org/viewvc?rev=951267&view=rev
Log:
AVRO-461. Skipping primitives in the ruby side. Merge from trunk.

Added:
    avro/branches/branch-1.3/lang/ruby/test/test_datafile.rb
      - copied unchanged from r930458, hadoop/avro/trunk/lang/ruby/test/test_datafile.rb
Modified:
    avro/branches/branch-1.3/   (props changed)
    avro/branches/branch-1.3/lang/ruby/lib/avro/io.rb

Propchange: avro/branches/branch-1.3/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jun  4 05:25:18 2010
@@ -1,2 +1,2 @@
 /avro/trunk:944035,944049
-/hadoop/avro/trunk:935526,938347
+/hadoop/avro/trunk:930458,935526,938347

Modified: avro/branches/branch-1.3/lang/ruby/lib/avro/io.rb
URL: http://svn.apache.org/viewvc/avro/branches/branch-1.3/lang/ruby/lib/avro/io.rb?rev=951267&r1=951266&r2=951267&view=diff
==============================================================================
--- avro/branches/branch-1.3/lang/ruby/lib/avro/io.rb (original)
+++ avro/branches/branch-1.3/lang/ruby/lib/avro/io.rb Fri Jun  4 05:25:18 2010
@@ -424,7 +424,6 @@ module Avro
         if readers_fields_hash.size > read_record.size
           writers_fields_hash = writers_schema.fields_hash
           readers_fields_hash.each do |field_name, field|
-            
             unless writers_fields_hash.has_key? field_name
               if !field.default.nil?
                 field_val = read_default_value(field.type, field.default)
@@ -482,6 +481,41 @@ module Avro
           raise AvroError(fail_msg)
         end
       end
+
+      def skip_data(writers_schema, decoder)
+        case writers_schema.type
+        when 'null'
+          decoder.skip_null
+        when 'boolean'
+          decoder.skip_boolean
+        when 'string'
+          decoder.skip_string
+        when 'int'
+          decoder.skip_int
+        when 'long'
+          decoder.skip_long
+        when 'float'
+          decoder.skip_float
+        when 'double'
+          decoder.skip_double
+        when 'bytes'
+          decoder.skip_bytes
+        when 'fixed'
+          skip_fixed(writers_schema, decoder)
+        when 'enum'
+          skip_enum(writers_schema, decoder)
+        when 'array'
+          skip_array(writers_schema, decoder)
+        when 'map'
+          skip_map(writers_schema, decoder)
+        when 'union'
+          skip_union(writers_schema, decoder)
+        when 'record', 'error', 'request'
+          skip_record(writers_schema, decoder)
+        else
+          raise AvroError, "Unknown schema type: #{schm.type}"
+        end
+      end
     end # DatumReader
 
     # DatumWriter for generic ruby objects



Mime
View raw message