I have a DataFrame which contains several records,
I want to iterate each row of this DataFrame in order to validate the data of each of its columns, doing something like the following code:
val validDF = dfNextRows.map {
x => ValidateRow(x)
}
def ValidateRow(row: Row) : Boolean = {
val nC = row.getString(0)
val si = row.getString(1)
val iD = row.getString(2)
val iH = row.getString(3)
val sF = row.getString(4)
// Stuff to validate the data field of each row
validateNC(nC)
validateSI(SI)
validateID(ID)
validateIF(IF)
validateSF(SF)
true
}
But, doing some tests, if I want to print the value of the val nC (to be sure that I'm sending the corret information to each functions), it doesn't bring me anything:
def ValidateRow(row: Row) : Boolean = {
val nC = row.getString(0)
val si = row.getString(1)
val iD = row.getString(2)
val iH = row.getString(3)
val sF = row.getString(4)
println(nC)
validateNC(nC)
validateSI(SI)
validateID(ID)
validateIF(IF)
validateSF(SF)
true
}
How can I know that I'm sending the correct information to each function (that I'm reading the data of each column of the row correctly)?
Regards.


