/** * Creates a new user exception builder . * * @see com.dremio.exec.proto.UserBitShared.DremioPBError.ErrorType#PLAN * @return user exception builder */ public static Builder planError() { return planError(null); }
private LogicalExpression doUnknown(RexNode o){ final String message = String.format(UNSUPPORTED_REX_NODE_ERROR + "RexNode Class: %s, RexNode Digest: %s", o.getClass().getName(), o.toString()); if(throwUserException) { throw UserException.planError().message(message).build(logger); } else { throw new IllegalStateException(message); } }
protected FunctionRender visitUnknown(RexNode o){ // raise an error throw UserException.planError() .message("Unsupported for elastic pushdown: RexNode Class: %s, RexNode Digest: %s", o.getClass().getName(), o.toString()) .build(logger); } }
protected List<List<String>> visitUnknown(RexNode o){ // raise an error throw UserException.planError() .message("Unsupported for elastic pushdown: RexNode Class: %s, RexNode Digest: %s", o.getClass().getName(), o.toString()) .build(logger); } }
@Override public List<List<String>> visitCall(RexCall call) { if (call.getOperator().getName().equalsIgnoreCase("item")) { if (call.getOperands().size() != 2) { throw UserException.planError().message("Item operator should only have two operands, but got " + call.getOperands().size()).build(logger); } RexNode leftRex = call.getOperands().get(0); RexNode rightRex = call.getOperands().get(1); List<List<String>> left = leftRex.accept(this); List<List<String>> right = rightRex.accept(this); if (left.isEmpty()) { // left was rex literal left.add(Lists.newArrayList(leftRex.toString())); } if (right.isEmpty()) { right.add(Lists.newArrayList(rightRex.toString())); } assert left.size() == 1 && right.size() == 1; left.get(0).addAll(right.get(0)); return left; } else { Set<List<String>> childrenNames = new HashSet<List<String>>(); for (RexNode rexnode : call.getOperands()) { List<List<String>> childNames = rexnode.accept(this); childrenNames.addAll(childNames); } return Lists.newArrayList(childrenNames); } }
@Override public void checkCancel() { if (cancelFlag.isCancelRequested()) { UserException.Builder builder = UserException.planError() .message("Query was cancelled because planning time exceeded %d seconds", cancelFlag.getTimeoutInSecs()); if (phase != null) { builder = builder.addContext("Planner Phase", phase.description); } throw builder.build(logger); } super.checkCancel(); }
@Override public void checkCancel() { if (cancelFlag.isCancelRequested()) { UserException.Builder builder = UserException.planError() .message("Query was cancelled because planning time exceeded %d seconds", cancelFlag.getTimeoutInSecs()); if (phase != null) { builder = builder.addContext("Planner Phase", phase.description); } throw builder.build(logger); } super.checkCancel(); } }
throw UserException.planError(ex) .message("Error while rewriting DESCRIBE query: %d", ex.getMessage()) .build(logger);
public static UserException.Builder planError(String query, Exception ex) { UserException.Builder b = UserException.planError(ex) .addContext(SQL_QUERY_CONTEXT, query); // CalciteContextException alters the error message including the start/end positions // we need to extract the original error message and add the remaining information as context if (ex instanceof CalciteContextException) { CalciteContextException cce = (CalciteContextException) ex; b.message(cce.getMessage()) .addContext(START_LINE_CONTEXT, cce.getPosLine()) .addContext(START_COLUMN_CONTEXT, cce.getPosColumn()) .addContext(END_LINE_CONTEXT, cce.getEndPosLine()) .addContext(END_COLUMN_CONTEXT, cce.getEndPosColumn()); } return b; }
throw UserException.planError().message("Tried to plan a distribution writer but distribution was incorrect.").build(logger);
public RelRoot expandView(ViewTable view) { final RelRoot root; try { root = DremioSqlToRelConverter.expandView(view.getPath(), view.getViewOwner(), view.getView().getSql(), view.getView().getWorkspaceSchemaPath(), sqlConverter); } catch (Exception ex) { throw UserException.planError(ex) .message("Error while expanding view %s",view.getPath()) .addContext("View SQL", view.getView().getSql()) .build(logger); } checkRowTypeConsistency(root.validatedRowType, view.getView().getRowType(sqlConverter.getCluster().getTypeFactory()), view.getPath().getSchemaPath()); return root; }
throw UserException.planError(e) .message("Failed to cast table rel row types to the query rel row types for materialization %s.%n" + "table schema %s%nquery schema %s", descriptor.getMaterializationId(),
.build(logger); } catch (final Throwable ex) { throw UserException.planError(ex) .addContext(SqlExceptionHelper.SQL_QUERY_CONTEXT, sql) .build(logger);