feedx 0.12.6 → 0.12.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab1b8d12efde331dcd1ca96c686c29e1ef16ab895f049121078b9f0503d23276
4
- data.tar.gz: 3d51319d3ea39cbceeb480252e06c37238fce0cda68aa6b65cf1f59c0f0af38b
3
+ metadata.gz: 6a8328c3af95657d103cf62048d13cb5a14cc50466351f2178082612c347a8cf
4
+ data.tar.gz: f2fdb20a577c88f165f2cbac3dadf217889716b67b9ae20e4941ed9ef396e864
5
5
  SHA512:
6
- metadata.gz: d08c34b59158c69d500b7cffe8019550dafa87b760e4b0cb3b25afc367801a3f3473486987dcb62e5c1bc62c05d3653bf26692fcbdcbb552d2af1073f4eced50
7
- data.tar.gz: cfa3f24458cead0c12c1f03b559ded816095e1e9cf29a1918c142cd255f782fa3c51d7c45ca5833ab25b5a745e0e68f4b1b1062c7760c56ff1b57da122767135
6
+ metadata.gz: 6cf78b2fb0917c7afb33014e6b3e30d045ffca874f4c8463092f25a7b22b268ab9f2cbd03a1dfda9df7a9314fe213d11c332ff965eb7b81436768cb94d80bf83
7
+ data.tar.gz: 9131ba95738e600ab4e731546b6e876cae77120782e148a6eac6e3ea4b90e398975f15f2af00b325e86f3fc73a79c39c4a6be25e80bc7298881ff636d61d150b
@@ -0,0 +1,18 @@
1
+ name: Lint
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ pull_request:
7
+ branches:
8
+ - main
9
+ jobs:
10
+ golangci:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout
14
+ uses: actions/checkout@v2
15
+ - name: Run lint
16
+ uses: golangci/golangci-lint-action@v2
17
+ with:
18
+ version: latest
@@ -11,18 +11,8 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- go-version: [1.15.x, 1.16.x]
14
+ go-version: [1.16.x, 1.17.x]
15
15
  steps:
16
- - name: Fetch staticcheck
17
- uses: engineerd/configurator@v0.0.6
18
- with:
19
- name: staticcheck
20
- fromGitHubReleases: true
21
- repo: dominikh/go-tools
22
- version: latest
23
- urlTemplate: "https://github.com/dominikh/go-tools/releases/download/2020.2.3/staticcheck_linux_amd64.tar.gz"
24
- pathInArchive: staticcheck/staticcheck
25
- token: ${{ secrets.GITHUB_TOKEN }}
26
16
  - name: Checkout
27
17
  uses: actions/checkout@v2
28
18
  - name: Cache dependencies
@@ -38,18 +28,16 @@ jobs:
38
28
  go-version: ${{ matrix.go-version }}
39
29
  - name: Run tests
40
30
  run: make test
41
- - name: Run staticcheck
42
- run: make staticcheck
43
31
  ruby:
44
32
  runs-on: ubuntu-latest
45
33
  strategy:
46
34
  matrix:
47
- ruby-version: ["2.6", "2.7", "3.0"]
35
+ ruby-version: ["2.7", "3.0", "3.1"]
48
36
  steps:
49
37
  - name: Install libarrow
50
38
  run: |
51
- wget https://apache.bintray.com/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-archive-keyring-latest-$(lsb_release --codename --short).deb
52
- sudo apt install -y ./apache-arrow-archive-keyring-latest-$(lsb_release --codename --short).deb
39
+ wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
40
+ sudo apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
53
41
  sudo apt update
54
42
  sudo apt install -y libarrow-dev libarrow-glib-dev libarrow-dataset-dev libplasma-dev libplasma-glib-dev libgandiva-dev libgandiva-glib-dev libparquet-dev libparquet-glib-dev
55
43
  - uses: actions/checkout@v2
data/.golangci.yml ADDED
@@ -0,0 +1,4 @@
1
+ linters-settings:
2
+ errcheck:
3
+ exclude-functions:
4
+ - (*github.com/bsm/feedx.Writer).Discard
data/.rubocop.yml CHANGED
@@ -6,7 +6,7 @@ inherit_mode:
6
6
  - Exclude
7
7
 
8
8
  AllCops:
9
- TargetRubyVersion: 2.6
9
+ TargetRubyVersion: 2.7
10
10
  Naming/MethodParameterName:
11
11
  MinNameLength: 2
12
12
  Naming/MemoizedInstanceVariableName:
data/Gemfile.lock CHANGED
@@ -1,34 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- feedx (0.12.6)
4
+ feedx (0.12.7)
5
5
  bfs (>= 0.8.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  ast (2.4.2)
11
- bfs (0.8.4)
12
- bigdecimal (3.0.2)
13
- diff-lcs (1.4.4)
14
- extpp (0.0.9)
15
- gio2 (3.4.4)
16
- gobject-introspection (= 3.4.4)
17
- glib2 (3.4.4)
11
+ bfs (0.9.0)
12
+ bigdecimal (3.1.1)
13
+ diff-lcs (1.5.0)
14
+ extpp (0.1.0)
15
+ gio2 (3.4.9)
16
+ gobject-introspection (= 3.4.9)
17
+ glib2 (3.4.9)
18
18
  native-package-installer (>= 1.0.3)
19
19
  pkg-config (>= 1.3.5)
20
- gobject-introspection (3.4.4)
21
- glib2 (= 3.4.4)
22
- google-protobuf (3.17.3)
20
+ gobject-introspection (3.4.9)
21
+ glib2 (= 3.4.9)
22
+ google-protobuf (3.19.2)
23
23
  native-package-installer (1.1.1)
24
- parallel (1.20.1)
25
- parser (3.0.1.1)
24
+ parallel (1.21.0)
25
+ parser (3.1.0.0)
26
26
  ast (~> 2.4.1)
27
27
  pbio (0.3.0)
28
28
  google-protobuf
29
29
  pkg-config (1.4.6)
30
30
  rainbow (3.0.0)
31
- rake (13.0.3)
31
+ rake (13.0.6)
32
32
  red-arrow (3.0.0)
33
33
  bigdecimal (>= 2.0.3)
34
34
  extpp (>= 0.0.7)
@@ -37,7 +37,7 @@ GEM
37
37
  pkg-config
38
38
  red-parquet (3.0.0)
39
39
  red-arrow (= 3.0.0)
40
- regexp_parser (2.1.1)
40
+ regexp_parser (2.2.0)
41
41
  rexml (3.2.5)
42
42
  rspec (3.10.0)
43
43
  rspec-core (~> 3.10.0)
@@ -51,33 +51,32 @@ GEM
51
51
  rspec-mocks (3.10.2)
52
52
  diff-lcs (>= 1.2.0, < 2.0)
53
53
  rspec-support (~> 3.10.0)
54
- rspec-support (3.10.2)
55
- rubocop (1.17.0)
54
+ rspec-support (3.10.3)
55
+ rubocop (1.24.1)
56
56
  parallel (~> 1.10)
57
57
  parser (>= 3.0.0.0)
58
58
  rainbow (>= 2.2.2, < 4.0)
59
59
  regexp_parser (>= 1.8, < 3.0)
60
60
  rexml
61
- rubocop-ast (>= 1.7.0, < 2.0)
61
+ rubocop-ast (>= 1.15.1, < 2.0)
62
62
  ruby-progressbar (~> 1.7)
63
63
  unicode-display_width (>= 1.4.0, < 3.0)
64
- rubocop-ast (1.7.0)
64
+ rubocop-ast (1.15.1)
65
65
  parser (>= 3.0.1.1)
66
66
  rubocop-bsm (0.6.0)
67
67
  rubocop (~> 1.0)
68
68
  rubocop-performance
69
69
  rubocop-rake
70
70
  rubocop-rspec
71
- rubocop-performance (1.11.3)
71
+ rubocop-performance (1.13.1)
72
72
  rubocop (>= 1.7.0, < 2.0)
73
73
  rubocop-ast (>= 0.4.0)
74
- rubocop-rake (0.5.1)
75
- rubocop
76
- rubocop-rspec (2.4.0)
74
+ rubocop-rake (0.6.0)
77
75
  rubocop (~> 1.0)
78
- rubocop-ast (>= 1.1.0)
76
+ rubocop-rspec (2.7.0)
77
+ rubocop (~> 1.19)
79
78
  ruby-progressbar (1.11.0)
80
- unicode-display_width (2.0.0)
79
+ unicode-display_width (2.1.0)
81
80
 
82
81
  PLATFORMS
83
82
  ruby
@@ -92,4 +91,4 @@ DEPENDENCIES
92
91
  rubocop-bsm
93
92
 
94
93
  BUNDLED WITH
95
- 2.1.4
94
+ 2.2.27
@@ -1,170 +1,59 @@
1
1
  package parquet
2
2
 
3
3
  import (
4
- "encoding/binary"
5
- "fmt"
6
4
  "io"
7
- "reflect"
8
- "time"
9
5
 
10
- kpq "github.com/bsm/parquet-go/parquet"
6
+ goparquet "github.com/fraugster/parquet-go"
7
+ "github.com/fraugster/parquet-go/floor"
11
8
  )
12
9
 
13
10
  type decoder struct {
14
- cols []*columnReader
15
- closers []io.Closer
11
+ pfr *goparquet.FileReader
12
+ ffr *floor.Reader
13
+ tmp *tempFile
16
14
  }
17
15
 
18
- func newDecoder(rs io.ReadSeeker, names []string, batchSize int) (*decoder, error) {
19
- file, err := kpq.FileFromReader(rs)
16
+ func newDecoder(rs io.ReadSeeker) (*decoder, error) {
17
+ pfr, err := goparquet.NewFileReader(rs)
20
18
  if err != nil {
21
19
  return nil, err
22
20
  }
23
21
 
24
- // normalise column names
25
- if len(names) == 0 {
26
- for _, c := range file.Schema.Columns() {
27
- names = append(names, c.String())
28
- }
29
- }
30
-
31
- // normalise batch size
32
- if batchSize < 1 {
33
- batchSize = 1000
34
- }
22
+ ffr := floor.NewReader(pfr)
35
23
 
36
- // initialise column buffers
37
- cols := make([]*columnReader, 0, len(names))
38
- for _, name := range names {
39
- col, ok := file.Schema.ColumnByName(name)
40
- if !ok {
41
- _ = file.Close()
42
- return nil, fmt.Errorf("column %q does not exist", name)
43
- }
44
- cols = append(cols, newColumnReader(file, col, batchSize))
45
- }
46
-
47
- return &decoder{cols: cols, closers: []io.Closer{file}}, nil
24
+ return &decoder{
25
+ pfr: pfr,
26
+ ffr: ffr,
27
+ },
28
+ nil
48
29
  }
49
30
 
50
31
  func (w *decoder) Decode(v interface{}) error {
51
- rv := reflect.ValueOf(v)
52
- rt := rv.Type()
53
- if rt.Kind() != reflect.Ptr {
54
- return fmt.Errorf("cannot decode non-pointer %s type", rt.String())
32
+ // read the next value and scan
33
+ if w.ffr.Next() {
34
+ return w.ffr.Scan(v)
55
35
  }
56
36
 
57
- // field index by name
58
- fidx := cachedTypeFields(rt.Elem())
59
- elem := rv.Elem()
60
-
61
- for _, r := range w.cols {
62
- // next column value
63
- val, err := r.Next()
64
- if err != nil {
65
- return err
66
- }
67
-
68
- // skip if value is NULL
69
- if val == nil {
70
- continue
71
- }
72
-
73
- // set field if exists
74
- if fi, ok := fidx[r.Name()]; ok {
75
- fv := elem.Field(fi)
76
- if ok := setValue(fv, val); !ok {
77
- return fmt.Errorf("cannot assign value of type %T to %s", val, fv.Type())
78
- }
79
- }
37
+ // check for errors
38
+ if err := w.ffr.Err(); err != nil {
39
+ return err
80
40
  }
81
41
 
82
- return nil
42
+ // end of file
43
+ return io.EOF
83
44
  }
84
45
 
85
46
  func (w *decoder) Close() (err error) {
86
- for _, c := range w.closers {
87
- if e := c.Close(); e != nil {
47
+ // close the tmp file if present
48
+ if w.tmp != nil {
49
+ if e := w.tmp.Close(); e != nil {
88
50
  err = e
89
51
  }
90
52
  }
91
- return
92
- }
93
53
 
94
- // --------------------------------------------------------------------
95
-
96
- func setValue(rv reflect.Value, v interface{}) bool {
97
- if rv.Kind() == reflect.Ptr {
98
- if rv.IsNil() {
99
- if ev := reflect.New(rv.Type().Elem()); setValue(ev, v) {
100
- rv.Set(ev)
101
- return true
102
- }
103
- return false
104
- }
105
- return setValue(rv.Elem(), v)
106
- }
107
-
108
- switch vv := v.(type) {
109
- case bool:
110
- switch rv.Kind() {
111
- case reflect.Bool:
112
- rv.SetBool(vv)
113
- return true
114
- }
115
- case []byte:
116
- switch rv.Kind() {
117
- case reflect.String:
118
- rv.SetString(string(vv))
119
- return true
120
- case reflect.Slice:
121
- if rv.Type() == byteSliceType {
122
- rv.SetBytes(vv)
123
- return true
124
- }
125
- }
126
- case int, int8, int16, int32, int64:
127
- switch rv.Kind() {
128
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
129
- rv.SetInt(reflect.ValueOf(v).Int())
130
- return true
131
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
132
- rv.SetUint(uint64(reflect.ValueOf(v).Int()))
133
- return true
134
- }
135
- case uint, uint8, uint16, uint32, uint64:
136
- switch rv.Kind() {
137
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
138
- rv.SetInt(int64(reflect.ValueOf(v).Uint()))
139
- return true
140
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
141
- rv.SetUint(reflect.ValueOf(v).Uint())
142
- return true
143
- }
144
- case float32, float64:
145
- switch rv.Kind() {
146
- case reflect.Float32, reflect.Float64:
147
- rv.SetFloat(reflect.ValueOf(v).Float())
148
- return true
149
- }
150
- case kpq.Int96:
151
- if rt := rv.Type(); rt == timeType {
152
- ns := int64(binary.LittleEndian.Uint64(vv[:8]))
153
- jd := int64(binary.LittleEndian.Uint32(vv[8:]))
154
- ts := time.Unix((jd-2440588)*86400, ns)
155
- rv.Set(reflect.ValueOf(ts))
156
- return true
157
- } else if rt == int96Type {
158
- rv.Set(reflect.ValueOf(v))
159
- return true
160
- }
54
+ // close the reader
55
+ if e := w.ffr.Close(); e != nil {
56
+ err = e
161
57
  }
162
-
163
- return false
58
+ return
164
59
  }
165
-
166
- var (
167
- byteSliceType = reflect.TypeOf(([]byte)(nil))
168
- int96Type = reflect.TypeOf(kpq.Int96{})
169
- timeType = reflect.TypeOf(time.Time{})
170
- )
@@ -24,7 +24,7 @@ var _ = Describe("Decoder", func() {
24
24
  fixture, err = os.Open("testdata/alltypes_plain.parquet")
25
25
  Expect(err).NotTo(HaveOccurred())
26
26
 
27
- format := &parquet.Format{BatchSize: 3}
27
+ format := &parquet.Format{}
28
28
  subject, err = format.NewDecoder(fixture)
29
29
  Expect(err).NotTo(HaveOccurred())
30
30
  })
@@ -42,7 +42,7 @@ var _ = Describe("Decoder", func() {
42
42
  Bool: true,
43
43
  Float: f32ptr(0),
44
44
  DateString: "03/01/09", ByteString: []byte("0"),
45
- Timestamp: time.Unix(1235865600, 0),
45
+ Timestamp: time.Unix(1235865600, 0).UTC(),
46
46
  }))
47
47
 
48
48
  v2 := new(mockStruct)
@@ -52,7 +52,7 @@ var _ = Describe("Decoder", func() {
52
52
  TinyInt: 1, SmallUint: 1, StdInt: 1, BigInt: 10,
53
53
  Float: f32ptr(1.1), Double: 10.1,
54
54
  DateString: "03/01/09", ByteString: []byte("1"),
55
- Timestamp: time.Unix(1235865660, 0),
55
+ Timestamp: time.Unix(1235865660, 0).UTC(),
56
56
  }))
57
57
 
58
58
  Expect(subject.Decode(new(mockStruct))).To(Succeed()) // v3
@@ -67,7 +67,7 @@ var _ = Describe("Decoder", func() {
67
67
  TinyInt: 1, SmallUint: 1, StdInt: 1, BigInt: 10,
68
68
  Float: f32ptr(1.1), Double: 10.1,
69
69
  DateString: "02/01/09", ByteString: []byte("1"),
70
- Timestamp: time.Unix(1233446460, 0),
70
+ Timestamp: time.Unix(1233446460, 0).UTC(),
71
71
  }))
72
72
 
73
73
  Expect(subject.Decode(new(mockStruct))).To(Succeed()) // v7
@@ -0,0 +1,27 @@
1
+ package parquet
2
+
3
+ import (
4
+ "io"
5
+
6
+ goparquet "github.com/fraugster/parquet-go"
7
+ "github.com/fraugster/parquet-go/floor"
8
+ )
9
+
10
+ type encoder struct {
11
+ *floor.Writer
12
+ }
13
+
14
+ func newEncoder(w io.Writer, opts []goparquet.FileWriterOption) (*encoder, error) {
15
+ // create the writer
16
+ pw := goparquet.NewFileWriter(w, opts...)
17
+
18
+ return &encoder{
19
+ // wrap the parquet writer with a floor writer
20
+ Writer: floor.NewWriter(pw),
21
+ }, nil
22
+ }
23
+
24
+ // implements feedx.FormatEncoder
25
+ func (w *encoder) Encode(v interface{}) error {
26
+ return w.Writer.Write(v)
27
+ }
@@ -0,0 +1,70 @@
1
+ package parquet_test
2
+
3
+ import (
4
+ "bytes"
5
+ "time"
6
+
7
+ "github.com/bsm/feedx"
8
+ "github.com/bsm/feedx/ext/parquet"
9
+ . "github.com/bsm/ginkgo"
10
+ . "github.com/bsm/gomega"
11
+ goparquet "github.com/fraugster/parquet-go"
12
+ parquetopt "github.com/fraugster/parquet-go/parquet"
13
+ "github.com/fraugster/parquet-go/parquetschema"
14
+ )
15
+
16
+ var _ = Describe("Encoder", func() {
17
+ var subject feedx.FormatEncoder
18
+
19
+ f32ptr := func(f float32) *float32 { return &f }
20
+
21
+ BeforeEach(func() {
22
+ var err error
23
+ buf := new(bytes.Buffer)
24
+
25
+ schemaDef, err := parquetschema.ParseSchemaDefinition(`message stat {
26
+ required int64 bigint_col;
27
+ optional boolean bool_col;
28
+ optional int32 tinyint_col;
29
+ optional int32 smallint_col;
30
+ optional int32 int_col;
31
+ optional int64 bigint_col;
32
+ optional float float_col;
33
+ optional double double_col;
34
+ optional binary date_string_col (STRING);
35
+ optional binary string_col;
36
+ optional int64 timestamp_col (TIMESTAMP(NANOS, true));
37
+ }`)
38
+ Expect(err).NotTo(HaveOccurred())
39
+
40
+ format := &parquet.Format{}
41
+ subject, err = format.NewEncoder(buf,
42
+ goparquet.WithSchemaDefinition(schemaDef),
43
+ goparquet.WithCompressionCodec(parquetopt.CompressionCodec_SNAPPY))
44
+ Expect(err).NotTo(HaveOccurred())
45
+ })
46
+
47
+ AfterEach(func() {
48
+ Expect(subject.Close()).To(Succeed())
49
+ })
50
+
51
+ It("encodes", func() {
52
+ v1 := &mockStruct{
53
+ ID: 1,
54
+ Bool: true,
55
+ TinyInt: int8(5),
56
+ SmallUint: uint16(12),
57
+ StdInt: 5,
58
+ BigInt: int64(99),
59
+ Float: f32ptr(5.5),
60
+ Double: float64(5.5),
61
+ DateString: "2021-08-11",
62
+ ByteString: []byte("string"),
63
+ Timestamp: time.Now(),
64
+ }
65
+ Expect(subject.Encode(v1)).To(Succeed())
66
+
67
+ v2 := &mockStruct{ID: 1}
68
+ Expect(subject.Encode(v2)).To(Succeed())
69
+ })
70
+ })
data/ext/parquet/go.mod CHANGED
@@ -3,8 +3,10 @@ module github.com/bsm/feedx/ext/parquet
3
3
  go 1.15
4
4
 
5
5
  require (
6
- github.com/bsm/feedx v0.12.5
7
- github.com/bsm/ginkgo v1.16.1
8
- github.com/bsm/gomega v1.11.0
9
- github.com/bsm/parquet-go v0.0.0-20200904113737-792434824f00
6
+ github.com/bsm/feedx v0.0.0-00010101000000-000000000000
7
+ github.com/bsm/ginkgo v1.16.5
8
+ github.com/bsm/gomega v1.17.0
9
+ github.com/fraugster/parquet-go v0.6.1
10
10
  )
11
+
12
+ replace github.com/bsm/feedx => ../../
data/ext/parquet/go.sum CHANGED
@@ -1,24 +1,33 @@
1
1
  cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
2
2
  github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
3
+ github.com/apache/thrift v0.15.0 h1:aGvdaR0v1t9XLgjtBYwxcBvBOTMqClzwE26CHOgjW1Y=
4
+ github.com/apache/thrift v0.15.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
5
+ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
3
6
  github.com/bmatcuk/doublestar/v3 v3.0.0 h1:TQtVPlDnAYwcrVNB2JiGuMc++H5qzWZd9PhkNo5WyHI=
4
7
  github.com/bmatcuk/doublestar/v3 v3.0.0/go.mod h1:6PcTVMw80pCY1RVuoqu3V++99uQB3vsSYKPTd8AWA0k=
5
- github.com/bsm/bfs v0.11.3 h1:BTFCftgmuVZwwu6vyjhyKr/Pg1E+cZ5tLodj3wKxr94=
6
- github.com/bsm/bfs v0.11.3/go.mod h1:sUhBrbc9g0XThRRrT9hiinMhhKbkKIdhLkFljk4fuzM=
7
- github.com/bsm/feedx v0.12.5 h1:N751MFTRKRgoP5eG1S30EoUuHsI7aAxJ0aQZg+7xf/Y=
8
- github.com/bsm/feedx v0.12.5/go.mod h1:l5YNhFomuWy9du+8+hznXMH8Hug2qSMik7b5Vipcy58=
9
- github.com/bsm/ginkgo v1.16.0/go.mod h1:RabIZLzOCPghgHJKUqHZpqrQETA5AnF4aCSIYy5C1bk=
10
- github.com/bsm/ginkgo v1.16.1 h1:jp1v1dbmbGZDWmnGXDTN+XK3U1fTTNja9xYa7VBI0l0=
11
- github.com/bsm/ginkgo v1.16.1/go.mod h1:RabIZLzOCPghgHJKUqHZpqrQETA5AnF4aCSIYy5C1bk=
12
- github.com/bsm/gomega v1.11.0 h1:wg9DVGPETNZLIbMsseneMV1a7uo/x+wsCyNXdEcifDI=
13
- github.com/bsm/gomega v1.11.0/go.mod h1:JifAceMQ4crZIWYUKrlGcmbN3bqHogVTADMD2ATsbwk=
14
- github.com/bsm/parquet-go v0.0.0-20200904113737-792434824f00 h1:seSUCN95Kgv0mxmBUxx99faZYYQB4+TbE1Do6E5ZwI4=
15
- github.com/bsm/parquet-go v0.0.0-20200904113737-792434824f00/go.mod h1:7EU1rAae6Y67NlxAbr+Mbxxxc5AFGcxZCSW/vbybDLs=
16
- github.com/bsm/pbio v0.2.2 h1:Xdj5hQkS0K3kKc1NY6hoSWMvzpq0Mk5j8vcc7irslno=
17
- github.com/bsm/pbio v0.2.2/go.mod h1:3O4XQFoarlYalkGd+zMFfEUyalP8NBKkQ0Ta4IwhN4w=
8
+ github.com/bsm/bfs v0.11.5 h1:NMWD0hOp/74boNd51Zas4DMh81mvp1As1SjEZrFWHi0=
9
+ github.com/bsm/bfs v0.11.5/go.mod h1:D2N+ly23VsODKiRvkf4HUgKSgOaNjKTOJE53rhL6Vfk=
10
+ github.com/bsm/ginkgo v1.16.4/go.mod h1:RabIZLzOCPghgHJKUqHZpqrQETA5AnF4aCSIYy5C1bk=
11
+ github.com/bsm/ginkgo v1.16.5 h1:uTeeWv0Yx1PnDeCk76PFyGrOMVw3D+r9bTNKNcIjDdQ=
12
+ github.com/bsm/ginkgo v1.16.5/go.mod h1:RabIZLzOCPghgHJKUqHZpqrQETA5AnF4aCSIYy5C1bk=
13
+ github.com/bsm/gomega v1.16.0/go.mod h1:JifAceMQ4crZIWYUKrlGcmbN3bqHogVTADMD2ATsbwk=
14
+ github.com/bsm/gomega v1.17.0 h1:Sd6EsHO5d0DU6d41dtx9cK3T7Vjsr89o6zyIVWgi0CI=
15
+ github.com/bsm/gomega v1.17.0/go.mod h1:JifAceMQ4crZIWYUKrlGcmbN3bqHogVTADMD2ATsbwk=
16
+ github.com/bsm/pbio v0.3.0 h1:8XzkUPoJZblPkLp2jHVMnIhGs5WaNHTCmO7gRC45izk=
17
+ github.com/bsm/pbio v0.3.0/go.mod h1:3O4XQFoarlYalkGd+zMFfEUyalP8NBKkQ0Ta4IwhN4w=
18
18
  github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
19
19
  github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
20
+ github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
21
+ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
22
+ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
23
+ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
24
+ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
25
+ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
26
+ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
20
27
  github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
21
28
  github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
29
+ github.com/fraugster/parquet-go v0.6.1 h1:Kks9Ibly3ZZQPRPGkS1lVmrwndBp8PxamBnDFG5jvEM=
30
+ github.com/fraugster/parquet-go v0.6.1/go.mod h1:1HGhXzpHv7CULzknVNWIY0Ihn2O3qNbD1p+aQvHWhqo=
22
31
  github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
23
32
  github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
24
33
  github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
@@ -26,6 +35,7 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
26
35
  github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
27
36
  github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
28
37
  github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
38
+ github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
29
39
  github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
30
40
  github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
31
41
  github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
@@ -35,8 +45,9 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W
35
45
  github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
36
46
  github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
37
47
  github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
38
- github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
39
48
  github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
49
+ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
50
+ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
40
51
  github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
41
52
  github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
42
53
  github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
@@ -46,7 +57,9 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
46
57
  github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
47
58
  github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
48
59
  github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
60
+ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
49
61
  github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
62
+ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
50
63
  github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
51
64
  github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
52
65
  github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
@@ -54,6 +67,9 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
54
67
  github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
55
68
  github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
56
69
  github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
70
+ github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
71
+ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
72
+ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
57
73
  github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
58
74
  github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
59
75
  github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@@ -64,9 +80,29 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
64
80
  github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
65
81
  github.com/onsi/gomega v1.10.2 h1:aY/nuoWlKJud2J6U0E3NWsjlg+0GtwXxgEqthRdzlcs=
66
82
  github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
83
+ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
84
+ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
85
+ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
86
+ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
87
+ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
67
88
  github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
89
+ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
90
+ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
91
+ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
92
+ github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
93
+ github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
94
+ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
95
+ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
96
+ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
97
+ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
98
+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
99
+ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
100
+ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
101
+ github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
102
+ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
68
103
  github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
69
104
  github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
105
+ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
70
106
  golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
71
107
  golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
72
108
  golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@@ -95,6 +131,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
95
131
  golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
96
132
  golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
97
133
  golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
134
+ golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
98
135
  golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
99
136
  golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
100
137
  golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -139,14 +176,16 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
139
176
  google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
140
177
  google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
141
178
  google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
142
- google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
143
179
  google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
180
+ google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
181
+ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
144
182
  gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
145
- gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
146
- gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
183
+ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
184
+ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
147
185
  gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
148
186
  gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
149
187
  gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
188
+ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
150
189
  gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
151
190
  gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
152
191
  gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
@@ -1,25 +1,25 @@
1
1
  package parquet
2
2
 
3
3
  import (
4
- "fmt"
5
4
  "io"
6
5
  "io/ioutil"
7
6
  "os"
8
7
 
9
8
  "github.com/bsm/feedx"
9
+ goparquet "github.com/fraugster/parquet-go"
10
10
  )
11
11
 
12
+ // --------------------------------------------------------------------
13
+
12
14
  // Format is a parquet format.
13
15
  type Format struct {
14
- TempDir string
15
- Columns []string // column names to include
16
- BatchSize int // batch size, default: 1,000
16
+ TempDir string
17
17
  }
18
18
 
19
19
  // NewDecoder implements Format.
20
20
  func (f *Format) NewDecoder(r io.Reader) (feedx.FormatDecoder, error) {
21
21
  if rs, ok := r.(io.ReadSeeker); ok {
22
- return newDecoder(rs, f.Columns, f.BatchSize)
22
+ return newDecoder(rs)
23
23
  }
24
24
 
25
25
  tmp, err := copyToTempFile(f.TempDir, r)
@@ -27,18 +27,18 @@ func (f *Format) NewDecoder(r io.Reader) (feedx.FormatDecoder, error) {
27
27
  return nil, err
28
28
  }
29
29
 
30
- dec, err := newDecoder(tmp, f.Columns, f.BatchSize)
30
+ dec, err := newDecoder(tmp)
31
31
  if err != nil {
32
32
  _ = tmp.Close()
33
33
  return nil, err
34
34
  }
35
- dec.closers = append(dec.closers, tmp)
35
+ dec.tmp = tmp
36
36
  return dec, nil
37
37
  }
38
38
 
39
39
  // NewEncoder implements Format.
40
- func (*Format) NewEncoder(w io.Writer) (feedx.FormatEncoder, error) {
41
- return nil, fmt.Errorf("not implemented")
40
+ func (f *Format) NewEncoder(w io.Writer, opts ...goparquet.FileWriterOption) (feedx.FormatEncoder, error) {
41
+ return newEncoder(w, opts)
42
42
  }
43
43
 
44
44
  // --------------------------------------------------------------------
@@ -69,7 +69,7 @@ func copyToTempFile(dir string, r io.Reader) (*tempFile, error) {
69
69
  return &tempFile{File: f}, nil
70
70
  }
71
71
 
72
- func (f tempFile) Close() error {
72
+ func (f *tempFile) Close() error {
73
73
  err := f.File.Close()
74
74
  if e := os.Remove(f.Name()); e != nil {
75
75
  err = e
data/feedx.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'feedx'
3
- s.version = '0.12.6'
3
+ s.version = '0.12.7'
4
4
  s.authors = ['Black Square Media Ltd']
5
5
  s.email = ['info@blacksquaremedia.com']
6
6
  s.summary = %(Exchange data between components via feeds)
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.files = `git ls-files -z`.split("\x0").reject {|f| f.start_with?('spec/') }
12
12
  s.test_files = `git ls-files -z -- spec/*`.split("\x0")
13
13
  s.require_paths = ['lib']
14
- s.required_ruby_version = '>= 2.6'
14
+ s.required_ruby_version = '>= 2.7'
15
15
 
16
16
  s.add_dependency 'bfs', '>= 0.8.0'
17
17
 
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'red-parquet', '>= 3.0', '< 4.0'
22
22
  s.add_development_dependency 'rspec'
23
23
  s.add_development_dependency 'rubocop-bsm'
24
+ s.metadata['rubygems_mfa_required'] = 'true'
24
25
  end
data/feedx_test.go CHANGED
@@ -48,6 +48,8 @@ func writeMulti(obj *bfs.Object, numEntries int, lastMod time.Time) error {
48
48
  return w.Commit()
49
49
  }
50
50
 
51
+ // ------------------------------------------------------------------------
52
+
51
53
  func TestSuite(t *testing.T) {
52
54
  RegisterFailHandler(Fail)
53
55
  RunSpecs(t, "feedx")
data/go.mod CHANGED
@@ -3,13 +3,11 @@ module github.com/bsm/feedx
3
3
  go 1.15
4
4
 
5
5
  require (
6
- github.com/bsm/bfs v0.11.3
7
- github.com/bsm/ginkgo v1.16.0
8
- github.com/bsm/gomega v1.11.0
9
- github.com/bsm/pbio v0.2.2
6
+ github.com/bsm/bfs v0.11.5
7
+ github.com/bsm/ginkgo v1.16.5
8
+ github.com/bsm/gomega v1.17.0
9
+ github.com/bsm/pbio v0.3.0
10
10
  github.com/gogo/protobuf v1.3.2
11
- github.com/golang/protobuf v1.5.0
12
- github.com/kr/pretty v0.1.0 // indirect
13
- google.golang.org/protobuf v1.26.0
14
- gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
11
+ github.com/golang/protobuf v1.5.2
12
+ google.golang.org/protobuf v1.27.1
15
13
  )
data/go.sum CHANGED
@@ -2,14 +2,16 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT
2
2
  github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
3
3
  github.com/bmatcuk/doublestar/v3 v3.0.0 h1:TQtVPlDnAYwcrVNB2JiGuMc++H5qzWZd9PhkNo5WyHI=
4
4
  github.com/bmatcuk/doublestar/v3 v3.0.0/go.mod h1:6PcTVMw80pCY1RVuoqu3V++99uQB3vsSYKPTd8AWA0k=
5
- github.com/bsm/bfs v0.11.3 h1:BTFCftgmuVZwwu6vyjhyKr/Pg1E+cZ5tLodj3wKxr94=
6
- github.com/bsm/bfs v0.11.3/go.mod h1:sUhBrbc9g0XThRRrT9hiinMhhKbkKIdhLkFljk4fuzM=
7
- github.com/bsm/ginkgo v1.16.0 h1:d0FSr//fhUpdWr4uBHBLG+xN1bOYWERSBnfu1hGknfU=
8
- github.com/bsm/ginkgo v1.16.0/go.mod h1:RabIZLzOCPghgHJKUqHZpqrQETA5AnF4aCSIYy5C1bk=
9
- github.com/bsm/gomega v1.11.0 h1:wg9DVGPETNZLIbMsseneMV1a7uo/x+wsCyNXdEcifDI=
10
- github.com/bsm/gomega v1.11.0/go.mod h1:JifAceMQ4crZIWYUKrlGcmbN3bqHogVTADMD2ATsbwk=
11
- github.com/bsm/pbio v0.2.2 h1:Xdj5hQkS0K3kKc1NY6hoSWMvzpq0Mk5j8vcc7irslno=
12
- github.com/bsm/pbio v0.2.2/go.mod h1:3O4XQFoarlYalkGd+zMFfEUyalP8NBKkQ0Ta4IwhN4w=
5
+ github.com/bsm/bfs v0.11.5 h1:NMWD0hOp/74boNd51Zas4DMh81mvp1As1SjEZrFWHi0=
6
+ github.com/bsm/bfs v0.11.5/go.mod h1:D2N+ly23VsODKiRvkf4HUgKSgOaNjKTOJE53rhL6Vfk=
7
+ github.com/bsm/ginkgo v1.16.4/go.mod h1:RabIZLzOCPghgHJKUqHZpqrQETA5AnF4aCSIYy5C1bk=
8
+ github.com/bsm/ginkgo v1.16.5 h1:uTeeWv0Yx1PnDeCk76PFyGrOMVw3D+r9bTNKNcIjDdQ=
9
+ github.com/bsm/ginkgo v1.16.5/go.mod h1:RabIZLzOCPghgHJKUqHZpqrQETA5AnF4aCSIYy5C1bk=
10
+ github.com/bsm/gomega v1.16.0/go.mod h1:JifAceMQ4crZIWYUKrlGcmbN3bqHogVTADMD2ATsbwk=
11
+ github.com/bsm/gomega v1.17.0 h1:Sd6EsHO5d0DU6d41dtx9cK3T7Vjsr89o6zyIVWgi0CI=
12
+ github.com/bsm/gomega v1.17.0/go.mod h1:JifAceMQ4crZIWYUKrlGcmbN3bqHogVTADMD2ATsbwk=
13
+ github.com/bsm/pbio v0.3.0 h1:8XzkUPoJZblPkLp2jHVMnIhGs5WaNHTCmO7gRC45izk=
14
+ github.com/bsm/pbio v0.3.0/go.mod h1:3O4XQFoarlYalkGd+zMFfEUyalP8NBKkQ0Ta4IwhN4w=
13
15
  github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
14
16
  github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
15
17
  github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -30,8 +32,9 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W
30
32
  github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
31
33
  github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
32
34
  github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
33
- github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
34
35
  github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
36
+ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
37
+ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
35
38
  github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
36
39
  github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
37
40
  github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@@ -42,11 +45,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
42
45
  github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
43
46
  github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
44
47
  github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
45
- github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
46
- github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
47
- github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
48
- github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
49
- github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
50
48
  github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
51
49
  github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
52
50
  github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
@@ -132,11 +130,11 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
132
130
  google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
133
131
  google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
134
132
  google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
135
- google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
136
133
  google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
134
+ google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
135
+ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
136
+ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
137
137
  gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
138
- gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
139
- gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
140
138
  gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
141
139
  gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
142
140
  gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feedx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.6
4
+ version: 0.12.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Black Square Media Ltd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-18 00:00:00.000000000 Z
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bfs
@@ -122,8 +122,10 @@ extensions: []
122
122
  extra_rdoc_files: []
123
123
  files:
124
124
  - ".editorconfig"
125
+ - ".github/workflows/lint.yml"
125
126
  - ".github/workflows/test.yml"
126
127
  - ".gitignore"
128
+ - ".golangci.yml"
127
129
  - ".rubocop.yml"
128
130
  - Gemfile
129
131
  - Gemfile.lock
@@ -137,13 +139,13 @@ files:
137
139
  - consumer_test.go
138
140
  - ext/parquet/decoder.go
139
141
  - ext/parquet/decoder_test.go
142
+ - ext/parquet/encoder.go
143
+ - ext/parquet/encoder_test.go
140
144
  - ext/parquet/go.mod
141
145
  - ext/parquet/go.sum
142
146
  - ext/parquet/parquet.go
143
147
  - ext/parquet/parquet_test.go
144
- - ext/parquet/reader.go
145
148
  - ext/parquet/testdata/alltypes_plain.parquet
146
- - ext/parquet/types.go
147
149
  - feedx.gemspec
148
150
  - feedx.go
149
151
  - feedx_ext_test.go
@@ -195,7 +197,8 @@ files:
195
197
  homepage: https://github.com/bsm/feedx
196
198
  licenses:
197
199
  - Apache-2.0
198
- metadata: {}
200
+ metadata:
201
+ rubygems_mfa_required: 'true'
199
202
  post_install_message:
200
203
  rdoc_options: []
201
204
  require_paths:
@@ -204,14 +207,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
204
207
  requirements:
205
208
  - - ">="
206
209
  - !ruby/object:Gem::Version
207
- version: '2.6'
210
+ version: '2.7'
208
211
  required_rubygems_version: !ruby/object:Gem::Requirement
209
212
  requirements:
210
213
  - - ">="
211
214
  - !ruby/object:Gem::Version
212
215
  version: '0'
213
216
  requirements: []
214
- rubygems_version: 3.1.4
217
+ rubygems_version: 3.2.15
215
218
  signing_key:
216
219
  specification_version: 4
217
220
  summary: Exchange data between components via feeds
@@ -1,89 +0,0 @@
1
- package parquet
2
-
3
- import (
4
- "io"
5
-
6
- kpq "github.com/bsm/parquet-go/parquet"
7
- )
8
-
9
- type columnReader struct {
10
- file *kpq.File
11
- col kpq.Column
12
- rowGroup int
13
-
14
- chunk *kpq.ColumnChunkReader
15
- values []interface{}
16
- dLevels []uint16
17
- rLevels []uint16
18
-
19
- n, i, vi int // chunk stats
20
- }
21
-
22
- func newColumnReader(file *kpq.File, col kpq.Column, batchSize int) *columnReader {
23
- return &columnReader{
24
- file: file,
25
- col: col,
26
- values: make([]interface{}, batchSize),
27
- dLevels: make([]uint16, batchSize),
28
- rLevels: make([]uint16, batchSize),
29
- }
30
- }
31
-
32
- func (c *columnReader) Name() string {
33
- return c.col.String()
34
- }
35
-
36
- func (c *columnReader) Next() (interface{}, error) {
37
- if err := c.ensureChunk(); err != nil {
38
- return nil, err
39
- }
40
-
41
- if err := c.ensureValues(); err == kpq.EndOfChunk {
42
- c.chunk = nil
43
- return c.Next()
44
- } else if err != nil {
45
- return nil, err
46
- }
47
-
48
- dLevel := c.dLevels[c.i]
49
- c.i++
50
-
51
- if notNull := dLevel == c.col.MaxD(); notNull {
52
- val := c.values[c.vi]
53
- c.vi++
54
- return val, nil
55
- }
56
-
57
- return nil, nil
58
- }
59
-
60
- func (c *columnReader) ensureChunk() error {
61
- if c.chunk != nil {
62
- return nil
63
- }
64
- if c.rowGroup >= len(c.file.MetaData.RowGroups) {
65
- return io.EOF
66
- }
67
-
68
- rd, err := c.file.NewReader(c.col, c.rowGroup)
69
- if err != nil {
70
- return err
71
- }
72
- c.chunk = rd
73
- c.rowGroup++
74
- return nil
75
- }
76
-
77
- func (c *columnReader) ensureValues() error {
78
- if c.n != 0 && c.i < c.n {
79
- return nil
80
- }
81
-
82
- n, err := c.chunk.Read(c.values, c.dLevels, c.rLevels)
83
- if err != nil {
84
- return err
85
- }
86
-
87
- c.n, c.i, c.vi = n, 0, 0
88
- return nil
89
- }
data/ext/parquet/types.go DELETED
@@ -1,51 +0,0 @@
1
- package parquet
2
-
3
- import (
4
- "reflect"
5
- "strings"
6
- "sync"
7
- )
8
-
9
- type structFields map[string]int
10
-
11
- var fieldCache sync.Map // map[reflect.Type]structFields
12
-
13
- // cachedTypeFields is like typeFields but uses a cache to avoid repeated work.
14
- //
15
- // "Inspired" by https://golang.org/src/encoding/json/encode.go
16
- // Copyright 2010 The Go Authors. All rights reserved.
17
- func cachedTypeFields(t reflect.Type) structFields {
18
- if f, ok := fieldCache.Load(t); ok {
19
- return f.(structFields)
20
- }
21
-
22
- f, _ := fieldCache.LoadOrStore(t, typeFields(t))
23
- return f.(structFields)
24
- }
25
-
26
- func tagName(tag string) string {
27
- if pos := strings.Index(tag, ","); pos != -1 {
28
- return tag[:pos]
29
- }
30
- return tag
31
- }
32
-
33
- // "Inspired" by https://golang.org/src/encoding/json/encode.go
34
- // Copyright 2010 The Go Authors. All rights reserved.
35
- func typeFields(t reflect.Type) structFields {
36
- index := make(map[string]int, t.NumField())
37
- for i := 0; i < t.NumField(); i++ {
38
- field := t.Field(i)
39
- tag := field.Tag.Get("parquet")
40
- if tag == "-" {
41
- continue
42
- }
43
-
44
- name := field.Name
45
- if s := tagName(tag); s != "" {
46
- name = s
47
- }
48
- index[name] = i
49
- }
50
- return index
51
- }