Java Code Examples for org.apache.kylin.cube.model.CubeDesc#setSignature()
The following examples show how to use
org.apache.kylin.cube.model.CubeDesc#setSignature() .
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: CubeMetadataUpgrade.java From Kylin with Apache License 2.0 | 6 votes |
private void upgradeCubeDesc() { logger.info("Reloading Cube Metadata from folder " + store.getReadableResourcePath(ResourceStore.CUBE_DESC_RESOURCE_ROOT)); List<String> paths = listResourceStore(ResourceStore.CUBE_DESC_RESOURCE_ROOT); for (String path : paths) { try { CubeDescUpgrader upgrade = new CubeDescUpgrader(path); CubeDesc ndesc = upgrade.upgrade(); ndesc.setSignature(ndesc.calculateSignature()); getStore().putResource(ndesc.getModel().getResourcePath(), ndesc.getModel(), MetadataManager.MODELDESC_SERIALIZER); getStore().putResource(ndesc.getResourcePath(), ndesc, CubeDescManager.CUBE_DESC_SERIALIZER); updatedResources.add(ndesc.getResourcePath()); } catch (IOException e) { e.printStackTrace(); errorMsgs.add("Upgrade CubeDesc at '" + path + "' failed: " + e.getLocalizedMessage()); } } }
Example 2
Source File: CubeSignatureRefresher.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
private void updateCubeDesc(CubeDesc cubeDesc) { try { String calculatedSign = cubeDesc.calculateSignature(); if (cubeDesc.getSignature() == null || (!cubeDesc.getSignature().equals(calculatedSign))) { cubeDesc.setSignature(calculatedSign); store.checkAndPutResource(cubeDesc.getResourcePath(), cubeDesc, CubeDesc.newSerializerForLowLevelAccess()); updatedResources.add(cubeDesc.getResourcePath()); } } catch (Exception e) { logger.error("error", e); errorMsgs.add("Update CubeDesc[" + cubeDesc.getName() + "] failed: " + e.getLocalizedMessage()); } }
Example 3
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 4
Source File: CubeDescManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
/** * Update CubeDesc with the input. Broadcast the event into cluster */ public CubeDesc updateCubeDesc(CubeDesc desc) throws IOException { try (AutoLock lock = descMapLock.lockForWrite()) { // Validate CubeDesc if (desc.getUuid() == null || desc.getName() == null) throw new IllegalArgumentException(); String name = desc.getName(); if (!cubeDescMap.containsKey(name)) throw new IllegalArgumentException("CubeDesc '" + name + "' does not exist."); if (desc.isDraft()) throw new IllegalArgumentException(String.format(Locale.ROOT, CUBE_SHOULD_NOT_BE_DRAFT_MSG, desc.getName())); try { desc.init(config); } catch (Exception e) { logger.warn("Broken cube desc " + desc, e); desc.addError(e.toString()); return desc; } postProcessCubeDesc(desc); // Semantic validation CubeMetadataValidator validator = new CubeMetadataValidator(config); ValidateContext context = validator.validate(desc); if (!context.ifPass()) { return desc; } desc.setSignature(desc.calculateSignature()); // save resource crud.save(desc); return desc; } }
Example 5
Source File: CubeSignatureRefresher.java From kylin with Apache License 2.0 | 5 votes |
private void updateCubeDesc(CubeDesc cubeDesc) { try { String calculatedSign = cubeDesc.calculateSignature(); if (cubeDesc.getSignature() == null || (!cubeDesc.getSignature().equals(calculatedSign))) { cubeDesc.setSignature(calculatedSign); store.checkAndPutResource(cubeDesc.getResourcePath(), cubeDesc, CubeDesc.newSerializerForLowLevelAccess()); updatedResources.add(cubeDesc.getResourcePath()); } } catch (Exception e) { logger.error("error", e); errorMsgs.add("Update CubeDesc[" + cubeDesc.getName() + "] failed: " + e.getLocalizedMessage()); } }
Example 6
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 7
Source File: CubeDescManager.java From kylin with Apache License 2.0 | 5 votes |
/** * Update CubeDesc with the input. Broadcast the event into cluster */ public CubeDesc updateCubeDesc(CubeDesc desc) throws IOException { try (AutoLock lock = descMapLock.lockForWrite()) { // Validate CubeDesc if (desc.getUuid() == null || desc.getName() == null) throw new IllegalArgumentException(); String name = desc.getName(); if (!cubeDescMap.containsKey(name)) throw new IllegalArgumentException("CubeDesc '" + name + "' does not exist."); if (desc.isDraft()) throw new IllegalArgumentException(String.format(Locale.ROOT, CUBE_SHOULD_NOT_BE_DRAFT_MSG, desc.getName())); try { desc.init(config); } catch (Exception e) { logger.warn("Broken cube desc " + desc, e); desc.addError(e.toString()); return desc; } postProcessCubeDesc(desc); // Semantic validation CubeMetadataValidator validator = new CubeMetadataValidator(config); ValidateContext context = validator.validate(desc); if (!context.ifPass()) { return desc; } desc.setSignature(desc.calculateSignature()); // save resource crud.save(desc); return desc; } }
Example 8
Source File: CubeDescManager.java From Kylin with Apache License 2.0 | 5 votes |
/** * Create a new CubeDesc * * @param cubeDesc * @return * @throws IOException */ public CubeDesc createCubeDesc(CubeDesc cubeDesc) throws IOException { if (cubeDesc.getUuid() == null || cubeDesc.getName() == null) throw new IllegalArgumentException(); if (cubeDescMap.containsKey(cubeDesc.getName())) throw new IllegalArgumentException("CubeDesc '" + cubeDesc.getName() + "' already exists"); try { cubeDesc.init(config, getMetadataManager().getAllTablesMap()); } catch (IllegalStateException e) { cubeDesc.addError(e.getMessage(), true); } // Check base validation if (!cubeDesc.getError().isEmpty()) { return cubeDesc; } // Semantic validation CubeMetadataValidator validator = new CubeMetadataValidator(); ValidateContext context = validator.validate(cubeDesc, true); if (!context.ifPass()) { return cubeDesc; } cubeDesc.setSignature(cubeDesc.calculateSignature()); String path = cubeDesc.getResourcePath(); getStore().putResource(path, cubeDesc, CUBE_DESC_SERIALIZER); cubeDescMap.put(cubeDesc.getName(), cubeDesc); return cubeDesc; }