@@ -55,11 +55,13 @@ protected CopyJobSession(CqlSession sourceSession, CqlSession astraSession, Spar
55
55
}
56
56
isPreserveTTLWritetime = Boolean .parseBoolean (sparkConf .get ("spark.migrate.preserveTTLWriteTime" , "false" ));
57
57
58
- String updateSelectMappingStr = sparkConf .get ("spark.migrate.source.counterTable.update.select.index" , "0" );
59
- for (String updateSelectIndex : updateSelectMappingStr .split ("," )) {
60
- updateSelectMapping .add (Integer .parseInt (updateSelectIndex ));
61
- }
62
58
if (isCounterTable ) {
59
+ String updateSelectMappingStr = sparkConf .get ("spark.migrate.source.counterTable.update.select.index" , "0" );
60
+ for (String updateSelectIndex : updateSelectMappingStr .split ("," )) {
61
+ updateSelectMapping .add (Integer .parseInt (updateSelectIndex ));
62
+ }
63
+
64
+
63
65
String counterTableUpdate = sparkConf .get ("spark.migrate.source.counterTable.update.cql" );
64
66
astraInsertStatement = astraSession .prepare (counterTableUpdate );
65
67
} else {
@@ -89,11 +91,15 @@ public void getDataAndInsert(BigInteger min, BigInteger max) {
89
91
if (batchSize == 1 || writeTimeStampFilter ) {
90
92
for (Row sourceRow : resultSet ) {
91
93
readLimiter .acquire (1 );
92
- // only process rows greater than writeTimeStampFilter
93
- Long sourceWriteTimeStamp = getLargestWriteTimeStamp (sourceRow );
94
- if (writeTimeStampFilter && (sourceWriteTimeStamp < minWriteTimeStampFilter )
95
- || sourceWriteTimeStamp > maxWriteTimeStampFilter ) {
96
- continue ;
94
+
95
+ if (writeTimeStampFilter ) {
96
+ // only process rows greater than writeTimeStampFilter
97
+ Long sourceWriteTimeStamp = getLargestWriteTimeStamp (sourceRow );
98
+ if (sourceWriteTimeStamp < minWriteTimeStampFilter
99
+ || sourceWriteTimeStamp > maxWriteTimeStampFilter ) {
100
+ continue ;
101
+ }
102
+
97
103
}
98
104
99
105
writeLimiter .acquire (1 );
@@ -222,7 +228,11 @@ public BoundStatement bindInsert(PreparedStatement insertStatement, Row sourceRo
222
228
MigrateDataType dataType = insertColTypes .get (index );
223
229
224
230
try {
225
- boundInsertStatement = boundInsertStatement .set (index , getData (dataType , index , sourceRow ), dataType .typeClass );
231
+ Object colData = getData (dataType , index , sourceRow );
232
+ if (index < idColTypes .size () && colData ==null && dataType .typeClass ==String .class ){
233
+ colData ="" ;
234
+ }
235
+ boundInsertStatement = boundInsertStatement .set (index , colData , dataType .typeClass );
226
236
} catch (NullPointerException e ) {
227
237
// ignore the exception for map values being null
228
238
if (dataType .typeClass != Map .class ) {
0 commit comments