[SPARK-3897]format example code and explicit val instead of var

agree.
the problem is i cannot find where to set two space which line start with "<"  in intellij IDEA

i think we can tolerate this less readability place
:)