Java Code Examples for org.apache.kylin.cube.model.CubeDesc#isBroken()
The following examples show how to use
org.apache.kylin.cube.model.CubeDesc#isBroken() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CubeService.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#project, 'ADMINISTRATION') or hasPermission(#project, 'MANAGEMENT')") public CubeDesc saveCube(CubeDesc desc, ProjectInstance project) throws IOException { Message msg = MsgPicker.getMsg(); desc.setDraft(false); if (desc.getUuid() == null) desc.updateRandomUuid(); try { createCubeAndDesc(project, desc); } catch (AccessDeniedException accessDeniedException) { throw new ForbiddenException(msg.getUPDATE_CUBE_NO_RIGHT()); } if (desc.isBroken()) { throw new BadRequestException(desc.getErrorsAsString()); } return desc; }
Example 2
Source File: CubeService.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public CubeDesc updateCube(CubeInstance cube, CubeDesc desc, ProjectInstance project) throws IOException { aclEvaluate.checkProjectWritePermission(cube); Message msg = MsgPicker.getMsg(); String projectName = project.getName(); desc.setDraft(false); try { if (cube.getSegments().size() != 0 && !cube.getDescriptor().consistentWith(desc)) { throw new BadRequestException( String.format(Locale.ROOT, msg.getINCONSISTENT_CUBE_DESC(), desc.getName())); } desc = updateCubeAndDesc(cube, desc, projectName, true); } catch (AccessDeniedException accessDeniedException) { throw new ForbiddenException(msg.getUPDATE_CUBE_NO_RIGHT()); } if (desc.isBroken()) { throw new BadRequestException(desc.getErrorsAsString()); } return desc; }
Example 3
Source File: CubeService.java From kylin with Apache License 2.0 | 6 votes |
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#project, 'ADMINISTRATION') or hasPermission(#project, 'MANAGEMENT')") public CubeDesc saveCube(CubeDesc desc, ProjectInstance project) throws IOException { Message msg = MsgPicker.getMsg(); desc.setDraft(false); if (desc.getUuid() == null) desc.updateRandomUuid(); try { createCubeAndDesc(project, desc); } catch (AccessDeniedException accessDeniedException) { throw new ForbiddenException(msg.getUPDATE_CUBE_NO_RIGHT()); } if (desc.isBroken()) { throw new BadRequestException(desc.getErrorsAsString()); } return desc; }
Example 4
Source File: CubeService.java From kylin with Apache License 2.0 | 6 votes |
public CubeDesc updateCube(CubeInstance cube, CubeDesc desc, ProjectInstance project) throws IOException { aclEvaluate.checkProjectWritePermission(cube); Message msg = MsgPicker.getMsg(); String projectName = project.getName(); desc.setDraft(false); try { if (cube.getSegments().size() != 0 && !cube.getDescriptor().consistentWith(desc)) { throw new BadRequestException( String.format(Locale.ROOT, msg.getINCONSISTENT_CUBE_DESC(), desc.getName())); } desc = updateCubeAndDesc(cube, desc, projectName, true); } catch (AccessDeniedException accessDeniedException) { throw new ForbiddenException(msg.getUPDATE_CUBE_NO_RIGHT()); } if (desc.isBroken()) { throw new BadRequestException(desc.getErrorsAsString()); } return desc; }
Example 5
Source File: CubeInstance.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
void init(KylinConfig config) { CubeDesc cubeDesc = CubeDescManager.getInstance(config).getCubeDesc(descName); checkNotNull(cubeDesc, "cube descriptor '%s' (for cube '%s') not found", descName, name); if (cubeDesc.isBroken()) { setStatus(RealizationStatusEnum.DESCBROKEN); logger.error("cube descriptor {} (for cube '{}') is broken", cubeDesc.getResourcePath(), name); logger.error("Errors: {}", cubeDesc.getErrorsAsString()); } else if (getStatus() == RealizationStatusEnum.DESCBROKEN) { setStatus(RealizationStatusEnum.DISABLED); logger.info("cube {} changed from DESCBROKEN to DISABLED", name); } setConfig((KylinConfigExt) cubeDesc.getConfig()); }
Example 6
Source File: CubeDescManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public CubeDesc reloadCubeDescLocal(String name) throws IOException { try (AutoLock lock = descMapLock.lockForWrite()) { CubeDesc ndesc = crud.reload(name); clearCuboidCache(name); // Broken CubeDesc is not allowed to be saved and broadcast. if (ndesc.isBroken()) throw new IllegalStateException("CubeDesc " + name + " is broken"); return ndesc; } }
Example 7
Source File: CubeDescManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
/** * Create a new CubeDesc */ public CubeDesc createCubeDesc(CubeDesc cubeDesc) throws IOException { try (AutoLock lock = descMapLock.lockForWrite()) { if (cubeDesc.getUuid() == null || cubeDesc.getName() == null) throw new IllegalArgumentException(); if (cubeDescMap.containsKey(cubeDesc.getName())) throw new IllegalArgumentException("CubeDesc '" + cubeDesc.getName() + "' already exists"); if (cubeDesc.isDraft()) throw new IllegalArgumentException(String.format(Locale.ROOT, CUBE_SHOULD_NOT_BE_DRAFT_MSG, cubeDesc.getName())); try { cubeDesc.init(config); } catch (Exception e) { logger.warn("Broken cube desc " + cubeDesc, e); cubeDesc.addError(e.toString()); } postProcessCubeDesc(cubeDesc); // Check base validation if (cubeDesc.isBroken()) { return cubeDesc; } // Semantic validation CubeMetadataValidator validator = new CubeMetadataValidator(config); ValidateContext context = validator.validate(cubeDesc); if (!context.ifPass()) { return cubeDesc; } cubeDesc.setSignature(cubeDesc.calculateSignature()); // save resource crud.save(cubeDesc); return cubeDesc; } }
Example 8
Source File: CubeService.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#project, 'ADMINISTRATION') or hasPermission(#project, 'MANAGEMENT')") public CubeInstance createCubeAndDesc(ProjectInstance project, CubeDesc desc) throws IOException { Message msg = MsgPicker.getMsg(); String cubeName = desc.getName(); if (getCubeManager().getCube(cubeName) != null) { throw new BadRequestException(String.format(Locale.ROOT, msg.getCUBE_ALREADY_EXIST(), cubeName)); } if (getCubeDescManager().getCubeDesc(desc.getName()) != null) { throw new BadRequestException(String.format(Locale.ROOT, msg.getCUBE_DESC_ALREADY_EXIST(), desc.getName())); } String owner = SecurityContextHolder.getContext().getAuthentication().getName(); CubeDesc createdDesc; CubeInstance createdCube; createdDesc = getCubeDescManager().createCubeDesc(desc); if (createdDesc.isBroken()) { throw new BadRequestException(createdDesc.getErrorsAsString()); } int cuboidCount = CuboidCLI.simulateCuboidGeneration(createdDesc, false); logger.info("New cube " + cubeName + " has " + cuboidCount + " cuboids"); createdCube = getCubeManager().createCube(cubeName, project.getName(), createdDesc, owner); return createdCube; }
Example 9
Source File: CubeInstance.java From kylin with Apache License 2.0 | 5 votes |
void init(KylinConfig config) { CubeDesc cubeDesc = CubeDescManager.getInstance(config).getCubeDesc(descName); checkNotNull(cubeDesc, "cube descriptor '%s' (for cube '%s') not found", descName, name); if (cubeDesc.isBroken()) { setStatus(RealizationStatusEnum.DESCBROKEN); logger.error("cube descriptor {} (for cube '{}') is broken", cubeDesc.getResourcePath(), name); logger.error("Errors: {}", cubeDesc.getErrorsAsString()); } else if (getStatus() == RealizationStatusEnum.DESCBROKEN) { setStatus(RealizationStatusEnum.DISABLED); logger.info("cube {} changed from DESCBROKEN to DISABLED", name); } setConfig((KylinConfigExt) cubeDesc.getConfig()); }
Example 10
Source File: CubeDescManager.java From kylin with Apache License 2.0 | 5 votes |
public CubeDesc reloadCubeDescLocal(String name) throws IOException { try (AutoLock lock = descMapLock.lockForWrite()) { CubeDesc ndesc = crud.reload(name); clearCuboidCache(name); // Broken CubeDesc is not allowed to be saved and broadcast. if (ndesc.isBroken()) throw new IllegalStateException("CubeDesc " + name + " is broken"); return ndesc; } }
Example 11
Source File: CubeDescManager.java From kylin with Apache License 2.0 | 5 votes |
/** * Create a new CubeDesc */ public CubeDesc createCubeDesc(CubeDesc cubeDesc) throws IOException { try (AutoLock lock = descMapLock.lockForWrite()) { if (cubeDesc.getUuid() == null || cubeDesc.getName() == null) throw new IllegalArgumentException(); if (cubeDescMap.containsKey(cubeDesc.getName())) throw new IllegalArgumentException("CubeDesc '" + cubeDesc.getName() + "' already exists"); if (cubeDesc.isDraft()) throw new IllegalArgumentException(String.format(Locale.ROOT, CUBE_SHOULD_NOT_BE_DRAFT_MSG, cubeDesc.getName())); try { cubeDesc.init(config); } catch (Exception e) { logger.warn("Broken cube desc " + cubeDesc, e); cubeDesc.addError(e.toString()); } postProcessCubeDesc(cubeDesc); // Check base validation if (cubeDesc.isBroken()) { return cubeDesc; } // Semantic validation CubeMetadataValidator validator = new CubeMetadataValidator(config); ValidateContext context = validator.validate(cubeDesc); if (!context.ifPass()) { return cubeDesc; } cubeDesc.setSignature(cubeDesc.calculateSignature()); // save resource crud.save(cubeDesc); return cubeDesc; } }
Example 12
Source File: CubeService.java From kylin with Apache License 2.0 | 5 votes |
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#project, 'ADMINISTRATION') or hasPermission(#project, 'MANAGEMENT')") public CubeInstance createCubeAndDesc(ProjectInstance project, CubeDesc desc) throws IOException { Message msg = MsgPicker.getMsg(); String cubeName = desc.getName(); if (getCubeManager().getCube(cubeName) != null) { throw new BadRequestException(String.format(Locale.ROOT, msg.getCUBE_ALREADY_EXIST(), cubeName)); } if (getCubeDescManager().getCubeDesc(desc.getName()) != null) { throw new BadRequestException(String.format(Locale.ROOT, msg.getCUBE_DESC_ALREADY_EXIST(), desc.getName())); } String owner = SecurityContextHolder.getContext().getAuthentication().getName(); CubeDesc createdDesc; CubeInstance createdCube; createdDesc = getCubeDescManager().createCubeDesc(desc); if (createdDesc.isBroken()) { throw new BadRequestException(createdDesc.getErrorsAsString()); } int cuboidCount = CuboidCLI.simulateCuboidGeneration(createdDesc, false); logger.info("New cube " + cubeName + " has " + cuboidCount + " cuboids"); createdCube = getCubeManager().createCube(cubeName, project.getName(), createdDesc, owner); return createdCube; }