|
5 | 5 |
|
6 | 6 | "github.com/apache/arrow/go/v7/arrow"
|
7 | 7 | "github.com/apache/arrow/go/v7/arrow/array"
|
8 |
| - arrowmem "github.com/apache/arrow/go/v7/arrow/memory" |
9 | 8 |
|
10 | 9 | "github.com/influxdata/flux/codes"
|
11 | 10 | "github.com/influxdata/flux/internal/errors"
|
@@ -158,65 +157,11 @@ func (a *String) Value(i int) string {
|
158 | 157 | return a.ValueString(i)
|
159 | 158 | }
|
160 | 159 |
|
161 |
| -// ValueRef returns a reference to the memory buffer and location that |
162 |
| -// stores the value at i. The reference is only valid for as long as the |
163 |
| -// array is, the buffer needs to be retained if further access is |
164 |
| -// required. |
165 |
| -func (a *String) ValueRef(i int) StringRef { |
166 |
| - if vr, ok := a.binaryArray.(interface{ ValueRef(int) StringRef }); ok { |
167 |
| - return vr.ValueRef(i) |
168 |
| - } |
169 |
| - return StringRef{ |
170 |
| - buf: a.Data().Buffers()[2], |
171 |
| - off: a.ValueOffset(i), |
172 |
| - len: a.ValueLen(i), |
173 |
| - } |
174 |
| -} |
175 |
| - |
176 |
| -// ValueCopy returns the value at the requested position copied into a |
177 |
| -// new memory location. This value will remain valid after the array is |
178 |
| -// released, but is not tracked by the memory allocator. |
179 |
| -// |
180 |
| -// This function is intended to be temporary while changes are being |
181 |
| -// made to reduce the amount of unaccounted data memory. |
182 |
| -func (a *String) ValueCopy(i int) string { |
183 |
| - return string(a.ValueRef(i).Bytes()) |
184 |
| -} |
185 |
| - |
186 | 160 | func (a *String) IsConstant() bool {
|
187 | 161 | ic, ok := a.binaryArray.(interface{ IsConstant() bool })
|
188 | 162 | return ok && ic.IsConstant()
|
189 | 163 | }
|
190 | 164 |
|
191 |
| -// StringRef contains a referenct to the storage for a value. |
192 |
| -type StringRef struct { |
193 |
| - buf *arrowmem.Buffer |
194 |
| - off int |
195 |
| - len int |
196 |
| -} |
197 |
| - |
198 |
| -// Buffer returns the memory buffer that contains the value. |
199 |
| -func (r StringRef) Buffer() *arrowmem.Buffer { |
200 |
| - return r.buf |
201 |
| -} |
202 |
| - |
203 |
| -// Offset returns the offset into the memory buffer at which the value |
204 |
| -// starts. |
205 |
| -func (r StringRef) Offset() int { |
206 |
| - return r.off |
207 |
| -} |
208 |
| - |
209 |
| -// Len returns the length of the value. |
210 |
| -func (r StringRef) Len() int { |
211 |
| - return r.len |
212 |
| -} |
213 |
| - |
214 |
| -// Bytes returns the bytes from the memory buffer that contain the |
215 |
| -// value. |
216 |
| -func (r StringRef) Bytes() []byte { |
217 |
| - return r.buf.Bytes()[r.off : r.off+r.len] |
218 |
| -} |
219 |
| - |
220 | 165 | type sliceable interface {
|
221 | 166 | Slice(i, j int) Array
|
222 | 167 | }
|
|
0 commit comments