Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.amazonaws.athena.connector.lambda.domain.predicate;
/*-
* #%L
* Amazon Athena Query Federation SDK
* %%
* Copyright (C) 2019 Amazon Web Services
* %%
* 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.
* #L%
*/
import com.amazonaws.athena.connector.lambda.data.ArrowTypeComparator;
import com.amazonaws.athena.connector.lambda.data.Block;
import com.amazonaws.athena.connector.lambda.data.BlockAllocator;
import com.amazonaws.athena.connector.lambda.data.BlockUtils;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.arrow.vector.FieldVector;
import org.apache.arrow.vector.complex.reader.FieldReader;
import org.apache.arrow.vector.types.Types;
import org.apache.arrow.vector.types.pojo.ArrowType;
import org.apache.arrow.vector.types.pojo.Schema;
import java.beans.Transient;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import static java.util.Objects.requireNonNull;
/**
* A set containing values that are uniquely identifiable.
* Assumes an infinite number of possible values. The values may be collectively included (aka whitelist)
* or collectively excluded (aka !whitelist).
*
* @see ValueSet
*/
public class EquatableValueSet
implements ValueSet
{
//The name of the single column used to represent values in the valueBlock.
private static final String DEFAULT_COLUMN = "col1";
private final boolean whiteList;
private final Block valueBlock;
public final boolean nullAllowed;
/**
* Constructs a new EquatableValueSet.
*
* @param valueBlock The values that are in this ValueSet expressed as a Block of Apache Arrow records.
* @param whiteList True if this ValueSet is a white list (only these values), False if these are excluded values.
* @param nullAllowed True if null values should be considered part of this ValueSet, False otherwise.
*/
@JsonCreator
public EquatableValueSet(
@JsonProperty("valueBlock") Block valueBlock,
@JsonProperty("whiteList") boolean whiteList,
@JsonProperty("nullAllowed") boolean nullAllowed)
{
requireNonNull(valueBlock, "valueBlock is null");
this.valueBlock = valueBlock;
this.whiteList = whiteList;
this.nullAllowed = nullAllowed;
}
/**
* Used to construct new Builder for EquatableValueSet.
*
* @param allocator The BlockAllocator to use when allocating Apache Arrow resources.
* @param type The type of the field that this EquatableValueSet will apply to.
* @param isWhiteList True if the EquatableValueSet will be a whitelist.
* @param nullAllowed True if the EquatableValueSet should include NULL.
* @return A new Builder that can be used to add values and create a new EquatableValueSet.
*/
public static Builder newBuilder(BlockAllocator allocator, ArrowType type, boolean isWhiteList, boolean nullAllowed)
{
return new Builder(allocator, type, isWhiteList, nullAllowed);
}
static EquatableValueSet none(BlockAllocator allocator, ArrowType type)
{
return new EquatableValueSet(BlockUtils.newEmptyBlock(allocator, DEFAULT_COLUMN, type), true, false);
}
static EquatableValueSet all(BlockAllocator allocator, ArrowType type)
{
return new EquatableValueSet(BlockUtils.newEmptyBlock(allocator, DEFAULT_COLUMN, type), false, true);
}
static EquatableValueSet onlyNull(BlockAllocator allocator, ArrowType type)
{
return new EquatableValueSet(BlockUtils.newEmptyBlock(allocator, DEFAULT_COLUMN, type), false, true);
}
static EquatableValueSet notNull(BlockAllocator allocator, ArrowType type)
{
return new EquatableValueSet(BlockUtils.newEmptyBlock(allocator, DEFAULT_COLUMN, type), false, false);
}
static EquatableValueSet of(BlockAllocator allocator, ArrowType type, Object... values)
{
return new EquatableValueSet(BlockUtils.newBlock(allocator, DEFAULT_COLUMN, type, values), true, false);
}
static EquatableValueSet of(BlockAllocator allocator, ArrowType type, boolean nullAllowed, Collection