Manya0407 commented on code in PR #6616:
URL: https://github.com/apache/hive/pull/6616#discussion_r3637255072


##########
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/StringLTrimScalarCol.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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.exec.vector.expressions;
+
+import java.util.Arrays;
+
+import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.VectorExpressionDescriptor;
+import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch;
+import org.apache.hadoop.hive.ql.metadata.HiveException;
+
+/**
+ * Vectorized LTRIM with a scalar string and a trim-characters column.
+ */
+public class StringLTrimScalarCol extends VectorExpression {

Review Comment:
   StringUnaryUDFDirect is for unary expressions with a single column input 
(e.g. StringTrimCol, StringTrimColScalar). The *ScalarCol classes are binary 
SCALAR + COLUMN expressions: a fixed scalar string plus a per-row 
trim-characters column. That operand pattern doesn’t match the unary base class 
API.
   
   For SCALAR + COLUMN, the existing precedent in Hive is 
StringScalarConcatStringGroupCol, which also extends VectorExpression directly 
and implements its own evaluate() loop. We followed the same approach for 
StringTrimScalarCol, StringLTrimScalarCol, and StringRTrimScalarCol.
   
   COL + SCALAR (trim(col, 'xy')) already uses StringTrimColScalarBase → 
StringUnaryUDFDirect. COL + COLUMN uses NullUtil.propagateNullsColCol in the 
ColCol classes.
   
   I can extract a shared base for the three *ScalarCol classes if you’d prefer 
less duplication in evaluate(), but extending StringUnaryUDFDirect wouldn’t be 
the right fit for this operand pattern.
   
   



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