21
21
22
22
import com .wgzhao .addax .core .element .BytesColumn ;
23
23
import com .wgzhao .addax .core .element .Column ;
24
+ import com .wgzhao .addax .core .element .StringColumn ;
24
25
import com .wgzhao .addax .core .element .TimestampColumn ;
25
26
import com .wgzhao .addax .core .plugin .RecordSender ;
26
27
import com .wgzhao .addax .core .spi .Reader ;
@@ -135,11 +136,12 @@ public void init()
135
136
protected Column createColumn (ResultSet rs , ResultSetMetaData metaData , int i )
136
137
throws SQLException , UnsupportedEncodingException
137
138
{
138
- if (metaData .getColumnType (i ) == Types .TIMESTAMP ) {
139
+ int columnType = metaData .getColumnType (i );
140
+ if (columnType == Types .TIMESTAMP ) {
139
141
// hive HiveBaseResultSet#getTimestamp(String columnName, Calendar cal) not support
140
142
return new TimestampColumn (rs .getTimestamp (i ));
141
143
}
142
- if (metaData . getColumnType ( i ) == Types .BINARY ||
144
+ if (columnType == Types .BINARY ||
143
145
metaData .getColumnType (i ) == Types .VARBINARY ) {
144
146
try {
145
147
return new BytesColumn (rs .getBytes (i ));
@@ -148,7 +150,10 @@ protected Column createColumn(ResultSet rs, ResultSetMetaData metaData, int i)
148
150
return new BytesColumn (rs .getString (i ).getBytes (StandardCharsets .UTF_8 ));
149
151
}
150
152
}
151
-
153
+ if (columnType == Types .ARRAY || columnType == Types .STRUCT || columnType == Types .JAVA_OBJECT ) {
154
+ // HiveBaseResultSet#getArray(String columnName) not support
155
+ return new StringColumn ( rs .getString (i ));
156
+ }
152
157
return super .createColumn (rs , metaData , i );
153
158
}
154
159
};
0 commit comments