17 package com.mapd.calcite.parser;
19 import static com.mapd.calcite.parser.HeavyDBParser.CURRENT_PARSER;
23 import org.apache.calcite.plan.RelOptTable;
25 import org.apache.calcite.rel.RelNode;
26 import org.apache.calcite.rel.RelRoot;
27 import org.apache.calcite.rel.type.RelDataType;
28 import org.apache.calcite.rel.type.RelDataTypeFactory;
29 import org.apache.calcite.schema.Schema;
30 import org.apache.calcite.schema.TranslatableTable;
31 import org.apache.calcite.sql.parser.SqlParseException;
32 import org.apache.calcite.tools.RelConversionException;
33 import org.apache.calcite.tools.ValidationException;
34 import org.slf4j.Logger;
35 import org.slf4j.LoggerFactory;
37 import java.util.ArrayList;
39 import ai.heavy.thrift.server.TTableDetails;
42 final static Logger
HEAVYDBLOGGER = LoggerFactory.getLogger(HeavyDBView.class);
49 this.viewSql = view_sql;
54 }
catch (SqlParseException e) {
55 HEAVYDBLOGGER.error(
"error parsing view SQL: " + view_sql, e);
56 }
catch (ValidationException ex) {
57 HEAVYDBLOGGER.error(
"error validating view SQL: " + view_sql, ex);
58 }
catch (RelConversionException ex) {
59 HEAVYDBLOGGER.error(
"error doing Rel Conversion view SQL: " + view_sql, ex);
64 return "View SQL: " +
viewSql +
"\n"
78 return Schema.TableType.VIEW;
82 public RelNode
toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable) {
83 return viewRelRoot.rel;
88 return viewRelRoot.validatedRowType;
RelDataType getRowType(RelDataTypeFactory rdtf)
Schema.TableType getJdbcTableType()
static final Logger HEAVYDBLOGGER
SqlIdentifierCapturer getAccessedObjects()
HeavyDBView(String view_sql, TTableDetails ri, HeavyDBParser mp)
SqlIdentifierCapturer accessObjects
RelNode toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable)