forked from crphang/orc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
orc.go
41 lines (35 loc) · 754 Bytes
/
orc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package orc
import (
"os"
)
// Version is the version of the ORC file.
type Version struct {
name string
major uint32
minor uint32
}
var (
// Version0_11 is an ORC file version compatible with Hive 0.11.
Version0_11 = Version{"0.11", 0, 11}
// Version0_12 is an ORC file version compatible with Hive 0.12.
Version0_12 = Version{"0.12", 0, 12}
)
type fileReader struct {
*os.File
}
// Size returns the size of the file in bytes.
func (f fileReader) Size() int64 {
stats, err := f.Stat()
if err != nil {
return 0
}
return stats.Size()
}
// Open opens the file at the provided filepath.
func Open(filepath string) (*Reader, error) {
f, err := os.Open(filepath)
if err != nil {
return nil, err
}
return NewReader(fileReader{f})
}