com.datastax.oss.driver.api.core.metadata.schema.AggregateMetadata Maven / Gradle / Ivy
/*
* 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 com.datastax.oss.driver.api.core.metadata.schema;
import com.datastax.oss.driver.api.core.CqlIdentifier;
import com.datastax.oss.driver.api.core.type.DataType;
import com.datastax.oss.driver.api.core.type.codec.TypeCodec;
import com.datastax.oss.driver.internal.core.metadata.schema.ScriptBuilder;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.util.Optional;
/** A CQL aggregate in the schema metadata. */
public interface AggregateMetadata extends Describable {
@NonNull
CqlIdentifier getKeyspace();
@NonNull
FunctionSignature getSignature();
/**
* The signature of the final function of this aggregate, or empty if there is none.
*
* This is the function specified with {@code FINALFUNC} in the {@code CREATE AGGREGATE...}
* statement. It transforms the final value after the aggregation is complete.
*/
@NonNull
Optional getFinalFuncSignature();
/**
* The initial state value of this aggregate, or {@code null} if there is none.
*
* This is the value specified with {@code INITCOND} in the {@code CREATE AGGREGATE...}
* statement. It's passed to the initial invocation of the state function (if that function does
* not accept null arguments).
*
*
The actual type of the returned object depends on the aggregate's {@link #getStateType()
* state type} and on the {@link TypeCodec codec} used to {@link TypeCodec#parse(String) parse}
* the {@code INITCOND} literal.
*
*
If, for some reason, the {@code INITCOND} literal cannot be parsed, a warning will be logged
* and the returned object will be the original {@code INITCOND} literal in its textual,
* non-parsed form.
*
* @return the initial state, or empty if there is none.
*/
@NonNull
Optional