带你底层看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的基本原理
随机推荐
- C#共享WIFI能通过代码控制给连接的移动端分配IP么
用C#创建了一个虚拟WIFI,但是能不能通过代码来给连接上的移动端分配各自的IP.之前都是自动分配的IP.望大神们赐教 C#共享WIFI能通过代码控制给连接的移动端分配IP么 >> csh ...
- 错排公式 全排列函数 next_permitation(a,a+n)
不容易系列之一 错排:3件东西分别装进3个不同的特定的袋子,如果刚好一个都没有装对,就叫做错排! 大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了! 做好“一件”事情尚且不易,若想永远 ...
- inception - resnet
只有reduction-A是共用的,只是改了其中的几个参数 linear是线性激活. 结构是一样的
- Percona Monitoring and Management (PMM)安装使用
一.docker安装 参考:http://www.cnblogs.com/liuyongsheng/articles/6595353.html 二.Percona Monitoring and Man ...
- iOS开发——捕获崩溃信息
可通过注册NSUncaughtExceptionHandler捕获异常信息,将拿到的NSException细节写入Crash日志,精准的定位出错程序位置,有需要的,可直接将crash信息直接上传服务器 ...
- BZOJ 2141 排队(分块+树状数组)
题意 第一行为一个正整数n,表示小朋友的数量:第二行包含n个由空格分隔的正整数h1,h2,…,hn,依次表示初始队列中小朋友的身高:第三行为一个正整数m,表示交换操作的次数:以下m行每行包含两个正整数 ...
- CentOS7.3 下开放防火墙的端口
CentOS 7.3默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1:关闭firewall: systemctl stop firewalld.service system ...
- mpstat---用于多CPU环境下,显示各个可用CPU的状态
mpstat命令指令主要用于多CPU环境下,它显示各个可用CPU的状态系你想.这些信息存放在/proc/stat文件中.在多CPUs系统里,其不但能查看所有CPU的平均状况信息,而且能够查看特定CPU ...
- webStrom的破解以及汉化
破解方法: 把JetbrainsCrack-3.1-release-enc.jar包放到bin目录下,然后把webstorm64.exe.vmoptions文件用文本打开, 在最后面加上一句-java ...
- 题解 P2504 【[HAOI2006]聪明的猴子】
这道题要坑死人啊... 第一次做40分,其他RE,改了一次之后就变成20分了... 究其原因,是有一个数组(dis)开的太小了,于是最后本蒟蒻就随手开了个五百万,然后,就AC了. 看到有一篇题解说求距 ...