[ https://issues.apache.org/jira/browse/SPARK-14023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15208308#comment-15208308 ]
Sean Owen commented on SPARK-14023: ----------------------------------- For now I'd just focus on standardizing the terminology. The only little drawback to custom exceptions is a) tiny bit more code and b) you can't just use {{require()}}. If it's just for descriptiveness, update the text. Custom exceptions make sense when you need callers to selectively catch one but that's not the case here. > Make exceptions consistent regarding fields and columns > ------------------------------------------------------- > > Key: SPARK-14023 > URL: https://issues.apache.org/jira/browse/SPARK-14023 > Project: Spark > Issue Type: Improvement > Components: MLlib > Affects Versions: 2.0.0 > Reporter: Jacek Laskowski > Priority: Trivial > > As you can see below, a column is called a field depending on where an > exception is thrown. I think it should be "column" everywhere (since that's > what has a type from a schema). > {code} > scala> lr > res32: org.apache.spark.ml.regression.LinearRegression = linReg_d9bfe808e743 > scala> lr.fit(ds) > java.lang.IllegalArgumentException: Field "features" does not exist. > at > org.apache.spark.sql.types.StructType$$anonfun$apply$1.apply(StructType.scala:214) > at > org.apache.spark.sql.types.StructType$$anonfun$apply$1.apply(StructType.scala:214) > at scala.collection.MapLike$class.getOrElse(MapLike.scala:128) > at scala.collection.AbstractMap.getOrElse(Map.scala:59) > at org.apache.spark.sql.types.StructType.apply(StructType.scala:213) > at > org.apache.spark.ml.util.SchemaUtils$.checkColumnType(SchemaUtils.scala:40) > at > org.apache.spark.ml.PredictorParams$class.validateAndTransformSchema(Predictor.scala:50) > at > org.apache.spark.ml.Predictor.validateAndTransformSchema(Predictor.scala:71) > at org.apache.spark.ml.Predictor.transformSchema(Predictor.scala:116) > at org.apache.spark.ml.PipelineStage.transformSchema(Pipeline.scala:67) > at org.apache.spark.ml.Predictor.fit(Predictor.scala:89) > ... 51 elided > scala> lr.fit(ds) > java.lang.IllegalArgumentException: requirement failed: Column label must be > of type DoubleType but was actually StringType. > at scala.Predef$.require(Predef.scala:219) > at > org.apache.spark.ml.util.SchemaUtils$.checkColumnType(SchemaUtils.scala:42) > at > org.apache.spark.ml.PredictorParams$class.validateAndTransformSchema(Predictor.scala:53) > at > org.apache.spark.ml.Predictor.validateAndTransformSchema(Predictor.scala:71) > at org.apache.spark.ml.Predictor.transformSchema(Predictor.scala:116) > at org.apache.spark.ml.PipelineStage.transformSchema(Pipeline.scala:67) > at org.apache.spark.ml.Predictor.fit(Predictor.scala:89) > ... 51 elided > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org