补充
其实啊,我们知道,sqoop在运行的时候,最终会去转换成mapreduce作业,这个很简单,不多赘述。直接贴出来。
具体这些怎么运行的,见我如下这篇博客。这里只做一个引子。
Sqoop Import HDFS 和 Sqoop Export HDFS(五)
因为,我一般是在/usr/local/sqoop/sqoopRunCreate目录下,运行对Soop Import HDFS/Hive/HBase 和 Soop Export HDFS/Hive/HBase。
1 [hadoop@djt002 sqoopRunCreate]$ pwd 2 /usr/local/sqoop/sqoopRunCreate 3 [hadoop@djt002 sqoopRunCreate]$ ls 4 djt_user_copy.java djt_user.java QueryResult.java 5 [hadoop@djt002 sqoopRunCreate]$ cat djt_user_copy.java 6 // ORM class for table 'djt_user_copy' 7 // WARNING: This class is AUTO-GENERATED. Modify at your own risk. 8 // 9 // Debug information: 10 // Generated date: Sat Mar 18 19:21:03 CST 2017 11 // For connector: org.apache.sqoop.manager.MySQLManager 12 import org.apache.hadoop.io.BytesWritable; 13 import org.apache.hadoop.io.Text; 14 import org.apache.hadoop.io.Writable; 15 import org.apache.hadoop.mapred.lib.db.DBWritable; 16 import com.cloudera.sqoop.lib.JdbcWritableBridge; 17 import com.cloudera.sqoop.lib.DelimiterSet; 18 import com.cloudera.sqoop.lib.FieldFormatter; 19 import com.cloudera.sqoop.lib.RecordParser; 20 import com.cloudera.sqoop.lib.BooleanParser; 21 import com.cloudera.sqoop.lib.BlobRef; 22 import com.cloudera.sqoop.lib.ClobRef; 23 import com.cloudera.sqoop.lib.LargeObjectLoader; 24 import com.cloudera.sqoop.lib.SqoopRecord; 25 import java.sql.PreparedStatement; 26 import java.sql.ResultSet; 27 import java.sql.SQLException; 28 import java.io.DataInput; 29 import java.io.DataOutput; 30 import java.io.IOException; 31 import java.nio.ByteBuffer; 32 import java.nio.CharBuffer; 33 import java.sql.Date; 34 import java.sql.Time; 35 import java.sql.Timestamp; 36 import java.util.Arrays; 37 import java.util.Iterator; 38 import java.util.List; 39 import java.util.Map; 40 import java.util.TreeMap; 41 42 public class djt_user_copy extends SqoopRecord implements DBWritable, Writable { 43 private final int PROTOCOL_VERSION = 3; 44 public int getClassFormatVersion() { return PROTOCOL_VERSION; } 45 protected ResultSet __cur_result_set; 46 private Integer id; 47 public Integer get_id() { 48 return id; 49 } 50 public void set_id(Integer id) { 51 this.id = id; 52 } 53 public djt_user_copy with_id(Integer id) { 54 this.id = id; 55 return this; 56 } 57 private String name; 58 public String get_name() { 59 return name; 60 } 61 public void set_name(String name) { 62 this.name = name; 63 } 64 public djt_user_copy with_name(String name) { 65 this.name = name; 66 return this; 67 } 68 private String sex; 69 public String get_sex() { 70 return sex; 71 } 72 public void set_sex(String sex) { 73 this.sex = sex; 74 } 75 public djt_user_copy with_sex(String sex) { 76 this.sex = sex; 77 return this; 78 } 79 private Integer age; 80 public Integer get_age() { 81 return age; 82 } 83 public void set_age(Integer age) { 84 this.age = age; 85 } 86 public djt_user_copy with_age(Integer age) { 87 this.age = age; 88 return this; 89 } 90 private String profile; 91 public String get_profile() { 92 return profile; 93 } 94 public void set_profile(String profile) { 95 this.profile = profile; 96 } 97 public djt_user_copy with_profile(String profile) { 98 this.profile = profile; 99 return this; 100 } 101 public boolean equals(Object o) { 102 if (this == o) { 103 return true; 104 } 105 if (!(o instanceof djt_user_copy)) { 106 return false; 107 } 108 djt_user_copy that = (djt_user_copy) o; 109 boolean equal = true; 110 equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id)); 111 equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name)); 112 equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex)); 113 equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age)); 114 equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile)); 115 return equal; 116 } 117 public boolean equals0(Object o) { 118 if (this == o) { 119 return true; 120 } 121 if (!(o instanceof djt_user_copy)) { 122 return false; 123 } 124 djt_user_copy that = (djt_user_copy) o; 125 boolean equal = true; 126 equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id)); 127 equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name)); 128 equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex)); 129 equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age)); 130 equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile)); 131 return equal; 132 } 133 public void readFields(ResultSet __dbResults) throws SQLException { 134 this.__cur_result_set = __dbResults; 135 this.id = JdbcWritableBridge.readInteger(1, __dbResults); 136 this.name = JdbcWritableBridge.readString(2, __dbResults); 137 this.sex = JdbcWritableBridge.readString(3, __dbResults); 138 this.age = JdbcWritableBridge.readInteger(4, __dbResults); 139 this.profile = JdbcWritableBridge.readString(5, __dbResults); 140 } 141 public void readFields0(ResultSet __dbResults) throws SQLException { 142 this.id = JdbcWritableBridge.readInteger(1, __dbResults); 143 this.name = JdbcWritableBridge.readString(2, __dbResults); 144 this.sex = JdbcWritableBridge.readString(3, __dbResults); 145 this.age = JdbcWritableBridge.readInteger(4, __dbResults); 146 this.profile = JdbcWritableBridge.readString(5, __dbResults); 147 } 148 public void loadLargeObjects(LargeObjectLoader __loader) 149 throws SQLException, IOException, InterruptedException { 150 } 151 public void loadLargeObjects0(LargeObjectLoader __loader) 152 throws SQLException, IOException, InterruptedException { 153 } 154 public void write(PreparedStatement __dbStmt) throws SQLException { 155 write(__dbStmt, 0); 156 } 157 158 public int write(PreparedStatement __dbStmt, int __off) throws SQLException { 159 JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt); 160 JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt); 161 JdbcWritableBridge.writeString(sex, 3 + __off, 12, __dbStmt); 162 JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt); 163 JdbcWritableBridge.writeString(profile, 5 + __off, 12, __dbStmt); 164 return 5; 165 } 166 public void write0(PreparedStatement __dbStmt, int __off) throws SQLException { 167 JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt); 168 JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt); 169 JdbcWritableBridge.writeString(sex, 3 + __off, 12, __dbStmt); 170 JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt); 171 JdbcWritableBridge.writeString(profile, 5 + __off, 12, __dbStmt); 172 } 173 public void readFields(DataInput __dataIn) throws IOException { 174 this.readFields0(__dataIn); } 175 public void readFields0(DataInput __dataIn) throws IOException { 176 if (__dataIn.readBoolean()) { 177 this.id = null; 178 } else { 179 this.id = Integer.valueOf(__dataIn.readInt()); 180 } 181 if (__dataIn.readBoolean()) { 182 this.name = null; 183 } else { 184 this.name = Text.readString(__dataIn); 185 } 186 if (__dataIn.readBoolean()) { 187 this.sex = null; 188 } else { 189 this.sex = Text.readString(__dataIn); 190 } 191 if (__dataIn.readBoolean()) { 192 this.age = null; 193 } else { 194 this.age = Integer.valueOf(__dataIn.readInt()); 195 } 196 if (__dataIn.readBoolean()) { 197 this.profile = null; 198 } else { 199 this.profile = Text.readString(__dataIn); 200 } 201 } 202 public void write(DataOutput __dataOut) throws IOException { 203 if (null == this.id) { 204 __dataOut.writeBoolean(true); 205 } else { 206 __dataOut.writeBoolean(false); 207 __dataOut.writeInt(this.id); 208 } 209 if (null == this.name) { 210 __dataOut.writeBoolean(true); 211 } else { 212 __dataOut.writeBoolean(false); 213 Text.writeString(__dataOut, name); 214 } 215 if (null == this.sex) { 216 __dataOut.writeBoolean(true); 217 } else { 218 __dataOut.writeBoolean(false); 219 Text.writeString(__dataOut, sex); 220 } 221 if (null == this.age) { 222 __dataOut.writeBoolean(true); 223 } else { 224 __dataOut.writeBoolean(false); 225 __dataOut.writeInt(this.age); 226 } 227 if (null == this.profile) { 228 __dataOut.writeBoolean(true); 229 } else { 230 __dataOut.writeBoolean(false); 231 Text.writeString(__dataOut, profile); 232 } 233 } 234 public void write0(DataOutput __dataOut) throws IOException { 235 if (null == this.id) { 236 __dataOut.writeBoolean(true); 237 } else { 238 __dataOut.writeBoolean(false); 239 __dataOut.writeInt(this.id); 240 } 241 if (null == this.name) { 242 __dataOut.writeBoolean(true); 243 } else { 244 __dataOut.writeBoolean(false); 245 Text.writeString(__dataOut, name); 246 } 247 if (null == this.sex) { 248 __dataOut.writeBoolean(true); 249 } else { 250 __dataOut.writeBoolean(false); 251 Text.writeString(__dataOut, sex); 252 } 253 if (null == this.age) { 254 __dataOut.writeBoolean(true); 255 } else { 256 __dataOut.writeBoolean(false); 257 __dataOut.writeInt(this.age); 258 } 259 if (null == this.profile) { 260 __dataOut.writeBoolean(true); 261 } else { 262 __dataOut.writeBoolean(false); 263 Text.writeString(__dataOut, profile); 264 } 265 } 266 private static final DelimiterSet __outputDelimiters = new DelimiterSet((char) 44, (char) 10, (char) 0, (char) 0, false); 267 public String toString() { 268 return toString(__outputDelimiters, true); 269 } 270 public String toString(DelimiterSet delimiters) { 271 return toString(delimiters, true); 272 } 273 public String toString(boolean useRecordDelim) { 274 return toString(__outputDelimiters, useRecordDelim); 275 } 276 public String toString(DelimiterSet delimiters, boolean useRecordDelim) { 277 StringBuilder __sb = new StringBuilder(); 278 char fieldDelim = delimiters.getFieldsTerminatedBy(); 279 __sb.append(FieldFormatter.escapeAndEnclose(id==null?"null":"" + id, delimiters)); 280 __sb.append(fieldDelim); 281 __sb.append(FieldFormatter.escapeAndEnclose(name==null?"null":name, delimiters)); 282 __sb.append(fieldDelim); 283 __sb.append(FieldFormatter.escapeAndEnclose(sex==null?"null":sex, delimiters)); 284 __sb.append(fieldDelim); 285 __sb.append(FieldFormatter.escapeAndEnclose(age==null?"null":"" + age, delimiters)); 286 __sb.append(fieldDelim); 287 __sb.append(FieldFormatter.escapeAndEnclose(profile==null?"null":profile, delimiters)); 288 if (useRecordDelim) { 289 __sb.append(delimiters.getLinesTerminatedBy()); 290 } 291 return __sb.toString(); 292 } 293 public void toString0(DelimiterSet delimiters, StringBuilder __sb, char fieldDelim) { 294 __sb.append(FieldFormatter.escapeAndEnclose(id==null?"null":"" + id, delimiters)); 295 __sb.append(fieldDelim); 296 __sb.append(FieldFormatter.escapeAndEnclose(name==null?"null":name, delimiters)); 297 __sb.append(fieldDelim); 298 __sb.append(FieldFormatter.escapeAndEnclose(sex==null?"null":sex, delimiters)); 299 __sb.append(fieldDelim); 300 __sb.append(FieldFormatter.escapeAndEnclose(age==null?"null":"" + age, delimiters)); 301 __sb.append(fieldDelim); 302 __sb.append(FieldFormatter.escapeAndEnclose(profile==null?"null":profile, delimiters)); 303 } 304 private static final DelimiterSet __inputDelimiters = new DelimiterSet((char) 64, (char) 10, (char) 0, (char) 0, false); 305 private RecordParser __parser; 306 public void parse(Text __record) throws RecordParser.ParseError { 307 if (null == this.__parser) { 308 this.__parser = new RecordParser(__inputDelimiters); 309 } 310 List<String> __fields = this.__parser.parseRecord(__record); 311 __loadFromFields(__fields); 312 } 313 314 public void parse(CharSequence __record) throws RecordParser.ParseError { 315 if (null == this.__parser) { 316 this.__parser = new RecordParser(__inputDelimiters); 317 } 318 List<String> __fields = this.__parser.parseRecord(__record); 319 __loadFromFields(__fields); 320 } 321 322 public void parse(byte [] __record) throws RecordParser.ParseError { 323 if (null == this.__parser) { 324 this.__parser = new RecordParser(__inputDelimiters); 325 } 326 List<String> __fields = this.__parser.parseRecord(__record); 327 __loadFromFields(__fields); 328 } 329 330 public void parse(char [] __record) throws RecordParser.ParseError { 331 if (null == this.__parser) { 332 this.__parser = new RecordParser(__inputDelimiters); 333 } 334 List<String> __fields = this.__parser.parseRecord(__record); 335 __loadFromFields(__fields); 336 } 337 338 public void parse(ByteBuffer __record) throws RecordParser.ParseError { 339 if (null == this.__parser) { 340 this.__parser = new RecordParser(__inputDelimiters); 341 } 342 List<String> __fields = this.__parser.parseRecord(__record); 343 __loadFromFields(__fields); 344 } 345 346 public void parse(CharBuffer __record) throws RecordParser.ParseError { 347 if (null == this.__parser) { 348 this.__parser = new RecordParser(__inputDelimiters); 349 } 350 List<String> __fields = this.__parser.parseRecord(__record); 351 __loadFromFields(__fields); 352 } 353 354 private void __loadFromFields(List<String> fields) { 355 Iterator<String> __it = fields.listIterator(); 356 String __cur_str = null; 357 try { 358 __cur_str = __it.next(); 359 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else { 360 this.id = Integer.valueOf(__cur_str); 361 } 362 363 __cur_str = __it.next(); 364 if (__cur_str.equals("null")) { this.name = null; } else { 365 this.name = __cur_str; 366 } 367 368 __cur_str = __it.next(); 369 if (__cur_str.equals("null")) { this.sex = null; } else { 370 this.sex = __cur_str; 371 } 372 373 __cur_str = __it.next(); 374 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else { 375 this.age = Integer.valueOf(__cur_str); 376 } 377 378 __cur_str = __it.next(); 379 if (__cur_str.equals("null")) { this.profile = null; } else { 380 this.profile = __cur_str; 381 } 382 383 } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } 384 385 private void __loadFromFields0(Iterator<String> __it) { 386 String __cur_str = null; 387 try { 388 __cur_str = __it.next(); 389 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else { 390 this.id = Integer.valueOf(__cur_str); 391 } 392 393 __cur_str = __it.next(); 394 if (__cur_str.equals("null")) { this.name = null; } else { 395 this.name = __cur_str; 396 } 397 398 __cur_str = __it.next(); 399 if (__cur_str.equals("null")) { this.sex = null; } else { 400 this.sex = __cur_str; 401 } 402 403 __cur_str = __it.next(); 404 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else { 405 this.age = Integer.valueOf(__cur_str); 406 } 407 408 __cur_str = __it.next(); 409 if (__cur_str.equals("null")) { this.profile = null; } else { 410 this.profile = __cur_str; 411 } 412 413 } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } 414 415 public Object clone() throws CloneNotSupportedException { 416 djt_user_copy o = (djt_user_copy) super.clone(); 417 return o; 418 } 419 420 public void clone0(djt_user_copy o) throws CloneNotSupportedException { 421 } 422 423 public Map<String, Object> getFieldMap() { 424 Map<String, Object> __sqoop$field_map = new TreeMap<String, Object>(); 425 __sqoop$field_map.put("id", this.id); 426 __sqoop$field_map.put("name", this.name); 427 __sqoop$field_map.put("sex", this.sex); 428 __sqoop$field_map.put("age", this.age); 429 __sqoop$field_map.put("profile", this.profile); 430 return __sqoop$field_map; 431 } 432 433 public void getFieldMap0(Map<String, Object> __sqoop$field_map) { 434 __sqoop$field_map.put("id", this.id); 435 __sqoop$field_map.put("name", this.name); 436 __sqoop$field_map.put("sex", this.sex); 437 __sqoop$field_map.put("age", this.age); 438 __sqoop$field_map.put("profile", this.profile); 439 } 440 441 public void setField(String __fieldName, Object __fieldVal) { 442 if ("id".equals(__fieldName)) { 443 this.id = (Integer) __fieldVal; 444 } 445 else if ("name".equals(__fieldName)) { 446 this.name = (String) __fieldVal; 447 } 448 else if ("sex".equals(__fieldName)) { 449 this.sex = (String) __fieldVal; 450 } 451 else if ("age".equals(__fieldName)) { 452 this.age = (Integer) __fieldVal; 453 } 454 else if ("profile".equals(__fieldName)) { 455 this.profile = (String) __fieldVal; 456 } 457 else { 458 throw new RuntimeException("No such field: " + __fieldName); 459 } 460 } 461 public boolean setField0(String __fieldName, Object __fieldVal) { 462 if ("id".equals(__fieldName)) { 463 this.id = (Integer) __fieldVal; 464 return true; 465 } 466 else if ("name".equals(__fieldName)) { 467 this.name = (String) __fieldVal; 468 return true; 469 } 470 else if ("sex".equals(__fieldName)) { 471 this.sex = (String) __fieldVal; 472 return true; 473 } 474 else if ("age".equals(__fieldName)) { 475 this.age = (Integer) __fieldVal; 476 return true; 477 } 478 else if ("profile".equals(__fieldName)) { 479 this.profile = (String) __fieldVal; 480 return true; 481 } 482 else { 483 return false; } 484 } 485 } 486 [hadoop@djt002 sqoopRunCreate]$
1 [hadoop@djt002 sqoopRunCreate]$ ls 2 djt_user_copy.java djt_user.java QueryResult.java 3 [hadoop@djt002 sqoopRunCreate]$ cat QueryResult.java 4 // ORM class for table 'null' 5 // WARNING: This class is AUTO-GENERATED. Modify at your own risk. 6 // 7 // Debug information: 8 // Generated date: Sat Mar 18 18:41:26 CST 2017 9 // For connector: org.apache.sqoop.manager.MySQLManager 10 import org.apache.hadoop.io.BytesWritable; 11 import org.apache.hadoop.io.Text; 12 import org.apache.hadoop.io.Writable; 13 import org.apache.hadoop.mapred.lib.db.DBWritable; 14 import com.cloudera.sqoop.lib.JdbcWritableBridge; 15 import com.cloudera.sqoop.lib.DelimiterSet; 16 import com.cloudera.sqoop.lib.FieldFormatter; 17 import com.cloudera.sqoop.lib.RecordParser; 18 import com.cloudera.sqoop.lib.BooleanParser; 19 import com.cloudera.sqoop.lib.BlobRef; 20 import com.cloudera.sqoop.lib.ClobRef; 21 import com.cloudera.sqoop.lib.LargeObjectLoader; 22 import com.cloudera.sqoop.lib.SqoopRecord; 23 import java.sql.PreparedStatement; 24 import java.sql.ResultSet; 25 import java.sql.SQLException; 26 import java.io.DataInput; 27 import java.io.DataOutput; 28 import java.io.IOException; 29 import java.nio.ByteBuffer; 30 import java.nio.CharBuffer; 31 import java.sql.Date; 32 import java.sql.Time; 33 import java.sql.Timestamp; 34 import java.util.Arrays; 35 import java.util.Iterator; 36 import java.util.List; 37 import java.util.Map; 38 import java.util.TreeMap; 39 40 public class QueryResult extends SqoopRecord implements DBWritable, Writable { 41 private final int PROTOCOL_VERSION = 3; 42 public int getClassFormatVersion() { return PROTOCOL_VERSION; } 43 protected ResultSet __cur_result_set; 44 private Integer id; 45 public Integer get_id() { 46 return id; 47 } 48 public void set_id(Integer id) { 49 this.id = id; 50 } 51 public QueryResult with_id(Integer id) { 52 this.id = id; 53 return this; 54 } 55 private String name; 56 public String get_name() { 57 return name; 58 } 59 public void set_name(String name) { 60 this.name = name; 61 } 62 public QueryResult with_name(String name) { 63 this.name = name; 64 return this; 65 } 66 private String sex; 67 public String get_sex() { 68 return sex; 69 } 70 public void set_sex(String sex) { 71 this.sex = sex; 72 } 73 public QueryResult with_sex(String sex) { 74 this.sex = sex; 75 return this; 76 } 77 private Integer age; 78 public Integer get_age() { 79 return age; 80 } 81 public void set_age(Integer age) { 82 this.age = age; 83 } 84 public QueryResult with_age(Integer age) { 85 this.age = age; 86 return this; 87 } 88 private String profile; 89 public String get_profile() { 90 return profile; 91 } 92 public void set_profile(String profile) { 93 this.profile = profile; 94 } 95 public QueryResult with_profile(String profile) { 96 this.profile = profile; 97 return this; 98 } 99 public boolean equals(Object o) { 100 if (this == o) { 101 return true; 102 } 103 if (!(o instanceof QueryResult)) { 104 return false; 105 } 106 QueryResult that = (QueryResult) o; 107 boolean equal = true; 108 equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id)); 109 equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name)); 110 equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex)); 111 equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age)); 112 equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile)); 113 return equal; 114 } 115 public boolean equals0(Object o) { 116 if (this == o) { 117 return true; 118 } 119 if (!(o instanceof QueryResult)) { 120 return false; 121 } 122 QueryResult that = (QueryResult) o; 123 boolean equal = true; 124 equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id)); 125 equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name)); 126 equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex)); 127 equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age)); 128 equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile)); 129 return equal; 130 } 131 public void readFields(ResultSet __dbResults) throws SQLException { 132 this.__cur_result_set = __dbResults; 133 this.id = JdbcWritableBridge.readInteger(1, __dbResults); 134 this.name = JdbcWritableBridge.readString(2, __dbResults); 135 this.sex = JdbcWritableBridge.readString(3, __dbResults); 136 this.age = JdbcWritableBridge.readInteger(4, __dbResults); 137 this.profile = JdbcWritableBridge.readString(5, __dbResults); 138 } 139 public void readFields0(ResultSet __dbResults) throws SQLException { 140 this.id = JdbcWritableBridge.readInteger(1, __dbResults); 141 this.name = JdbcWritableBridge.readString(2, __dbResults); 142 this.sex = JdbcWritableBridge.readString(3, __dbResults); 143 this.age = JdbcWritableBridge.readInteger(4, __dbResults); 144 this.profile = JdbcWritableBridge.readString(5, __dbResults); 145 } 146 public void loadLargeObjects(LargeObjectLoader __loader) 147 throws SQLException, IOException, InterruptedException { 148 } 149 public void loadLargeObjects0(LargeObjectLoader __loader) 150 throws SQLException, IOException, InterruptedException { 151 } 152 public void write(PreparedStatement __dbStmt) throws SQLException { 153 write(__dbStmt, 0); 154 } 155 156 public int write(PreparedStatement __dbStmt, int __off) throws SQLException { 157 JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt); 158 JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt); 159 JdbcWritableBridge.writeString(sex, 3 + __off, 12, __dbStmt); 160 JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt); 161 JdbcWritableBridge.writeString(profile, 5 + __off, 12, __dbStmt); 162 return 5; 163 } 164 public void write0(PreparedStatement __dbStmt, int __off) throws SQLException { 165 JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt); 166 JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt); 167 JdbcWritableBridge.writeString(sex, 3 + __off, 12, __dbStmt); 168 JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt); 169 JdbcWritableBridge.writeString(profile, 5 + __off, 12, __dbStmt); 170 } 171 public void readFields(DataInput __dataIn) throws IOException { 172 this.readFields0(__dataIn); } 173 public void readFields0(DataInput __dataIn) throws IOException { 174 if (__dataIn.readBoolean()) { 175 this.id = null; 176 } else { 177 this.id = Integer.valueOf(__dataIn.readInt()); 178 } 179 if (__dataIn.readBoolean()) { 180 this.name = null; 181 } else { 182 this.name = Text.readString(__dataIn); 183 } 184 if (__dataIn.readBoolean()) { 185 this.sex = null; 186 } else { 187 this.sex = Text.readString(__dataIn); 188 } 189 if (__dataIn.readBoolean()) { 190 this.age = null; 191 } else { 192 this.age = Integer.valueOf(__dataIn.readInt()); 193 } 194 if (__dataIn.readBoolean()) { 195 this.profile = null; 196 } else { 197 this.profile = Text.readString(__dataIn); 198 } 199 } 200 public void write(DataOutput __dataOut) throws IOException { 201 if (null == this.id) { 202 __dataOut.writeBoolean(true); 203 } else { 204 __dataOut.writeBoolean(false); 205 __dataOut.writeInt(this.id); 206 } 207 if (null == this.name) { 208 __dataOut.writeBoolean(true); 209 } else { 210 __dataOut.writeBoolean(false); 211 Text.writeString(__dataOut, name); 212 } 213 if (null == this.sex) { 214 __dataOut.writeBoolean(true); 215 } else { 216 __dataOut.writeBoolean(false); 217 Text.writeString(__dataOut, sex); 218 } 219 if (null == this.age) { 220 __dataOut.writeBoolean(true); 221 } else { 222 __dataOut.writeBoolean(false); 223 __dataOut.writeInt(this.age); 224 } 225 if (null == this.profile) { 226 __dataOut.writeBoolean(true); 227 } else { 228 __dataOut.writeBoolean(false); 229 Text.writeString(__dataOut, profile); 230 } 231 } 232 public void write0(DataOutput __dataOut) throws IOException { 233 if (null == this.id) { 234 __dataOut.writeBoolean(true); 235 } else { 236 __dataOut.writeBoolean(false); 237 __dataOut.writeInt(this.id); 238 } 239 if (null == this.name) { 240 __dataOut.writeBoolean(true); 241 } else { 242 __dataOut.writeBoolean(false); 243 Text.writeString(__dataOut, name); 244 } 245 if (null == this.sex) { 246 __dataOut.writeBoolean(true); 247 } else { 248 __dataOut.writeBoolean(false); 249 Text.writeString(__dataOut, sex); 250 } 251 if (null == this.age) { 252 __dataOut.writeBoolean(true); 253 } else { 254 __dataOut.writeBoolean(false); 255 __dataOut.writeInt(this.age); 256 } 257 if (null == this.profile) { 258 __dataOut.writeBoolean(true); 259 } else { 260 __dataOut.writeBoolean(false); 261 Text.writeString(__dataOut, profile); 262 } 263 } 264 private static final DelimiterSet __outputDelimiters = new DelimiterSet((char) 64, (char) 10, (char) 0, (char) 0, false); 265 public String toString() { 266 return toString(__outputDelimiters, true); 267 } 268 public String toString(DelimiterSet delimiters) { 269 return toString(delimiters, true); 270 } 271 public String toString(boolean useRecordDelim) { 272 return toString(__outputDelimiters, useRecordDelim); 273 } 274 public String toString(DelimiterSet delimiters, boolean useRecordDelim) { 275 StringBuilder __sb = new StringBuilder(); 276 char fieldDelim = delimiters.getFieldsTerminatedBy(); 277 __sb.append(FieldFormatter.escapeAndEnclose(id==null?"###":"" + id, delimiters)); 278 __sb.append(fieldDelim); 279 __sb.append(FieldFormatter.escapeAndEnclose(name==null?"###":name, delimiters)); 280 __sb.append(fieldDelim); 281 __sb.append(FieldFormatter.escapeAndEnclose(sex==null?"###":sex, delimiters)); 282 __sb.append(fieldDelim); 283 __sb.append(FieldFormatter.escapeAndEnclose(age==null?"###":"" + age, delimiters)); 284 __sb.append(fieldDelim); 285 __sb.append(FieldFormatter.escapeAndEnclose(profile==null?"###":profile, delimiters)); 286 if (useRecordDelim) { 287 __sb.append(delimiters.getLinesTerminatedBy()); 288 } 289 return __sb.toString(); 290 } 291 public void toString0(DelimiterSet delimiters, StringBuilder __sb, char fieldDelim) { 292 __sb.append(FieldFormatter.escapeAndEnclose(id==null?"###":"" + id, delimiters)); 293 __sb.append(fieldDelim); 294 __sb.append(FieldFormatter.escapeAndEnclose(name==null?"###":name, delimiters)); 295 __sb.append(fieldDelim); 296 __sb.append(FieldFormatter.escapeAndEnclose(sex==null?"###":sex, delimiters)); 297 __sb.append(fieldDelim); 298 __sb.append(FieldFormatter.escapeAndEnclose(age==null?"###":"" + age, delimiters)); 299 __sb.append(fieldDelim); 300 __sb.append(FieldFormatter.escapeAndEnclose(profile==null?"###":profile, delimiters)); 301 } 302 private static final DelimiterSet __inputDelimiters = new DelimiterSet((char) 64, (char) 10, (char) 0, (char) 0, false); 303 private RecordParser __parser; 304 public void parse(Text __record) throws RecordParser.ParseError { 305 if (null == this.__parser) { 306 this.__parser = new RecordParser(__inputDelimiters); 307 } 308 List<String> __fields = this.__parser.parseRecord(__record); 309 __loadFromFields(__fields); 310 } 311 312 public void parse(CharSequence __record) throws RecordParser.ParseError { 313 if (null == this.__parser) { 314 this.__parser = new RecordParser(__inputDelimiters); 315 } 316 List<String> __fields = this.__parser.parseRecord(__record); 317 __loadFromFields(__fields); 318 } 319 320 public void parse(byte [] __record) throws RecordParser.ParseError { 321 if (null == this.__parser) { 322 this.__parser = new RecordParser(__inputDelimiters); 323 } 324 List<String> __fields = this.__parser.parseRecord(__record); 325 __loadFromFields(__fields); 326 } 327 public void parse(char [] __record) throws RecordParser.ParseError { 328 if (null == this.__parser) { 329 this.__parser = new RecordParser(__inputDelimiters); 330 } 331 List<String> __fields = this.__parser.parseRecord(__record); 332 __loadFromFields(__fields); 333 } 334 335 public void parse(ByteBuffer __record) throws RecordParser.ParseError { 336 if (null == this.__parser) { 337 this.__parser = new RecordParser(__inputDelimiters); 338 } 339 List<String> __fields = this.__parser.parseRecord(__record); 340 __loadFromFields(__fields); 341 } 342 343 public void parse(CharBuffer __record) throws RecordParser.ParseError { 344 if (null == this.__parser) { 345 this.__parser = new RecordParser(__inputDelimiters); 346 } 347 List<String> __fields = this.__parser.parseRecord(__record); 348 __loadFromFields(__fields); 349 } 350 351 private void __loadFromFields(List<String> fields) { 352 Iterator<String> __it = fields.listIterator(); 353 String __cur_str = null; 354 try { 355 __cur_str = __it.next(); 356 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else { 357 this.id = Integer.valueOf(__cur_str); 358 } 359 360 __cur_str = __it.next(); 361 if (__cur_str.equals("null")) { this.name = null; } else { 362 this.name = __cur_str; 363 } 364 365 __cur_str = __it.next(); 366 if (__cur_str.equals("null")) { this.sex = null; } else { 367 this.sex = __cur_str; 368 } 369 370 __cur_str = __it.next(); 371 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else { 372 this.age = Integer.valueOf(__cur_str); 373 } 374 375 __cur_str = __it.next(); 376 if (__cur_str.equals("null")) { this.profile = null; } else { 377 this.profile = __cur_str; 378 } 379 380 } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } 381 382 private void __loadFromFields0(Iterator<String> __it) { 383 String __cur_str = null; 384 try { 385 __cur_str = __it.next(); 386 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else { 387 this.id = Integer.valueOf(__cur_str); 388 } 389 390 __cur_str = __it.next(); 391 if (__cur_str.equals("null")) { this.name = null; } else { 392 this.name = __cur_str; 393 } 394 395 __cur_str = __it.next(); 396 if (__cur_str.equals("null")) { this.sex = null; } else { 397 this.sex = __cur_str; 398 } 399 400 __cur_str = __it.next(); 401 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else { 402 this.age = Integer.valueOf(__cur_str); 403 } 404 405 __cur_str = __it.next(); 406 if (__cur_str.equals("null")) { this.profile = null; } else { 407 this.profile = __cur_str; 408 } 409 410 } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } 411 412 public Object clone() throws CloneNotSupportedException { 413 QueryResult o = (QueryResult) super.clone(); 414 return o; 415 } 416 417 public void clone0(QueryResult o) throws CloneNotSupportedException { 418 } 419 420 public Map<String, Object> getFieldMap() { 421 Map<String, Object> __sqoop$field_map = new TreeMap<String, Object>(); 422 __sqoop$field_map.put("id", this.id); 423 __sqoop$field_map.put("name", this.name); 424 __sqoop$field_map.put("sex", this.sex); 425 __sqoop$field_map.put("age", this.age); 426 __sqoop$field_map.put("profile", this.profile); 427 return __sqoop$field_map; 428 } 429 430 public void getFieldMap0(Map<String, Object> __sqoop$field_map) { 431 __sqoop$field_map.put("id", this.id); 432 __sqoop$field_map.put("name", this.name); 433 __sqoop$field_map.put("sex", this.sex); 434 __sqoop$field_map.put("age", this.age); 435 __sqoop$field_map.put("profile", this.profile); 436 } 437 438 public void setField(String __fieldName, Object __fieldVal) { 439 if ("id".equals(__fieldName)) { 440 this.id = (Integer) __fieldVal; 441 } 442 else if ("name".equals(__fieldName)) { 443 this.name = (String) __fieldVal; 444 } 445 else if ("sex".equals(__fieldName)) { 446 this.sex = (String) __fieldVal; 447 } 448 else if ("age".equals(__fieldName)) { 449 this.age = (Integer) __fieldVal; 450 } 451 else if ("profile".equals(__fieldName)) { 452 this.profile = (String) __fieldVal; 453 } 454 else { 455 throw new RuntimeException("No such field: " + __fieldName); 456 } 457 } 458 public boolean setField0(String __fieldName, Object __fieldVal) { 459 if ("id".equals(__fieldName)) { 460 this.id = (Integer) __fieldVal; 461 return true; 462 } 463 else if ("name".equals(__fieldName)) { 464 this.name = (String) __fieldVal; 465 return true; 466 } 467 else if ("sex".equals(__fieldName)) { 468 this.sex = (String) __fieldVal; 469 return true; 470 } 471 else if ("age".equals(__fieldName)) { 472 this.age = (Integer) __fieldVal; 473 return true; 474 } 475 else if ("profile".equals(__fieldName)) { 476 this.profile = (String) __fieldVal; 477 return true; 478 } 479 else { 480 return false; } 481 } 482 } 483 [hadoop@djt002 sqoopRunCreate]$
1 [hadoop@djt002 sqoopRunCreate]$ pwd 2 /usr/local/sqoop/sqoopRunCreate 3 [hadoop@djt002 sqoopRunCreate]$ ls 4 djt_user_copy.java djt_user.java QueryResult.java 5 [hadoop@djt002 sqoopRunCreate]$ cat djt_user.java 6 // ORM class for table 'djt-user' 7 // WARNING: This class is AUTO-GENERATED. Modify at your own risk. 8 // 9 // Debug information: 10 // Generated date: Sat Mar 18 03:49:13 CST 2017 11 // For connector: org.apache.sqoop.manager.MySQLManager 12 import org.apache.hadoop.io.BytesWritable; 13 import org.apache.hadoop.io.Text; 14 import org.apache.hadoop.io.Writable; 15 import org.apache.hadoop.mapred.lib.db.DBWritable; 16 import com.cloudera.sqoop.lib.JdbcWritableBridge; 17 import com.cloudera.sqoop.lib.DelimiterSet; 18 import com.cloudera.sqoop.lib.FieldFormatter; 19 import com.cloudera.sqoop.lib.RecordParser; 20 import com.cloudera.sqoop.lib.BooleanParser; 21 import com.cloudera.sqoop.lib.BlobRef; 22 import com.cloudera.sqoop.lib.ClobRef; 23 import com.cloudera.sqoop.lib.LargeObjectLoader; 24 import com.cloudera.sqoop.lib.SqoopRecord; 25 import java.sql.PreparedStatement; 26 import java.sql.ResultSet; 27 import java.sql.SQLException; 28 import java.io.DataInput; 29 import java.io.DataOutput; 30 import java.io.IOException; 31 import java.nio.ByteBuffer; 32 import java.nio.CharBuffer; 33 import java.sql.Date; 34 import java.sql.Time; 35 import java.sql.Timestamp; 36 import java.util.Arrays; 37 import java.util.Iterator; 38 import java.util.List; 39 import java.util.Map; 40 import java.util.TreeMap; 41 42 public class djt_user extends SqoopRecord implements DBWritable, Writable { 43 private final int PROTOCOL_VERSION = 3; 44 public int getClassFormatVersion() { return PROTOCOL_VERSION; } 45 protected ResultSet __cur_result_set; 46 private Integer id; 47 public Integer get_id() { 48 return id; 49 } 50 public void set_id(Integer id) { 51 this.id = id; 52 } 53 public djt_user with_id(Integer id) { 54 this.id = id; 55 return this; 56 } 57 private String name; 58 public String get_name() { 59 return name; 60 } 61 public void set_name(String name) { 62 this.name = name; 63 } 64 public djt_user with_name(String name) { 65 this.name = name; 66 return this; 67 } 68 private org.apache.hadoop.io.BytesWritable sex; 69 public org.apache.hadoop.io.BytesWritable get_sex() { 70 return sex; 71 } 72 public void set_sex(org.apache.hadoop.io.BytesWritable sex) { 73 this.sex = sex; 74 } 75 public djt_user with_sex(org.apache.hadoop.io.BytesWritable sex) { 76 this.sex = sex; 77 return this; 78 } 79 private Integer age; 80 public Integer get_age() { 81 return age; 82 } 83 public void set_age(Integer age) { 84 this.age = age; 85 } 86 public djt_user with_age(Integer age) { 87 this.age = age; 88 return this; 89 } 90 private org.apache.hadoop.io.BytesWritable profile; 91 public org.apache.hadoop.io.BytesWritable get_profile() { 92 return profile; 93 } 94 public void set_profile(org.apache.hadoop.io.BytesWritable profile) { 95 this.profile = profile; 96 } 97 public djt_user with_profile(org.apache.hadoop.io.BytesWritable profile) { 98 this.profile = profile; 99 return this; 100 } 101 public boolean equals(Object o) { 102 if (this == o) { 103 return true; 104 } 105 if (!(o instanceof djt_user)) { 106 return false; 107 } 108 djt_user that = (djt_user) o; 109 boolean equal = true; 110 equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id)); 111 equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name)); 112 equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex)); 113 equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age)); 114 equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile)); 115 return equal; 116 } 117 public boolean equals0(Object o) { 118 if (this == o) { 119 return true; 120 } 121 if (!(o instanceof djt_user)) { 122 return false; 123 } 124 djt_user that = (djt_user) o; 125 boolean equal = true; 126 equal = equal && (this.id == null ? that.id == null : this.id.equals(that.id)); 127 equal = equal && (this.name == null ? that.name == null : this.name.equals(that.name)); 128 equal = equal && (this.sex == null ? that.sex == null : this.sex.equals(that.sex)); 129 equal = equal && (this.age == null ? that.age == null : this.age.equals(that.age)); 130 equal = equal && (this.profile == null ? that.profile == null : this.profile.equals(that.profile)); 131 return equal; 132 } 133 public void readFields(ResultSet __dbResults) throws SQLException { 134 this.__cur_result_set = __dbResults; 135 this.id = JdbcWritableBridge.readInteger(1, __dbResults); 136 this.name = JdbcWritableBridge.readString(2, __dbResults); 137 this.sex = JdbcWritableBridge.readBytesWritable(3, __dbResults); 138 this.age = JdbcWritableBridge.readInteger(4, __dbResults); 139 this.profile = JdbcWritableBridge.readBytesWritable(5, __dbResults); 140 } 141 public void readFields0(ResultSet __dbResults) throws SQLException { 142 this.id = JdbcWritableBridge.readInteger(1, __dbResults); 143 this.name = JdbcWritableBridge.readString(2, __dbResults); 144 this.sex = JdbcWritableBridge.readBytesWritable(3, __dbResults); 145 this.age = JdbcWritableBridge.readInteger(4, __dbResults); 146 this.profile = JdbcWritableBridge.readBytesWritable(5, __dbResults); 147 } 148 public void loadLargeObjects(LargeObjectLoader __loader) 149 throws SQLException, IOException, InterruptedException { 150 } 151 public void loadLargeObjects0(LargeObjectLoader __loader) 152 throws SQLException, IOException, InterruptedException { 153 } 154 public void write(PreparedStatement __dbStmt) throws SQLException { 155 write(__dbStmt, 0); 156 } 157 158 public int write(PreparedStatement __dbStmt, int __off) throws SQLException { 159 JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt); 160 JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt); 161 JdbcWritableBridge.writeBytesWritable(sex, 3 + __off, -3, __dbStmt); 162 JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt); 163 JdbcWritableBridge.writeBytesWritable(profile, 5 + __off, -3, __dbStmt); 164 return 5; 165 } 166 public void write0(PreparedStatement __dbStmt, int __off) throws SQLException { 167 JdbcWritableBridge.writeInteger(id, 1 + __off, 4, __dbStmt); 168 JdbcWritableBridge.writeString(name, 2 + __off, 12, __dbStmt); 169 JdbcWritableBridge.writeBytesWritable(sex, 3 + __off, -3, __dbStmt); 170 JdbcWritableBridge.writeInteger(age, 4 + __off, -6, __dbStmt); 171 JdbcWritableBridge.writeBytesWritable(profile, 5 + __off, -3, __dbStmt); 172 } 173 public void readFields(DataInput __dataIn) throws IOException { 174 this.readFields0(__dataIn); } 175 public void readFields0(DataInput __dataIn) throws IOException { 176 if (__dataIn.readBoolean()) { 177 this.id = null; 178 } else { 179 this.id = Integer.valueOf(__dataIn.readInt()); 180 } 181 if (__dataIn.readBoolean()) { 182 this.name = null; 183 } else { 184 this.name = Text.readString(__dataIn); 185 } 186 if (__dataIn.readBoolean()) { 187 this.sex = null; 188 } else { 189 this.sex = new BytesWritable(); 190 this.sex.readFields(__dataIn); 191 } 192 if (__dataIn.readBoolean()) { 193 this.age = null; 194 } else { 195 this.age = Integer.valueOf(__dataIn.readInt()); 196 } 197 if (__dataIn.readBoolean()) { 198 this.profile = null; 199 } else { 200 this.profile = new BytesWritable(); 201 this.profile.readFields(__dataIn); 202 } 203 } 204 public void write(DataOutput __dataOut) throws IOException { 205 if (null == this.id) { 206 __dataOut.writeBoolean(true); 207 } else { 208 __dataOut.writeBoolean(false); 209 __dataOut.writeInt(this.id); 210 } 211 if (null == this.name) { 212 __dataOut.writeBoolean(true); 213 } else { 214 __dataOut.writeBoolean(false); 215 Text.writeString(__dataOut, name); 216 } 217 if (null == this.sex) { 218 __dataOut.writeBoolean(true); 219 } else { 220 __dataOut.writeBoolean(false); 221 this.sex.write(__dataOut); 222 } 223 if (null == this.age) { 224 __dataOut.writeBoolean(true); 225 } else { 226 __dataOut.writeBoolean(false); 227 __dataOut.writeInt(this.age); 228 } 229 if (null == this.profile) { 230 __dataOut.writeBoolean(true); 231 } else { 232 __dataOut.writeBoolean(false); 233 this.profile.write(__dataOut); 234 } 235 } 236 public void write0(DataOutput __dataOut) throws IOException { 237 if (null == this.id) { 238 __dataOut.writeBoolean(true); 239 } else { 240 __dataOut.writeBoolean(false); 241 __dataOut.writeInt(this.id); 242 } 243 if (null == this.name) { 244 __dataOut.writeBoolean(true); 245 } else { 246 __dataOut.writeBoolean(false); 247 Text.writeString(__dataOut, name); 248 } 249 if (null == this.sex) { 250 __dataOut.writeBoolean(true); 251 } else { 252 __dataOut.writeBoolean(false); 253 this.sex.write(__dataOut); 254 } 255 if (null == this.age) { 256 __dataOut.writeBoolean(true); 257 } else { 258 __dataOut.writeBoolean(false); 259 __dataOut.writeInt(this.age); 260 } 261 if (null == this.profile) { 262 __dataOut.writeBoolean(true); 263 } else { 264 __dataOut.writeBoolean(false); 265 this.profile.write(__dataOut); 266 } 267 } 268 private static final DelimiterSet __outputDelimiters = new DelimiterSet((char) 44, (char) 10, (char) 0, (char) 0, false); 269 public String toString() { 270 return toString(__outputDelimiters, true); 271 } 272 public String toString(DelimiterSet delimiters) { 273 return toString(delimiters, true); 274 } 275 public String toString(boolean useRecordDelim) { 276 return toString(__outputDelimiters, useRecordDelim); 277 } 278 public String toString(DelimiterSet delimiters, boolean useRecordDelim) { 279 StringBuilder __sb = new StringBuilder(); 280 char fieldDelim = delimiters.getFieldsTerminatedBy(); 281 __sb.append(FieldFormatter.escapeAndEnclose(id==null?"null":"" + id, delimiters)); 282 __sb.append(fieldDelim); 283 __sb.append(FieldFormatter.escapeAndEnclose(name==null?"null":name, delimiters)); 284 __sb.append(fieldDelim); 285 __sb.append(FieldFormatter.escapeAndEnclose(sex==null?"null":"" + sex, delimiters)); 286 __sb.append(fieldDelim); 287 __sb.append(FieldFormatter.escapeAndEnclose(age==null?"null":"" + age, delimiters)); 288 __sb.append(fieldDelim); 289 __sb.append(FieldFormatter.escapeAndEnclose(profile==null?"null":"" + profile, delimiters)); 290 if (useRecordDelim) { 291 __sb.append(delimiters.getLinesTerminatedBy()); 292 } 293 return __sb.toString(); 294 } 295 public void toString0(DelimiterSet delimiters, StringBuilder __sb, char fieldDelim) { 296 __sb.append(FieldFormatter.escapeAndEnclose(id==null?"null":"" + id, delimiters)); 297 __sb.append(fieldDelim); 298 __sb.append(FieldFormatter.escapeAndEnclose(name==null?"null":name, delimiters)); 299 __sb.append(fieldDelim); 300 __sb.append(FieldFormatter.escapeAndEnclose(sex==null?"null":"" + sex, delimiters)); 301 __sb.append(fieldDelim); 302 __sb.append(FieldFormatter.escapeAndEnclose(age==null?"null":"" + age, delimiters)); 303 __sb.append(fieldDelim); 304 __sb.append(FieldFormatter.escapeAndEnclose(profile==null?"null":"" + profile, delimiters)); 305 } 306 private static final DelimiterSet __inputDelimiters = new DelimiterSet((char) 44, (char) 10, (char) 0, (char) 0, false); 307 private RecordParser __parser; 308 public void parse(Text __record) throws RecordParser.ParseError { 309 if (null == this.__parser) { 310 this.__parser = new RecordParser(__inputDelimiters); 311 } 312 List<String> __fields = this.__parser.parseRecord(__record); 313 __loadFromFields(__fields); 314 } 315 316 public void parse(CharSequence __record) throws RecordParser.ParseError { 317 if (null == this.__parser) { 318 this.__parser = new RecordParser(__inputDelimiters); 319 } 320 List<String> __fields = this.__parser.parseRecord(__record); 321 __loadFromFields(__fields); 322 } 323 public void parse(CharBuffer __record) throws RecordParser.ParseError { 324 if (null == this.__parser) { 325 this.__parser = new RecordParser(__inputDelimiters); 326 } 327 List<String> __fields = this.__parser.parseRecord(__record); 328 __loadFromFields(__fields); 329 } 330 331 private void __loadFromFields(List<String> fields) { 332 Iterator<String> __it = fields.listIterator(); 333 String __cur_str = null; 334 try { 335 __cur_str = __it.next(); 336 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else { 337 this.id = Integer.valueOf(__cur_str); 338 } 339 340 __cur_str = __it.next(); 341 if (__cur_str.equals("null")) { this.name = null; } else { 342 this.name = __cur_str; 343 } 344 345 __cur_str = __it.next(); 346 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.sex = null; } else { 347 String[] strByteVal = __cur_str.trim().split(" "); 348 byte [] byteVal = new byte[strByteVal.length]; 349 for (int i = 0; i < byteVal.length; ++i) { 350 byteVal[i] = (byte)Integer.parseInt(strByteVal[i], 16); 351 } 352 this.sex = new BytesWritable(byteVal); 353 } 354 355 __cur_str = __it.next(); 356 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else { 357 this.age = Integer.valueOf(__cur_str); 358 } 359 360 __cur_str = __it.next(); 361 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.profile = null; } else { 362 String[] strByteVal = __cur_str.trim().split(" "); 363 byte [] byteVal = new byte[strByteVal.length]; 364 for (int i = 0; i < byteVal.length; ++i) { 365 byteVal[i] = (byte)Integer.parseInt(strByteVal[i], 16); 366 } 367 this.profile = new BytesWritable(byteVal); 368 } 369 370 } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } 371 372 private void __loadFromFields0(Iterator<String> __it) { 373 String __cur_str = null; 374 try { 375 __cur_str = __it.next(); 376 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.id = null; } else { 377 this.id = Integer.valueOf(__cur_str); 378 } 379 380 __cur_str = __it.next(); 381 if (__cur_str.equals("null")) { this.name = null; } else { 382 this.name = __cur_str; 383 } 384 385 __cur_str = __it.next(); 386 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.sex = null; } else { 387 String[] strByteVal = __cur_str.trim().split(" "); 388 byte [] byteVal = new byte[strByteVal.length]; 389 for (int i = 0; i < byteVal.length; ++i) { 390 byteVal[i] = (byte)Integer.parseInt(strByteVal[i], 16); 391 } 392 this.sex = new BytesWritable(byteVal); 393 } 394 395 __cur_str = __it.next(); 396 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.age = null; } else { 397 this.age = Integer.valueOf(__cur_str); 398 } 399 400 __cur_str = __it.next(); 401 if (__cur_str.equals("null") || __cur_str.length() == 0) { this.profile = null; } else { 402 String[] strByteVal = __cur_str.trim().split(" "); 403 byte [] byteVal = new byte[strByteVal.length]; 404 for (int i = 0; i < byteVal.length; ++i) { 405 byteVal[i] = (byte)Integer.parseInt(strByteVal[i], 16); 406 } 407 this.profile = new BytesWritable(byteVal); 408 } 409 410 } catch (RuntimeException e) { throw new RuntimeException("Can't parse input data: '" + __cur_str + "'", e); } } 411 412 public Object clone() throws CloneNotSupportedException { 413 djt_user o = (djt_user) super.clone(); 414 o.sex = (o.sex != null) ? new BytesWritable(Arrays.copyOf(sex.getBytes(), sex.getLength())) : null; 415 o.profile = (o.profile != null) ? new BytesWritable(Arrays.copyOf(profile.getBytes(), profile.getLength())) : null; 416 return o; 417 } 418 public void clone0(djt_user o) throws CloneNotSupportedException { 419 o.sex = (o.sex != null) ? new BytesWritable(Arrays.copyOf(sex.getBytes(), sex.getLength())) : null; 420 o.profile = (o.profile != null) ? new BytesWritable(Arrays.copyOf(profile.getBytes(), profile.getLength())) : null; 421 } 422 423 public Map<String, Object> getFieldMap() { 424 Map<String, Object> __sqoop$field_map = new TreeMap<String, Object>(); 425 __sqoop$field_map.put("id", this.id); 426 __sqoop$field_map.put("name", this.name); 427 __sqoop$field_map.put("sex", this.sex); 428 __sqoop$field_map.put("age", this.age); 429 __sqoop$field_map.put("profile", this.profile); 430 return __sqoop$field_map; 431 } 432 433 public void getFieldMap0(Map<String, Object> __sqoop$field_map) { 434 __sqoop$field_map.put("id", this.id); 435 __sqoop$field_map.put("name", this.name); 436 __sqoop$field_map.put("sex", this.sex); 437 __sqoop$field_map.put("age", this.age); 438 __sqoop$field_map.put("profile", this.profile); 439 } 440 441 public void setField(String __fieldName, Object __fieldVal) { 442 if ("id".equals(__fieldName)) { 443 this.id = (Integer) __fieldVal; 444 } 445 else if ("name".equals(__fieldName)) { 446 this.name = (String) __fieldVal; 447 } 448 else if ("sex".equals(__fieldName)) { 449 this.sex = (org.apache.hadoop.io.BytesWritable) __fieldVal; 450 } 451 else if ("age".equals(__fieldName)) { 452 this.age = (Integer) __fieldVal; 453 } 454 else if ("profile".equals(__fieldName)) { 455 this.profile = (org.apache.hadoop.io.BytesWritable) __fieldVal; 456 } 457 else { 458 throw new RuntimeException("No such field: " + __fieldName); 459 } 460 } 461 public boolean setField0(String __fieldName, Object __fieldVal) { 462 if ("id".equals(__fieldName)) { 463 this.id = (Integer) __fieldVal; 464 return true; 465 } 466 else if ("name".equals(__fieldName)) { 467 this.name = (String) __fieldVal; 468 return true; 469 } 470 else if ("sex".equals(__fieldName)) { 471 this.sex = (org.apache.hadoop.io.BytesWritable) __fieldVal; 472 return true; 473 } 474 else if ("age".equals(__fieldName)) { 475 this.age = (Integer) __fieldVal; 476 return true; 477 } 478 else if ("profile".equals(__fieldName)) { 479 this.profile = (org.apache.hadoop.io.BytesWritable) __fieldVal; 480 return true; 481 } 482 else { 483 return false; } 484 } 485 } 486 [hadoop@djt002 sqoopRunCreate]$