dtenedor commented on code in PR #52800: URL: https://github.com/apache/spark/pull/52800#discussion_r2482528636
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/kllExpressions.scala: ########## @@ -0,0 +1,577 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.catalyst.expressions + +import org.apache.datasketches.kll._ +import org.apache.datasketches.memory.Memory + +import org.apache.spark.sql.catalyst.expressions.codegen.CodegenFallback +import org.apache.spark.sql.catalyst.util.{ArrayData, GenericArrayData} +import org.apache.spark.sql.errors.QueryExecutionErrors +import org.apache.spark.sql.types._ +import org.apache.spark.unsafe.types.UTF8String + +// scalastyle:off line.size.limit +@ExpressionDescription( + usage = """ + _FUNC_(expr) - Returns human readable summary information about this sketch. + """, + examples = """ + Examples: + > SELECT LENGTH(_FUNC_(kll_sketch_agg_bigint(col))) > 0 FROM VALUES (1), (2), (3), (4), (5) tab(col); + true + """, + group = "misc_funcs", + since = "4.1.0") +case class KllSketchToStringBigint(child: Expression) extends KllSketchToStringBase { Review Comment: It's for debugging/ad-hoc purposes mostly. This is an example what the string looks like: ``` ### KllDirectCompactKllLongsSketch Summary: K : 200 Dynamic min K : 200 M : 8 N : 7 Epsilon : 1.329% Epsilon PMF : 1.652% Empty : false Estimation Mode : false Levels : 1 Level 0 Sorted : false Capacity Items : 200 Retained Items : 7 Free Space : 193 ReadOnly : true(Format) Updatable Storage Bytes: 1644 Compact Storage Bytes : 96 Min Item : 1 Max Item : 7 ``` It's not meant to be consumed by automated tools or saved into storage, but instead just give an introspection ability that users of the regular Java API already get. -- 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]
