diff options
author | Matei Zaharia <matei.zaharia@gmail.com> | 2013-07-14 07:23:09 +0000 |
---|---|---|
committer | Matei Zaharia <matei.zaharia@gmail.com> | 2013-07-14 07:23:09 +0000 |
commit | a44a7b123862202cf97f2de7a96aeaf29a93002a (patch) | |
tree | b3e229cac87b55a9e10ba55b79099351e0dc9f9c /core/src/main | |
parent | e271fde10b342216e33f4f45af73c5d103215cf2 (diff) | |
download | spark-a44a7b123862202cf97f2de7a96aeaf29a93002a.tar.gz spark-a44a7b123862202cf97f2de7a96aeaf29a93002a.tar.bz2 spark-a44a7b123862202cf97f2de7a96aeaf29a93002a.zip |
Determine Spark core classes better in getCallSite
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/scala/spark/Utils.scala | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/src/main/scala/spark/Utils.scala b/core/src/main/scala/spark/Utils.scala index c6a3f97872..a36186bf8a 100644 --- a/core/src/main/scala/spark/Utils.scala +++ b/core/src/main/scala/spark/Utils.scala @@ -579,8 +579,15 @@ private object Utils extends Logging { output.toString } + /** + * A regular expression to match classes of the "core" Spark API that we want to skip when + * finding the call site of a method. + */ + private val SPARK_CLASS_REGEX = """^spark(\.api\.java)?(\.rdd)?\.[A-Z]""".r + private[spark] class CallSiteInfo(val lastSparkMethod: String, val firstUserFile: String, val firstUserLine: Int, val firstUserClass: String) + /** * When called inside a class in the spark package, returns the name of the user code class * (outside the spark package) that called into Spark, as well as which Spark method they called. @@ -602,7 +609,7 @@ private object Utils extends Logging { for (el <- trace) { if (!finished) { - if (el.getClassName.startsWith("spark.") && !el.getClassName.startsWith("spark.examples.")) { + if (SPARK_CLASS_REGEX.findFirstIn(el.getClassName) != None) { lastSparkMethod = if (el.getMethodName == "<init>") { // Spark method is a constructor; get its class name el.getClassName.substring(el.getClassName.lastIndexOf('.') + 1) |