elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
69.41k stars 24.56k forks source link

Add immutable tuples to Painless #91714

Open thecoop opened 1 year ago

thecoop commented 1 year ago

Python has had tuples since it was created, Java has gone with records instead.

It would be good to add built-in immutable tuples to Painless - an object that is just defined as (10, "foo", new ArrayList<>()). Such objects would probably only be accessible as def, with built-in implementations for 1 to N-tuples under the hood.

The javatuples library is probably a good starting point for implementation/methods.

thecoop commented 1 year ago

Note this would be instead of #75431

elasticsearchmachine commented 1 year ago

Pinging @elastic/es-core-infra (Team:Core/Infra)

jdconrad commented 1 year ago

What are the use cases you see for this feature? As none of the libraries we currently support would support these, I'm having trouble envisioning how useful something like this would be.

thecoop commented 1 year ago

I'm primarily thinking of map keys for grouping/sorting, and for data transfer within stream-like constructs.