OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator Class Reference
+ Inheritance diagram for org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator:
+ Collaboration diagram for org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator:

Protected Member Functions

void validateGroupClause (SqlSelect select)
 
void validateFrom (SqlNode node, RelDataType targetRowType, SqlValidatorScope scope)
 

Package Functions

 HeavyDBSqlAdvisorValidator (List< String > visibleTables, SqlOperatorTable opTab, SqlValidatorCatalogReader catalogReader, RelDataTypeFactory typeFactory, Config config)
 
boolean tableViolatesPermissions (final String tableName)
 
boolean hasViolatedTablePermissions ()
 

Private Attributes

List< String > visibleTables
 
boolean violatedTablePermissions = false
 

Detailed Description

Definition at line 34 of file HeavyDBSqlAdvisorValidator.java.

Constructor & Destructor Documentation

org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.HeavyDBSqlAdvisorValidator ( List< String >  visibleTables,
SqlOperatorTable  opTab,
SqlValidatorCatalogReader  catalogReader,
RelDataTypeFactory  typeFactory,
Config  config 
)
inlinepackage

Definition at line 35 of file HeavyDBSqlAdvisorValidator.java.

References org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.visibleTables.

39  {
40  super(opTab, catalogReader, typeFactory, config);
41  this.visibleTables = visibleTables;
42  }

Member Function Documentation

boolean org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.hasViolatedTablePermissions ( )
inlinepackage

Definition at line 88 of file HeavyDBSqlAdvisorValidator.java.

References org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.violatedTablePermissions.

Referenced by org.apache.calcite.prepare.HeavyDBSqlAdvisor.getCompletionHints().

+ Here is the caller graph for this function:

boolean org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.tableViolatesPermissions ( final String  tableName)
inlinepackage

Definition at line 82 of file HeavyDBSqlAdvisorValidator.java.

References org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.visibleTables.

Referenced by org.apache.calcite.prepare.HeavyDBSqlAdvisor.applyPermissionsToTableHints(), and org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.validateFrom().

82  {
83  return !tableName.isEmpty() && Character.isAlphabetic(tableName.charAt(0))
84  && visibleTables.stream().noneMatch(
85  visibleTableName -> visibleTableName.equalsIgnoreCase(tableName));
86  }

+ Here is the caller graph for this function:

void org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.validateFrom ( SqlNode  node,
RelDataType  targetRowType,
SqlValidatorScope  scope 
)
inlineprotected

Definition at line 64 of file HeavyDBSqlAdvisorValidator.java.

References org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.tableViolatesPermissions(), and org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.violatedTablePermissions.

65  {
66  try {
67  // Must not return columns from a table which is not visible. Since column
68  // hints are returned without their table, we must keep track of visibility
69  // violations during validation.
70  if (node.getKind() == SqlKind.IDENTIFIER
71  && tableViolatesPermissions(node.toString())) {
73  }
74  super.validateFrom(node, targetRowType, scope);
75  } catch (CalciteException e) {
76  Util.swallow(e, TRACER);
77  }
78  }

+ Here is the call graph for this function:

void org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.validateGroupClause ( SqlSelect  select)
inlineprotected

Definition at line 45 of file HeavyDBSqlAdvisorValidator.java.

45  {
46  try {
47  SqlNodeList groupList = select.getGroup();
48  if (groupList == null) {
49  return;
50  }
51  // Validate the group items so that completions are available for them.
52  // For some reason, the base class doesn't do it.
53  for (final SqlNode groupItem : groupList) {
54  final SqlValidatorScope groupScope = getGroupScope(select);
55  groupItem.validate(this, groupScope);
56  }
57  super.validateGroupClause(select);
58  } catch (CalciteException e) {
59  Util.swallow(e, TRACER);
60  }
61  }

Member Data Documentation

boolean org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.violatedTablePermissions = false
private
List<String> org.apache.calcite.prepare.HeavyDBSqlAdvisorValidator.visibleTables
private

The documentation for this class was generated from the following file: