Source data looks like:
{
"IntegrityLevel": "16384",
"ParentProcessId": "10972929104936",
"SourceProcessId": "10972929104936",
"SHA256Hash": "a26a1ffb81a61281ffa55cb7778cc3fb0ff981704de49f75f51f18b283fba7a2",
"ImageFileName": "\\Device\\HarddiskVolume3\\Windows\\System32\\conhost.exe",
"SourceThreadId": "192964614202574",
"name": "ProcessRollup2V19",
}
Current streaming read is using an inferred schema, which is rendering fields like ParentProcessId as strings.
I have experimented with a manually-constructed schema using LongType, but this turns the would-be integers to nulls:
val schema = new StructType()
.add("ImageFileName", StringType,true)
.add("ParentProcessId", LongType, true)
If this can't be done via schema, is there an elegant way (avoiding foreachBatch) in
readStream.format("delta") or writeStream.format("delta")
to convert a dozen or so fields to a different type?