Repository of analysis state for single select block. Conjuncts: Conjuncts are registered during analysis (registerConjuncts()) and assigned during the planning process (getUnassigned[Oj]Conjuncts()/isConjunctAssigned()/ markConjunctsAssigned()). All conjuncts are assigned a unique id when initiall
| 182 | * more accurately and consistently here and elsewhere. |
| 183 | */ |
| 184 | public class Analyzer { |
| 185 | public static final byte ACCESSTYPE_READ = (byte)2; |
| 186 | public static final byte ACCESSTYPE_WRITE = (byte)4; |
| 187 | public static final byte ACCESSTYPE_READWRITE = (byte)8; |
| 188 | |
| 189 | // Common analysis error messages |
| 190 | public final static String DB_DOES_NOT_EXIST_ERROR_MSG = "Database does not exist: "; |
| 191 | public final static String DB_ALREADY_EXISTS_ERROR_MSG = "Database already exists: "; |
| 192 | public final static String TBL_DOES_NOT_EXIST_ERROR_MSG = "Table does not exist: "; |
| 193 | public final static String TBL_ALREADY_EXISTS_ERROR_MSG = "Table already exists: "; |
| 194 | public final static String VIEW_ALREADY_EXISTS_ERROR_MSG = "View already exists: "; |
| 195 | public final static String FN_DOES_NOT_EXIST_ERROR_MSG = "Function does not exist: "; |
| 196 | public final static String FN_ALREADY_EXISTS_ERROR_MSG = "Function already exists: "; |
| 197 | public final static String DATA_SRC_DOES_NOT_EXIST_ERROR_MSG = |
| 198 | "Data source does not exist: "; |
| 199 | public final static String DATA_SRC_ALREADY_EXISTS_ERROR_MSG = |
| 200 | "Data source already exists: "; |
| 201 | private static final String TRANSACTIONAL_TABLE_NOT_SUPPORTED = |
| 202 | "%s not supported on transactional (ACID) table: %s"; |
| 203 | private static final String FULL_TRANSACTIONAL_TABLE_NOT_SUPPORTED = |
| 204 | "%s not supported on full transactional (ACID) table: %s"; |
| 205 | private static final String BUCKETED_TABLE_NOT_SUPPORTED = |
| 206 | "%s is a bucketed table. Only read operations are supported on such tables."; |
| 207 | private static final String TABLE_NOT_SUPPORTED = |
| 208 | "%s not supported. Table %s access type is: %s"; |
| 209 | |
| 210 | private final static Logger LOG = LoggerFactory.getLogger(Analyzer.class); |
| 211 | |
| 212 | private final User user_; |
| 213 | |
| 214 | // Indicates whether this query block contains a straight join hint. |
| 215 | private boolean isStraightJoin_ = false; |
| 216 | |
| 217 | // Whether to use Hive's auto-generated column labels. |
| 218 | private boolean useHiveColLabels_ = false; |
| 219 | |
| 220 | // True if the corresponding select block has a limit and/or offset clause. |
| 221 | private boolean hasLimitOffsetClause_ = false; |
| 222 | |
| 223 | // Current depth of nested analyze() calls. Used for enforcing a |
| 224 | // maximum expr-tree depth. Needs to be manually maintained by the user |
| 225 | // of this Analyzer with incrementCallDepth() and decrementCallDepth(). |
| 226 | private int callDepth_ = 0; |
| 227 | |
| 228 | // Flag indicating if this analyzer instance belongs to a subquery. |
| 229 | private boolean isSubquery_ = false; |
| 230 | |
| 231 | // Tracks the simple LIMIT status of this query block. First item of the |
| 232 | // pair indicates whether a simple limit exists or not, second item is |
| 233 | // the actual limit value if it does exist. We use a pair instead of just |
| 234 | // a single nullable field because a query block may not have a LIMIT but |
| 235 | // if it is an inline view it may be eligible for limit pushdown from an |
| 236 | // outer query, so for such case the simpleLimitStatus_ will be non-null |
| 237 | // but the pair will be <false, null>. |
| 238 | private Pair<Boolean, Long> simpleLimitStatus_ = null; |
| 239 | |
| 240 | // Flag indicating whether this analyzer belongs to a WITH clause view. |
| 241 | private boolean hasWithClause_ = false; |
nothing calls this directly
no outgoing calls
no test coverage detected