I have an ELT process that after the dataset has been created, the code below is executed to count the rows to determine the number of partitions.
provider_out = get_provider(spark)
numofpartitions = round(provider_out.count()/10000000)
This numofpartitions variable is used later to partition the data equally when writing to the destition as shown below.
provider_out.repartition(numofpartitions).write.mode("overwrite").parquet(dest_path)
I'm running into a problem when the numofpartions variable gets calculated and throws the "Invalid argument, not a string or column: 45.0838586 of type <class 'float'>. For column literals, use 'lit', 'array', 'struct' or 'create_map' function." error. I know this can occur when the result gets passed as an object, but it's a single float value that is being rounded.
Any idea why this may be happening?