17 package org.apache.calcite.prepare;
19 import org.apache.calcite.rel.type.RelDataType;
20 import org.apache.calcite.rel.type.RelDataTypeFactory;
21 import org.apache.calcite.runtime.CalciteException;
22 import org.apache.calcite.sql.SqlKind;
23 import org.apache.calcite.sql.SqlNode;
24 import org.apache.calcite.sql.SqlNodeList;
25 import org.apache.calcite.sql.SqlOperatorTable;
26 import org.apache.calcite.sql.SqlSelect;
27 import org.apache.calcite.sql.advise.SqlAdvisorValidator;
28 import org.apache.calcite.sql.validate.SqlValidatorCatalogReader;
29 import org.apache.calcite.sql.validate.SqlValidatorScope;
30 import org.apache.calcite.util.Util;
32 import java.util.List;
36 SqlOperatorTable opTab,
37 SqlValidatorCatalogReader catalogReader,
38 RelDataTypeFactory typeFactory,
40 super(opTab, catalogReader, typeFactory, config);
47 SqlNodeList groupList = select.getGroup();
48 if (groupList == null) {
53 for (
final SqlNode groupItem : groupList) {
54 final SqlValidatorScope groupScope = getGroupScope(select);
55 groupItem.validate(
this, groupScope);
57 super.validateGroupClause(select);
58 }
catch (CalciteException e) {
59 Util.swallow(e, TRACER);
65 SqlNode node, RelDataType targetRowType, SqlValidatorScope scope) {
70 if (node.getKind() == SqlKind.IDENTIFIER
74 super.validateFrom(node, targetRowType, scope);
75 }
catch (CalciteException e) {
76 Util.swallow(e, TRACER);
83 return !tableName.isEmpty() && Character.isAlphabetic(tableName.charAt(0))
85 visibleTableName -> visibleTableName.equalsIgnoreCase(tableName));
boolean violatedTablePermissions
void validateGroupClause(SqlSelect select)
HeavyDBSqlAdvisorValidator(List< String > visibleTables, SqlOperatorTable opTab, SqlValidatorCatalogReader catalogReader, RelDataTypeFactory typeFactory, Config config)
List< String > visibleTables
void validateFrom(SqlNode node, RelDataType targetRowType, SqlValidatorScope scope)
boolean tableViolatesPermissions(final String tableName)
boolean hasViolatedTablePermissions()