mqy commented on a change in pull request #9122:
URL: https://github.com/apache/arrow/pull/9122#discussion_r553426212
##########
File path: rust/arrow/src/array/array_struct.rs
##########
@@ -69,6 +69,9 @@ impl StructArray {
}
/// Return child array whose field name equals to column_name
+ ///
+ /// Note: The Arrow specification allows for duplicate field names, and in
such
Review comment:
From the IPC doc: `A struct is a nested type parameterized by an ordered
sequence of types (which can all be distinct), called its fields. Each field
must have a UTF8-encoded name, and these field names are part of the type
metadata.`
The `which can all be distinct` is totally wasting of time, isn't it?
From C++:
https://github.com/apache/arrow/blob/57376d28cf433bed95f19fa44c1e90a780ba54e8/cpp/src/arrow/type.cc
```c++
// From this point, there's one or more field in the builder that exists
with
// the same name.
if (policy_ == CONFLICT_IGNORE) {
// The ignore policy is more generous when there's duplicate in the
builder.
return Status::OK();
} else if (policy_ == CONFLICT_ERROR) {
return Status::Invalid("Duplicate found, policy dictate to treat as an
error");
}
```
From java
https://github.com/apache/arrow/blob/25c736d48dc289f457e74d15d05db65f6d539447/java/vector/src/main/java/org/apache/arrow/vector/complex/AbstractStructVector.java
```java
/**
* Policy to determine how to react when duplicate columns are encountered.
*/
public enum ConflictPolicy {
// Ignore the conflict and append the field. This is the default
behaviour
CONFLICT_APPEND,
// Keep the existing field and ignore the newer one.
CONFLICT_IGNORE,
// Replace the existing field with the newer one.
CONFLICT_REPLACE,
// Refuse the new field and error out.
CONFLICT_ERROR
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]