public class MergeSemanticAnalyzer extends RewriteSemanticAnalyzer<MergeStatement>
SemanticAnalyzer that just handles
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 merges instead.CalcitePlanner.ASTSearcher, CalcitePlanner.CalcitePlannerAction, CalcitePlanner.InputContext, CalcitePlanner.PreCboCtxSemanticAnalyzer.GenericUDAFInfo, SemanticAnalyzer.MaterializationRebuildModeBaseSemanticAnalyzer.AnalyzeRewriteContext, BaseSemanticAnalyzer.TableSpecLOG, useSuperaliasToCTEs, 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 boolean |
allowOutputMultipleTimes() |
void |
analyze(ASTNode tree,
Table targetTable,
ASTNode targetNameNode)
Here we take a Merge statement AST and generate a semantically equivalent multi-insert
statement to execute.
|
protected boolean |
enableColumnStatsCollecting() |
protected String |
getMatchedText(ASTNode n)
This allows us to take an arbitrary ASTNode and turn it back into SQL that produced it without
needing to understand what it is (except for QuotedIdentifiers).
|
protected String |
getSimpleTableName(ASTNode n)
Returns the table name to use in the generated query preserving original quotes/escapes if any.
|
protected ASTNode |
getTargetTableNode(ASTNode tree) |
protected ASTNode |
getWhenClauseOperation(ASTNode whenClause) |
protected MergeStatement.DeleteClause |
handleDelete(ASTNode whenMatchedDeleteClause,
String updateExtraPredicate) |
protected boolean |
isAliased(ASTNode n) |
analyzeInternal, analyzeRewrittenTree, checkValidSetClauseTarget, collectSetColumnsAndExpressions, findLHSofAssignment, getTable, markReadEntityForUpdate, rewriteAndAnalyze, setUpAccessControlInfoForUpdate, updateOutputs, validateTargetTablecreatePlanner, createPlannerAction, fixUpAfterCbo, genLogicalPlan, genRexNode, getOptimizedSql, getTableObjectByName, resetCalciteConfiguration, warmupaddPartitionColsToInsert, addPartitionColsToInsert, analyzeCreateView, compilePlan, 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, validateUnsupportedPartitionClauseprotected ASTNode getTargetTableNode(ASTNode tree)
getTargetTableNode in class RewriteSemanticAnalyzer<MergeStatement>public void analyze(ASTNode tree, Table targetTable, ASTNode targetNameNode) throws SemanticException
analyze in class RewriteSemanticAnalyzer<MergeStatement>SemanticExceptionprotected MergeStatement.DeleteClause handleDelete(ASTNode whenMatchedDeleteClause, String updateExtraPredicate)
updateExtraPredicate - - see notes at callerprotected boolean allowOutputMultipleTimes()
allowOutputMultipleTimes in class SemanticAnalyzerprotected boolean enableColumnStatsCollecting()
enableColumnStatsCollecting in class SemanticAnalyzerprotected String getMatchedText(ASTNode n)
protected boolean isAliased(ASTNode n)
protected String getSimpleTableName(ASTNode n) throws SemanticException
SemanticExceptionBaseSemanticAnalyzer.getFullTableNameForSQL(ASTNode)Copyright © 2024 The Apache Software Foundation. All rights reserved.