Codec support for Java arrays

Description

these mappings work fine:

private List<Integer> myBuiltinList <==> my_builtin_list list<int>
private List<MyUDT> myUDTList <==> my_udt_list list<frozen<my_udt>>

these don't:

private int[] myBuiltinArray <==> my_builtin_array list<int>
private MyUDT[] myUDTArray <==> my_udt_array list<frozen<my_udt>>

but they should.

The memory footprint and gc difference is particularly noticable with int/long/float/double primitives, but for ease of use a solution that also handles object types, including UDTs, is preferable.

Environment

None

Pull Requests

None

Activity

Show:
Olivier Michallat
July 28, 2015, 10:37 AM

Custom codecs (introduced in 2.2.0-rc2) allow you to do this. We've decided not to include an array codec out of the box at this time, but TypeCodecArraysIntegrationTest shows how you can write your own. It goes directly from ByteBuffer to int[] without intermediary collections or boxing.

Olivier Michallat
July 28, 2015, 10:42 AM

We plan to provide common extra codecs in a dedicated module in a future version. It might be a good idea to provide at least a base class for array types, so I'm leaving this ticket open.

Alexandre Dutra
October 27, 2015, 8:06 PM
Edited

A pull request is available. Both object arrays and primitive arrays are supported.

Fixed

Assignee

Alexandre Dutra

Reporter

Jonathan Halliday

PM Priority

A

Affects versions

None

Fix versions

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Components

Priority

Major
Configure