huaxingao commented on a change in pull request #20442: [SPARK-23265][ML]Update 
multi-column error handling logic in QuantileDiscretizer
URL: https://github.com/apache/spark/pull/20442#discussion_r321946449
 
 

 ##########
 File path: 
mllib/src/main/scala/org/apache/spark/ml/feature/QuantileDiscretizer.scala
 ##########
 @@ -171,25 +171,38 @@ final class QuantileDiscretizer @Since("1.6.0") 
(@Since("1.6.0") override val ui
   @Since("2.3.0")
   def setOutputCols(value: Array[String]): this.type = set(outputCols, value)
 
-  private[feature] def getInOutCols: (Array[String], Array[String]) = {
-    require((isSet(inputCol) && isSet(outputCol) && !isSet(inputCols) && 
!isSet(outputCols)) ||
-      (!isSet(inputCol) && !isSet(outputCol) && isSet(inputCols) && 
isSet(outputCols)),
-      "QuantileDiscretizer only supports setting either inputCol/outputCol or" 
+
-        "inputCols/outputCols."
-    )
+  @Since("1.6.0")
+  override def transformSchema(schema: StructType): StructType = {
+    ParamValidators.checkSingleVsMultiColumnParams(this, Seq(outputCol),
 
 Review comment:
   Thanks @viirya for your quick reply!
   The reason I didn't use 
   ```
       ParamValidators.checkSingleVsMultiColumnParams(this, Seq(outputCol, 
numBuckets),
         Seq(outputCols, numBucketsArray))
   ```
   is that we can actually setNumBuckets for multi columns. I looked the 
previous conversion, we have decided to allow setNumBuckets for multi columns. 
In the multi columns case
   ```
   If however the numBucketsArray param is unset but the numBuckets param is 
set, 
   the user is saying they want the same numBuckets across all columns, then we 
can 
   use the multi-column version of approxQuantiles in this case.
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to