text: Q:
  
  Set DEFAULT_MAX_TO_STRING_FIELDS in Spark 2.2.0
  
  I want to change the value of the variable DEFAULT_MAX_TO_STRING_FIELDS in Spark 2.2.0 because I want to apply Machine Learning algorithms on data sets that have more than 25 features. The Apache Spark libraries are integrated in a Spring Boot application in the form of Maven dependencies thus I would like to change this property from code. I found an approach to display the number of features:
  System.out.println(Utils.DEFAULT_MAX_TO_STRING_FIELDS());
  
  but unfortunately I do not know how to change this value dynamically. 
  Thank you !!!
  
  A:
  
  Try below
  SparkSession.conf.set("spark.debug.maxToStringFields", maxlength)
  
  