Skip to content

Commit ca0612c

Browse files
committed
Allow nulls in non-pk columns
1 parent e79edc4 commit ca0612c

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<properties>
1010
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11-
<revision>3.2.0</revision>
11+
<revision>3.2.1</revision>
1212
<scala.version>2.12.17</scala.version>
1313
<scala.main.version>2.12</scala.main.version>
1414
<spark.version>3.3.1</spark.version>

src/main/java/datastax/astra/migrate/AbstractJobSession.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,14 @@ private BoundStatement getBoundStatement(Row sourceRow, BoundStatement boundSele
254254
Object colData = getData(dataTypeObj, index, sourceRow);
255255

256256
// Handle rows with blank values in primary-key fields
257-
Optional<Object> optionalVal = handleBlankInPrimaryKey(index, colData, dataTypeObj.typeClass, sourceRow);
258-
if (!optionalVal.isPresent()) {
259-
return null;
257+
if (index < idColTypes.size()) {
258+
Optional<Object> optionalVal = handleBlankInPrimaryKey(index, colData, dataTypeObj.typeClass, sourceRow);
259+
if (!optionalVal.isPresent()) {
260+
return null;
261+
}
262+
colData = optionalVal.get();
260263
}
261-
boundSelectStatement = boundSelectStatement.set(index, optionalVal.get(), dataTypeObj.typeClass);
264+
boundSelectStatement = boundSelectStatement.set(index, colData, dataTypeObj.typeClass);
262265
return boundSelectStatement;
263266
}
264267

src/resources/sparkConf.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spark.query.types 9,1,4,3
6464
#############################################################################################################
6565

6666
# ENABLE ONLY IF COLUMN NAMES ON TARGET IS DIFFERENT FROM ORIGIN (SCHEMA & DATA-TYPES MUST BE SAME)
67-
#spark.query.target partition-key,clustering-key,order-date,amount
67+
#spark.query.target comma-separated-partition-key,comma-separated-clustering-key,comma-separated-other-columns
6868

6969
# The tool adds TTL & Writetime at row-level (not field-level).
7070
# The largest TTL & Writetime values are used if multiple indexes are listed (comma separated)

0 commit comments

Comments
 (0)