[ https://issues.apache.org/jira/browse/HIVE-26243?focusedWorklogId=827175&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-827175 ]
ASF GitHub Bot logged work on HIVE-26243: ----------------------------------------- Author: ASF GitHub Bot Created on: 18/Nov/22 13:40 Start Date: 18/Nov/22 13:40 Worklog Time Spent: 10m Work Description: asolimando commented on code in PR #3317: URL: https://github.com/apache/hive/pull/3317#discussion_r1026448025 ########## ql/src/java/org/apache/hadoop/hive/ql/udf/generic/histogram/kll/KllUtils.java: ########## @@ -0,0 +1,106 @@ +/* + * 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.ql.udf.generic.histogram.kll; + +import org.apache.datasketches.kll.KllFloatsSketch; +import org.apache.datasketches.memory.Memory; +import org.apache.hadoop.hive.ql.util.JavaDataModel; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * KLL serialization utilities. + */ +public class KllUtils { + + private KllUtils() { + throw new AssertionError("Suppress default constructor for non instantiation"); + } + + /** + * KLL is serialized according to what provided by data-sketches library + * @param out output stream to write to + * @param kll KLL sketch that needs to be serialized + * @throws IOException if an error occurs during serialization + */ + public static void serializeKll(OutputStream out, KllFloatsSketch kll) throws IOException { + out.write(kll.toByteArray()); + } + + /** + * This function deserializes the serialized KLL sketch from a stream. + * @param in input stream to be deserialized + * @return KLL sketch + * @throws IOException if errors occur while reading the stream + */ + public static KllFloatsSketch deserializeKll(InputStream in) throws IOException { Review Comment: I have removed it and double checked the other methods, since generated code is involved my IDE is not 100% accurate, thanks for catching this Issue Time Tracking ------------------- Worklog Id: (was: 827175) Time Spent: 5h 40m (was: 5.5h) > 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: 5h 40m > 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)