Search in sources :

Example 1 with EQUAL

use of io.prestosql.spi.function.OperatorType.EQUAL in project hetu-core by openlookeng.

the class RowExpressionDomainTranslator method extractDisjuncts.

private List<RowExpression> extractDisjuncts(Type type, DiscreteValues discreteValues, RowExpression reference) {
    List<RowExpression> values = discreteValues.getValues().stream().map(object -> toRowExpression(object, type)).collect(toList());
    // If values is empty, then the equatableValues was either ALL or NONE, both of which should already have been checked for
    checkState(!values.isEmpty());
    RowExpression predicate;
    if (values.size() == 1) {
        predicate = equal(reference, getOnlyElement(values));
    } else {
        predicate = in(reference, values);
    }
    if (!discreteValues.isWhiteList()) {
        predicate = not(functionResolution, predicate);
    }
    return ImmutableList.of(predicate);
}
Also used : ConstantExpression(io.prestosql.spi.relation.ConstantExpression) FALSE_CONSTANT(io.prestosql.expressions.LogicalRowExpressions.FALSE_CONSTANT) LogicalRowExpressions(io.prestosql.expressions.LogicalRowExpressions) DiscreteValues(io.prestosql.spi.predicate.DiscreteValues) OperatorNotFoundException(io.prestosql.metadata.OperatorNotFoundException) ValueSet(io.prestosql.spi.predicate.ValueSet) NullableValue(io.prestosql.spi.predicate.NullableValue) PeekingIterator(com.google.common.collect.PeekingIterator) DeterminismEvaluator(io.prestosql.spi.relation.DeterminismEvaluator) LESS_THAN(io.prestosql.spi.function.OperatorType.LESS_THAN) CallExpression(io.prestosql.spi.relation.CallExpression) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) ConnectorSession(io.prestosql.spi.connector.ConnectorSession) Expressions.call(io.prestosql.sql.relational.Expressions.call) Slices(io.airlift.slice.Slices) OperatorType(io.prestosql.spi.function.OperatorType) Map(java.util.Map) BOOLEAN(io.prestosql.spi.type.BooleanType.BOOLEAN) FunctionMetadata(io.prestosql.spi.function.FunctionMetadata) Type(io.prestosql.spi.type.Type) OR(io.prestosql.spi.relation.SpecialForm.Form.OR) IS_NULL(io.prestosql.spi.relation.SpecialForm.Form.IS_NULL) SliceUtf8.getCodePointAt(io.airlift.slice.SliceUtf8.getCodePointAt) EQUAL(io.prestosql.spi.function.OperatorType.EQUAL) DomainTranslator(io.prestosql.spi.relation.DomainTranslator) ImmutableMap(com.google.common.collect.ImmutableMap) CastType(io.prestosql.metadata.CastType) LikeFunctions(io.prestosql.type.LikeFunctions) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) SortedRangeSet(io.prestosql.spi.predicate.SortedRangeSet) Metadata(io.prestosql.metadata.Metadata) Preconditions.checkState(com.google.common.base.Preconditions.checkState) FunctionHandle(io.prestosql.spi.function.FunctionHandle) RowExpressionInterpreter(io.prestosql.sql.planner.RowExpressionInterpreter) List(java.util.List) IS_DISTINCT_FROM(io.prestosql.spi.function.OperatorType.IS_DISTINCT_FROM) LambdaDefinitionExpression(io.prestosql.spi.relation.LambdaDefinitionExpression) Domain(io.prestosql.spi.predicate.Domain) Optional(java.util.Optional) LESS_THAN_OR_EQUAL(io.prestosql.spi.function.OperatorType.LESS_THAN_OR_EQUAL) FunctionAndTypeManager(io.prestosql.metadata.FunctionAndTypeManager) Utils(io.prestosql.spi.predicate.Utils) TRUE_CONSTANT(io.prestosql.expressions.LogicalRowExpressions.TRUE_CONSTANT) Slice(io.airlift.slice.Slice) NOT_EQUAL(io.prestosql.spi.function.OperatorType.NOT_EQUAL) Marker(io.prestosql.spi.predicate.Marker) RowExpressionVisitor(io.prestosql.spi.relation.RowExpressionVisitor) StandardFunctionResolution(io.prestosql.spi.function.StandardFunctionResolution) Collectors.collectingAndThen(java.util.stream.Collectors.collectingAndThen) LogicalRowExpressions.and(io.prestosql.expressions.LogicalRowExpressions.and) ArrayList(java.util.ArrayList) GREATER_THAN_OR_EQUAL(io.prestosql.spi.function.OperatorType.GREATER_THAN_OR_EQUAL) OPTIMIZED(io.prestosql.sql.planner.RowExpressionInterpreter.Level.OPTIMIZED) Inject(javax.inject.Inject) ImmutableList(com.google.common.collect.ImmutableList) InterpretedFunctionInvoker(io.prestosql.sql.InterpretedFunctionInvoker) LiteralEncoder.toRowExpression(io.prestosql.sql.planner.LiteralEncoder.toRowExpression) Range(io.prestosql.spi.predicate.Range) AND(io.prestosql.spi.relation.SpecialForm.Form.AND) Objects.requireNonNull(java.util.Objects.requireNonNull) GREATER_THAN(io.prestosql.spi.function.OperatorType.GREATER_THAN) Comparator.comparing(java.util.Comparator.comparing) SpecialForm(io.prestosql.spi.relation.SpecialForm) Iterators.peekingIterator(com.google.common.collect.Iterators.peekingIterator) Block(io.prestosql.spi.block.Block) Nullable(javax.annotation.Nullable) Symbol(io.prestosql.spi.plan.Symbol) IN(io.prestosql.spi.relation.SpecialForm.Form.IN) InternalTypeManager(io.prestosql.type.InternalTypeManager) SliceUtf8.lengthOfCodePoint(io.airlift.slice.SliceUtf8.lengthOfCodePoint) LogicalRowExpressions.or(io.prestosql.expressions.LogicalRowExpressions.or) TypeSignatureProvider.fromTypes(io.prestosql.sql.analyzer.TypeSignatureProvider.fromTypes) Ranges(io.prestosql.spi.predicate.Ranges) TupleDomain(io.prestosql.spi.predicate.TupleDomain) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) VariableReferenceExpression(io.prestosql.spi.relation.VariableReferenceExpression) SliceUtf8.setCodePointAt(io.airlift.slice.SliceUtf8.setCodePointAt) Collectors.toList(java.util.stream.Collectors.toList) InputReferenceExpression(io.prestosql.spi.relation.InputReferenceExpression) RowExpression(io.prestosql.spi.relation.RowExpression) SliceUtf8.countCodePoints(io.airlift.slice.SliceUtf8.countCodePoints) VarcharType(io.prestosql.spi.type.VarcharType) LiteralEncoder.toRowExpression(io.prestosql.sql.planner.LiteralEncoder.toRowExpression) RowExpression(io.prestosql.spi.relation.RowExpression)

Aggregations

Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Iterables.getOnlyElement (com.google.common.collect.Iterables.getOnlyElement)1 Iterators.peekingIterator (com.google.common.collect.Iterators.peekingIterator)1 PeekingIterator (com.google.common.collect.PeekingIterator)1 Slice (io.airlift.slice.Slice)1 SliceUtf8.countCodePoints (io.airlift.slice.SliceUtf8.countCodePoints)1 SliceUtf8.getCodePointAt (io.airlift.slice.SliceUtf8.getCodePointAt)1 SliceUtf8.lengthOfCodePoint (io.airlift.slice.SliceUtf8.lengthOfCodePoint)1 SliceUtf8.setCodePointAt (io.airlift.slice.SliceUtf8.setCodePointAt)1 Slices (io.airlift.slice.Slices)1 LogicalRowExpressions (io.prestosql.expressions.LogicalRowExpressions)1 FALSE_CONSTANT (io.prestosql.expressions.LogicalRowExpressions.FALSE_CONSTANT)1 TRUE_CONSTANT (io.prestosql.expressions.LogicalRowExpressions.TRUE_CONSTANT)1 LogicalRowExpressions.and (io.prestosql.expressions.LogicalRowExpressions.and)1 LogicalRowExpressions.or (io.prestosql.expressions.LogicalRowExpressions.or)1 CastType (io.prestosql.metadata.CastType)1