avro 1.10.2 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Manifest +0 -1
- data/NOTICE +1 -1
- data/Rakefile +13 -19
- data/avro.gemspec +36 -29
- data/interop/test_interop.rb +2 -1
- data/lib/avro/VERSION.txt +1 -1
- data/lib/avro/data_file.rb +5 -4
- data/lib/avro/io.rb +8 -9
- data/lib/avro/ipc.rb +9 -5
- data/lib/avro/logical_types.rb +186 -2
- data/lib/avro/protocol.rb +1 -0
- data/lib/avro/schema.rb +68 -11
- data/lib/avro/schema_compatibility.rb +11 -11
- data/lib/avro/schema_normalization.rb +1 -0
- data/lib/avro/schema_validator.rb +13 -12
- data/lib/avro.rb +1 -0
- data/test/case_finder.rb +1 -0
- data/test/random_data.rb +5 -4
- data/test/sample_ipc_client.rb +1 -0
- data/test/sample_ipc_http_client.rb +1 -0
- data/test/sample_ipc_http_server.rb +1 -0
- data/test/sample_ipc_server.rb +1 -0
- data/test/test_datafile.rb +1 -0
- data/test/test_fingerprints.rb +1 -0
- data/test/test_help.rb +1 -0
- data/test/test_io.rb +31 -16
- data/test/test_logical_types.rb +138 -1
- data/test/test_protocol.rb +2 -1
- data/test/test_schema.rb +134 -4
- data/test/test_schema_compatibility.rb +106 -0
- data/test/test_schema_normalization.rb +1 -0
- data/test/test_schema_validator.rb +17 -2
- data/test/test_socket_transport.rb +1 -0
- data/test/tool.rb +8 -7
- metadata +26 -30
- data/CHANGELOG +0 -1
data/test/test_schema.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
3
|
# or more contributor license agreements. See the NOTICE file
|
|
3
4
|
# distributed with this work for additional information
|
|
@@ -541,6 +542,76 @@ class TestSchema < Test::Unit::TestCase
|
|
|
541
542
|
exception.to_s)
|
|
542
543
|
end
|
|
543
544
|
|
|
545
|
+
def test_fixed_decimal_to_include_precision_scale
|
|
546
|
+
schema = Avro::Schema.parse <<-SCHEMA
|
|
547
|
+
{
|
|
548
|
+
"type": "fixed",
|
|
549
|
+
"name": "aFixed",
|
|
550
|
+
"logicalType": "decimal",
|
|
551
|
+
"size": 4,
|
|
552
|
+
"precision": 9,
|
|
553
|
+
"scale": 2
|
|
554
|
+
}
|
|
555
|
+
SCHEMA
|
|
556
|
+
|
|
557
|
+
schema_hash =
|
|
558
|
+
{
|
|
559
|
+
'type' => 'fixed',
|
|
560
|
+
'name' => 'aFixed',
|
|
561
|
+
'logicalType' => 'decimal',
|
|
562
|
+
'size' => 4,
|
|
563
|
+
'precision' => 9,
|
|
564
|
+
'scale' => 2
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
assert_equal schema_hash, schema.to_avro
|
|
568
|
+
end
|
|
569
|
+
|
|
570
|
+
def test_fixed_decimal_to_include_precision_no_scale
|
|
571
|
+
schema = Avro::Schema.parse <<-SCHEMA
|
|
572
|
+
{
|
|
573
|
+
"type": "fixed",
|
|
574
|
+
"name": "aFixed",
|
|
575
|
+
"logicalType": "decimal",
|
|
576
|
+
"size": 4,
|
|
577
|
+
"precision": 9
|
|
578
|
+
}
|
|
579
|
+
SCHEMA
|
|
580
|
+
|
|
581
|
+
schema_hash =
|
|
582
|
+
{
|
|
583
|
+
'type' => 'fixed',
|
|
584
|
+
'name' => 'aFixed',
|
|
585
|
+
'logicalType' => 'decimal',
|
|
586
|
+
'size' => 4,
|
|
587
|
+
'precision' => 9
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
assert_equal schema_hash, schema.to_avro
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
# Note: this is not valid but validation is not yet implemented
|
|
594
|
+
def test_fixed_decimal_to_without_precision_scale
|
|
595
|
+
schema = Avro::Schema.parse <<-SCHEMA
|
|
596
|
+
{
|
|
597
|
+
"type": "fixed",
|
|
598
|
+
"size": 4,
|
|
599
|
+
"name": "aFixed",
|
|
600
|
+
"logicalType": "decimal"
|
|
601
|
+
}
|
|
602
|
+
SCHEMA
|
|
603
|
+
|
|
604
|
+
schema_hash =
|
|
605
|
+
{
|
|
606
|
+
'type' => 'fixed',
|
|
607
|
+
'name' => 'aFixed',
|
|
608
|
+
'logicalType' => 'decimal',
|
|
609
|
+
'size' => 4
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
assert_equal schema_hash, schema.to_avro
|
|
613
|
+
end
|
|
614
|
+
|
|
544
615
|
def test_bytes_decimal_to_include_precision_scale
|
|
545
616
|
schema = Avro::Schema.parse <<-SCHEMA
|
|
546
617
|
{
|
|
@@ -562,23 +633,82 @@ class TestSchema < Test::Unit::TestCase
|
|
|
562
633
|
assert_equal schema_hash, schema.to_avro
|
|
563
634
|
end
|
|
564
635
|
|
|
565
|
-
def
|
|
636
|
+
def test_bytes_decimal_with_string_precision_no_scale
|
|
566
637
|
schema = Avro::Schema.parse <<-SCHEMA
|
|
567
638
|
{
|
|
568
639
|
"type": "bytes",
|
|
569
|
-
"logicalType": "decimal"
|
|
640
|
+
"logicalType": "decimal",
|
|
641
|
+
"precision": "7"
|
|
570
642
|
}
|
|
571
643
|
SCHEMA
|
|
572
644
|
|
|
573
645
|
schema_hash =
|
|
574
646
|
{
|
|
575
647
|
'type' => 'bytes',
|
|
576
|
-
'logicalType' => 'decimal'
|
|
648
|
+
'logicalType' => 'decimal',
|
|
649
|
+
'precision' => 7
|
|
577
650
|
}
|
|
578
651
|
|
|
579
652
|
assert_equal schema_hash, schema.to_avro
|
|
580
653
|
end
|
|
581
654
|
|
|
655
|
+
def test_bytes_decimal_without_precision_or_scale
|
|
656
|
+
error = assert_raise Avro::SchemaParseError do
|
|
657
|
+
Avro::Schema.parse <<-SCHEMA
|
|
658
|
+
{
|
|
659
|
+
"type": "bytes",
|
|
660
|
+
"logicalType": "decimal"
|
|
661
|
+
}
|
|
662
|
+
SCHEMA
|
|
663
|
+
end
|
|
664
|
+
|
|
665
|
+
assert_equal 'Precision must be positive', error.message
|
|
666
|
+
end
|
|
667
|
+
|
|
668
|
+
def test_bytes_decimal_to_negative_precision
|
|
669
|
+
error = assert_raise Avro::SchemaParseError do
|
|
670
|
+
Avro::Schema.parse <<-SCHEMA
|
|
671
|
+
{
|
|
672
|
+
"type": "bytes",
|
|
673
|
+
"logicalType": "decimal",
|
|
674
|
+
"precision": -1
|
|
675
|
+
}
|
|
676
|
+
SCHEMA
|
|
677
|
+
end
|
|
678
|
+
|
|
679
|
+
assert_equal 'Precision must be positive', error.message
|
|
680
|
+
end
|
|
681
|
+
|
|
682
|
+
def test_bytes_decimal_to_negative_scale
|
|
683
|
+
error = assert_raise Avro::SchemaParseError do
|
|
684
|
+
Avro::Schema.parse <<-SCHEMA
|
|
685
|
+
{
|
|
686
|
+
"type": "bytes",
|
|
687
|
+
"logicalType": "decimal",
|
|
688
|
+
"precision": 2,
|
|
689
|
+
"scale": -1
|
|
690
|
+
}
|
|
691
|
+
SCHEMA
|
|
692
|
+
end
|
|
693
|
+
|
|
694
|
+
assert_equal 'Scale must be greater than or equal to 0', error.message
|
|
695
|
+
end
|
|
696
|
+
|
|
697
|
+
def test_bytes_decimal_with_precision_less_than_scale
|
|
698
|
+
error = assert_raise Avro::SchemaParseError do
|
|
699
|
+
Avro::Schema.parse <<-SCHEMA
|
|
700
|
+
{
|
|
701
|
+
"type": "bytes",
|
|
702
|
+
"logicalType": "decimal",
|
|
703
|
+
"precision": 3,
|
|
704
|
+
"scale": 4
|
|
705
|
+
}
|
|
706
|
+
SCHEMA
|
|
707
|
+
end
|
|
708
|
+
|
|
709
|
+
assert_equal 'Precision must be greater than scale', error.message
|
|
710
|
+
end
|
|
711
|
+
|
|
582
712
|
def test_bytes_schema
|
|
583
713
|
schema = Avro::Schema.parse <<-SCHEMA
|
|
584
714
|
{
|
|
@@ -644,7 +774,7 @@ class TestSchema < Test::Unit::TestCase
|
|
|
644
774
|
ensure
|
|
645
775
|
Avro.disable_enum_symbol_validation = nil
|
|
646
776
|
end
|
|
647
|
-
|
|
777
|
+
|
|
648
778
|
def test_validate_field_aliases
|
|
649
779
|
exception = assert_raise(Avro::SchemaParseError) do
|
|
650
780
|
hash_to_schema(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
3
|
# or more contributor license agreements. See the NOTICE file
|
|
3
4
|
# distributed with this work for additional information
|
|
@@ -292,6 +293,111 @@ class TestSchemaCompatibility < Test::Unit::TestCase
|
|
|
292
293
|
assert_false(can_read?(writer_schema, reader_schema))
|
|
293
294
|
end
|
|
294
295
|
|
|
296
|
+
def test_bytes_decimal
|
|
297
|
+
bytes_decimal_schema = Avro::Schema.
|
|
298
|
+
parse('{"type":"bytes", "logicalType":"decimal", "precision":4, "scale":4}')
|
|
299
|
+
bytes2_decimal_schema = Avro::Schema.
|
|
300
|
+
parse('{"type":"bytes", "logicalType":"decimal", "precision":4, "scale":4}')
|
|
301
|
+
bytes_decimal_different_precision_schema = Avro::Schema.
|
|
302
|
+
parse('{"type":"bytes", "logicalType":"decimal", "precision":5, "scale":4}')
|
|
303
|
+
bytes_decimal_no_scale_schema = Avro::Schema.
|
|
304
|
+
parse('{"type":"bytes", "logicalType":"decimal", "precision":4}')
|
|
305
|
+
bytes2_decimal_no_scale_schema = Avro::Schema.
|
|
306
|
+
parse('{"type":"bytes", "logicalType":"decimal", "precision":4}')
|
|
307
|
+
bytes_decimal_zero_scale_schema = Avro::Schema.
|
|
308
|
+
parse('{"type":"bytes", "logicalType":"decimal", "precision":4, "scale":0}')
|
|
309
|
+
bytes_unknown_logical_type_schema = Avro::Schema.
|
|
310
|
+
parse('{"type":"bytes", "logicalType":"unknown"}')
|
|
311
|
+
|
|
312
|
+
# decimal bytes and non-decimal bytes can be mixed
|
|
313
|
+
assert_true(can_read?(bytes_schema, bytes_decimal_schema))
|
|
314
|
+
assert_true(can_read?(bytes_decimal_schema, bytes_schema))
|
|
315
|
+
assert_true(can_read?(bytes_decimal_schema, bytes_unknown_logical_type_schema))
|
|
316
|
+
|
|
317
|
+
# decimal bytes match even if precision and scale differ
|
|
318
|
+
assert_true(can_read?(bytes_decimal_schema, bytes_decimal_different_precision_schema))
|
|
319
|
+
assert_true(can_read?(bytes_decimal_schema, bytes_decimal_no_scale_schema))
|
|
320
|
+
assert_true(can_read?(bytes_decimal_schema, bytes_decimal_zero_scale_schema))
|
|
321
|
+
# - zero and no scale are equivalent
|
|
322
|
+
assert_true(can_read?(bytes_decimal_zero_scale_schema, bytes_decimal_no_scale_schema))
|
|
323
|
+
# - different schemas with the same attributes match
|
|
324
|
+
assert_true(can_read?(bytes_decimal_schema, bytes2_decimal_schema))
|
|
325
|
+
# - different schemas with the same no scale match
|
|
326
|
+
assert_true(can_read?(bytes2_decimal_no_scale_schema, bytes_decimal_no_scale_schema))
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
def test_fixed_decimal
|
|
330
|
+
fixed_decimal_schema = Avro::Schema.
|
|
331
|
+
parse('{"type":"fixed", "size":2, "name":"Fixed1", "logicalType":"decimal", "precision":4, "scale":2}')
|
|
332
|
+
fixed2_decimal_schema = Avro::Schema.
|
|
333
|
+
parse('{"type":"fixed", "size":2, "name":"Fixed2", "logicalType":"decimal", "precision":4, "scale":2}')
|
|
334
|
+
fixed_decimal_different_precision_schema = Avro::Schema.
|
|
335
|
+
parse('{"type":"fixed", "size":2, "name":"Fixed1", "logicalType":"decimal", "precision":3, "scale":2}')
|
|
336
|
+
fixed_decimal_size3_schema = Avro::Schema.
|
|
337
|
+
parse('{"type":"fixed", "size":3, "name":"FixedS3", "logicalType":"decimal", "precision":4, "scale":2}')
|
|
338
|
+
fixed_unknown_schema = Avro::Schema.
|
|
339
|
+
parse('{"type":"fixed", "size":2, "name":"Fixed1", "logicalType":"unknown"}')
|
|
340
|
+
fixed_decimal_zero_scale_schema = Avro::Schema.
|
|
341
|
+
parse('{"type":"fixed", "size":2, "name":"Fixed1", "logicalType":"decimal", "precision":4, "scale":0}')
|
|
342
|
+
fixed_decimal_no_scale_schema = Avro::Schema.
|
|
343
|
+
parse('{"type":"fixed", "size":2, "name":"Fixed1", "logicalType":"decimal", "precision":4}')
|
|
344
|
+
|
|
345
|
+
# decimal fixed and non-decimal can be mixed if fixed name matches
|
|
346
|
+
assert_true(can_read?(fixed_decimal_schema, fixed1_schema))
|
|
347
|
+
assert_true(can_read?(fixed1_schema, fixed_decimal_schema))
|
|
348
|
+
assert_false(can_read?(fixed2_schema, fixed_decimal_schema))
|
|
349
|
+
|
|
350
|
+
# decimal logical types match even if fixed name differs
|
|
351
|
+
assert_true(can_read?(fixed_decimal_schema, fixed2_decimal_schema))
|
|
352
|
+
|
|
353
|
+
# fixed with the same name & size match even if decimal precision and scale differ
|
|
354
|
+
assert_true(can_read?(fixed_decimal_schema, fixed_decimal_different_precision_schema))
|
|
355
|
+
assert_true(can_read?(fixed_decimal_schema, fixed_decimal_size3_schema))
|
|
356
|
+
assert_true(can_read?(fixed_decimal_schema, fixed_unknown_schema))
|
|
357
|
+
# - zero and no scale are equivalent but these match anyway due to same name & size
|
|
358
|
+
assert_true(can_read?(fixed_decimal_no_scale_schema, fixed_decimal_zero_scale_schema))
|
|
359
|
+
# - scale does not match
|
|
360
|
+
assert_true(can_read?(fixed_decimal_schema, fixed_decimal_no_scale_schema))
|
|
361
|
+
assert_true(can_read?(fixed_decimal_schema, fixed_decimal_zero_scale_schema))
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
def test_decimal_different_types
|
|
365
|
+
fixed_decimal_schema = Avro::Schema.
|
|
366
|
+
parse('{"type":"fixed", "size":2, "name":"Fixed1", "logicalType":"decimal", "precision":4, "scale":2}')
|
|
367
|
+
fixed_decimal_scale4_schema = Avro::Schema.
|
|
368
|
+
parse('{"type":"fixed", "size":2, "name":"Fixed1", "logicalType":"decimal", "precision":4, "scale":4}')
|
|
369
|
+
bytes_decimal_schema = Avro::Schema.
|
|
370
|
+
parse('{"type":"bytes", "logicalType":"decimal", "precision":4, "scale":2}')
|
|
371
|
+
fixed_decimal_zero_scale_schema = Avro::Schema.
|
|
372
|
+
parse('{"type":"fixed", "size":2, "name":"Fixed1", "logicalType":"decimal", "precision":4, "scale":0}')
|
|
373
|
+
fixed_decimal_no_scale_schema = Avro::Schema.
|
|
374
|
+
parse('{"type":"fixed", "size":2, "name":"Fixed1", "logicalType":"decimal", "precision":4}')
|
|
375
|
+
bytes_decimal_zero_scale_schema = Avro::Schema.
|
|
376
|
+
parse('{"type":"bytes", "logicalType":"decimal", "precision":4, "scale":0}')
|
|
377
|
+
bytes_decimal_no_scale_schema = Avro::Schema.
|
|
378
|
+
parse('{"type":"bytes", "logicalType":"decimal", "precision":4}')
|
|
379
|
+
|
|
380
|
+
# decimal logical types can be read
|
|
381
|
+
assert_true(can_read?(fixed_decimal_schema, bytes_decimal_schema))
|
|
382
|
+
assert_true(can_read?(bytes_decimal_schema, fixed_decimal_schema))
|
|
383
|
+
|
|
384
|
+
# non-decimal bytes and fixed cannot be mixed
|
|
385
|
+
assert_false(can_read?(fixed_decimal_schema, bytes_schema))
|
|
386
|
+
assert_false(can_read?(bytes_schema, fixed_decimal_schema))
|
|
387
|
+
assert_false(can_read?(fixed1_schema, bytes_decimal_schema))
|
|
388
|
+
assert_false(can_read?(bytes_decimal_schema, fixed1_schema))
|
|
389
|
+
|
|
390
|
+
# decimal precision and scale must match
|
|
391
|
+
assert_false(can_read?(fixed_decimal_scale4_schema, bytes_decimal_schema))
|
|
392
|
+
assert_false(can_read?(bytes_decimal_schema, fixed_decimal_scale4_schema))
|
|
393
|
+
|
|
394
|
+
# zero scale and no scale are equivalent
|
|
395
|
+
assert_true(can_read?(bytes_decimal_no_scale_schema, fixed_decimal_zero_scale_schema))
|
|
396
|
+
assert_true(can_read?(fixed_decimal_zero_scale_schema, bytes_decimal_no_scale_schema))
|
|
397
|
+
assert_true(can_read?(bytes_decimal_zero_scale_schema, fixed_decimal_no_scale_schema))
|
|
398
|
+
assert_true(can_read?(fixed_decimal_no_scale_schema, bytes_decimal_zero_scale_schema))
|
|
399
|
+
end
|
|
400
|
+
|
|
295
401
|
# Tests from lang/java/avro/src/test/java/org/apache/avro/io/parsing/TestResolvingGrammarGenerator2.java
|
|
296
402
|
|
|
297
403
|
def point_2d_schema
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
3
|
# or more contributor license agreements. See the NOTICE file
|
|
3
4
|
# distributed with this work for additional information
|
|
@@ -169,13 +170,13 @@ class TestSchemaValidator < Test::Unit::TestCase
|
|
|
169
170
|
def test_validate_float
|
|
170
171
|
schema = hash_to_schema(type: 'float', name: 'name')
|
|
171
172
|
|
|
172
|
-
assert_valid_schema(schema, [1.1, 1, Avro::Schema::LONG_MAX_VALUE], ['string'], true)
|
|
173
|
+
assert_valid_schema(schema, [1.1, 1, BigDecimal('1.1'), Avro::Schema::LONG_MAX_VALUE], ['string'], true)
|
|
173
174
|
end
|
|
174
175
|
|
|
175
176
|
def test_validate_double
|
|
176
177
|
schema = hash_to_schema(type: 'double', name: 'name')
|
|
177
178
|
|
|
178
|
-
assert_valid_schema(schema, [1.1, 1, Avro::Schema::LONG_MAX_VALUE], ['string'], true)
|
|
179
|
+
assert_valid_schema(schema, [1.1, 1, BigDecimal('1.1'), Avro::Schema::LONG_MAX_VALUE], ['string'], true)
|
|
179
180
|
end
|
|
180
181
|
|
|
181
182
|
def test_validate_fixed
|
|
@@ -557,4 +558,18 @@ class TestSchemaValidator < Test::Unit::TestCase
|
|
|
557
558
|
assert_equal(1, exception.result.errors.size)
|
|
558
559
|
assert_equal("at . extra field 'color' - not in schema", exception.to_s)
|
|
559
560
|
end
|
|
561
|
+
|
|
562
|
+
def test_validate_bytes_decimal
|
|
563
|
+
schema = hash_to_schema(type: 'bytes', logicalType: 'decimal', precision: 4, scale: 2)
|
|
564
|
+
assert_valid_schema(schema, [BigDecimal('1.23'), 4.2, 1], ['4.2', BigDecimal('233.2')], true)
|
|
565
|
+
|
|
566
|
+
schema = hash_to_schema(type: 'bytes', logicalType: 'decimal', precision: 4, scale: 4)
|
|
567
|
+
assert_valid_schema(schema, [BigDecimal('0.2345'), 0.2, 0.1], ['4.2', BigDecimal('233.2')], true)
|
|
568
|
+
|
|
569
|
+
schema = hash_to_schema(type: 'bytes', logicalType: 'decimal', precision: 4, scale: 0)
|
|
570
|
+
assert_valid_schema(schema, [BigDecimal('123'), 2], ['4.2', BigDecimal('233.2')], true)
|
|
571
|
+
|
|
572
|
+
schema = hash_to_schema(type: 'bytes', logicalType: 'decimal', precision: 4)
|
|
573
|
+
assert_valid_schema(schema, [BigDecimal('123'), 2], ['4.2', BigDecimal('233.2')], true)
|
|
574
|
+
end
|
|
560
575
|
end
|
data/test/tool.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
3
|
# or more contributor license agreements. See the NOTICE file
|
|
3
4
|
# distributed with this work for additional information
|
|
@@ -21,7 +22,7 @@ require 'logger'
|
|
|
21
22
|
|
|
22
23
|
class GenericResponder < Avro::IPC::Responder
|
|
23
24
|
def initialize(proto, msg, datum)
|
|
24
|
-
proto_json = open(proto).read
|
|
25
|
+
proto_json = File.open(proto).read
|
|
25
26
|
super(Avro::Protocol.parse(proto_json))
|
|
26
27
|
@msg = msg
|
|
27
28
|
@datum = datum
|
|
@@ -62,14 +63,14 @@ end
|
|
|
62
63
|
def send_message(uri, proto, msg, datum)
|
|
63
64
|
uri = URI.parse(uri)
|
|
64
65
|
trans = Avro::IPC::HTTPTransceiver.new(uri.host, uri.port)
|
|
65
|
-
proto_json = open(proto).read
|
|
66
|
+
proto_json = File.open(proto).read
|
|
66
67
|
requestor = Avro::IPC::Requestor.new(Avro::Protocol.parse(proto_json),
|
|
67
68
|
trans)
|
|
68
69
|
p requestor.request(msg, datum)
|
|
69
70
|
end
|
|
70
71
|
|
|
71
72
|
def file_or_stdin(f)
|
|
72
|
-
f == "-" ? STDIN : open(f)
|
|
73
|
+
f == "-" ? STDIN : File.open(f)
|
|
73
74
|
end
|
|
74
75
|
|
|
75
76
|
def main
|
|
@@ -100,9 +101,9 @@ def main
|
|
|
100
101
|
if ARGV.size > 4
|
|
101
102
|
case ARGV[4]
|
|
102
103
|
when "-file"
|
|
103
|
-
Avro::DataFile.open(ARGV[5])
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
Avro::DataFile.open(ARGV[5]) do |f|
|
|
105
|
+
datum = f.first
|
|
106
|
+
end
|
|
106
107
|
when "-data"
|
|
107
108
|
puts "JSON Decoder not yet implemented."
|
|
108
109
|
return 1
|
|
@@ -124,7 +125,7 @@ def main
|
|
|
124
125
|
if ARGV.size > 4
|
|
125
126
|
case ARGV[4]
|
|
126
127
|
when "-file"
|
|
127
|
-
Avro::DataFile.open(ARGV[5]){|f|
|
|
128
|
+
Avro::DataFile.open(ARGV[5]){ |f| datum = f.first }
|
|
128
129
|
when "-data"
|
|
129
130
|
puts "JSON Decoder not yet implemented"
|
|
130
131
|
return 1
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: avro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Apache Software Foundation
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-10-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: multi_json
|
|
@@ -16,34 +16,20 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1'
|
|
19
|
+
version: '1.0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1'
|
|
26
|
+
version: '1.0'
|
|
27
27
|
description: Avro is a data serialization and RPC format
|
|
28
28
|
email: dev@avro.apache.org
|
|
29
29
|
executables: []
|
|
30
30
|
extensions: []
|
|
31
|
-
extra_rdoc_files:
|
|
32
|
-
- CHANGELOG
|
|
33
|
-
- LICENSE
|
|
34
|
-
- lib/avro.rb
|
|
35
|
-
- lib/avro/VERSION.txt
|
|
36
|
-
- lib/avro/data_file.rb
|
|
37
|
-
- lib/avro/io.rb
|
|
38
|
-
- lib/avro/ipc.rb
|
|
39
|
-
- lib/avro/logical_types.rb
|
|
40
|
-
- lib/avro/protocol.rb
|
|
41
|
-
- lib/avro/schema.rb
|
|
42
|
-
- lib/avro/schema_compatibility.rb
|
|
43
|
-
- lib/avro/schema_normalization.rb
|
|
44
|
-
- lib/avro/schema_validator.rb
|
|
31
|
+
extra_rdoc_files: []
|
|
45
32
|
files:
|
|
46
|
-
- CHANGELOG
|
|
47
33
|
- LICENSE
|
|
48
34
|
- Manifest
|
|
49
35
|
- NOTICE
|
|
@@ -82,7 +68,11 @@ files:
|
|
|
82
68
|
homepage: https://avro.apache.org/
|
|
83
69
|
licenses:
|
|
84
70
|
- Apache-2.0
|
|
85
|
-
metadata:
|
|
71
|
+
metadata:
|
|
72
|
+
homepage_uri: https://avro.apache.org/
|
|
73
|
+
bug_tracker_uri: https://issues.apache.org/jira/browse/AVRO
|
|
74
|
+
source_code_uri: https://github.com/apache/avro
|
|
75
|
+
documentation_uri: https://avro.apache.org/docs/1.11.0/
|
|
86
76
|
post_install_message:
|
|
87
77
|
rdoc_options:
|
|
88
78
|
- "--line-numbers"
|
|
@@ -94,27 +84,33 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
94
84
|
requirements:
|
|
95
85
|
- - ">="
|
|
96
86
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: '
|
|
87
|
+
version: '2.6'
|
|
98
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
89
|
requirements:
|
|
100
90
|
- - ">="
|
|
101
91
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
92
|
+
version: '0'
|
|
103
93
|
requirements: []
|
|
104
|
-
|
|
105
|
-
rubygems_version: 2.5.2.1
|
|
94
|
+
rubygems_version: 3.1.2
|
|
106
95
|
signing_key:
|
|
107
96
|
specification_version: 4
|
|
108
97
|
summary: Apache Avro for Ruby
|
|
109
98
|
test_files:
|
|
110
|
-
- test/
|
|
111
|
-
- test/
|
|
99
|
+
- test/case_finder.rb
|
|
100
|
+
- test/random_data.rb
|
|
101
|
+
- test/sample_ipc_client.rb
|
|
102
|
+
- test/sample_ipc_http_client.rb
|
|
103
|
+
- test/sample_ipc_http_server.rb
|
|
104
|
+
- test/sample_ipc_server.rb
|
|
105
|
+
- test/test_datafile.rb
|
|
106
|
+
- test/test_fingerprints.rb
|
|
107
|
+
- test/test_help.rb
|
|
112
108
|
- test/test_io.rb
|
|
113
109
|
- test/test_logical_types.rb
|
|
114
|
-
- test/test_help.rb
|
|
115
|
-
- test/test_datafile.rb
|
|
116
110
|
- test/test_protocol.rb
|
|
117
|
-
- test/
|
|
111
|
+
- test/test_schema.rb
|
|
118
112
|
- test/test_schema_compatibility.rb
|
|
119
113
|
- test/test_schema_normalization.rb
|
|
120
|
-
- test/
|
|
114
|
+
- test/test_schema_validator.rb
|
|
115
|
+
- test/test_socket_transport.rb
|
|
116
|
+
- test/tool.rb
|
data/CHANGELOG
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
v0.0.1 stuff
|