public abstract class RewriteSemanticAnalyzer<T> extends CalcitePlanner
SemanticAnalyzer that just handles
update, delete and merge statements. It works by rewriting the updates and deletes into insert
statements (since they are actually inserts) and then doing some patch up to make them work as
updates and deletes instead.CalcitePlanner.ASTSearcher, CalcitePlanner.CalcitePlannerAction, CalcitePlanner.InputContext, CalcitePlanner.PreCboCtxSemanticAnalyzer.GenericUDAFInfo, SemanticAnalyzer.MaterializationRebuildModeBaseSemanticAnalyzer.AnalyzeRewriteContext, BaseSemanticAnalyzer.TableSpec| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
LOG |
protected boolean |
useSuper |
aliasToCTEs, analyzeRewrite, ast, autogenColAliasPrfxLbl, createVwDesc, defaultJoinMerge, disableJoinMerge, DUMMY_DATABASE, DUMMY_TABLE, forViewCreation, mvRebuildMode, opParseCtx, originalResultSchema, prunedPartitions, resultSchema, SUBQUERY_TAG_1, SUBQUERY_TAG_2, topOps, topOpsCopy, unparseTranslator, VALUES_TMP_TABLE_NAME_PREFIX, viewSelectacidFileSinks, cacheUsage, cContext, columnAccessInfo, conf, console, ctx, db, fetchTask, idToTableNameMap, inputs, linfo, outputs, prepareQuery, queryProperties, queryState, rootTasks, STATIC_LOG, tableAccessInfo, transactionalInQuery, txnManager, updateColumnAccessInfo, userSuppliedFunctions| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
analyze(ASTNode tree,
Table table,
ASTNode tableName) |
void |
analyzeInternal(ASTNode tree) |
protected void |
analyzeRewrittenTree(ASTNode rewrittenTree,
Context rewrittenCtx) |
protected void |
checkValidSetClauseTarget(ASTNode colName,
Table targetTable)
Assert that we are not asked to update a bucketing column or partition column.
|
protected Map<String,ASTNode> |
collectSetColumnsAndExpressions(ASTNode setClause,
Set<String> setRCols,
Table targetTable) |
protected ASTNode |
findLHSofAssignment(ASTNode assignment) |
protected static Table |
getTable(ASTNode tabRef,
Hive db,
boolean throwException) |
protected abstract ASTNode |
getTargetTableNode(ASTNode tree) |
protected void |
markReadEntityForUpdate()
Walk through all our inputs and set them to note that this read is part of an update or a delete.
|
protected void |
rewriteAndAnalyze(T statementData,
String subQueryAlias) |
protected void |
setUpAccessControlInfoForUpdate(Table mTable,
Map<String,ASTNode> setCols)
For updates, we need to set the column access info so that it contains information on
the columns we are updating.
|
protected void |
updateOutputs(Table targetTable)
SemanticAnalyzer will generate a WriteEntity for the target table since it doesn't know/check
if the read and write are of the same table in "insert ...
|
protected void |
validateTargetTable(Table mTable)
Assert it supports Acid write.
|
createPlanner, createPlannerAction, fixUpAfterCbo, genLogicalPlan, genRexNode, getOptimizedSql, getTableObjectByName, resetCalciteConfiguration, warmupaddPartitionColsToInsert, addPartitionColsToInsert, allowOutputMultipleTimes, analyzeCreateView, compilePlan, enableColumnStatsCollecting, executeUnParseTranslations, forViewCreation, generateErrorMessage, genExprNodeDesc, genFileSinkPlan, getAcidAnalyzeTable, getAliasId, getAllInputs, getAllOutputs, getAllRootTasks, getColNameToDefaultValueMap, getColumnInternalName, getDefaultConstraints, getDummyTable, getGenericUDAFEvaluator, getGenericUDAFEvaluator2, getGenericUDAFInfo, getGenericUDAFInfo2, getInvalidResultCacheReason, getLoadFileWork, getLoadTableWork, getMaterializationValidationResult, getOpContext, getOriginalResultSchema, getParseContext, getQB, getResultSchema, getSinkOp, getTableObjectByName, getTargetTable, getTopOps, getViewAliasToInput, groupByDescModeToUDAFMode, hasGroupBySibling, init, isConstantParameterInAggregationParameters, isInsertInto, isSelectDistinct, isValidQueryCaching, parseSelect, processNoScanCommand, processTableColumnNames, reset, rewriteGroupingFunctionAST, saveViewDefinition, setAST, setBit, setInvalidResultCacheReason, setLoadFileWork, setLoadTableWork, setMaterializationValidationResult, startAnalysis, translateFieldDesc, updating, validateaddPropertyReadEntry, analyze, analyzeStoredAdDirs, charSetString, checkColumnName, constructListBucketingCtx, createFetchTask, createHiveDB, endAnalysis, escapeSQLString, findTabRefIdxs, getAcidDdlDesc, getAcidFileSinks, getAutoCommitValue, getCacheUsage, getCboInfo, getColumnAccessInfo, getColumnNames, getColumnNamesOrder, getColumns, getColumns, getColumns, getCtx, getDatabase, getDatabase, getDataConnector, getDataConnector, getDb, getDbTableNamePair, getFetchTask, getFullTableNameForSQL, getIdToTableNameMap, getInputs, getLineageInfo, getOutputs, getPartitionSpecs, getPartSpec, getProps, getQualifiedTableName, getQualifiedTableName, getQueryProperties, getQueryState, getRootTasks, getSimpleTableNameBase, getTable, getTable, getTable, getTable, getTable, getTable, getTableAccessInfo, getTableAlias, getTxnMgr, getTypeStringFromAST, getUnescapedName, getUnescapedName, getUnescapedUnqualifiedTableName, getUpdateColumnAccessInfo, getUserSuppliedFunctions, getValidatedPartSpec, hasTransactionalInQuery, initCtx, isPrepareQuery, isValidPrefixSpec, processOrderSpec, raiseWrongType, readProps, setAutoCommitValue, setCacheUsage, setColumnAccessInfo, setFetchTask, setLineageInfo, setTableAccessInfo, setUpdateColumnAccessInfo, skipAuthorization, stripQuotes, toReadEntity, toReadEntity, toReadEntity, toWriteEntity, toWriteEntity, toWriteEntity, tryQualifyPath, unescapeIdentifier, unescapeSQLString, validatePartColumnType, validatePartSpec, validateUnsupportedPartitionClausepublic void analyzeInternal(ASTNode tree) throws SemanticException
analyzeInternal in class CalcitePlannerSemanticExceptionprotected abstract void analyze(ASTNode tree, Table table, ASTNode tableName) throws SemanticException
SemanticExceptionprotected void rewriteAndAnalyze(T statementData, String subQueryAlias) throws SemanticException
SemanticExceptionprotected void analyzeRewrittenTree(ASTNode rewrittenTree, Context rewrittenCtx) throws SemanticException
SemanticExceptionprotected void checkValidSetClauseTarget(ASTNode colName, Table targetTable) throws SemanticException
colName - it's the A in "SET A = B"SemanticExceptionprotected Map<String,ASTNode> collectSetColumnsAndExpressions(ASTNode setClause, Set<String> setRCols, Table targetTable) throws SemanticException
SemanticExceptionprotected static Table getTable(ASTNode tabRef, Hive db, boolean throwException) throws SemanticException
throwException - if false, return null if table doesn't exist, else throwSemanticExceptionprotected void markReadEntityForUpdate()
protected void setUpAccessControlInfoForUpdate(Table mTable, Map<String,ASTNode> setCols)
protected void validateTargetTable(Table mTable) throws SemanticException
SemanticExceptionprotected void updateOutputs(Table targetTable)
Copyright © 2024 The Apache Software Foundation. All rights reserved.