1 /***********************************************************************
2  * Copyright (c) 2013-2024 Commonwealth Computer Research, Inc.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Apache License, Version 2.0
5  * which accompanies this distribution and is available at
6  * http://www.opensource.org/licenses/apache2.0.php.
7  ***********************************************************************/
8 
9 package org.locationtech.geomesa.arrow.vector
10 
11 import org.apache.arrow.vector.FieldVector
12 import org.apache.arrow.vector.dictionary.Dictionary
13 import org.apache.arrow.vector.types.pojo.{ArrowType, DictionaryEncoding}
14 import org.geotools.api.feature.`type`.AttributeDescriptor
15 import org.locationtech.geomesa.arrow.ArrowAllocator
16 import org.locationtech.geomesa.arrow.vector.SimpleFeatureVector.SimpleFeatureEncoding
17 import org.locationtech.geomesa.utils.geotools.ObjectType
18 import org.locationtech.geomesa.utils.geotools.ObjectType.ObjectType
19 import org.locationtech.geomesa.utils.io.CloseWithLogging
20 
21 import java.io.Closeable
22 import java.util.concurrent.atomic.AtomicInteger
23 import scala.reflect.ClassTag
24 
25 /**
26   * Holder for dictionary values
27   */
28 sealed trait ArrowDictionary extends Closeable {
29 
30   lazy private val map = {
31     val builder = scala.collection.mutable.Map.newBuilder[AnyRef, Int]
32     builder.sizeHint(length)
33     var i = 0
34     foreach { value =>
35       builder += ((value, i))
36       i += 1
37     }
38     builder.result()
39   }
40 
41   def encoding: DictionaryEncoding
42   def id: Long = encoding.getId
43   def length: Int
44 
45   /**
46     * Decode a dictionary int to a value. Note: may not be thread safe
47     *
48     * @param i dictionary encoded int
49     * @return value
50     */
51   def lookup(i: Int): AnyRef
52 
53   /**
54     * Dictionary encode a value to an int
55     *
56     * @param value value to encode
57     * @return dictionary encoded int
58     */
59   def index(value: AnyRef): Int = map.getOrElse(value, length)
60 
61   /**
62     * Apply a function to each value in the dictionary
63     *
64     * @param f function
65     * @tparam U function return type
66     */
67   def foreach[U](f: AnyRef => U): Unit = iterator.foreach(f)
68 
69   /**
70     * Create an iterator over the values in this dictionary
71     *
72     * @return
73     */
74   def iterator: Iterator[AnyRef] = new Iterator[AnyRef] {
75     private var i = 0
76     override def hasNext: Boolean = i < ArrowDictionary.this.length
77     override def next(): AnyRef = try { lookup(i) } finally { i += 1 }
78   }
79 
80   /**
81    * Create an arrow dictionary vector
82    *
83    * @param precision precision
84    * @return
85    */
86   def toDictionary(precision: SimpleFeatureEncoding): Dictionary with Closeable
87 }
88 
89 object ArrowDictionary {
90 
91   /**
92     * Create a dictionary based off a sequence of values. Encoding will be smallest that will fit all values.
93     *
94     * @param id dictionary id
95     * @param values dictionary values
96     * @return dictionary
97     */
98   def create[T <: AnyRef](typename: String, id: Long, values: Array[T])(implicit ct: ClassTag[T]): ArrowDictionary =
99     create(typename, id, values, values.length)
100 
101   /**
102     * Create a dictionary based on a subset of a value array
103     *
104     * @param id dictionary id
105     * @param values array of dictionary values
106     * @param length number of valid entries in the values array, starting at position 0
107     * @return
108     */
109   def create[T <: AnyRef](typename: String, id: Long, values: Array[T], length: Int)(implicit ct: ClassTag[T]): ArrowDictionary =
110     new ArrowDictionaryArray[T](typename, createEncoding(id, length), values, length, ct.runtimeClass.asInstanceOf[Class[T]])
111 
112   /**
113     * Create a dictionary based on wrapping an arrow vector
114     *
115     * @param encoding dictionary id and metadata
116     * @param values dictionary vector
117     * @param descriptor attribute descriptor for the dictionary, used to read values from the underlying vector
118     * @param precision simple feature encoding used on the dictionary values
119     * @return
120     */
121   def create(
122       encoding: DictionaryEncoding,
123       values: FieldVector,
124       descriptor: AttributeDescriptor,
125       precision: SimpleFeatureEncoding): ArrowDictionary = {
126     new ArrowDictionaryVector(encoding, values, ObjectType.selectType(descriptor), precision)
127   }
128 
129   /**
130    * Create a dictionary based on wrapping an arrow vector
131    *
132    * @param encoding dictionary id and metadata
133    * @param values dictionary vector
134    * @param bindings attribute descriptor bindings, used for reading values from the arrow vector
135    * @param precision simple feature encoding used on the dictionary values
136    * @return
137    */
138   def create(
139       encoding: DictionaryEncoding,
140       values: FieldVector,
141       bindings: Seq[ObjectType],
142       precision: SimpleFeatureEncoding): ArrowDictionary = {
143     new ArrowDictionaryVector(encoding, values, bindings, precision)
144   }
145 
146   /**
147     * Holder for dictionary values
148     *
149     * @param values dictionary values. When encoded, values are replaced with their index in the seq
150     * @param encoding dictionary id and int width, id must be unique per arrow file
151     */
152   class ArrowDictionaryArray[T <: AnyRef](
153       typename: String,
154       val encoding: DictionaryEncoding,
155       values: Array[T],
156       val length: Int,
157       binding: Class[T]
158     ) extends ArrowDictionary {
159 
160     override def lookup(i: Int): AnyRef = if (i < length) { values(i) } else { "[other]" }
161 
162     override def toDictionary(precision: SimpleFeatureEncoding): Dictionary with Closeable = {
163       val allocator = ArrowAllocator(s"dictionary-array:$typename")
164       val name = s"dictionary-$id"
165       val bindings = ObjectType.selectType(binding)
166       val writer = ArrowAttributeWriter(name, bindings, None, Map.empty, precision, VectorFactory(allocator))
167       var i = 0
168       while (i < length) {
169         writer.apply(i, values(i))
170         i += 1
171       }
172       writer.setValueCount(length)
173 
174       new Dictionary(writer.vector, encoding) with Closeable {
175         override def close(): Unit = CloseWithLogging.raise(writer.vector, allocator)
176       }
177     }
178 
179     override def close(): Unit = {}
180   }
181 
182   /**
183     * Dictionary that wraps an arrow vector
184     *
185     * @param encoding dictionary id and metadata
186     * @param vector arrow vector
187     * @param bindings attribute descriptor bindings, used for reading values from the arrow vector
188     * @param precision simple feature encoding used for the arrow vector
189     */
190   class ArrowDictionaryVector(
191       val encoding: DictionaryEncoding,
192       vector: FieldVector,
193       bindings: Seq[ObjectType],
194       precision: SimpleFeatureEncoding
195     ) extends ArrowDictionary {
196 
197     // we use an attribute reader to get the right type conversion
198     private val reader = ArrowAttributeReader(bindings, vector, None, precision)
199     private var references = 1
200 
201     override val length: Int = vector.getValueCount
202 
203     override def lookup(i: Int): AnyRef = if (i < length) { reader.apply(i) } else { "[other]" }
204 
205     override def toDictionary(precision: SimpleFeatureEncoding): Dictionary with Closeable = synchronized {
206       if (references < 1) {
207         throw new IllegalStateException("Trying to create a dictionary from a closed vector")
208       } else if (precision != this.precision) {
209         throw new IllegalArgumentException("Wrapped dictionary vectors can't be re-encoded with a different precision")
210       }
211       references += 1
212       new Dictionary(vector, encoding) with Closeable {
213         override def close(): Unit = ArrowDictionaryVector.this.close()
214       }
215     }
216 
217     override def close(): Unit = synchronized {
218       references -= 1
219       if (references < 1) {
220         vector.close()
221       }
222     }
223   }
224 
225   /**
226    * Tracks values seen and writes dictionary encoded ints instead
227    */
228   class ArrowDictionaryBuilder(val encoding: DictionaryEncoding) extends ArrowDictionary {
229 
230     // next dictionary index to use
231     private val counter = new AtomicInteger(0)
232 
233     // values that we have seen, and their dictionary index
234     private val values = scala.collection.mutable.LinkedHashMap.empty[AnyRef, Int]
235 
236     override def lookup(i: Int): AnyRef = values.find(_._2 == i).map(_._1).getOrElse("[other]")
237 
238     override def index(value: AnyRef): Int = values.getOrElseUpdate(value, counter.getAndIncrement())
239 
240     override def length: Int = values.size
241 
242     // note: iterator will return in insert order
243     // we need to keep it ordered so that dictionary values match up with their index
244     override def iterator: Iterator[AnyRef] = values.keys.iterator
245 
246     override def toDictionary(precision: SimpleFeatureEncoding): Dictionary with Closeable =
247       throw new NotImplementedError()
248 
249     override def close(): Unit = {}
250 
251     def clear(): Unit = {
252       counter.set(0)
253       values.clear()
254     }
255   }
256 
257   // use the smallest int type possible to minimize bytes used
258   private def createEncoding(id: Long, count: Int): DictionaryEncoding = {
259     // we check `MaxValue - 1` to allow for the fallback 'other'
260     if (count < Byte.MaxValue - 1) {
261       new DictionaryEncoding(id, false, new ArrowType.Int(8, true))
262     } else if (count < Short.MaxValue - 1) {
263       new DictionaryEncoding(id, false, new ArrowType.Int(16, true))
264     } else {
265       new DictionaryEncoding(id, false, new ArrowType.Int(32, true))
266     }
267   }
268 }
Line Stmt Id Pos Tree Symbol Tests Code
42 3089 1555 - 1569 Apply org.apache.arrow.vector.types.pojo.DictionaryEncoding.getId ArrowDictionary.this.encoding.getId()
59 3090 1955 - 1961 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.length ArrowDictionary.this.length
59 3091 1934 - 1962 Apply scala.collection.MapLike.getOrElse ArrowDictionary.this.map.getOrElse[Int](value, ArrowDictionary.this.length)
67 3092 2140 - 2159 Apply scala.collection.Iterator.foreach ArrowDictionary.this.iterator.foreach[U](f)
74 3102 2289 - 2292 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.$anon.<init> new $anon()
75 3093 2332 - 2333 Literal <nosymbol> 0
76 3094 2374 - 2401 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.length ArrowDictionary.this.length
76 3095 2370 - 2401 Apply scala.Int.< $anon.this.i.<(ArrowDictionary.this.length)
77 3096 2449 - 2450 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.$anon.i $anon.this.i
77 3097 2442 - 2451 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.lookup ArrowDictionary.this.lookup($anon.this.i)
77 3098 2442 - 2451 Block org.locationtech.geomesa.arrow.vector.ArrowDictionary.lookup ArrowDictionary.this.lookup($anon.this.i)
77 3099 2464 - 2470 Apply scala.Int.+ $anon.this.i.+(1)
77 3100 2464 - 2470 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.$anon.i_= $anon.this.i_=($anon.this.i.+(1))
77 3101 2464 - 2470 Block org.locationtech.geomesa.arrow.vector.ArrowDictionary.$anon.i_= $anon.this.i_=($anon.this.i.+(1))
99 3103 3031 - 3074 ApplyToImplicitArgs org.locationtech.geomesa.arrow.vector.ArrowDictionary.create ArrowDictionary.this.create[T](typename, id, values, values.length)(ct)
110 3104 3507 - 3533 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.createEncoding ArrowDictionary.this.createEncoding(id, length)
110 3105 3551 - 3589 TypeApply scala.Any.asInstanceOf ct.runtimeClass.asInstanceOf[Class[T]]
110 3106 3469 - 3590 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryArray.<init> new org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryArray[T](typename, ArrowDictionary.this.createEncoding(id, length), values, length, ct.runtimeClass.asInstanceOf[Class[T]])
126 3107 4186 - 4219 Apply org.locationtech.geomesa.utils.geotools.ObjectType.selectType org.locationtech.geomesa.utils.geotools.ObjectType.selectType(descriptor)
126 3108 4142 - 4231 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.<init> new ArrowDictionary.this.ArrowDictionaryVector(encoding, values, org.locationtech.geomesa.utils.geotools.ObjectType.selectType(descriptor), precision)
143 3109 4760 - 4824 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.<init> new ArrowDictionary.this.ArrowDictionaryVector(encoding, values, bindings, precision)
160 3110 5330 - 5336 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryArray.length ArrowDictionaryArray.this.length
160 3111 5326 - 5336 Apply scala.Int.< i.<(ArrowDictionaryArray.this.length)
160 3112 5340 - 5349 Apply scala.Array.apply ArrowDictionaryArray.this.values.apply(i)
160 3113 5340 - 5349 Block scala.Array.apply ArrowDictionaryArray.this.values.apply(i)
160 3114 5359 - 5368 Literal <nosymbol> "[other]"
160 3115 5359 - 5368 Block <nosymbol> "[other]"
163 3116 5506 - 5524 Literal <nosymbol> "dictionary-array:"
163 3117 5532 - 5533 Literal <nosymbol> ""
163 3118 5524 - 5532 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryArray.typename ArrowDictionaryArray.this.typename
163 3119 5504 - 5533 Apply scala.StringContext.s scala.StringContext.apply("dictionary-array:", "").s(ArrowDictionaryArray.this.typename)
163 3120 5489 - 5534 Apply org.locationtech.geomesa.arrow.ArrowAllocator.apply org.locationtech.geomesa.arrow.`package`.ArrowAllocator.apply(scala.StringContext.apply("dictionary-array:", "").s(ArrowDictionaryArray.this.typename))
164 3121 5554 - 5566 Literal <nosymbol> "dictionary-"
164 3122 5568 - 5569 Literal <nosymbol> ""
164 3123 5566 - 5568 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.id ArrowDictionaryArray.this.id
164 3124 5552 - 5569 Apply scala.StringContext.s scala.StringContext.apply("dictionary-", "").s(ArrowDictionaryArray.this.id)
165 3125 5613 - 5620 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryArray.binding ArrowDictionaryArray.this.binding
165 3126 5591 - 5621 Apply org.locationtech.geomesa.utils.geotools.ObjectType.selectType org.locationtech.geomesa.utils.geotools.ObjectType.selectType(ArrowDictionaryArray.this.binding, org.locationtech.geomesa.utils.geotools.ObjectType.selectType$default$2)
166 3127 5678 - 5682 Select scala.None scala.None
166 3128 5684 - 5693 TypeApply scala.collection.immutable.Map.empty scala.Predef.Map.empty[String, Nothing]
166 3129 5706 - 5730 Apply org.locationtech.geomesa.arrow.vector.VectorFactory.apply vector.this.`package`.VectorFactory.apply(allocator)
166 3130 5641 - 5731 Apply org.locationtech.geomesa.arrow.vector.ArrowAttributeWriter.apply ArrowAttributeWriter.apply(name, bindings, scala.None, scala.Predef.Map.empty[String, Nothing], precision, vector.this.`package`.VectorFactory.apply(allocator))
167 3131 5746 - 5747 Literal <nosymbol> 0
168 3132 5765 - 5771 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryArray.length ArrowDictionaryArray.this.length
168 3133 5761 - 5771 Apply scala.Int.< i.<(ArrowDictionaryArray.this.length)
168 3137 5773 - 5773 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryArray.while$1 while$1()
168 3138 5773 - 5832 Block <nosymbol> { { writer.apply(i, ArrowDictionaryArray.this.values.apply(i)); i = i.+(1) }; while$1() }
168 3139 5754 - 5754 Literal <nosymbol> ()
168 3140 5754 - 5754 Block <nosymbol> ()
169 3134 5799 - 5808 Apply scala.Array.apply ArrowDictionaryArray.this.values.apply(i)
169 3135 5783 - 5809 Apply org.locationtech.geomesa.arrow.vector.ArrowAttributeWriter.apply writer.apply(i, ArrowDictionaryArray.this.values.apply(i))
170 3136 5818 - 5824 Apply scala.Int.+ i.+(1)
172 3141 5860 - 5866 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryArray.length ArrowDictionaryArray.this.length
172 3142 5839 - 5867 Apply org.locationtech.geomesa.arrow.vector.ArrowAttributeWriter.setValueCount writer.setValueCount(ArrowDictionaryArray.this.length)
174 3147 5875 - 5878 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryArray.$anon.<init> new $anon()
175 3143 5992 - 6005 Select org.locationtech.geomesa.arrow.vector.ArrowAttributeWriter.vector writer.vector
175 3144 5991 - 5991 Select org.locationtech.geomesa.utils.io.IsCloseableImplicits.closeableIsCloseable io.this.IsCloseable.closeableIsCloseable
175 3145 5991 - 5991 Select org.locationtech.geomesa.utils.io.IsCloseableImplicits.closeableIsCloseable io.this.IsCloseable.closeableIsCloseable
175 3146 5969 - 6017 ApplyToImplicitArgs org.locationtech.geomesa.utils.io.SafeClose.raise org.locationtech.geomesa.utils.io.`package`.CloseWithLogging.raise[org.apache.arrow.vector.FieldVector, org.apache.arrow.memory.BufferAllocator](writer.vector, allocator)(io.this.IsCloseable.closeableIsCloseable, io.this.IsCloseable.closeableIsCloseable)
179 3148 6066 - 6068 Literal <nosymbol> ()
198 3149 6707 - 6715 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.bindings ArrowDictionaryVector.this.bindings
198 3150 6717 - 6723 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.vector ArrowDictionaryVector.this.vector
198 3151 6725 - 6729 Select scala.None scala.None
198 3152 6731 - 6740 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.precision ArrowDictionaryVector.this.precision
198 3153 6686 - 6741 Apply org.locationtech.geomesa.arrow.vector.ArrowAttributeReader.apply ArrowAttributeReader.apply(ArrowDictionaryVector.this.bindings, ArrowDictionaryVector.this.vector, scala.None, ArrowDictionaryVector.this.precision)
199 3154 6771 - 6772 Literal <nosymbol> 1
201 3155 6805 - 6825 Apply org.apache.arrow.vector.ValueVector.getValueCount ArrowDictionaryVector.this.vector.getValueCount()
203 3156 6877 - 6883 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.length ArrowDictionaryVector.this.length
203 3157 6873 - 6883 Apply scala.Int.< i.<(ArrowDictionaryVector.this.length)
203 3158 6887 - 6902 Apply org.locationtech.geomesa.arrow.vector.ArrowAttributeReader.apply ArrowDictionaryVector.this.reader.apply(i)
203 3159 6887 - 6902 Block org.locationtech.geomesa.arrow.vector.ArrowAttributeReader.apply ArrowDictionaryVector.this.reader.apply(i)
203 3160 6912 - 6921 Literal <nosymbol> "[other]"
203 3161 6912 - 6921 Block <nosymbol> "[other]"
205 3176 7018 - 7494 Apply java.lang.Object.synchronized ArrowDictionaryVector.this.synchronized[org.apache.arrow.vector.dictionary.Dictionary with java.io.Closeable]({ if (ArrowDictionaryVector.this.references.<(1)) throw new java.lang.IllegalStateException("Trying to create a dictionary from a closed vector") else if (precision.!=(this.precision)) throw new scala.`package`.IllegalArgumentException("Wrapped dictionary vectors can\'t be re-encoded with a different precision") else (); ArrowDictionaryVector.this.references_=(ArrowDictionaryVector.this.references.+(1)); { final class $anon extends org.apache.arrow.vector.dictionary.Dictionary with java.io.Closeable { def <init>(): <$anon: org.apache.arrow.vector.dictionary.Dictionary with java.io.Closeable> = { $anon.super.<init>(ArrowDictionaryVector.this.vector, ArrowDictionaryVector.this.encoding); () }; override def close(): Unit = ArrowDictionaryVector.this.close() }; new $anon() } })
206 3162 7043 - 7057 Apply scala.Int.< ArrowDictionaryVector.this.references.<(1)
207 3163 7069 - 7154 Throw <nosymbol> throw new java.lang.IllegalStateException("Trying to create a dictionary from a closed vector")
207 3164 7069 - 7154 Block <nosymbol> throw new java.lang.IllegalStateException("Trying to create a dictionary from a closed vector")
208 3165 7185 - 7199 Select org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.precision this.precision
208 3166 7172 - 7199 Apply java.lang.Object.!= precision.!=(this.precision)
208 3169 7168 - 7168 Literal <nosymbol> ()
208 3170 7168 - 7168 Block <nosymbol> ()
208 3171 7168 - 7330 If <nosymbol> if (precision.!=(this.precision)) throw new scala.`package`.IllegalArgumentException("Wrapped dictionary vectors can\'t be re-encoded with a different precision") else ()
209 3167 7211 - 7322 Throw <nosymbol> throw new scala.`package`.IllegalArgumentException("Wrapped dictionary vectors can\'t be re-encoded with a different precision")
209 3168 7211 - 7322 Block <nosymbol> throw new scala.`package`.IllegalArgumentException("Wrapped dictionary vectors can\'t be re-encoded with a different precision")
211 3172 7337 - 7352 Apply scala.Int.+ ArrowDictionaryVector.this.references.+(1)
211 3173 7337 - 7352 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.references_= ArrowDictionaryVector.this.references_=(ArrowDictionaryVector.this.references.+(1))
212 3175 7359 - 7362 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.$anon.<init> new $anon()
213 3174 7446 - 7480 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.close ArrowDictionaryVector.this.close()
217 3184 7529 - 7630 Apply java.lang.Object.synchronized ArrowDictionaryVector.this.synchronized[Unit]({ ArrowDictionaryVector.this.references_=(ArrowDictionaryVector.this.references.-(1)); if (ArrowDictionaryVector.this.references.<(1)) ArrowDictionaryVector.this.vector.close() else () })
218 3177 7550 - 7565 Apply scala.Int.- ArrowDictionaryVector.this.references.-(1)
218 3178 7550 - 7565 Apply org.locationtech.geomesa.arrow.vector.ArrowDictionary.ArrowDictionaryVector.references_= ArrowDictionaryVector.this.references_=(ArrowDictionaryVector.this.references.-(1))
219 3179 7576 - 7590 Apply scala.Int.< ArrowDictionaryVector.this.references.<(1)
219 3182 7572 - 7572 Literal <nosymbol> ()
219 3183 7572 - 7572 Block <nosymbol> ()
220 3180 7602 - 7616 Apply org.apache.arrow.vector.ValueVector.close ArrowDictionaryVector.this.vector.close()
220 3181 7602 - 7616 Block org.apache.arrow.vector.ValueVector.close ArrowDictionaryVector.this.vector.close()
231 3185 7869 - 7889 Apply java.util.concurrent.atomic.AtomicInteger.<init> new java.util.concurrent.atomic.AtomicInteger(0)
234 3186 7976 - 8033 TypeApply scala.collection.mutable.LinkedHashMap.empty scala.collection.mutable.LinkedHashMap.empty[AnyRef, Int]
236 3187 8077 - 8130 Apply scala.Option.getOrElse ArrowDictionaryBuilder.this.values.find(((x$1: (AnyRef, Int)) => x$1._2.==(i))).map[AnyRef](((x$2: (AnyRef, Int)) => x$2._1)).getOrElse[AnyRef]("[other]")
238 3188 8207 - 8232 Apply java.util.concurrent.atomic.AtomicInteger.getAndIncrement ArrowDictionaryBuilder.this.counter.getAndIncrement()
238 3189 8177 - 8233 Apply scala.collection.mutable.MapLike.getOrElseUpdate ArrowDictionaryBuilder.this.values.getOrElseUpdate(value, ArrowDictionaryBuilder.this.counter.getAndIncrement())
240 3190 8266 - 8277 Select scala.collection.mutable.LinkedHashMap.size ArrowDictionaryBuilder.this.values.size
244 3191 8461 - 8481 Select scala.collection.IterableLike.iterator ArrowDictionaryBuilder.this.values.keys.iterator
247 3192 8582 - 8613 Throw <nosymbol> throw new scala.NotImplementedError()
249 3193 8648 - 8650 Literal <nosymbol> ()
252 3194 8684 - 8698 Apply java.util.concurrent.atomic.AtomicInteger.set ArrowDictionaryBuilder.this.counter.set(0)
253 3195 8705 - 8719 Apply scala.collection.mutable.LinkedHashMap.clear ArrowDictionaryBuilder.this.values.clear()
260 3196 8942 - 8967 Apply scala.Int.< count.<(126)
261 3197 9004 - 9009 Literal <nosymbol> false
261 3198 9011 - 9037 Apply org.apache.arrow.vector.types.pojo.ArrowType.Int.<init> new org.apache.arrow.vector.types.pojo.ArrowType.Int(8, true)
261 3199 8977 - 9038 Apply org.apache.arrow.vector.types.pojo.DictionaryEncoding.<init> new org.apache.arrow.vector.types.pojo.DictionaryEncoding(id, false, new org.apache.arrow.vector.types.pojo.ArrowType.Int(8, true))
261 3200 8977 - 9038 Block org.apache.arrow.vector.types.pojo.DictionaryEncoding.<init> new org.apache.arrow.vector.types.pojo.DictionaryEncoding(id, false, new org.apache.arrow.vector.types.pojo.ArrowType.Int(8, true))
262 3201 9054 - 9080 Apply scala.Int.< count.<(32766)
262 3210 9050 - 9240 If <nosymbol> if (count.<(32766)) new org.apache.arrow.vector.types.pojo.DictionaryEncoding(id, false, new org.apache.arrow.vector.types.pojo.ArrowType.Int(16, true)) else new org.apache.arrow.vector.types.pojo.DictionaryEncoding(id, false, new org.apache.arrow.vector.types.pojo.ArrowType.Int(32, true))
263 3202 9117 - 9122 Literal <nosymbol> false
263 3203 9124 - 9151 Apply org.apache.arrow.vector.types.pojo.ArrowType.Int.<init> new org.apache.arrow.vector.types.pojo.ArrowType.Int(16, true)
263 3204 9090 - 9152 Apply org.apache.arrow.vector.types.pojo.DictionaryEncoding.<init> new org.apache.arrow.vector.types.pojo.DictionaryEncoding(id, false, new org.apache.arrow.vector.types.pojo.ArrowType.Int(16, true))
263 3205 9090 - 9152 Block org.apache.arrow.vector.types.pojo.DictionaryEncoding.<init> new org.apache.arrow.vector.types.pojo.DictionaryEncoding(id, false, new org.apache.arrow.vector.types.pojo.ArrowType.Int(16, true))
265 3206 9199 - 9204 Literal <nosymbol> false
265 3207 9206 - 9233 Apply org.apache.arrow.vector.types.pojo.ArrowType.Int.<init> new org.apache.arrow.vector.types.pojo.ArrowType.Int(32, true)
265 3208 9172 - 9234 Apply org.apache.arrow.vector.types.pojo.DictionaryEncoding.<init> new org.apache.arrow.vector.types.pojo.DictionaryEncoding(id, false, new org.apache.arrow.vector.types.pojo.ArrowType.Int(32, true))
265 3209 9172 - 9234 Block org.apache.arrow.vector.types.pojo.DictionaryEncoding.<init> new org.apache.arrow.vector.types.pojo.DictionaryEncoding(id, false, new org.apache.arrow.vector.types.pojo.ArrowType.Int(32, true))