MaxGekk commented on code in PR #41486:
URL: https://github.com/apache/spark/pull/41486#discussion_r1233335296


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala:
##########
@@ -2849,4 +2849,23 @@ private[sql] object QueryExecutionErrors extends 
QueryErrorsBase {
         "data" -> data,
         "enumString" -> enumString))
   }
+
+  def hllInvalidLogK(function: String, min: String, max: String, value: 
String): Throwable = {
+    new SparkRuntimeException(
+      errorClass = "HLL_INVALID_LOG_K",
+      messageParameters = Map(
+        "function" -> function,

Review Comment:
   Please, quote the function name by `toSQLId`



##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/datasketchesAggregates.scala:
##########
@@ -286,19 +285,17 @@ case class HllUnionAgg(
   }
 
   /**
-   * Helper method to compare lgConfigKs and throw an exception if
-   * allowDifferentLgConfigK isn't true and configs don't match
+   * Helper method to compare lgConfigKs and throw an exception if 
allowDifferentLgConfigK isn't
+   * true and configs don't match.
    *
    * @param left An lgConfigK value
    * @param right An lgConfigK value
    */
   def compareLgConfigK(left: Int, right: Int): Unit = {
     if (!allowDifferentLgConfigK) {
       if (left != right) {
-        throw new UnsupportedOperationException(
-          s"Sketches have different lgConfigK values: $left and $right. " +
-            "Set allowDifferentLgConfigK to true to enable unions of " +
-            "different lgConfigK values.")
+        throw QueryExecutionErrors.hllUnionDifferentLogK(
+          left.toString, right.toString, function = "HLL_UNION_AGG")

Review Comment:
   Could you just pass `left` and `right` as is, and quote them by `toSQLVal`



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to