-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-42218: [Java] MapVector cannot be loaded via IPC #43014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5d24b02
b2d6765
27e770a
e5be0a4
0a936df
37a7341
20ed1fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,6 +140,33 @@ public UnionMapWriter value() { | |
| return this; | ||
| } | ||
|
|
||
| private String getWriteFieldName() { | ||
| Field mapField = this.vector.getField(); | ||
| Preconditions.checkNotNull(mapField, "MapVector does not have a field."); | ||
| Preconditions.checkArgument(mapField.getChildren().size() == 1, | ||
| "MapVector does not have a single struct field."); | ||
| Field structField = mapField.getChildren().get(0); | ||
| switch (mode) { | ||
| case KEY: | ||
| if (structField.getChildren().size() == 0) { | ||
| // key is not defined in the struct, use default name | ||
| return MapVector.KEY_NAME; | ||
|
||
| } else { | ||
| return structField.getChildren().get(0).getName(); | ||
| } | ||
| case VALUE: | ||
| if (structField.getChildren().size() < 2) { | ||
| // key may or may not have been defined in the struct, but | ||
| // value has not been defined. | ||
| return MapVector.VALUE_NAME; | ||
| } else { | ||
| return structField.getChildren().get(1).getName(); | ||
| } | ||
| default: | ||
| throw new UnsupportedOperationException("Cannot get field name in OFF mode"); | ||
| } | ||
| } | ||
|
|
||
| <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first /> | ||
| <#assign fields = minor.fields!type.fields /> | ||
| <#assign uncappedName = name?uncap_first/> | ||
|
|
@@ -149,9 +176,9 @@ public UnionMapWriter value() { | |
| public ${name}Writer ${uncappedName}() { | ||
| switch (mode) { | ||
| case KEY: | ||
| return entryWriter.${uncappedName}(MapVector.KEY_NAME); | ||
| return entryWriter.${uncappedName}(getWriteFieldName()); | ||
| case VALUE: | ||
| return entryWriter.${uncappedName}(MapVector.VALUE_NAME); | ||
| return entryWriter.${uncappedName}(getWriteFieldName()); | ||
| default: | ||
| return this; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.