com.qubole.quark.planner.QuarkTable Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2015. Qubole Inc
* 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 com.qubole.quark.planner;
import org.apache.calcite.adapter.java.JavaTypeFactory;
import org.apache.calcite.linq4j.AbstractEnumerable;
import org.apache.calcite.linq4j.Enumerable;
import org.apache.calcite.linq4j.QueryProvider;
import org.apache.calcite.linq4j.Queryable;
import org.apache.calcite.linq4j.tree.Expression;
import org.apache.calcite.plan.RelOptTable;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeFactory;
import org.apache.calcite.schema.QueryableTable;
import org.apache.calcite.schema.SchemaPlus;
import org.apache.calcite.schema.Schemas;
import org.apache.calcite.schema.TranslatableTable;
import org.apache.calcite.schema.impl.AbstractTable;
import org.apache.calcite.util.Pair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
/**
* Source of inspiration is Kylin:OlapTable
* and
* https://github.com/apache/incubator-calcite/tree/master/
* example/csv/src/main/java/org/apache/calcite/adapter/csv
*/
public class QuarkTable extends AbstractTable
implements QueryableTable, TranslatableTable {
protected static final Logger LOG = LoggerFactory.getLogger(QuarkTable.class);
protected final QuarkSchema schema;
protected final String name;
protected final List columns;
public QuarkTable(QuarkSchema schema, String name, List columns) {
this.schema = schema;
this.name = name;
this.columns = columns;
}
/**
* Returns an enumerable over a given projection of the fields.
*
* Called from generated code.
*/
public Enumerable