补充

  其实啊,我们知道,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作业运行的(代码程序)的更多相关文章

  1. Hive中SQL查询转换成MapReduce作业的过程

  2. JavaScript:将key和value不带双引号的JSON字符串转换成JSON对象的方法

    遇到相关的问题,花了两天的时间来解决,深感来之不易,所以做如下的总结,希望遇到此问题的码农能更快的找到解决办法! var jsonArr= [{col:TO_CHAR(HZRQ,'YYYYMM'),t ...

  3. 【HIVE】sql语句转换成mapreduce

    1.hive是什么? 2.MapReduce框架实现SQL基本操作的原理是什么? 3.Hive怎样实现SQL的词法和语法解析? 连接:http://www.aboutyun.com/thread-20 ...

  4. python提取图片内容并转换成对应表格的markdown代码

    本节我们将介绍使用python识别一张图片中的内容,并试着得到一张表格,当然并不是类似于Excel的表格,而是该表格的markdown代码. 注:原创内容,转载请标明出处! 相关工具的安装 本次实验环 ...

  5. XML转换成TXT行数据的Java程序

    ZKe ------------------- XML数据的一个块内的所有属性,转换成TXT文件的一行.众所周知XML文件是通过类似HTML的标签进行数据的定义如图所示 属性由id, article, ...

  6. 一个用于将sql脚本转换成实体类的js代码

    以前写过一段C#,苦于编译才能用.这样的小工具最好是用脚本语言来编写,易于执行,也易于修改. js 代码 convert.js ------------------------------------ ...

  7. js-input框中写入的小写小写字母全部转换成大写字母的js代码

    <input type="text" id="blinitials" name="blinitials"  onkeyup=" ...

  8. 把对象转换成JSON形式的html代码

    function formatJson(msg) { var rep = "~"; var jsonStr = JSON.stringify(msg, null, rep) var ...

  9. SQL语句转换成MapReduce的基本原理

随机推荐

  1. CUDA笔记(八)

    今天真正进入了攻坚期.不光是疲劳,主要是遇到的问题指数级上升,都是需要绕道的. 以visual profile来说,刚刚发现自己还没使用过. http://bbs.csdn.net/topics/39 ...

  2. TabHost的自定义

    使用自定义的TabHost可以不用继承TabActicity,但是要注意的是如果使用Activity作为Content的话,有两处代码是一定要加的.不然就会出现RuntimeError,还有在XML布 ...

  3. php基础:implode()函数 和exlplode函数

    1implode() 函数返回一个由数组元素组合成的字符串. 注释:implode() 函数接受两种参数顺序.但是由于历史原因,explode() 是不行的,您必须保证 separator 参数在 s ...

  4. caffe(9) caffe例子

    为了程序的简洁,在caffe中是不带练习数据的,因此需要自己去下载.但在caffe根目录下的data文件夹里,作者已经为我们编写好了下载数据的脚本文件,我们只需要联网,运行这些脚本文件就行了. 注意: ...

  5. oracle创建静态监听

    [oracle@localhost admin]$ pwd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin [oracle@localhos ...

  6. MySql中允许远程连接

    要达到这个目的需要实现两点 开通用户权限 解除本地绑定 开通用户权限 首先登陆服务器端的mysql //不使用空格可以直接登陆 mysql -u用户名 -p密码 mysql> use mysql ...

  7. oh-my-zsh upgrade problem

    Oh-My-ZSH upgrade issue with bad substitution message   Any problem with automatic Oh-My-Zsh upgrade ...

  8. Entity Framework之Model First开发方式

    一.Model First开发方式 在项目一开始,就没用数据库时,可以借助EF设计模型,然后根据模型同步完成数据库中表的创建,这就是Model First开发方式.总结一点就是,现有模型再有表. 二. ...

  9. Git 操作笔记

    ¥先放个地址:这个视频超详细 https://www.bilibili.com/video/av10475153 分了2部分: 1是GitHub的功能介绍:2是pc端+doc命令的操作+发布个人网站 ...

  10. 推荐《机器学习实战:基于Scikit-Learn和TensorFlow》高清中英文PDF+源代码

    探索机器学习,使用Scikit-Learn全程跟踪一个机器学习项目的例子:探索各种训练模型:使用TensorFlow库构建和训练神经网络,深入神经网络架构,包括卷积神经网络.循环神经网络和深度强化学习 ...