I'm doing the output of the readStream
format("rate")
and I'd like to get the format of the out of the box value field of the dataframe
. The only option I have fount in the docs is truncate
, but I can't find how to force to get something like that
Batch: 3
-------------------------------------------
----------------------- ---------
|timestamp:String |value:Int|
----------------------- ---------
|2021-10-14 14:28:58.981|0 |
----------------------- ---------
instead of that
Batch: 3
-------------------------------------------
----------------------- -----
|timestamp |value|
----------------------- -----
|2021-10-14 14:28:58.981|0 |
----------------------- -----
Output code is:
df
.writeStream
.format("console")
.option("truncate", "false")
.start().awaitTermination(20000)
CodePudding user response:
Thanks to @m_vemuri
the solution is
println("Rate schema:")
println(rate.schema.fields.mkString)
and since that I know what is the type that rate
produces for the value
:
Rate schema:
StructField(timestamp,TimestampType,true)StructField(value,LongType,true)