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

Protected Member Functions

RelDataType getLogicalSourceRowType (RelDataType sourceRowType, SqlInsert insert)
RelDataType getLogicalTargetRowType (RelDataType targetRowType, SqlInsert insert)
void addToSelectList (List< SqlNode > list, Set< String > aliases, List< Map.Entry< String, RelDataType >> fieldList, SqlNode exp, SelectScope scope, boolean includeSystemVars)
void checkTypeAssignment (SqlValidatorScope sourceScope, SqlValidatorTable table, RelDataType sourceRowType, RelDataType targetRowType, SqlNode query)
- Protected Member Functions inherited from org.apache.calcite.sql.validate.SqlValidatorImpl
 SqlValidatorImpl (SqlOperatorTable opTab, SqlValidatorCatalogReader catalogReader, RelDataTypeFactory typeFactory, Config config)
void validateNamespace (final SqlValidatorNamespace namespace, RelDataType targetRowType)
SqlNode performUnconditionalRewrites (SqlNode node, boolean underFrom)
SqlNode getSelfJoinExprForUpdate (SqlNode table, String alias)
SqlSelect createSourceSelectForUpdate (SqlUpdate call)
SqlSelect createSourceSelectForDelete (SqlDelete call)
void inferUnknownTypes (@Nonnull RelDataType inferredType,@Nonnull SqlValidatorScope scope,@Nonnull SqlNode node)
void addToSelectList (List< SqlNode > list, Set< String > aliases, List< Map.Entry< String, RelDataType >> fieldList, SqlNode exp, SelectScope scope, final boolean includeSystemVars)
boolean shouldAllowIntermediateOrderBy ()
MatchRecognizeNamespace createMatchRecognizeNameSpace (SqlMatchRecognize call, SqlNode enclosingNode)
void registerNamespace (SqlValidatorScope usingScope, String alias, SqlValidatorNamespace ns, boolean forceNullable)
boolean shouldAllowOverRelation ()
SelectNamespace createSelectNamespace (SqlSelect select, SqlNode enclosingNode)
SetopNamespace createSetopNamespace (SqlCall call, SqlNode enclosingNode)
boolean isNestedAggregateWindow (SqlNode node)
boolean isOverAggregateWindow (SqlNode node)
SqlNode getAggregate (SqlSelect select)
void validateFrom (SqlNode node, RelDataType targetRowType, SqlValidatorScope scope)
void validateOver (SqlCall call, SqlValidatorScope scope)
void validateUnnest (SqlCall call, SqlValidatorScope scope, RelDataType targetRowType)
void validateJoin (SqlJoin join, SqlValidatorScope scope)
void validateSelect (SqlSelect select, RelDataType targetRowType)
void validateWindowClause (SqlSelect select)
void validateOrderList (SqlSelect select)
void validateGroupClause (SqlSelect select)
void validateWhereClause (SqlSelect select)
void validateWhereOrOn (SqlValidatorScope scope, SqlNode condition, String clause)
void validateHavingClause (SqlSelect select)
RelDataType validateSelectList (final SqlNodeList selectItems, SqlSelect select, RelDataType targetRowType)
RelDataType createTargetRowType (SqlValidatorTable table, SqlNodeList targetColumnList, boolean append)
RelDataType getLogicalTargetRowType (RelDataType targetRowType, SqlInsert insert)
RelDataType getLogicalSourceRowType (RelDataType sourceRowType, SqlInsert insert)
void checkTypeAssignment (SqlValidatorScope sourceScope, SqlValidatorTable table, RelDataType sourceRowType, RelDataType targetRowType, final SqlNode query)
void validateValues (SqlCall node, RelDataType targetRowType, final SqlValidatorScope scope)
SqlWindow getWindowByName (SqlIdentifier id, SqlValidatorScope scope)
void validateFeature (Feature feature, SqlParserPos context)

Package Functions

 CalciteSqlValidator (SqlOperatorTable opTab, CalciteCatalogReader catalogReader, JavaTypeFactory typeFactory, Config config)
- Package Functions inherited from org.apache.calcite.sql.validate.SqlValidatorImpl
void lookupSelectHints (SqlSelect select, SqlParserPos pos, Collection< SqlMoniker > hintList)
RelDataType getTableConstructorRowType (SqlCall values, SqlValidatorScope scope)
RelDataType deriveTypeImpl (SqlValidatorScope scope, SqlNode operand)
SqlValidatorNamespace lookupFieldNamespace (RelDataType rowType, String name)

Private Member Functions

boolean isSystemColumn (final SqlNode exp, final SelectScope scope)

Additional Inherited Members

- Public Member Functions inherited from org.apache.calcite.sql.validate.SqlValidatorImpl
SqlConformance getConformance ()
SqlValidatorCatalogReader getCatalogReader ()
SqlOperatorTable getOperatorTable ()
RelDataTypeFactory getTypeFactory ()
RelDataType getUnknownType ()
SqlNodeList expandStar (SqlNodeList selectList, SqlSelect select, boolean includeSystemVars)
void declareCursor (SqlSelect select, SqlValidatorScope parentScope)
void pushFunctionCall ()
void popFunctionCall ()
String getParentCursor (String columnListParamName)
List< String > usingNames (SqlJoin join)
SqlNode validate (SqlNode topNode)
List< SqlMoniker > lookupHints (SqlNode topNode, SqlParserPos pos)
SqlMoniker lookupQualifiedName (SqlNode topNode, SqlParserPos pos)
final void lookupNameCompletionHints (SqlValidatorScope scope, List< String > names, SqlParserPos pos, Collection< SqlMoniker > hintList)
SqlNode validateParameterizedExpression (SqlNode topNode, final Map< String, RelDataType > nameToTypeMap)
void validateQuery (SqlNode node, SqlValidatorScope scope, RelDataType targetRowType)
SqlValidatorScope getEmptyScope ()
SqlValidatorScope getCursorScope (SqlSelect select)
SqlValidatorScope getWhereScope (SqlSelect select)
SqlValidatorScope getSelectScope (SqlSelect select)
SelectScope getRawSelectScope (SqlSelect select)
SqlValidatorScope getHavingScope (SqlSelect select)
SqlValidatorScope getGroupScope (SqlSelect select)
SqlValidatorScope getFromScope (SqlSelect select)
SqlValidatorScope getOrderScope (SqlSelect select)
SqlValidatorScope getMatchRecognizeScope (SqlMatchRecognize node)
SqlValidatorScope getJoinScope (SqlNode node)
SqlValidatorScope getOverScope (SqlNode node)
SqlValidatorNamespace getNamespace (SqlNode node)
RelDataType getValidatedNodeType (SqlNode node)
RelDataType getValidatedNodeTypeIfKnown (SqlNode node)
final void setValidatedNodeType (SqlNode node, RelDataType type)
void removeValidatedNodeType (SqlNode node)
SqlCall makeNullaryCall (SqlIdentifier id)
RelDataType deriveType (SqlValidatorScope scope, SqlNode expr)
RelDataType deriveConstructorType (SqlValidatorScope scope, SqlCall call, SqlFunction unresolvedConstructor, SqlFunction resolvedConstructor, List< RelDataType > argTypes)
CalciteException handleUnresolvedFunction (SqlCall call, SqlFunction unresolvedFunction, List< RelDataType > argTypes, List< String > argNames)
String deriveAlias (SqlNode node, int ordinal)
boolean isAggregate (SqlSelect select)
boolean isAggregate (SqlNode selectNode)
void validateIdentifier (SqlIdentifier id, SqlValidatorScope scope)
void validateLiteral (SqlLiteral literal)
void validateIntervalQualifier (SqlIntervalQualifier qualifier)
boolean validateModality (SqlSelect select, SqlModality modality, boolean fail)
void validateWith (SqlWith with, SqlValidatorScope scope)
void validateWithItem (SqlWithItem withItem)
void validateSequenceValue (SqlValidatorScope scope, SqlIdentifier id)
SqlValidatorScope getWithScope (SqlNode withItem)
TypeCoercion getTypeCoercion ()
Config config ()
SqlValidator transform (UnaryOperator< Config > transform)
SqlNode expandOrderExpr (SqlSelect select, SqlNode orderExpr)
void validateInsert (SqlInsert insert)
void validateDelete (SqlDelete call)
void validateUpdate (SqlUpdate call)
void validateMerge (SqlMerge call)
void validateDataType (SqlDataTypeSpec dataType)
void validateDynamicParam (SqlDynamicParam dynamicParam)
ValidationErrorFunction getValidationErrorFunction ()
CalciteContextException newValidationError (SqlNode node, Resources.ExInst< SqlValidatorException > e)
SqlWindow resolveWindow (SqlNode windowOrRef, SqlValidatorScope scope)
SqlNode getOriginal (SqlNode expr)
void setOriginal (SqlNode expr, SqlNode original)
void validateWindow (SqlNode windowOrId, SqlValidatorScope scope, SqlCall call)
void validateMatchRecognize (SqlCall call)
void validateAggregateParams (SqlCall aggCall, SqlNode filter, SqlNodeList orderList, SqlValidatorScope scope)
void validateCall (SqlCall call, SqlValidatorScope scope)
SqlNode expandSelectExpr (SqlNode expr, SelectScope scope, SqlSelect select)
SqlNode expand (SqlNode expr, SqlValidatorScope scope)
SqlNode expandGroupByOrHavingExpr (SqlNode expr, SqlValidatorScope scope, SqlSelect select, boolean havingExpression)
boolean isSystemField (RelDataTypeField field)
List< List< String > > getFieldOrigins (SqlNode sqlQuery)
RelDataType getParameterRowType (SqlNode sqlQuery)
void validateColumnListParams (SqlFunction function, List< RelDataType > argTypes, List< SqlNode > operands)
- Static Public Attributes inherited from org.apache.calcite.sql.validate.SqlValidatorImpl
static final Logger TRACER = CalciteTrace.PARSER_LOGGER
static final String UPDATE_SRC_ALIAS = "SYS$SRC"
static final String UPDATE_TGT_ALIAS = "SYS$TGT"
static final String UPDATE_ANON_PREFIX = "SYS$ANON"
- Protected Attributes inherited from org.apache.calcite.sql.validate.SqlValidatorImpl
final Map< String, IdInfoidPositions = new HashMap<>()
final Map< SqlNode,
SqlValidatorScope > 
final Map< SqlNode,
SqlValidatorNamespace > 
final Deque< FunctionParamInfofunctionCallStack
final RelDataTypeFactory typeFactory
final RelDataType unknownType
- Package Attributes inherited from org.apache.calcite.sql.validate.SqlValidatorImpl
final SqlValidatorCatalogReader catalogReader

Detailed Description

Based on CalciteSqlValidator in calcite-core with the addition of an addToSelectList() method override, which fixes the omission of system column checks when adding columns from an expanded star selection into the select list.

Definition at line 44 of file

Constructor & Destructor Documentation

org.apache.calcite.prepare.CalciteSqlValidator.CalciteSqlValidator ( SqlOperatorTable  opTab,
CalciteCatalogReader  catalogReader,
JavaTypeFactory  typeFactory,
Config  config 

Member Function Documentation

void org.apache.calcite.prepare.CalciteSqlValidator.addToSelectList ( List< SqlNode >  list,
Set< String >  aliases,
List< Map.Entry< String, RelDataType >>  fieldList,
SqlNode  exp,
SelectScope  scope,
boolean  includeSystemVars 

Definition at line 67 of file

References org.apache.calcite.prepare.CalciteSqlValidator.isSystemColumn().

72  {
73  if (includeSystemVars || !isSystemColumn(exp, scope)) {
74  super.addToSelectList(list, aliases, fieldList, exp, scope, includeSystemVars);
75  }
76  }
boolean isSystemColumn(final SqlNode exp, final SelectScope scope)

+ Here is the call graph for this function:

void org.apache.calcite.prepare.CalciteSqlValidator.checkTypeAssignment ( SqlValidatorScope  sourceScope,
SqlValidatorTable  table,
RelDataType  sourceRowType,
RelDataType  targetRowType,
SqlNode  query 

Definition at line 97 of file

101  {
102  // disabling assignment checking in calcite and instead letting HEAVY.AI server
103  // handle
104  }
RelDataType org.apache.calcite.prepare.CalciteSqlValidator.getLogicalSourceRowType ( RelDataType  sourceRowType,
SqlInsert  insert 

Definition at line 53 of file

References org.apache.calcite.sql.validate.SqlValidatorImpl.typeFactory.

54  {
55  final RelDataType superType = super.getLogicalSourceRowType(sourceRowType, insert);
56  return ((JavaTypeFactory) typeFactory).toSql(superType);
57  }
RelDataType org.apache.calcite.prepare.CalciteSqlValidator.getLogicalTargetRowType ( RelDataType  targetRowType,
SqlInsert  insert 

Definition at line 60 of file

References org.apache.calcite.sql.validate.SqlValidatorImpl.typeFactory.

61  {
62  final RelDataType superType = super.getLogicalTargetRowType(targetRowType, insert);
63  return ((JavaTypeFactory) typeFactory).toSql(superType);
64  }
boolean org.apache.calcite.prepare.CalciteSqlValidator.isSystemColumn ( final SqlNode  exp,
final SelectScope  scope 

Definition at line 78 of file

Referenced by org.apache.calcite.prepare.CalciteSqlValidator.addToSelectList().

78  {
79  if (exp instanceof SqlIdentifier) {
80  SqlIdentifier columnId = (SqlIdentifier) exp;
81  // Expects columnId.names[0] to be table name and columnId.names[1] to be column
82  // name
83  if (columnId.names != null && columnId.names.size() == 2) {
84  SqlValidatorTable sqlValidatorTable =
85  scope.fullyQualify(columnId).namespace.getTable();
86  if (sqlValidatorTable != null) {
87  HeavyDBTable table =
88  (HeavyDBTable) sqlValidatorTable.unwrap(HeavyDBTable.class);
89  return table.isSystemColumn(columnId.names.get(1));
90  }
91  }
92  }
93  return false;
94  }

+ Here is the caller graph for this function:

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