/** * Autogenerated by Thrift * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING */ package com.cloudera.beeswax.api; import org.apache.commons.lang.builder.HashCodeBuilder; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.Set; import java.util.HashSet; import java.util.Collections; import org.apache.log4j.Logger; import org.apache.thrift.*; import org.apache.thrift.meta_data.*; import org.apache.thrift.protocol.*; /** * Metadata information about the results. * Applicable only for SELECT. */ public class ResultsMetadata implements TBase, java.io.Serializable, Cloneable { private static final TStruct STRUCT_DESC = new TStruct("ResultsMetadata"); private static final TField SCHEMA_FIELD_DESC = new TField("schema", TType.STRUCT, (short)1); private static final TField TABLE_DIR_FIELD_DESC = new TField("table_dir", TType.STRING, (short)2); private static final TField IN_TABLENAME_FIELD_DESC = new TField("in_tablename", TType.STRING, (short)3); private static final TField DELIM_FIELD_DESC = new TField("delim", TType.STRING, (short)4); /** * The schema of the results */ public org.apache.hadoop.hive.metastore.api.Schema schema; public static final int SCHEMA = 1; /** * The directory containing the results. Not applicable for partition table. */ public String table_dir; public static final int TABLE_DIR = 2; /** * If the results are straight from an existing table, the table name. */ public String in_tablename; public static final int IN_TABLENAME = 3; /** * Field delimiter */ public String delim; public static final int DELIM = 4; private final Isset __isset = new Isset(); private static final class Isset implements java.io.Serializable { } public static final Map metaDataMap = Collections.unmodifiableMap(new HashMap() {{ put(SCHEMA, new FieldMetaData("schema", TFieldRequirementType.DEFAULT, new StructMetaData(TType.STRUCT, org.apache.hadoop.hive.metastore.api.Schema.class))); put(TABLE_DIR, new FieldMetaData("table_dir", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); put(IN_TABLENAME, new FieldMetaData("in_tablename", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); put(DELIM, new FieldMetaData("delim", TFieldRequirementType.DEFAULT, new FieldValueMetaData(TType.STRING))); }}); static { FieldMetaData.addStructMetaDataMap(ResultsMetadata.class, metaDataMap); } public ResultsMetadata() { } public ResultsMetadata( org.apache.hadoop.hive.metastore.api.Schema schema, String table_dir, String in_tablename, String delim) { this(); this.schema = schema; this.table_dir = table_dir; this.in_tablename = in_tablename; this.delim = delim; } /** * Performs a deep copy on other. */ public ResultsMetadata(ResultsMetadata other) { if (other.isSetSchema()) { this.schema = new org.apache.hadoop.hive.metastore.api.Schema(other.schema); } if (other.isSetTable_dir()) { this.table_dir = other.table_dir; } if (other.isSetIn_tablename()) { this.in_tablename = other.in_tablename; } if (other.isSetDelim()) { this.delim = other.delim; } } @Override public ResultsMetadata clone() { return new ResultsMetadata(this); } /** * The schema of the results */ public org.apache.hadoop.hive.metastore.api.Schema getSchema() { return this.schema; } /** * The schema of the results */ public void setSchema(org.apache.hadoop.hive.metastore.api.Schema schema) { this.schema = schema; } public void unsetSchema() { this.schema = null; } // Returns true if field schema is set (has been asigned a value) and false otherwise public boolean isSetSchema() { return this.schema != null; } public void setSchemaIsSet(boolean value) { if (!value) { this.schema = null; } } /** * The directory containing the results. Not applicable for partition table. */ public String getTable_dir() { return this.table_dir; } /** * The directory containing the results. Not applicable for partition table. */ public void setTable_dir(String table_dir) { this.table_dir = table_dir; } public void unsetTable_dir() { this.table_dir = null; } // Returns true if field table_dir is set (has been asigned a value) and false otherwise public boolean isSetTable_dir() { return this.table_dir != null; } public void setTable_dirIsSet(boolean value) { if (!value) { this.table_dir = null; } } /** * If the results are straight from an existing table, the table name. */ public String getIn_tablename() { return this.in_tablename; } /** * If the results are straight from an existing table, the table name. */ public void setIn_tablename(String in_tablename) { this.in_tablename = in_tablename; } public void unsetIn_tablename() { this.in_tablename = null; } // Returns true if field in_tablename is set (has been asigned a value) and false otherwise public boolean isSetIn_tablename() { return this.in_tablename != null; } public void setIn_tablenameIsSet(boolean value) { if (!value) { this.in_tablename = null; } } /** * Field delimiter */ public String getDelim() { return this.delim; } /** * Field delimiter */ public void setDelim(String delim) { this.delim = delim; } public void unsetDelim() { this.delim = null; } // Returns true if field delim is set (has been asigned a value) and false otherwise public boolean isSetDelim() { return this.delim != null; } public void setDelimIsSet(boolean value) { if (!value) { this.delim = null; } } public void setFieldValue(int fieldID, Object value) { switch (fieldID) { case SCHEMA: if (value == null) { unsetSchema(); } else { setSchema((org.apache.hadoop.hive.metastore.api.Schema)value); } break; case TABLE_DIR: if (value == null) { unsetTable_dir(); } else { setTable_dir((String)value); } break; case IN_TABLENAME: if (value == null) { unsetIn_tablename(); } else { setIn_tablename((String)value); } break; case DELIM: if (value == null) { unsetDelim(); } else { setDelim((String)value); } break; default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } public Object getFieldValue(int fieldID) { switch (fieldID) { case SCHEMA: return getSchema(); case TABLE_DIR: return getTable_dir(); case IN_TABLENAME: return getIn_tablename(); case DELIM: return getDelim(); default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise public boolean isSet(int fieldID) { switch (fieldID) { case SCHEMA: return isSetSchema(); case TABLE_DIR: return isSetTable_dir(); case IN_TABLENAME: return isSetIn_tablename(); case DELIM: return isSetDelim(); default: throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!"); } } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof ResultsMetadata) return this.equals((ResultsMetadata)that); return false; } public boolean equals(ResultsMetadata that) { if (that == null) return false; boolean this_present_schema = true && this.isSetSchema(); boolean that_present_schema = true && that.isSetSchema(); if (this_present_schema || that_present_schema) { if (!(this_present_schema && that_present_schema)) return false; if (!this.schema.equals(that.schema)) return false; } boolean this_present_table_dir = true && this.isSetTable_dir(); boolean that_present_table_dir = true && that.isSetTable_dir(); if (this_present_table_dir || that_present_table_dir) { if (!(this_present_table_dir && that_present_table_dir)) return false; if (!this.table_dir.equals(that.table_dir)) return false; } boolean this_present_in_tablename = true && this.isSetIn_tablename(); boolean that_present_in_tablename = true && that.isSetIn_tablename(); if (this_present_in_tablename || that_present_in_tablename) { if (!(this_present_in_tablename && that_present_in_tablename)) return false; if (!this.in_tablename.equals(that.in_tablename)) return false; } boolean this_present_delim = true && this.isSetDelim(); boolean that_present_delim = true && that.isSetDelim(); if (this_present_delim || that_present_delim) { if (!(this_present_delim && that_present_delim)) return false; if (!this.delim.equals(that.delim)) return false; } return true; } @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_schema = true && (isSetSchema()); builder.append(present_schema); if (present_schema) builder.append(schema); boolean present_table_dir = true && (isSetTable_dir()); builder.append(present_table_dir); if (present_table_dir) builder.append(table_dir); boolean present_in_tablename = true && (isSetIn_tablename()); builder.append(present_in_tablename); if (present_in_tablename) builder.append(in_tablename); boolean present_delim = true && (isSetDelim()); builder.append(present_delim); if (present_delim) builder.append(delim); return builder.toHashCode(); } public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case SCHEMA: if (field.type == TType.STRUCT) { this.schema = new org.apache.hadoop.hive.metastore.api.Schema(); this.schema.read(iprot); } else { TProtocolUtil.skip(iprot, field.type); } break; case TABLE_DIR: if (field.type == TType.STRING) { this.table_dir = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case IN_TABLENAME: if (field.type == TType.STRING) { this.in_tablename = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; case DELIM: if (field.type == TType.STRING) { this.delim = iprot.readString(); } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method validate(); } public void write(TProtocol oprot) throws TException { validate(); oprot.writeStructBegin(STRUCT_DESC); if (this.schema != null) { oprot.writeFieldBegin(SCHEMA_FIELD_DESC); this.schema.write(oprot); oprot.writeFieldEnd(); } if (this.table_dir != null) { oprot.writeFieldBegin(TABLE_DIR_FIELD_DESC); oprot.writeString(this.table_dir); oprot.writeFieldEnd(); } if (this.in_tablename != null) { oprot.writeFieldBegin(IN_TABLENAME_FIELD_DESC); oprot.writeString(this.in_tablename); oprot.writeFieldEnd(); } if (this.delim != null) { oprot.writeFieldBegin(DELIM_FIELD_DESC); oprot.writeString(this.delim); oprot.writeFieldEnd(); } oprot.writeFieldStop(); oprot.writeStructEnd(); } @Override public String toString() { StringBuilder sb = new StringBuilder("ResultsMetadata("); boolean first = true; sb.append("schema:"); if (this.schema == null) { sb.append("null"); } else { sb.append(this.schema); } first = false; if (!first) sb.append(", "); sb.append("table_dir:"); if (this.table_dir == null) { sb.append("null"); } else { sb.append(this.table_dir); } first = false; if (!first) sb.append(", "); sb.append("in_tablename:"); if (this.in_tablename == null) { sb.append("null"); } else { sb.append(this.in_tablename); } first = false; if (!first) sb.append(", "); sb.append("delim:"); if (this.delim == null) { sb.append("null"); } else { sb.append(this.delim); } first = false; sb.append(")"); return sb.toString(); } public void validate() throws TException { // check for required fields // check that fields of type enum have valid values } }