带你底层看Sqoop如何转换成MapReduce作业运行的(代码程序)
补充
其实啊,我们知道,sqoop在运行的时候,最终会去转换成mapreduce作业,这个很简单,不多赘述。直接贴出来。
具体这些怎么运行的,见我如下这篇博客。这里只做一个引子。
Sqoop Import HDFS 和 Sqoop Export HDFS(五)
因为,我一般是在/usr/local/sqoop/sqoopRunCreate目录下,运行对Soop Import HDFS/Hive/HBase 和 Soop Export HDFS/Hive/HBase。
[hadoop@djt002 sqoopRunCreate]$ pwd
/usr/local/sqoop/sqoopRunCreate
[hadoop@djt002 sqoopRunCreate]$ ls
djt_user_copy.java djt_user.java QueryResult.java
[hadoop@djt002 sqoopRunCreate]$ cat djt_user_copy.java
// ORM class for table 'djt_user_copy'
// WARNING: This class is AUTO-GENERATED. Modify at your own risk.
//
// Debug information:
// Generated date: Sat Mar 18 19:21:03 CST 2017
// For connector: org.apache.sqoop.manager.MySQLManager
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapred.lib.db.DBWritable;
import com.cloudera.sqoop.lib.JdbcWritableBridge;
import com.cloudera.sqoop.lib.DelimiterSet;
import com.cloudera.sqoop.lib.FieldFormatter;
import com.cloudera.sqoop.lib.RecordParser;
import com.cloudera.sqoop.lib.BooleanParser;
import com.cloudera.sqoop.lib.BlobRef;
import com.cloudera.sqoop.lib.ClobRef;
import com.cloudera.sqoop.lib.LargeObjectLoader;
import com.cloudera.sqoop.lib.SqoopRecord;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap; public class djt_user_copy extends SqoopRecord implements DBWritable, Writable {
private final int PROTOCOL_VERSION = 3;
public int getClassFormatVersion() { return PROTOCOL_VERSION; }
protected ResultSet __cur_result_set;
private Integer id;
public Integer get_id() {
return id;
}
public void set_id(Integer id) {
this.id = id;
}
public djt_user_copy with_id(Integer id) {
this.id = id;
return this;
}
private String name;
public String get_name() {
return name;
}
public void set_name(String name) {
this.name = name;
}
public djt_user_copy with_name(String name) {
this.name = name;
return this;
}
private String sex;
public String get_sex() {
return sex;
}
public void set_sex(String sex) {
this.sex = sex;
}
public djt_user_copy with_sex(String sex) {
this.sex = sex;
return this;
}
private Integer age;
public Integer get_age() {
return age;
}
public void set_age(Integer age) {
this.age = age;
}
public djt_user_copy with_age(Integer age) {
this.age = age;
return this;
}
private String profile;
public String get_profile() {
return profile;
}
public void set_profile(String profile) {
this.profile = profile;
}
public djt_user_copy with_profile(String profile) {
this.profile = profile;
return this;
}
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof djt_user_copy)) {
return false;
}
djt_user_copy that = (djt_user_copy) o;
boolean equal = true;
equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id));
equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name));
equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex));
equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age));
equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile));
return equal;
}
public boolean equals0(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof djt_user_copy)) {
return false;
}
djt_user_copy that = (djt_user_copy) o;
boolean equal = true;
equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id));
equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name));
equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex));
equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age));
equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile));
return equal;
}
public void readFields(ResultSet __dbResults) throws SQLException {
this.__cur_result_set = __dbResults;
this.id = JdbcWritableBridge.readInteger(1, __dbResults);
this.name = JdbcWritableBridge.readString(2, __dbResults);
this.sex = JdbcWritableBridge.readString(3, __dbResults);
this.age = JdbcWritableBridge.readInteger(4, __dbResults);
this.profile = JdbcWritableBridge.readString(5, __dbResults);
}
public void readFields0(ResultSet __dbResults) throws SQLException {
this.id = JdbcWritableBridge.readInteger(1, __dbResults);
this.name = JdbcWritableBridge.readString(2, __dbResults);
this.sex = JdbcWritableBridge.readString(3, __dbResults);
this.age = JdbcWritableBridge.readInteger(4, __dbResults);
this.profile = JdbcWritableBridge.readString(5, __dbResults);
}
public void loadLargeObjects(LargeObjectLoader __loader)
throws SQLException, IOException, InterruptedException {
}
public void loadLargeObjects0(LargeObjectLoader __loader)
throws SQLException, IOException, InterruptedException {
}
public void write(PreparedStatement __dbStmt) throws SQLException {
write(__dbStmt, 0);
} public int write(PreparedStatement __dbStmt, int __off) throws SQLException {
JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt);
JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt);
JdbcWritableBridge.writeString(sex, 3 + __off, 12, __dbStmt);
JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt);
JdbcWritableBridge.writeString(profile, 5 + __off, 12, __dbStmt);
return 5;
}
public void write0(PreparedStatement __dbStmt, int __off) throws SQLException {
JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt);
JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt);
JdbcWritableBridge.writeString(sex, 3 + __off, 12, __dbStmt);
JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt);
JdbcWritableBridge.writeString(profile, 5 + __off, 12, __dbStmt);
}
public void readFields(DataInput __dataIn) throws IOException {
this.readFields0(__dataIn); }
public void readFields0(DataInput __dataIn) throws IOException {
if (__dataIn.readBoolean()) {
this.id = null;
} else {
this.id = Integer.valueOf(__dataIn.readInt());
}
if (__dataIn.readBoolean()) {
this.name = null;
} else {
this.name = Text.readString(__dataIn);
}
if (__dataIn.readBoolean()) {
this.sex = null;
} else {
this.sex = Text.readString(__dataIn);
}
if (__dataIn.readBoolean()) {
this.age = null;
} else {
this.age = Integer.valueOf(__dataIn.readInt());
}
if (__dataIn.readBoolean()) {
this.profile = null;
} else {
this.profile = Text.readString(__dataIn);
}
}
public void write(DataOutput __dataOut) throws IOException {
if (null == this.id) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.id);
}
if (null == this.name) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, name);
}
if (null == this.sex) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, sex);
}
if (null == this.age) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.age);
}
if (null == this.profile) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, profile);
}
}
public void write0(DataOutput __dataOut) throws IOException {
if (null == this.id) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.id);
}
if (null == this.name) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, name);
}
if (null == this.sex) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, sex);
}
if (null == this.age) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.age);
}
if (null == this.profile) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, profile);
}
}
private static final DelimiterSet __outputDelimiters = new DelimiterSet((char) 44, (char) 10, (char) 0, (char) 0, false);
public String toString() {
return toString(__outputDelimiters, true);
}
public String toString(DelimiterSet delimiters) {
return toString(delimiters, true);
}
public String toString(boolean useRecordDelim) {
return toString(__outputDelimiters, useRecordDelim);
}
public String toString(DelimiterSet delimiters, boolean useRecordDelim) {
StringBuilder __sb = new StringBuilder();
char fieldDelim = delimiters.getFieldsTerminatedBy();
__sb.append(FieldFormatter.escapeAndEnclose(id==null?"null":"" + id, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(name==null?"null":name, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(sex==null?"null":sex, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(age==null?"null":"" + age, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(profile==null?"null":profile, delimiters));
if (useRecordDelim) {
__sb.append(delimiters.getLinesTerminatedBy());
}
return __sb.toString();
}
public void toString0(DelimiterSet delimiters, StringBuilder __sb, char fieldDelim) {
__sb.append(FieldFormatter.escapeAndEnclose(id==null?"null":"" + id, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(name==null?"null":name, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(sex==null?"null":sex, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(age==null?"null":"" + age, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(profile==null?"null":profile, delimiters));
}
private static final DelimiterSet __inputDelimiters = new DelimiterSet((char) 64, (char) 10, (char) 0, (char) 0, false);
private RecordParser __parser;
public void parse(Text __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} public void parse(CharSequence __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} public void parse(byte [] __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} public void parse(char [] __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} public void parse(ByteBuffer __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} public void parse(CharBuffer __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} private void __loadFromFields(List<String> fields) {
Iterator<String> __it = fields.listIterator();
String __cur_str = null;
try {
__cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else {
this.id = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.name = null; } else {
this.name = __cur_str;
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.sex = null; } else {
this.sex = __cur_str;
} __cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else {
this.age = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.profile = null; } else {
this.profile = __cur_str;
} } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } private void __loadFromFields0(Iterator<String> __it) {
String __cur_str = null;
try {
__cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else {
this.id = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.name = null; } else {
this.name = __cur_str;
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.sex = null; } else {
this.sex = __cur_str;
} __cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else {
this.age = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.profile = null; } else {
this.profile = __cur_str;
} } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } public Object clone() throws CloneNotSupportedException {
djt_user_copy o = (djt_user_copy) super.clone();
return o;
} public void clone0(djt_user_copy o) throws CloneNotSupportedException {
} public Map<String, Object> getFieldMap() {
Map<String, Object> __sqoop$field_map = new TreeMap<String, Object>();
__sqoop$field_map.put("id", this.id);
__sqoop$field_map.put("name", this.name);
__sqoop$field_map.put("sex", this.sex);
__sqoop$field_map.put("age", this.age);
__sqoop$field_map.put("profile", this.profile);
return __sqoop$field_map;
} public void getFieldMap0(Map<String, Object> __sqoop$field_map) {
__sqoop$field_map.put("id", this.id);
__sqoop$field_map.put("name", this.name);
__sqoop$field_map.put("sex", this.sex);
__sqoop$field_map.put("age", this.age);
__sqoop$field_map.put("profile", this.profile);
} public void setField(String __fieldName, Object __fieldVal) {
if ("id".equals(__fieldName)) {
this.id = (Integer) __fieldVal;
}
else if ("name".equals(__fieldName)) {
this.name = (String) __fieldVal;
}
else if ("sex".equals(__fieldName)) {
this.sex = (String) __fieldVal;
}
else if ("age".equals(__fieldName)) {
this.age = (Integer) __fieldVal;
}
else if ("profile".equals(__fieldName)) {
this.profile = (String) __fieldVal;
}
else {
throw new RuntimeException("No such field: " + __fieldName);
}
}
public boolean setField0(String __fieldName, Object __fieldVal) {
if ("id".equals(__fieldName)) {
this.id = (Integer) __fieldVal;
return true;
}
else if ("name".equals(__fieldName)) {
this.name = (String) __fieldVal;
return true;
}
else if ("sex".equals(__fieldName)) {
this.sex = (String) __fieldVal;
return true;
}
else if ("age".equals(__fieldName)) {
this.age = (Integer) __fieldVal;
return true;
}
else if ("profile".equals(__fieldName)) {
this.profile = (String) __fieldVal;
return true;
}
else {
return false; }
}
}
[hadoop@djt002 sqoopRunCreate]$
[hadoop@djt002 sqoopRunCreate]$ ls
djt_user_copy.java djt_user.java QueryResult.java
[hadoop@djt002 sqoopRunCreate]$ cat QueryResult.java
// ORM class for table 'null'
// WARNING: This class is AUTO-GENERATED. Modify at your own risk.
//
// Debug information:
// Generated date: Sat Mar 18 18:41:26 CST 2017
// For connector: org.apache.sqoop.manager.MySQLManager
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapred.lib.db.DBWritable;
import com.cloudera.sqoop.lib.JdbcWritableBridge;
import com.cloudera.sqoop.lib.DelimiterSet;
import com.cloudera.sqoop.lib.FieldFormatter;
import com.cloudera.sqoop.lib.RecordParser;
import com.cloudera.sqoop.lib.BooleanParser;
import com.cloudera.sqoop.lib.BlobRef;
import com.cloudera.sqoop.lib.ClobRef;
import com.cloudera.sqoop.lib.LargeObjectLoader;
import com.cloudera.sqoop.lib.SqoopRecord;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap; public class QueryResult extends SqoopRecord implements DBWritable, Writable {
private final int PROTOCOL_VERSION = 3;
public int getClassFormatVersion() { return PROTOCOL_VERSION; }
protected ResultSet __cur_result_set;
private Integer id;
public Integer get_id() {
return id;
}
public void set_id(Integer id) {
this.id = id;
}
public QueryResult with_id(Integer id) {
this.id = id;
return this;
}
private String name;
public String get_name() {
return name;
}
public void set_name(String name) {
this.name = name;
}
public QueryResult with_name(String name) {
this.name = name;
return this;
}
private String sex;
public String get_sex() {
return sex;
}
public void set_sex(String sex) {
this.sex = sex;
}
public QueryResult with_sex(String sex) {
this.sex = sex;
return this;
}
private Integer age;
public Integer get_age() {
return age;
}
public void set_age(Integer age) {
this.age = age;
}
public QueryResult with_age(Integer age) {
this.age = age;
return this;
}
private String profile;
public String get_profile() {
return profile;
}
public void set_profile(String profile) {
this.profile = profile;
}
public QueryResult with_profile(String profile) {
this.profile = profile;
return this;
}
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof QueryResult)) {
return false;
}
QueryResult that = (QueryResult) o;
boolean equal = true;
equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id));
equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name));
equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex));
equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age));
equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile));
return equal;
}
public boolean equals0(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof QueryResult)) {
return false;
}
QueryResult that = (QueryResult) o;
boolean equal = true;
equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id));
equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name));
equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex));
equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age));
equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile));
return equal;
}
public void readFields(ResultSet __dbResults) throws SQLException {
this.__cur_result_set = __dbResults;
this.id = JdbcWritableBridge.readInteger(1, __dbResults);
this.name = JdbcWritableBridge.readString(2, __dbResults);
this.sex = JdbcWritableBridge.readString(3, __dbResults);
this.age = JdbcWritableBridge.readInteger(4, __dbResults);
this.profile = JdbcWritableBridge.readString(5, __dbResults);
}
public void readFields0(ResultSet __dbResults) throws SQLException {
this.id = JdbcWritableBridge.readInteger(1, __dbResults);
this.name = JdbcWritableBridge.readString(2, __dbResults);
this.sex = JdbcWritableBridge.readString(3, __dbResults);
this.age = JdbcWritableBridge.readInteger(4, __dbResults);
this.profile = JdbcWritableBridge.readString(5, __dbResults);
}
public void loadLargeObjects(LargeObjectLoader __loader)
throws SQLException, IOException, InterruptedException {
}
public void loadLargeObjects0(LargeObjectLoader __loader)
throws SQLException, IOException, InterruptedException {
}
public void write(PreparedStatement __dbStmt) throws SQLException {
write(__dbStmt, 0);
} public int write(PreparedStatement __dbStmt, int __off) throws SQLException {
JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt);
JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt);
JdbcWritableBridge.writeString(sex, 3 + __off, 12, __dbStmt);
JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt);
JdbcWritableBridge.writeString(profile, 5 + __off, 12, __dbStmt);
return 5;
}
public void write0(PreparedStatement __dbStmt, int __off) throws SQLException {
JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt);
JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt);
JdbcWritableBridge.writeString(sex, 3 + __off, 12, __dbStmt);
JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt);
JdbcWritableBridge.writeString(profile, 5 + __off, 12, __dbStmt);
}
public void readFields(DataInput __dataIn) throws IOException {
this.readFields0(__dataIn); }
public void readFields0(DataInput __dataIn) throws IOException {
if (__dataIn.readBoolean()) {
this.id = null;
} else {
this.id = Integer.valueOf(__dataIn.readInt());
}
if (__dataIn.readBoolean()) {
this.name = null;
} else {
this.name = Text.readString(__dataIn);
}
if (__dataIn.readBoolean()) {
this.sex = null;
} else {
this.sex = Text.readString(__dataIn);
}
if (__dataIn.readBoolean()) {
this.age = null;
} else {
this.age = Integer.valueOf(__dataIn.readInt());
}
if (__dataIn.readBoolean()) {
this.profile = null;
} else {
this.profile = Text.readString(__dataIn);
}
}
public void write(DataOutput __dataOut) throws IOException {
if (null == this.id) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.id);
}
if (null == this.name) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, name);
}
if (null == this.sex) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, sex);
}
if (null == this.age) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.age);
}
if (null == this.profile) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, profile);
}
}
public void write0(DataOutput __dataOut) throws IOException {
if (null == this.id) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.id);
}
if (null == this.name) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, name);
}
if (null == this.sex) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, sex);
}
if (null == this.age) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.age);
}
if (null == this.profile) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, profile);
}
}
private static final DelimiterSet __outputDelimiters = new DelimiterSet((char) 64, (char) 10, (char) 0, (char) 0, false);
public String toString() {
return toString(__outputDelimiters, true);
}
public String toString(DelimiterSet delimiters) {
return toString(delimiters, true);
}
public String toString(boolean useRecordDelim) {
return toString(__outputDelimiters, useRecordDelim);
}
public String toString(DelimiterSet delimiters, boolean useRecordDelim) {
StringBuilder __sb = new StringBuilder();
char fieldDelim = delimiters.getFieldsTerminatedBy();
__sb.append(FieldFormatter.escapeAndEnclose(id==null?"###":"" + id, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(name==null?"###":name, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(sex==null?"###":sex, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(age==null?"###":"" + age, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(profile==null?"###":profile, delimiters));
if (useRecordDelim) {
__sb.append(delimiters.getLinesTerminatedBy());
}
return __sb.toString();
}
public void toString0(DelimiterSet delimiters, StringBuilder __sb, char fieldDelim) {
__sb.append(FieldFormatter.escapeAndEnclose(id==null?"###":"" + id, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(name==null?"###":name, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(sex==null?"###":sex, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(age==null?"###":"" + age, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(profile==null?"###":profile, delimiters));
}
private static final DelimiterSet __inputDelimiters = new DelimiterSet((char) 64, (char) 10, (char) 0, (char) 0, false);
private RecordParser __parser;
public void parse(Text __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} public void parse(CharSequence __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} public void parse(byte [] __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
}
public void parse(char [] __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} public void parse(ByteBuffer __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} public void parse(CharBuffer __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} private void __loadFromFields(List<String> fields) {
Iterator<String> __it = fields.listIterator();
String __cur_str = null;
try {
__cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else {
this.id = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.name = null; } else {
this.name = __cur_str;
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.sex = null; } else {
this.sex = __cur_str;
} __cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else {
this.age = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.profile = null; } else {
this.profile = __cur_str;
} } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } private void __loadFromFields0(Iterator<String> __it) {
String __cur_str = null;
try {
__cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else {
this.id = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.name = null; } else {
this.name = __cur_str;
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.sex = null; } else {
this.sex = __cur_str;
} __cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else {
this.age = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.profile = null; } else {
this.profile = __cur_str;
} } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } public Object clone() throws CloneNotSupportedException {
QueryResult o = (QueryResult) super.clone();
return o;
} public void clone0(QueryResult o) throws CloneNotSupportedException {
} public Map<String, Object> getFieldMap() {
Map<String, Object> __sqoop$field_map = new TreeMap<String, Object>();
__sqoop$field_map.put("id", this.id);
__sqoop$field_map.put("name", this.name);
__sqoop$field_map.put("sex", this.sex);
__sqoop$field_map.put("age", this.age);
__sqoop$field_map.put("profile", this.profile);
return __sqoop$field_map;
} public void getFieldMap0(Map<String, Object> __sqoop$field_map) {
__sqoop$field_map.put("id", this.id);
__sqoop$field_map.put("name", this.name);
__sqoop$field_map.put("sex", this.sex);
__sqoop$field_map.put("age", this.age);
__sqoop$field_map.put("profile", this.profile);
} public void setField(String __fieldName, Object __fieldVal) {
if ("id".equals(__fieldName)) {
this.id = (Integer) __fieldVal;
}
else if ("name".equals(__fieldName)) {
this.name = (String) __fieldVal;
}
else if ("sex".equals(__fieldName)) {
this.sex = (String) __fieldVal;
}
else if ("age".equals(__fieldName)) {
this.age = (Integer) __fieldVal;
}
else if ("profile".equals(__fieldName)) {
this.profile = (String) __fieldVal;
}
else {
throw new RuntimeException("No such field: " + __fieldName);
}
}
public boolean setField0(String __fieldName, Object __fieldVal) {
if ("id".equals(__fieldName)) {
this.id = (Integer) __fieldVal;
return true;
}
else if ("name".equals(__fieldName)) {
this.name = (String) __fieldVal;
return true;
}
else if ("sex".equals(__fieldName)) {
this.sex = (String) __fieldVal;
return true;
}
else if ("age".equals(__fieldName)) {
this.age = (Integer) __fieldVal;
return true;
}
else if ("profile".equals(__fieldName)) {
this.profile = (String) __fieldVal;
return true;
}
else {
return false; }
}
}
[hadoop@djt002 sqoopRunCreate]$
[hadoop@djt002 sqoopRunCreate]$ pwd
/usr/local/sqoop/sqoopRunCreate
[hadoop@djt002 sqoopRunCreate]$ ls
djt_user_copy.java djt_user.java QueryResult.java
[hadoop@djt002 sqoopRunCreate]$ cat djt_user.java
// ORM class for table 'djt-user'
// WARNING: This class is AUTO-GENERATED. Modify at your own risk.
//
// Debug information:
// Generated date: Sat Mar 18 03:49:13 CST 2017
// For connector: org.apache.sqoop.manager.MySQLManager
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapred.lib.db.DBWritable;
import com.cloudera.sqoop.lib.JdbcWritableBridge;
import com.cloudera.sqoop.lib.DelimiterSet;
import com.cloudera.sqoop.lib.FieldFormatter;
import com.cloudera.sqoop.lib.RecordParser;
import com.cloudera.sqoop.lib.BooleanParser;
import com.cloudera.sqoop.lib.BlobRef;
import com.cloudera.sqoop.lib.ClobRef;
import com.cloudera.sqoop.lib.LargeObjectLoader;
import com.cloudera.sqoop.lib.SqoopRecord;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap; public class djt_user extends SqoopRecord implements DBWritable, Writable {
private final int PROTOCOL_VERSION = 3;
public int getClassFormatVersion() { return PROTOCOL_VERSION; }
protected ResultSet __cur_result_set;
private Integer id;
public Integer get_id() {
return id;
}
public void set_id(Integer id) {
this.id = id;
}
public djt_user with_id(Integer id) {
this.id = id;
return this;
}
private String name;
public String get_name() {
return name;
}
public void set_name(String name) {
this.name = name;
}
public djt_user with_name(String name) {
this.name = name;
return this;
}
private org.apache.hadoop.io.BytesWritable sex;
public org.apache.hadoop.io.BytesWritable get_sex() {
return sex;
}
public void set_sex(org.apache.hadoop.io.BytesWritable sex) {
this.sex = sex;
}
public djt_user with_sex(org.apache.hadoop.io.BytesWritable sex) {
this.sex = sex;
return this;
}
private Integer age;
public Integer get_age() {
return age;
}
public void set_age(Integer age) {
this.age = age;
}
public djt_user with_age(Integer age) {
this.age = age;
return this;
}
private org.apache.hadoop.io.BytesWritable profile;
public org.apache.hadoop.io.BytesWritable get_profile() {
return profile;
}
public void set_profile(org.apache.hadoop.io.BytesWritable profile) {
this.profile = profile;
}
public djt_user with_profile(org.apache.hadoop.io.BytesWritable profile) {
this.profile = profile;
return this;
}
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof djt_user)) {
return false;
}
djt_user that = (djt_user) o;
boolean equal = true;
equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id));
equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name));
equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex));
equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age));
equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile));
return equal;
}
public boolean equals0(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof djt_user)) {
return false;
}
djt_user that = (djt_user) o;
boolean equal = true;
equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id));
equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name));
equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex));
equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age));
equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile));
return equal;
}
public void readFields(ResultSet __dbResults) throws SQLException {
this.__cur_result_set = __dbResults;
this.id = JdbcWritableBridge.readInteger(1, __dbResults);
this.name = JdbcWritableBridge.readString(2, __dbResults);
this.sex = JdbcWritableBridge.readBytesWritable(3, __dbResults);
this.age = JdbcWritableBridge.readInteger(4, __dbResults);
this.profile = JdbcWritableBridge.readBytesWritable(5, __dbResults);
}
public void readFields0(ResultSet __dbResults) throws SQLException {
this.id = JdbcWritableBridge.readInteger(1, __dbResults);
this.name = JdbcWritableBridge.readString(2, __dbResults);
this.sex = JdbcWritableBridge.readBytesWritable(3, __dbResults);
this.age = JdbcWritableBridge.readInteger(4, __dbResults);
this.profile = JdbcWritableBridge.readBytesWritable(5, __dbResults);
}
public void loadLargeObjects(LargeObjectLoader __loader)
throws SQLException, IOException, InterruptedException {
}
public void loadLargeObjects0(LargeObjectLoader __loader)
throws SQLException, IOException, InterruptedException {
}
public void write(PreparedStatement __dbStmt) throws SQLException {
write(__dbStmt, 0);
} public int write(PreparedStatement __dbStmt, int __off) throws SQLException {
JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt);
JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt);
JdbcWritableBridge.writeBytesWritable(sex, 3 + __off, -3, __dbStmt);
JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt);
JdbcWritableBridge.writeBytesWritable(profile, 5 + __off, -3, __dbStmt);
return 5;
}
public void write0(PreparedStatement __dbStmt, int __off) throws SQLException {
JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt);
JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt);
JdbcWritableBridge.writeBytesWritable(sex, 3 + __off, -3, __dbStmt);
JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt);
JdbcWritableBridge.writeBytesWritable(profile, 5 + __off, -3, __dbStmt);
}
public void readFields(DataInput __dataIn) throws IOException {
this.readFields0(__dataIn); }
public void readFields0(DataInput __dataIn) throws IOException {
if (__dataIn.readBoolean()) {
this.id = null;
} else {
this.id = Integer.valueOf(__dataIn.readInt());
}
if (__dataIn.readBoolean()) {
this.name = null;
} else {
this.name = Text.readString(__dataIn);
}
if (__dataIn.readBoolean()) {
this.sex = null;
} else {
this.sex = new BytesWritable();
this.sex.readFields(__dataIn);
}
if (__dataIn.readBoolean()) {
this.age = null;
} else {
this.age = Integer.valueOf(__dataIn.readInt());
}
if (__dataIn.readBoolean()) {
this.profile = null;
} else {
this.profile = new BytesWritable();
this.profile.readFields(__dataIn);
}
}
public void write(DataOutput __dataOut) throws IOException {
if (null == this.id) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.id);
}
if (null == this.name) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, name);
}
if (null == this.sex) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
this.sex.write(__dataOut);
}
if (null == this.age) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.age);
}
if (null == this.profile) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
this.profile.write(__dataOut);
}
}
public void write0(DataOutput __dataOut) throws IOException {
if (null == this.id) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.id);
}
if (null == this.name) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
Text.writeString(__dataOut, name);
}
if (null == this.sex) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
this.sex.write(__dataOut);
}
if (null == this.age) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
__dataOut.writeInt(this.age);
}
if (null == this.profile) {
__dataOut.writeBoolean(true);
} else {
__dataOut.writeBoolean(false);
this.profile.write(__dataOut);
}
}
private static final DelimiterSet __outputDelimiters = new DelimiterSet((char) 44, (char) 10, (char) 0, (char) 0, false);
public String toString() {
return toString(__outputDelimiters, true);
}
public String toString(DelimiterSet delimiters) {
return toString(delimiters, true);
}
public String toString(boolean useRecordDelim) {
return toString(__outputDelimiters, useRecordDelim);
}
public String toString(DelimiterSet delimiters, boolean useRecordDelim) {
StringBuilder __sb = new StringBuilder();
char fieldDelim = delimiters.getFieldsTerminatedBy();
__sb.append(FieldFormatter.escapeAndEnclose(id==null?"null":"" + id, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(name==null?"null":name, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(sex==null?"null":"" + sex, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(age==null?"null":"" + age, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(profile==null?"null":"" + profile, delimiters));
if (useRecordDelim) {
__sb.append(delimiters.getLinesTerminatedBy());
}
return __sb.toString();
}
public void toString0(DelimiterSet delimiters, StringBuilder __sb, char fieldDelim) {
__sb.append(FieldFormatter.escapeAndEnclose(id==null?"null":"" + id, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(name==null?"null":name, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(sex==null?"null":"" + sex, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(age==null?"null":"" + age, delimiters));
__sb.append(fieldDelim);
__sb.append(FieldFormatter.escapeAndEnclose(profile==null?"null":"" + profile, delimiters));
}
private static final DelimiterSet __inputDelimiters = new DelimiterSet((char) 44, (char) 10, (char) 0, (char) 0, false);
private RecordParser __parser;
public void parse(Text __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} public void parse(CharSequence __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
}
public void parse(CharBuffer __record) throws RecordParser.ParseError {
if (null == this.__parser) {
this.__parser = new RecordParser(__inputDelimiters);
}
List<String> __fields = this.__parser.parseRecord(__record);
__loadFromFields(__fields);
} private void __loadFromFields(List<String> fields) {
Iterator<String> __it = fields.listIterator();
String __cur_str = null;
try {
__cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else {
this.id = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.name = null; } else {
this.name = __cur_str;
} __cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.sex = null; } else {
String[] strByteVal = __cur_str.trim().split(" ");
byte [] byteVal = new byte[strByteVal.length];
for (int i = 0; i < byteVal.length; ++i) {
byteVal[i] = (byte)Integer.parseInt(strByteVal[i], 16);
}
this.sex = new BytesWritable(byteVal);
} __cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else {
this.age = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.profile = null; } else {
String[] strByteVal = __cur_str.trim().split(" ");
byte [] byteVal = new byte[strByteVal.length];
for (int i = 0; i < byteVal.length; ++i) {
byteVal[i] = (byte)Integer.parseInt(strByteVal[i], 16);
}
this.profile = new BytesWritable(byteVal);
} } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } private void __loadFromFields0(Iterator<String> __it) {
String __cur_str = null;
try {
__cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else {
this.id = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null")) { this.name = null; } else {
this.name = __cur_str;
} __cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.sex = null; } else {
String[] strByteVal = __cur_str.trim().split(" ");
byte [] byteVal = new byte[strByteVal.length];
for (int i = 0; i < byteVal.length; ++i) {
byteVal[i] = (byte)Integer.parseInt(strByteVal[i], 16);
}
this.sex = new BytesWritable(byteVal);
} __cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else {
this.age = Integer.valueOf(__cur_str);
} __cur_str = __it.next();
if (__cur_str.equals("null") || __cur_str.length() == 0) { this.profile = null; } else {
String[] strByteVal = __cur_str.trim().split(" ");
byte [] byteVal = new byte[strByteVal.length];
for (int i = 0; i < byteVal.length; ++i) {
byteVal[i] = (byte)Integer.parseInt(strByteVal[i], 16);
}
this.profile = new BytesWritable(byteVal);
} } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } public Object clone() throws CloneNotSupportedException {
djt_user o = (djt_user) super.clone();
o.sex = (o.sex != null) ? new BytesWritable(Arrays.copyOf(sex.getBytes(), sex.getLength())) : null;
o.profile = (o.profile != null) ? new BytesWritable(Arrays.copyOf(profile.getBytes(), profile.getLength())) : null;
return o;
}
public void clone0(djt_user o) throws CloneNotSupportedException {
o.sex = (o.sex != null) ? new BytesWritable(Arrays.copyOf(sex.getBytes(), sex.getLength())) : null;
o.profile = (o.profile != null) ? new BytesWritable(Arrays.copyOf(profile.getBytes(), profile.getLength())) : null;
} public Map<String, Object> getFieldMap() {
Map<String, Object> __sqoop$field_map = new TreeMap<String, Object>();
__sqoop$field_map.put("id", this.id);
__sqoop$field_map.put("name", this.name);
__sqoop$field_map.put("sex", this.sex);
__sqoop$field_map.put("age", this.age);
__sqoop$field_map.put("profile", this.profile);
return __sqoop$field_map;
} public void getFieldMap0(Map<String, Object> __sqoop$field_map) {
__sqoop$field_map.put("id", this.id);
__sqoop$field_map.put("name", this.name);
__sqoop$field_map.put("sex", this.sex);
__sqoop$field_map.put("age", this.age);
__sqoop$field_map.put("profile", this.profile);
} public void setField(String __fieldName, Object __fieldVal) {
if ("id".equals(__fieldName)) {
this.id = (Integer) __fieldVal;
}
else if ("name".equals(__fieldName)) {
this.name = (String) __fieldVal;
}
else if ("sex".equals(__fieldName)) {
this.sex = (org.apache.hadoop.io.BytesWritable) __fieldVal;
}
else if ("age".equals(__fieldName)) {
this.age = (Integer) __fieldVal;
}
else if ("profile".equals(__fieldName)) {
this.profile = (org.apache.hadoop.io.BytesWritable) __fieldVal;
}
else {
throw new RuntimeException("No such field: " + __fieldName);
}
}
public boolean setField0(String __fieldName, Object __fieldVal) {
if ("id".equals(__fieldName)) {
this.id = (Integer) __fieldVal;
return true;
}
else if ("name".equals(__fieldName)) {
this.name = (String) __fieldVal;
return true;
}
else if ("sex".equals(__fieldName)) {
this.sex = (org.apache.hadoop.io.BytesWritable) __fieldVal;
return true;
}
else if ("age".equals(__fieldName)) {
this.age = (Integer) __fieldVal;
return true;
}
else if ("profile".equals(__fieldName)) {
this.profile = (org.apache.hadoop.io.BytesWritable) __fieldVal;
return true;
}
else {
return false; }
}
}
[hadoop@djt002 sqoopRunCreate]$
带你底层看Sqoop如何转换成MapReduce作业运行的(代码程序)的更多相关文章
- Hive中SQL查询转换成MapReduce作业的过程
- JavaScript:将key和value不带双引号的JSON字符串转换成JSON对象的方法
遇到相关的问题,花了两天的时间来解决,深感来之不易,所以做如下的总结,希望遇到此问题的码农能更快的找到解决办法! var jsonArr= [{col:TO_CHAR(HZRQ,'YYYYMM'),t ...
- 【HIVE】sql语句转换成mapreduce
1.hive是什么? 2.MapReduce框架实现SQL基本操作的原理是什么? 3.Hive怎样实现SQL的词法和语法解析? 连接:http://www.aboutyun.com/thread-20 ...
- python提取图片内容并转换成对应表格的markdown代码
本节我们将介绍使用python识别一张图片中的内容,并试着得到一张表格,当然并不是类似于Excel的表格,而是该表格的markdown代码. 注:原创内容,转载请标明出处! 相关工具的安装 本次实验环 ...
- XML转换成TXT行数据的Java程序
ZKe ------------------- XML数据的一个块内的所有属性,转换成TXT文件的一行.众所周知XML文件是通过类似HTML的标签进行数据的定义如图所示 属性由id, article, ...
- 一个用于将sql脚本转换成实体类的js代码
以前写过一段C#,苦于编译才能用.这样的小工具最好是用脚本语言来编写,易于执行,也易于修改. js 代码 convert.js ------------------------------------ ...
- js-input框中写入的小写小写字母全部转换成大写字母的js代码
<input type="text" id="blinitials" name="blinitials" onkeyup=" ...
- 把对象转换成JSON形式的html代码
function formatJson(msg) { var rep = "~"; var jsonStr = JSON.stringify(msg, null, rep) var ...
- SQL语句转换成MapReduce的基本原理
随机推荐
- P3227 [HNOI2013]切糕
题目描述 经过千辛万苦小 A 得到了一块切糕,切糕的形状是长方体,小 A 打算拦腰将切糕切成两半分给小 B.出于美观考虑,小 A 希望切面能尽量光滑且和谐.于是她找到你,希望你能帮她找出最好的切割方案 ...
- 为什么在input中加了display:inline;再加宽,还有作用?
以前一直一位input是个行内元素,但是,行内元素的特性就是没有宽高的概念,元素多高,多宽,全凭内容撑起来的. 但是今天写了个demo,用chrome控制台显示:display:inline-bloc ...
- Spring MVC模式示例(未采用解耦控制器)
Product package com.mstf.bean; import java.io.Serializable; /** * Product类,封装了一些信息,包含三个属性 * @author ...
- PostgreSQL Replication之第三章 理解即时恢复(3)
3.3 做基础备份 在上一节中,您已经看到,启用归档只需要几行命令,并提供了极大的灵活性.在本节,我们将看到如何创建一个所谓的基础备份,稍后这可以使用XLOG.一个基本备份是一个最初的数据的拷贝. [ ...
- 洛谷1440 求m区间的最小值 单调队列
题目描述 一个含有n项的数列(n<=2000000),求出每一项前的m个数到它这个区间内的最小值.若前面的数不足m项则从第1个数开始,若前面没有数则输出0. 输入格式: 第一行两个数n,m. 第 ...
- NOIP2016 天天爱跑步(树上差分)
题意 给定一棵树,从时刻 0 开始,有若干人从 S[i] 出发向 T[i] 移动,每单位时刻移动一条边 对于树上每个点 x,求 w[x] 时刻有多少人恰好路过 x N,M≤300000 题解 从上午 ...
- 学习参考《Python基础教程(第3版)》中文PDF+英文PDF+源代码
python基础教程ed3: 基础知识 列表和元组 字符串 字典 流程控制 抽象(参数 作用域 递归) 异常 魔术方法/特性/迭代器 模块/标准库 文件 GUI DB 网络编程 测试 扩展python ...
- BNU 34974 MATLAB大法好
题目链接:http://www.bnuoj.com/bnuoj/problem_show.php?pid=34974 MATLAB大法好 Time Limit: 8000ms Memory Limi ...
- 三:redis的List类型相关操作
</pre><pre name="code" class="php" style="font-size: 14px;"&g ...
- Servlet具体解释
Servlet具体解释 基本概述 Session在计算机中,尤其是在网络应用中,称为"会话控制".在计算机专业术语中.Session是指一个终端用户与交互系统进行通信的时间间隔,通 ...