private void failIfColAliasExists(Set<String> nameSet, String name) throws SemanticException { if (nameSet.contains(name)) { throw new SemanticException(ErrorMsg.COLUMN_ALIAS_ALREADY_EXISTS .getMsg(name)); } nameSet.add(name); }
private void checkForPartitionColumns(List<String> specifiedCols, List<String> partCols) throws SemanticException { // Raise error if user has specified partition column for stats for (String pc : partCols) { for (String sc : specifiedCols) { if (pc.equalsIgnoreCase(sc)) { throw new SemanticException(ErrorMsg.COLUMNSTATSCOLLECTOR_INVALID_COLUMN.getMsg() + " [Try removing column '" + sc + "' from column list]"); } } } }
private static void checkColumnName(String columnName) throws SemanticException { if (VirtualColumn.VIRTUAL_COLUMN_NAMES.contains(columnName.toUpperCase())) { throw new SemanticException(ErrorMsg.INVALID_COLUMN_NAME.getMsg(columnName)); } }
private void validateDatabase(String databaseName) throws SemanticException { try { if (!db.databaseExists(databaseName)) { throw new SemanticException(ErrorMsg.DATABASE_NOT_EXISTS.getMsg(databaseName)); } } catch (HiveException e) { throw new SemanticException(ErrorMsg.DATABASE_NOT_EXISTS.getMsg(databaseName), e); } }
@Override void setHiveConf(HiveConf conf) { super.setHiveConf(conf); if (!conf.getBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY)) { throw new RuntimeException(ErrorMsg.DBTXNMGR_REQUIRES_CONCURRENCY.getMsg()); } }
private void validateSpecifiedColumnNames(List<String> specifiedCols) throws SemanticException { List<String> tableCols = Utilities.getColumnNamesFromFieldSchema(tbl.getCols()); for (String sc : specifiedCols) { if (!tableCols.contains(sc.toLowerCase())) { String msg = "'" + sc + "' (possible columns are " + tableCols.toString() + ")"; throw new SemanticException(ErrorMsg.INVALID_COLUMN.getMsg(msg)); } } }
static void validateTable(org.apache.hadoop.hive.ql.metadata.Table table) throws SemanticException { if (table.isNonNative()) { throw new SemanticException(ErrorMsg.EXIM_FOR_NON_NATIVE.getMsg()); } }
private FunctionDescBuilder(Context context) throws SemanticException { this.context = context; try { FileSystem fs = FileSystem.get(new Path(context.location).toUri(), context.hiveConf); metadata = EximUtil.readMetaData(fs, new Path(context.location, EximUtil.METADATA_NAME)); } catch (IOException e) { throw new SemanticException(ErrorMsg.INVALID_PATH.getMsg(), e); } destinationDbName = context.isDbNameEmpty() ? metadata.function.getDbName() : context.dbName; }
/** * Assert it supports Acid write. */ protected void validateTargetTable(Table mTable) throws SemanticException { if (mTable.getTableType() == TableType.VIRTUAL_VIEW || mTable.getTableType() == TableType.MATERIALIZED_VIEW) { LOG.error("Table " + mTable.getFullyQualifiedName() + " is a view or materialized view"); throw new SemanticException(ErrorMsg.UPDATE_DELETE_VIEW.getMsg()); } }
private ASTNode getChildFromSubqueryAST(String errorMsg, int type) throws SemanticException { ASTNode childAST = (ASTNode) subQueryAST.getFirstChildWithType(type); if (childAST == null && errorMsg != null) { subQueryAST.setOrigin(originalSQASTOrigin); throw new SemanticException(ErrorMsg.INVALID_SUBQUERY_EXPRESSION.getMsg( subQueryAST, errorMsg + " clause is missing in SubQuery.")); } return childAST; }
private boolean heartbeatMaterializationRebuildLock(String dbName, String tableName, long txnId) throws LockException { try { return getMS().heartbeatLockMaterializationRebuild(dbName, tableName, txnId); } catch (TException e) { throw new LockException(ErrorMsg.METASTORE_COMMUNICATION_FAILED.getMsg(), e); } }
@Override public void replTableWriteIdState(String validWriteIdList, String dbName, String tableName, List<String> partNames) throws LockException { try { getMS().replTableWriteIdState(validWriteIdList, dbName, tableName, partNames); } catch (TException e) { throw new LockException(ErrorMsg.METASTORE_COMMUNICATION_FAILED.getMsg(), e); } }
private static boolean hasTableAlias(JoinTypeCheckCtx ctx, String tabName, ASTNode expr) throws SemanticException { int tblAliasCnt = 0; for (RowResolver rr : ctx.getInputRRList()) { if (rr.hasTableAlias(tabName)) tblAliasCnt++; } if (tblAliasCnt > 1) { throw new SemanticException(ErrorMsg.AMBIGUOUS_TABLE_OR_COLUMN.getMsg(expr)); } return (tblAliasCnt == 1) ? true : false; }
@Override public ValidTxnWriteIdList getValidWriteIds(List<String> tableList, String validTxnList) throws LockException { assert isTxnOpen(); assert validTxnList != null && !validTxnList.isEmpty(); try { return TxnCommonUtils.createValidTxnWriteIdList( txnId, getMS().getValidWriteIds(tableList, validTxnList)); } catch (TException e) { throw new LockException(ErrorMsg.METASTORE_COMMUNICATION_FAILED.getMsg(), e); } }
private static void checkChildOperatorType(Operator<? extends OperatorDesc> op) throws SemanticException { if (!op.opAllowedAfterMapJoin()) { throw new SemanticException(ErrorMsg.OPERATOR_NOT_ALLOWED_WITH_MAPJOIN.getMsg()); } for (Operator<? extends OperatorDesc> childOp : op.getChildOperators()) { checkChildOperatorType(childOp); } }
public static MetaData readMetaData(FileSystem fs, Path metadataPath) throws IOException, SemanticException { String message = readAsString(fs, metadataPath); try { return new MetadataJson(message).getMetaData(); } catch (TException | JSONException e) { throw new SemanticException(ErrorMsg.ERROR_SERIALIZE_METADATA.getMsg(), e); } }
private static void checkParentOperatorType(Operator<? extends OperatorDesc> op) throws SemanticException { if (!op.opAllowedBeforeMapJoin()) { throw new SemanticException(ErrorMsg.OPERATOR_NOT_ALLOWED_WITH_MAPJOIN.getMsg()); } if (op.getParentOperators() != null) { for (Operator<? extends OperatorDesc> parentOp : op.getParentOperators()) { checkParentOperatorType(parentOp); } } }
private void checkExternalTable(Table dest_tab) throws SemanticException { if ((!conf.getBoolVar(HiveConf.ConfVars.HIVE_INSERT_INTO_EXTERNAL_TABLES)) && (dest_tab.getTableType().equals(TableType.EXTERNAL_TABLE))) { throw new SemanticException( ErrorMsg.INSERT_EXTERNAL_TABLE.getMsg(dest_tab.getTableName())); } }
@Test public void testBogusLevel() throws Exception { boolean sawException = false; try { parseAndAnalyze("alter table foo partition(ds = 'today') compact 'bogus'"); } catch (SemanticException e) { sawException = true; Assert.assertEquals(ErrorMsg.INVALID_COMPACTION_TYPE.getMsg(), e.getMessage()); } Assert.assertTrue(sawException); }
@Override public ValidTxnList getValidTxns() throws LockException { assert isTxnOpen(); init(); try { return getMS().getValidTxns(txnId); } catch (TException e) { throw new LockException(ErrorMsg.METASTORE_COMMUNICATION_FAILED.getMsg(), e); } }