line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one |
2
|
|
|
|
|
|
|
# or more contributor license agreements. See the NOTICE file |
3
|
|
|
|
|
|
|
# distributed with this work for additional information |
4
|
|
|
|
|
|
|
# regarding copyright ownership. The ASF licenses this file |
5
|
|
|
|
|
|
|
# to you under the Apache License, Version 2.0 (the |
6
|
|
|
|
|
|
|
# "License"); you may not use this file except in compliance |
7
|
|
|
|
|
|
|
# with the License. You may obtain a copy of the License at |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# https://www.apache.org/licenses/LICENSE-2.0 |
10
|
|
|
|
|
|
|
# |
11
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, |
12
|
|
|
|
|
|
|
# software distributed under the License is distributed on an |
13
|
|
|
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14
|
|
|
|
|
|
|
# KIND, either express or implied. See the License for the |
15
|
|
|
|
|
|
|
# specific language governing permissions and limitations |
16
|
|
|
|
|
|
|
# under the License. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Avro::DataFile; |
19
|
1
|
|
|
1
|
|
24461
|
use strict; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
30
|
|
20
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
5
|
use constant AVRO_MAGIC => "Obj\x01"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
458
|
use Avro::Schema; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
131
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our $VERSION = '1.11.2'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
our $HEADER_SCHEMA = Avro::Schema->parse(<<EOH); |
29
|
|
|
|
|
|
|
{"type": "record", "name": "org.apache.avro.file.Header", |
30
|
|
|
|
|
|
|
"fields" : [ |
31
|
|
|
|
|
|
|
{"name": "magic", "type": {"type": "fixed", "name": "Magic", "size": 4}}, |
32
|
|
|
|
|
|
|
{"name": "meta", "type": {"type": "map", "values": "bytes"}}, |
33
|
|
|
|
|
|
|
{"name": "sync", "type": {"type": "fixed", "name": "Sync", "size": 16}} |
34
|
|
|
|
|
|
|
] |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
EOH |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
our %ValidCodec = ( |
39
|
|
|
|
|
|
|
null => 1, |
40
|
|
|
|
|
|
|
deflate => 1, |
41
|
|
|
|
|
|
|
bzip2 => 1, |
42
|
|
|
|
|
|
|
zstandard => 1, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub is_codec_valid { |
46
|
12
|
|
|
12
|
0
|
21
|
my $datafile = shift; |
47
|
12
|
|
50
|
|
|
26
|
my $codec = shift || ''; |
48
|
12
|
|
|
|
|
61
|
return $ValidCodec{$codec}; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
+1; |