Skip to content

Commit f38e72f

Browse files
authored
GH-859: Fix ARROW_STRUCT_CONFLICT_POLICY env var (#860)
## What's Changed Do not specify default value when getting the `arrow.struct.conflict.policy` property Closes #859
1 parent ec3a424 commit f38e72f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

vector/src/main/java/org/apache/arrow/vector/complex/AbstractStructVector.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ public abstract class AbstractStructVector extends AbstractContainerVector {
4646
private ConflictPolicy conflictPolicy;
4747

4848
static {
49-
String conflictPolicyStr =
50-
System.getProperty(STRUCT_CONFLICT_POLICY_JVM, ConflictPolicy.CONFLICT_REPLACE.toString());
49+
String conflictPolicyStr = System.getProperty(STRUCT_CONFLICT_POLICY_JVM);
5150
if (conflictPolicyStr == null) {
5251
conflictPolicyStr = System.getenv(STRUCT_CONFLICT_POLICY_ENV);
5352
}
53+
if (conflictPolicyStr == null) {
54+
conflictPolicyStr = ConflictPolicy.CONFLICT_REPLACE.toString();
55+
}
5456
ConflictPolicy conflictPolicy;
5557
try {
5658
conflictPolicy = ConflictPolicy.valueOf(conflictPolicyStr.toUpperCase(Locale.ROOT));
@@ -62,11 +64,11 @@ public abstract class AbstractStructVector extends AbstractContainerVector {
6264

6365
/** Policy to determine how to react when duplicate columns are encountered. */
6466
public enum ConflictPolicy {
65-
// Ignore the conflict and append the field. This is the default behaviour
67+
// Ignore the conflict and append the field.
6668
CONFLICT_APPEND,
6769
// Keep the existing field and ignore the newer one.
6870
CONFLICT_IGNORE,
69-
// Replace the existing field with the newer one.
71+
// Replace the existing field with the newer one. This is the default behaviour
7072
CONFLICT_REPLACE,
7173
// Refuse the new field and error out.
7274
CONFLICT_ERROR

0 commit comments

Comments
 (0)