Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Sqoop, mail # user - HSQLDB issue with null strings


Copy link to this message
-
Re: HSQLDB issue with null strings
Jarek Jarcec Cecho 2013-11-22, 19:24
Hi sir,
it seems that HSQLDB is reporting the column "STRING" as type CLOB. The parameters --(input-)null-(non-)string are working only for a string based columns (CHAR, VARCHAR, NCHAR, ...) and not for a CLOB. You might be able to overcome this by using --map-column-java parameter and force it's type to String (and not a CLOB):

  sqoop import --map-column-java STRING=String ...

You can find more details about type mapping in Sqoop User Guide:

  http://sqoop.apache.org/docs/1.4.4/SqoopUserGuide.html#_controlling_type_mapping

Jarcec

On Thu, Nov 21, 2013 at 09:56:15PM -0800, redshift-etl-user wrote:
> Jarek - class included below. Thanks!
>
>
> // ORM class for table 'null'
> // WARNING: This class is AUTO-GENERATED. Modify at your own risk.
> //
> // Debug information:
> // Generated date: Thu Nov 21 21:52:32 PST 2013
> // For connector: org.apache.sqoop.manager.GenericJdbcManager
> 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 gXoTNYSfULokaKs 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 gXoTNYSfULokaKs with_ID(Integer ID) {
>     this.ID = ID;
>     return this;
>   }
>   private com.cloudera.sqoop.lib.ClobRef STRING;
>   public com.cloudera.sqoop.lib.ClobRef get_STRING() {
>     return STRING;
>   }
>   public void set_STRING(com.cloudera.sqoop.lib.ClobRef STRING) {
>     this.STRING = STRING;
>   }
>   public gXoTNYSfULokaKs with_STRING(com.cloudera.sqoop.lib.ClobRef STRING)
> {
>     this.STRING = STRING;
>     return this;
>   }
>   public boolean equals(Object o) {
>     if (this == o) {
>       return true;
>     }
>     if (!(o instanceof gXoTNYSfULokaKs)) {
>       return false;
>     }
>     gXoTNYSfULokaKs that = (gXoTNYSfULokaKs) o;
>     boolean equal = true;
>     equal = equal && (this.ID == null ? that.ID == null :
> this.ID.equals(that.ID));
>     equal = equal && (this.STRING == null ? that.STRING == null :
> this.STRING.equals(that.STRING));
>     return equal;
>   }
>   public void readFields(ResultSet __dbResults) throws SQLException {
>     this.__cur_result_set = __dbResults;
>     this.ID = JdbcWritableBridge.readInteger(1, __dbResults);
>     this.STRING = JdbcWritableBridge.readClobRef(2, __dbResults);
>   }
>   public void loadLargeObjects(LargeObjectLoader __loader)
>       throws SQLException, IOException, InterruptedException {
>     this.STRING = __loader.readClobRef(2, this.__cur_result_set);
>   }
>   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.writeClobRef(STRING, 2 + __off, 2005, __dbStmt);