OmniSciDB  8a228a1076
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, 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 MapDSqlAdvisorValidator.java.

Constructor & Destructor Documentation

◆ MapDSqlAdvisorValidator()

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

Definition at line 35 of file MapDSqlAdvisorValidator.java.

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

39  {
40  super(opTab, catalogReader, typeFactory, config);
42  }

Member Function Documentation

◆ hasViolatedTablePermissions()

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

Definition at line 88 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:

◆ tableViolatesPermissions()

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

Definition at line 82 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().

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:

◆ validateFrom()

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

Definition at line 64 of file MapDSqlAdvisorValidator.java.

References org.apache.calcite.prepare.MapDSqlAdvisorValidator.tableViolatesPermissions(), and org.apache.calcite.prepare.MapDSqlAdvisorValidator.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:

◆ validateGroupClause()

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

Definition at line 45 of file MapDSqlAdvisorValidator.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

◆ violatedTablePermissions

boolean org.apache.calcite.prepare.MapDSqlAdvisorValidator.violatedTablePermissions = false
private

◆ visibleTables

List<String> org.apache.calcite.prepare.MapDSqlAdvisorValidator.visibleTables
private

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