Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.facebook.presto.operator.scalar;
 /*
  * Licensed 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.
 */
import static com.facebook.presto.metadata.FunctionRegistry.operatorInfo;
import static com.facebook.presto.metadata.OperatorType.EQUAL;
import static com.facebook.presto.metadata.Signature.comparableWithVariadicBound;
import static com.facebook.presto.spi.type.TypeSignature.parseTypeSignature;
import static com.facebook.presto.util.Reflection.methodHandle;
public class RowEqualOperator
        extends ParametricOperator
    public static final RowEqualOperator ROW_EQUAL = new RowEqualOperator();
    private static final TypeSignature RETURN_TYPE = parseTypeSignature(.);
    private static final MethodHandle METHOD_HANDLE = methodHandle(RowEqualOperator.class"equals"Type.classSlice.classSlice.class);
    private RowEqualOperator()
    {
        super(, ImmutableList.of(comparableWithVariadicBound("T""row")), ., ImmutableList.of("T""T"));
    }
    @Override
    public FunctionInfo specialize(Map<StringTypetypesint arityTypeManager typeManagerFunctionRegistry functionRegistry)
    {
        Type type = types.get("T");
        TypeSignature typeSignature = type.getTypeSignature();
        return operatorInfo(, ImmutableList.of(typeSignaturetypeSignature), .bindTo(type), false, ImmutableList.of(falsefalse));
    }
    public static boolean equals(Type rowTypeSlice leftRowSlice rightRow)
    {
        BlockBuilder leftBlockBuilder = rowType.createBlockBuilder(new BlockBuilderStatus(), 1, leftRow.length());
        BlockBuilder rightBlockBuilder = rowType.createBlockBuilder(new BlockBuilderStatus(), 1, rightRow.length());
        leftBlockBuilder.writeBytes(leftRow, 0, leftRow.length());
        rightBlockBuilder.writeBytes(rightRow, 0, rightRow.length());
        return rowType.equalTo(leftBlockBuilder.closeEntry().build(), 0, rightBlockBuilder.closeEntry().build(), 0);
    }
New to GrepCode? Check out our FAQ X