@Override public List<String> getRelatedKylinResources(TableDesc table) { List<String> dependentResources = Lists.newArrayList(); dependentResources.add(KafkaConfig.concatResourcePath(table.getIdentity())); if (table.getSourceType() == ISourceAware.ID_STREAMING) { dependentResources.add(StreamingConfig.concatResourcePath(table.getIdentity())); } return dependentResources; }
@Override public int getSourceType() { return getModel().getRootFactTable().getTableDesc().getSourceType(); }
public DataModelDesc createModelDesc(String projectName, DataModelDesc desc) throws IOException { aclEvaluate.checkProjectWritePermission(projectName); Message msg = MsgPicker.getMsg(); if (getDataModelManager().getDataModelDesc(desc.getName()) != null) { throw new BadRequestException(String.format(Locale.ROOT, msg.getDUPLICATE_MODEL_NAME(), desc.getName())); } String factTableName = desc.getRootFactTableName(); TableDesc tableDesc = getTableManager().getTableDesc(factTableName, projectName); if (tableDesc.getSourceType() == ISourceAware.ID_STREAMING && (desc.getPartitionDesc() == null || desc.getPartitionDesc().getPartitionDateColumn() == null)) { throw new IllegalArgumentException("Must define a partition column."); } DataModelDesc createdDesc = null; String owner = SecurityContextHolder.getContext().getAuthentication().getName(); createdDesc = getDataModelManager().createDataModelDesc(desc, projectName, owner); return createdDesc; }
/** * @param table */ public TableDescResponse(TableDesc table) { this.setColumns(table.getColumns()); this.setDatabase(table.getDatabase()); this.setName(table.getName()); this.setSourceType(table.getSourceType()); this.setUuid(table.getUuid()); this.setTableType(table.getTableType()); }
@Override public void validate(CubeDesc cube, ValidateContext context) { DataModelDesc model = cube.getModel(); if (model.getRootFactTable().getTableDesc().getSourceType() != ISourceAware.ID_STREAMING) { return; } if (model.getPartitionDesc() == null || model.getPartitionDesc().getPartitionDateColumn() == null) { context.addResult(ResultLevel.ERROR, "Must define a partition column."); return; } final TblColRef partitionCol = model.getPartitionDesc().getPartitionDateColumnRef(); boolean found = false; for (DimensionDesc dimensionDesc : cube.getDimensions()) { for (TblColRef dimCol : dimensionDesc.getColumnRefs()) { if (dimCol.equals(partitionCol)) { found = true; break; } } } if (found == false) { context.addResult(ResultLevel.ERROR, "Partition column '" + partitionCol + "' isn't in dimension list."); return; } }
public CubeInstanceResponse(CubeInstance cube, String project) { this.project = project; if (cube == null) return; setUuid(cube.getUuid()); setVersion(cube.getVersion()); setName(cube.getName()); setOwner(cube.getOwner()); setDescName(cube.getDescName()); setCost(cube.getCost()); setStatus(cube.getStatus()); setSegments(cube.getSegments()); setCreateTimeUTC(cube.getCreateTimeUTC()); setLastModified(cube.getDescriptor().getLastModified()); setCuboidLastOptimized(cube.getCuboidLastOptimized()); this.model = cube.getDescriptor().getModelName(); this.partitionDateStart = cube.getDescriptor().getPartitionDateStart(); // cuz model doesn't have a state to label a model is broken, // so in some case the model can not be loaded due to some check failed, // but the cube in this model can still be loaded. if (cube.getModel() != null) { this.partitionDateColumn = cube.getModel().getPartitionDesc().getPartitionDateColumn(); this.isStandardPartitioned = cube.getModel().isStandardPartitionedDateColumn(); this.isStreaming = cube.getModel().getRootFactTable().getTableDesc() .getSourceType() == ISourceAware.ID_STREAMING; } initSizeKB(); initInputRecordCount(); initInputRecordSizeBytes(); }
@Override public int getSourceType() { return getDataModelDesc().getFactTableDesc().getSourceType(); } }
@Override public List<String> getRelatedKylinResources(TableDesc table) { List<String> dependentResources = Lists.newArrayList(); dependentResources.add(KafkaConfig.concatResourcePath(table.getIdentity())); if (table.getSourceType() == ISourceAware.ID_STREAMING) { dependentResources.add(StreamingConfig.concatResourcePath(table.getIdentity())); } return dependentResources; }
@Override public int getSourceType() { return getModel().getRootFactTable().getTableDesc().getSourceType(); }
@Override public void validate(CubeDesc cube, ValidateContext context) { DataModelDesc model = cube.getModel(); if (model.getRootFactTable().getTableDesc().getSourceType() != ISourceAware.ID_STREAMING) { return; } if (model.getPartitionDesc() == null || model.getPartitionDesc().getPartitionDateColumn() == null) { context.addResult(ResultLevel.ERROR, "Must define a partition column."); return; } final TblColRef partitionCol = model.getPartitionDesc().getPartitionDateColumnRef(); boolean found = false; for (DimensionDesc dimensionDesc : cube.getDimensions()) { for (TblColRef dimCol : dimensionDesc.getColumnRefs()) { if (dimCol.equals(partitionCol)) { found = true; break; } } } if (found == false) { context.addResult(ResultLevel.ERROR, "Partition column '" + partitionCol + "' isn't in dimension list."); return; } }