com.hazelcast.org.apache.calcite.schema.impl.ViewTableMacro 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.hazelcast.org.apache.calcite.schema.impl;
import com.hazelcast.org.apache.calcite.adapter.java.JavaTypeFactory;
import com.hazelcast.org.apache.calcite.jdbc.CalciteConnection;
import com.hazelcast.org.apache.calcite.jdbc.CalcitePrepare;
import com.hazelcast.org.apache.calcite.jdbc.CalciteSchema;
import com.hazelcast.org.apache.calcite.rel.type.RelDataTypeImpl;
import com.hazelcast.org.apache.calcite.schema.FunctionParameter;
import com.hazelcast.org.apache.calcite.schema.Schemas;
import com.hazelcast.org.apache.calcite.schema.TableMacro;
import com.hazelcast.org.apache.calcite.schema.TranslatableTable;
import com.hazelcast.com.google.common.collect.ImmutableList;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
/** Table function that implements a view. It returns the operator
* tree of the view's SQL query. */
public class ViewTableMacro implements TableMacro {
protected final String viewSql;
protected final CalciteSchema schema;
private final Boolean modifiable;
/** Typically null. If specified, overrides the path of the schema as the
* context for validating {@code viewSql}. */
protected final List schemaPath;
protected final List viewPath;
/**
* Creates a ViewTableMacro.
*
* @param schema Root schema
* @param viewSql SQL defining the view
* @param schemaPath Schema path relative to the root schema
* @param viewPath View path relative to the schema path
* @param modifiable Request that a view is modifiable (dependent on analysis
* of {@code viewSql})
*/
public ViewTableMacro(CalciteSchema schema, String viewSql,
List schemaPath, List viewPath, Boolean modifiable) {
this.viewSql = viewSql;
this.schema = schema;
this.viewPath = viewPath == null ? null : ImmutableList.copyOf(viewPath);
this.modifiable = modifiable;
this.schemaPath =
schemaPath == null ? null : ImmutableList.copyOf(schemaPath);
}
public List getParameters() {
return Collections.emptyList();
}
public TranslatableTable apply(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy