All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.trino.spi.function.table.TableArgument Maven / Gradle / Ivy

The newest version!
/*
 * 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.
 */
package io.trino.spi.function.table;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.trino.spi.Experimental;
import io.trino.spi.expression.ConnectorExpression;
import io.trino.spi.type.RowType;

import java.util.List;

import static java.util.Objects.requireNonNull;

/**
 * This class represents the table argument passed to a Table Function.
 * 

* This representation should be considered experimental. Eventually, {@link ConnectorExpression} * should be extended to include this kind of argument. */ @Experimental(eta = "2022-10-31") public class TableArgument extends Argument { private final RowType rowType; private final List partitionBy; private final List orderBy; @JsonCreator public TableArgument( @JsonProperty("rowType") RowType rowType, @JsonProperty("partitionBy") List partitionBy, @JsonProperty("orderBy") List orderBy) { this.rowType = requireNonNull(rowType, "rowType is null"); this.partitionBy = requireNonNull(partitionBy, "partitionBy is null"); this.orderBy = requireNonNull(orderBy, "orderBy is null"); } @JsonProperty public RowType getRowType() { return rowType; } @JsonProperty public List getPartitionBy() { return partitionBy; } @JsonProperty public List getOrderBy() { return orderBy; } public static Builder builder() { return new Builder(); } public static final class Builder { private RowType rowType; private List partitionBy = List.of(); private List orderBy = List.of(); private Builder() {} public Builder rowType(RowType rowType) { this.rowType = rowType; return this; } public Builder partitionBy(List partitionBy) { this.partitionBy = partitionBy; return this; } public Builder orderBy(List orderBy) { this.orderBy = orderBy; return this; } public TableArgument build() { return new TableArgument(rowType, partitionBy, orderBy); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy