/** * Creates a new user exception builder . * * @see com.dremio.exec.proto.UserBitShared.DremioPBError.ErrorType#PARSE * @return user exception builder */ public static Builder parseError() { return parseError(null); }
public static UserException.Builder parseError(String query, SqlParseException ex) { final SqlParserPos pos = ex.getPos(); if (pos == null) { return UserException .parseError(ex) .addContext(SQL_QUERY_CONTEXT, query); } else { // Calcite convention is to return column and line numbers as 1-based inclusive positions. return addParseContext(UserException.parseError(ex), query, pos); } }
public TableInstance(TableSignature sig, List<Object> params) { super(); if (params.size() != sig.params.size()) { throw UserException.parseError() .message( "should have as many params (%d) as signature (%d)", params.size(), sig.params.size()) .addContext("table", sig.name) .build(logger); } this.sig = sig; this.params = unmodifiableList(params); }
public static UserException.Builder parseError(String message, String query, SqlParserPos pos) { return addParseContext(UserException.parseError().message(message), query, pos); }
private UserException getConvertFunctionInvalidTypeException(final RexCall function) { // Caused by user entering a value with a numeric type final String functionName = function.getOperator().getName(); final String typeName = function.getOperands().get(1).getType().getFullTypeString(); return UserException.parseError() .message("Invalid type %s passed as second argument to function '%s'. " + "The function expects a literal argument.", typeName, functionName) .build(logger); }
throw UserException.parseError().message("Unable to find table %s.", path).build(logger); final DremioTable table = catalog.getTableNoResolve(path); if(table == null || table.getJdbcTableType() != TableType.TABLE) { throw UserException.parseError().message("Unable to find table %s.", path).build(logger);
throw UserException.parseError().message("Unable to find source %s.", path).build(logger);
FormatPluginOptionsDescriptor optionsDescriptor = optionsByTypeName.get(type.toLowerCase()); if (optionsDescriptor == null) { throw UserException.parseError() .message("unknown type %s, expected one of %s", type, optionsByTypeName.keySet()) .addContext("Given options: %s", formatOptions)
public static TableWithPath verify(final Catalog catalog, SqlIdentifier identifier){ NamespaceKey path = catalog.resolveSingle(new NamespaceKey(identifier.names)); DremioTable table = catalog.getTable(path); if(table == null) { throw UserException.parseError().message("Unable to find table %s.", path).build(logger); } return new TableWithPath(table); }
throw UserException.parseError() .message("unknown first param for %s", t.getSig()) .addContext("table", t.getSig().getName()) throw UserException.parseError() .message("type param must be present but was missing") .addContext("table", t.getSig().getName()) throw UserException.parseError() .message( "unknown type %s, expected one of %s",
throw UserException.parseError().message("System and Information Schema tables cannot be modified.", path).build(logger); throw UserException.parseError().message("Unable to approximate stats on virtual dataset %s", path).build(logger); throw UserException.parseError().message("Unable to find table %s.", path).build(logger); return singletonList(successful(String.format("Successfully updated table '%s' from namespace.", table.getPath()))); } catch (NamespaceNotFoundException ex) { throw UserException.parseError(ex).message("Failure modifying table %s.", path).build(logger);
throw UserException.parseError() .message("'%s' expects a string literal as a second argument.", functionName) .build(logger); } else if (nArgs > 3 || (nArgs > 2 && functionName.equalsIgnoreCase("convert_to"))) { throw UserException.parseError() .message("Too many operands (%d) for '%s'", nArgs, functionName) .build(logger); if (nArgs == 3) { if (!literal.equalsIgnoreCase("utf8")) { throw UserException.parseError() .message("3-argument convert_from only supported for utf8 encoding. Instead, got %s", literal) .build(logger);
@Override public void dropView(SchemaConfig schemaConfig, List<String> tableSchemaPath) throws IOException { if(!getMutability().hasMutationCapability(MutationType.VIEW, schemaConfig.isSystemUser())) { throw UserException.parseError() .message("Unable to drop view. Schema [%s] is immutable for this user.", this.name) .build(logger); } getFS(schemaConfig.getUserName()).delete(getViewPath(tableSchemaPath), false); }
|| !typeName.equalsIgnoreCase((String)typeParam)) { throw UserException.parseError() .message( "This function signature is not supported: %s\n" config = pluginConfigClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw UserException.parseError(e) .message( "configuration for format of type %s can not be created (class: %s)", TableParamDef expectedParamDef = this.functionParamsByName.get(paramDef.getName()); if (expectedParamDef == null || expectedParamDef.getType() != paramDef.getType()) { throw UserException.parseError() .message( "The parameters provided are not applicable to the type specified:\n" String stringParam = (String) param; if (stringParam.length() != 1) { throw UserException.parseError() .message("Expected single character but was String: %s", stringParam) .addContext("table", t.getSig().getName()) throw UserException.parseError(e) .message("can not set value %s to parameter %s: %s", param, paramDef.getName(), paramDef.getType()) .addContext("table", t.getSig().getName())
@Override public boolean createOrUpdateView(NamespaceKey key, View view, SchemaConfig schemaConfig) throws IOException { if(!getMutability().hasMutationCapability(MutationType.VIEW, schemaConfig.isSystemUser())) { throw UserException.parseError() .message("Unable to create view. Schema [%s] is immutable for this user.", key.getParent()) .build(logger); } Path viewPath = getViewPath(key.getPathComponents()); FileSystemWrapper fs = getFS(schemaConfig.getUserName()); boolean replaced = fs.exists(viewPath); final FsPermission viewPerms = new FsPermission(schemaConfig.getOption(ExecConstants.NEW_VIEW_DEFAULT_PERMS_KEY).getStringVal()); try (OutputStream stream = FileSystemWrapper.create(fs, viewPath, viewPerms)) { lpPersistance.getMapper().writeValue(stream, view); } return replaced; }
case ExtendedTypeName.TYPE: if(checkNextToken(JsonToken.VALUE_NUMBER_INT) || !hasBinary()) { throw UserException.parseError() .message("Either $type is not an integer or has no $binary") .build(LOG);
@Override public CreateTableEntry createNewTable(SchemaConfig config, NamespaceKey key, WriterOptions writerOptions, Map<String, Object> storageOptions) { if(!getMutability().hasMutationCapability(MutationType.TABLE, config.isSystemUser())) { throw UserException.parseError() .message("Unable to create table. Schema [%s] is immutable for this user.", key.getParent()) .build(logger);
throw UserException.parseError() .message("Unable to drop table. Schema [%s] is immutable for this user.", this.name) .build(logger);