Commits


abandy authored and GitHub committed adc656ec65d
GH-42021: [Swift] Add Arrow encoder implementation for Swift Codable (#43063) ### Rationale for this change This change implements encoder for the Arrow Swift Codable. This will allow data in a struct/class to be copied to a RecordBatch. ### What changes are included in this PR? The ArrowEncoder class is included in this PR along with a class for each container type (keyed, unkeyed, and single). Most of the logic is encapsulated in the ArrowEncoder with minimal logic in each container class (Most of the methods in the container classes are a single line that calls methods in ArrowEncoder). - The ArrowEncoder does not allow nested encoding. The inherited methods for creating a nested encoder do not throw errors so an "errorMsg" member has been added to the ArrowEncoder to indicate that an error occurred in a method that does not throw. If this member is set, then an error will be thrown at the next available opportunity. - The underlaying Codable implementation for Dictionaries will encode each key/value as it's own property/field. The ArrowEncoder checks to see if the Type that is being encoded is a Dictionary and if so, sets the member variable modForIndex to 2. This ensures that the RecordBatch will contain only two columns (one for the key and value). ### Are these changes tested? Yes, unit tests has been added * GitHub Issue: #42021 Authored-by: Alva Bandy <abandy@live.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>