Yes, the highest priority is assigned to the configuration in user code using the set () function. After that, the flags passed with sparks.
Properties set directly to SparkConf have the highest priority, then the flags are passed to spark-submit or spark-shell, and then to spark-defaults.conf. Several configuration keys have been renamed from earlier versions of Spark; in such cases, the old key names are still accepted, but have lower priority than any instance of the new key.
Source