TNestedField.java
/**
* Autogenerated by Thrift Compiler (0.16.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.doris.thrift.schema.external;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2026-05-14")
public class TNestedField extends org.apache.thrift.TUnion<TNestedField, TNestedField._Fields> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TNestedField");
private static final org.apache.thrift.protocol.TField ARRAY_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("array_field", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField STRUCT_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("struct_field", org.apache.thrift.protocol.TType.STRUCT, (short)2);
private static final org.apache.thrift.protocol.TField MAP_FIELD_FIELD_DESC = new org.apache.thrift.protocol.TField("map_field", org.apache.thrift.protocol.TType.STRUCT, (short)3);
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
ARRAY_FIELD((short)1, "array_field"),
STRUCT_FIELD((short)2, "struct_field"),
MAP_FIELD((short)3, "map_field");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
static {
for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
@org.apache.thrift.annotation.Nullable
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // ARRAY_FIELD
return ARRAY_FIELD;
case 2: // STRUCT_FIELD
return STRUCT_FIELD;
case 3: // MAP_FIELD
return MAP_FIELD;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
@org.apache.thrift.annotation.Nullable
public static _Fields findByName(java.lang.String name) {
return byName.get(name);
}
private final short _thriftId;
private final java.lang.String _fieldName;
_Fields(short thriftId, java.lang.String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public java.lang.String getFieldName() {
return _fieldName;
}
}
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.ARRAY_FIELD, new org.apache.thrift.meta_data.FieldMetaData("array_field", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TArrayField.class)));
tmpMap.put(_Fields.STRUCT_FIELD, new org.apache.thrift.meta_data.FieldMetaData("struct_field", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TStructField.class)));
tmpMap.put(_Fields.MAP_FIELD, new org.apache.thrift.meta_data.FieldMetaData("map_field", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TMapField.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TNestedField.class, metaDataMap);
}
public TNestedField() {
super();
}
public TNestedField(_Fields setField, java.lang.Object value) {
super(setField, value);
}
public TNestedField(TNestedField other) {
super(other);
}
public TNestedField deepCopy() {
return new TNestedField(this);
}
public static TNestedField array_field(TArrayField value) {
TNestedField x = new TNestedField();
x.setArrayField(value);
return x;
}
public static TNestedField struct_field(TStructField value) {
TNestedField x = new TNestedField();
x.setStructField(value);
return x;
}
public static TNestedField map_field(TMapField value) {
TNestedField x = new TNestedField();
x.setMapField(value);
return x;
}
@Override
protected void checkType(_Fields setField, java.lang.Object value) throws java.lang.ClassCastException {
switch (setField) {
case ARRAY_FIELD:
if (value instanceof TArrayField) {
break;
}
throw new java.lang.ClassCastException("Was expecting value of type TArrayField for field 'array_field', but got " + value.getClass().getSimpleName());
case STRUCT_FIELD:
if (value instanceof TStructField) {
break;
}
throw new java.lang.ClassCastException("Was expecting value of type TStructField for field 'struct_field', but got " + value.getClass().getSimpleName());
case MAP_FIELD:
if (value instanceof TMapField) {
break;
}
throw new java.lang.ClassCastException("Was expecting value of type TMapField for field 'map_field', but got " + value.getClass().getSimpleName());
default:
throw new java.lang.IllegalArgumentException("Unknown field id " + setField);
}
}
@Override
protected java.lang.Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
_Fields setField = _Fields.findByThriftId(field.id);
if (setField != null) {
switch (setField) {
case ARRAY_FIELD:
if (field.type == ARRAY_FIELD_FIELD_DESC.type) {
TArrayField array_field;
array_field = new TArrayField();
array_field.read(iprot);
return array_field;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case STRUCT_FIELD:
if (field.type == STRUCT_FIELD_FIELD_DESC.type) {
TStructField struct_field;
struct_field = new TStructField();
struct_field.read(iprot);
return struct_field;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case MAP_FIELD:
if (field.type == MAP_FIELD_FIELD_DESC.type) {
TMapField map_field;
map_field = new TMapField();
map_field.read(iprot);
return map_field;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
default:
throw new java.lang.IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
}
@Override
protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
switch (setField_) {
case ARRAY_FIELD:
TArrayField array_field = (TArrayField)value_;
array_field.write(oprot);
return;
case STRUCT_FIELD:
TStructField struct_field = (TStructField)value_;
struct_field.write(oprot);
return;
case MAP_FIELD:
TMapField map_field = (TMapField)value_;
map_field.write(oprot);
return;
default:
throw new java.lang.IllegalStateException("Cannot write union with unknown field " + setField_);
}
}
@Override
protected java.lang.Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {
_Fields setField = _Fields.findByThriftId(fieldID);
if (setField != null) {
switch (setField) {
case ARRAY_FIELD:
TArrayField array_field;
array_field = new TArrayField();
array_field.read(iprot);
return array_field;
case STRUCT_FIELD:
TStructField struct_field;
struct_field = new TStructField();
struct_field.read(iprot);
return struct_field;
case MAP_FIELD:
TMapField map_field;
map_field = new TMapField();
map_field.read(iprot);
return map_field;
default:
throw new java.lang.IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
throw new org.apache.thrift.protocol.TProtocolException("Couldn't find a field with field id " + fieldID);
}
}
@Override
protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
switch (setField_) {
case ARRAY_FIELD:
TArrayField array_field = (TArrayField)value_;
array_field.write(oprot);
return;
case STRUCT_FIELD:
TStructField struct_field = (TStructField)value_;
struct_field.write(oprot);
return;
case MAP_FIELD:
TMapField map_field = (TMapField)value_;
map_field.write(oprot);
return;
default:
throw new java.lang.IllegalStateException("Cannot write union with unknown field " + setField_);
}
}
@Override
protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) {
switch (setField) {
case ARRAY_FIELD:
return ARRAY_FIELD_FIELD_DESC;
case STRUCT_FIELD:
return STRUCT_FIELD_FIELD_DESC;
case MAP_FIELD:
return MAP_FIELD_FIELD_DESC;
default:
throw new java.lang.IllegalArgumentException("Unknown field id " + setField);
}
}
@Override
protected org.apache.thrift.protocol.TStruct getStructDesc() {
return STRUCT_DESC;
}
@Override
protected _Fields enumForId(short id) {
return _Fields.findByThriftIdOrThrow(id);
}
@org.apache.thrift.annotation.Nullable
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public TArrayField getArrayField() {
if (getSetField() == _Fields.ARRAY_FIELD) {
return (TArrayField)getFieldValue();
} else {
throw new java.lang.RuntimeException("Cannot get field 'array_field' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setArrayField(TArrayField value) {
setField_ = _Fields.ARRAY_FIELD;
value_ = java.util.Objects.requireNonNull(value,"_Fields.ARRAY_FIELD");
}
public TStructField getStructField() {
if (getSetField() == _Fields.STRUCT_FIELD) {
return (TStructField)getFieldValue();
} else {
throw new java.lang.RuntimeException("Cannot get field 'struct_field' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setStructField(TStructField value) {
setField_ = _Fields.STRUCT_FIELD;
value_ = java.util.Objects.requireNonNull(value,"_Fields.STRUCT_FIELD");
}
public TMapField getMapField() {
if (getSetField() == _Fields.MAP_FIELD) {
return (TMapField)getFieldValue();
} else {
throw new java.lang.RuntimeException("Cannot get field 'map_field' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setMapField(TMapField value) {
setField_ = _Fields.MAP_FIELD;
value_ = java.util.Objects.requireNonNull(value,"_Fields.MAP_FIELD");
}
public boolean isSetArrayField() {
return setField_ == _Fields.ARRAY_FIELD;
}
public boolean isSetStructField() {
return setField_ == _Fields.STRUCT_FIELD;
}
public boolean isSetMapField() {
return setField_ == _Fields.MAP_FIELD;
}
public boolean equals(java.lang.Object other) {
if (other instanceof TNestedField) {
return equals((TNestedField)other);
} else {
return false;
}
}
public boolean equals(TNestedField other) {
return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue());
}
@Override
public int compareTo(TNestedField other) {
int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField());
if (lastComparison == 0) {
return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue());
}
return lastComparison;
}
@Override
public int hashCode() {
java.util.List<java.lang.Object> list = new java.util.ArrayList<java.lang.Object>();
list.add(this.getClass().getName());
org.apache.thrift.TFieldIdEnum setField = getSetField();
if (setField != null) {
list.add(setField.getThriftFieldId());
java.lang.Object value = getFieldValue();
if (value instanceof org.apache.thrift.TEnum) {
list.add(((org.apache.thrift.TEnum)getFieldValue()).getValue());
} else {
list.add(value);
}
}
return list.hashCode();
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
}