You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Salil Surendran <sa...@gmail.com> on 2022/12/12 19:49:48 UTC

How to see user defined variables in spark shell

I often define vals and vars in spark shell and after some time I forget
the ones I defined. I want to see only the ones I had defined and the ones
that come from spark. I have tried the following commands but all of them
show the variables and defs defined by spark also

$intp.definedTerms
  .map(t => s"${t.toTermName}: ${$intp.typeOfTerm(t.toTermName.toString)}")
  .foreach(println)

$intp.definedSymbolList,
$intp.namedDefinedTerms,
$intp.definedTerms.filter(x => !x.startsWith("res")).foreach(println),
$intp.allDefinedNames.filter(!_.startsWith("$"))

Any other command that works?
-- 
Thanks,
Salil
"The surest sign that intelligent life exists elsewhere in the universe is
that none of it has tried to contact us."