OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
org.apache.calcite.prepare.MapDSqlAdvisorValidator Class Reference
+ Inheritance diagram for org.apache.calcite.prepare.MapDSqlAdvisorValidator:
+ Collaboration diagram for org.apache.calcite.prepare.MapDSqlAdvisorValidator:

Protected Member Functions

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

Package Functions

 MapDSqlAdvisorValidator (List< String > visibleTables, SqlOperatorTable opTab, SqlValidatorCatalogReader catalogReader, RelDataTypeFactory typeFactory, SqlConformance conformance)
 
boolean tableViolatesPermissions (final String tableName)
 
boolean hasViolatedTablePermissions ()
 

Private Attributes

List< String > visibleTables
 
boolean violatedTablePermissions = false
 

Detailed Description

Definition at line 35 of file MapDSqlAdvisorValidator.java.

Constructor & Destructor Documentation

org.apache.calcite.prepare.MapDSqlAdvisorValidator.MapDSqlAdvisorValidator ( List< String >  visibleTables,
SqlOperatorTable  opTab,
SqlValidatorCatalogReader  catalogReader,
RelDataTypeFactory  typeFactory,
SqlConformance  conformance 
)
inlinepackage

Definition at line 36 of file MapDSqlAdvisorValidator.java.

References org.apache.calcite.prepare.MapDSqlAdvisorValidator.visibleTables.

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

Member Function Documentation

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

Definition at line 89 of file MapDSqlAdvisorValidator.java.

References org.apache.calcite.prepare.MapDSqlAdvisorValidator.violatedTablePermissions.

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

+ Here is the caller graph for this function:

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

Definition at line 83 of file MapDSqlAdvisorValidator.java.

References org.apache.calcite.prepare.MapDSqlAdvisorValidator.visibleTables.

Referenced by org.apache.calcite.prepare.MapDSqlAdvisor.applyPermissionsToTableHints(), and org.apache.calcite.prepare.MapDSqlAdvisorValidator.validateFrom().

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

+ Here is the caller graph for this function:

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

Definition at line 65 of file MapDSqlAdvisorValidator.java.

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

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

+ Here is the call graph for this function:

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

Definition at line 46 of file MapDSqlAdvisorValidator.java.

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

Member Data Documentation

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

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