You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/11/03 13:00:00 UTC

[jira] [Work logged] (HIVE-26243) Add vectorized implementation of the 'ds_kll_sketch' UDAF

     [ https://issues.apache.org/jira/browse/HIVE-26243?focusedWorklogId=823077&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-823077 ]

ASF GitHub Bot logged work on HIVE-26243:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 03/Nov/22 12:59
            Start Date: 03/Nov/22 12:59
    Worklog Time Spent: 10m 
      Work Description: deniskuzZ commented on code in PR #3317:
URL: https://github.com/apache/hive/pull/3317#discussion_r1012845371


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/Vectorizer.java:
##########
@@ -304,7 +327,7 @@ public enum EnabledOverride {
         nameMap.put(
             vectorizationEnabledOverride.name().toLowerCase(), vectorizationEnabledOverride);

Review Comment:
   could you please create toString() method that returns name().toLowerCase() and use that



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/common/histogram/KllHistogramEstimator.java:
##########
@@ -0,0 +1,83 @@
+/*
+ * 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.hadoop.hive.common.histogram;
+
+import org.apache.datasketches.kll.KllFloatsSketch;
+import org.apache.hadoop.hive.common.histogram.kll.KllUtils;
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.ql.util.JavaDataModel;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+public class KllHistogramEstimator {

Review Comment:
   should we keep those classes in hive-exec module?



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/common/histogram/KllHistogramEstimatorFactory.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.hadoop.hive.common.histogram;
+
+import org.apache.hadoop.hive.common.histogram.kll.KllUtils;
+
+public class KllHistogramEstimatorFactory {
+
+  private KllHistogramEstimatorFactory() {
+    throw new AssertionError("Suppress default constructor for non instantiation");
+  }
+
+  /**
+   * This function deserializes the serialized KLL histogram estimator from a byte array.
+   * @param buf to deserialize
+   * @return KLL histogram estimator
+   */
+  public static KllHistogramEstimator getKllHistogramEstimator(byte[] buf) {

Review Comment:
   is it used? 



##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/common/histogram/KllHistogramEstimatorFactory.java:
##########
@@ -0,0 +1,75 @@
+/*
+ * 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.hadoop.hive.common.histogram;
+
+import org.apache.hadoop.hive.common.histogram.kll.KllUtils;
+
+public class KllHistogramEstimatorFactory {
+
+  private KllHistogramEstimatorFactory() {
+    throw new AssertionError("Suppress default constructor for non instantiation");
+  }
+
+  /**
+   * This function deserializes the serialized KLL histogram estimator from a byte array.
+   * @param buf to deserialize
+   * @return KLL histogram estimator
+   */
+  public static KllHistogramEstimator getKllHistogramEstimator(byte[] buf) {
+    return new KllHistogramEstimator(KllUtils.deserializeKll(buf, 0, buf.length));
+  }
+
+  /**
+   * This function deserializes the serialized KLL histogram estimator from a byte array.
+   * @param buf to deserialize
+   * @param start start index for deserialization
+   * @param len start+len is deserialized
+   * @return KLL histogram estimator
+   */
+  public static KllHistogramEstimator getKllHistogramEstimator(byte[] buf, int start, int len) {
+    return new KllHistogramEstimator(KllUtils.deserializeKll(buf, start, len));
+  }
+
+  /**
+   * This method creates an empty histogram estimator with a KLL sketch with k=200.
+   * @return an empty histogram estimator with a KLL sketch with k=200
+   */
+  public static KllHistogramEstimator getEmptyHistogramEstimator() {

Review Comment:
   i think this is still valid, please check and remove unused factory methods





Issue Time Tracking
-------------------

    Worklog Id:     (was: 823077)
    Time Spent: 3h  (was: 2h 50m)

> Add vectorized implementation of the 'ds_kll_sketch' UDAF
> ---------------------------------------------------------
>
>                 Key: HIVE-26243
>                 URL: https://issues.apache.org/jira/browse/HIVE-26243
>             Project: Hive
>          Issue Type: Improvement
>          Components: UDF, Vectorization
>    Affects Versions: 4.0.0-alpha-2
>            Reporter: Alessandro Solimando
>            Assignee: Alessandro Solimando
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 3h
>  Remaining Estimate: 0h
>
> _ds_kll_sketch_ UDAF does not have a vectorized implementation at the moment, the present ticket aims at bridging this gap.
> This is particularly important because vectorization has an "all or nothing" approach, so if this function is used at the side of vectorized functions, they won't be able to benefit from vectorized execution.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)