Java Code Examples for org.apache.kylin.metadata.realization.IRealization#getAllColumns()

The following examples show how to use org.apache.kylin.metadata.realization.IRealization#getAllColumns() . 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: ProjectL2Cache.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
private boolean sanityCheck(ProjectCache prjCache, IRealization realization) {
    if (realization == null)
        return false;

    TableMetadataManager metaMgr = mgr.getTableManager();

    Set<TblColRef> allColumns = realization.getAllColumns();
    if (allColumns == null || allColumns.isEmpty()) {
        logger.error("Realization '" + realization.getCanonicalName() + "' does not report any columns");
        return false;
    }

    for (TblColRef col : allColumns) {
        TableDesc table = metaMgr.getTableDesc(col.getTable(), prjCache.project);
        if (table == null) {
            logger.error("Realization '" + realization.getCanonicalName() + "' reports column '" + col.getCanonicalName() + "', but its table is not found by MetadataManager");
            return false;
        }

        if (!col.getColumnDesc().isComputedColumn()) {
            ColumnDesc foundCol = table.findColumnByName(col.getName());
            if (col.getColumnDesc().equals(foundCol) == false) {
                logger.error("Realization '" + realization.getCanonicalName() + "' reports column '" + col.getCanonicalName() + "', but it is not equal to '" + foundCol + "' according to MetadataManager");
                return false;
            }
        } else {
            //computed column may not exit here
        }

        // auto-define table required by realization for some legacy test case
        if (prjCache.tables.get(table.getIdentity()) == null) {
            prjCache.tables.put(table.getIdentity(), new TableCache(table));
            logger.warn("Realization '" + realization.getCanonicalName() + "' reports column '" + col.getCanonicalName() + "' whose table is not defined in project '" + prjCache.project + "'");
        }
    }

    return true;
}
 
Example 2
Source File: ProjectL2Cache.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
private void markExposedTablesAndColumns(ProjectCache prjCache, IRealization realization) {
    if (!realization.isReady()) {
        return;
    }

    for (TblColRef col : realization.getAllColumns()) {
        TableCache tableCache = prjCache.tables.get(col.getTable());
        prjCache.exposedTables.add(tableCache.tableDesc);
        tableCache.exposed = true;
        tableCache.exposedColumns.add(col.getColumnDesc());
    }
}
 
Example 3
Source File: ProjectL2Cache.java    From kylin with Apache License 2.0 5 votes vote down vote up
private boolean sanityCheck(ProjectCache prjCache, IRealization realization) {
    if (realization == null)
        return false;

    TableMetadataManager metaMgr = mgr.getTableManager();

    Set<TblColRef> allColumns = realization.getAllColumns();
    if (allColumns == null || allColumns.isEmpty()) {
        logger.error("Realization '" + realization.getCanonicalName() + "' does not report any columns");
        return false;
    }

    for (TblColRef col : allColumns) {
        TableDesc table = metaMgr.getTableDesc(col.getTable(), prjCache.project);
        if (table == null) {
            logger.error("Realization '" + realization.getCanonicalName() + "' reports column '" + col.getCanonicalName() + "', but its table is not found by MetadataManager");
            return false;
        }

        if (!col.getColumnDesc().isComputedColumn()) {
            ColumnDesc foundCol = table.findColumnByName(col.getName());
            if (col.getColumnDesc().equals(foundCol) == false) {
                logger.error("Realization '" + realization.getCanonicalName() + "' reports column '" + col.getCanonicalName() + "', but it is not equal to '" + foundCol + "' according to MetadataManager");
                return false;
            }
        } else {
            //computed column may not exit here
        }

        // auto-define table required by realization for some legacy test case
        if (prjCache.tables.get(table.getIdentity()) == null) {
            prjCache.tables.put(table.getIdentity(), new TableCache(table));
            logger.warn("Realization '" + realization.getCanonicalName() + "' reports column '" + col.getCanonicalName() + "' whose table is not defined in project '" + prjCache.project + "'");
        }
    }

    return true;
}
 
Example 4
Source File: ProjectL2Cache.java    From kylin with Apache License 2.0 5 votes vote down vote up
private void markExposedTablesAndColumns(ProjectCache prjCache, IRealization realization) {
    if (!realization.isReady()) {
        return;
    }

    for (TblColRef col : realization.getAllColumns()) {
        TableCache tableCache = prjCache.tables.get(col.getTable());
        prjCache.exposedTables.add(tableCache.tableDesc);
        tableCache.exposed = true;
        tableCache.exposedColumns.add(col.getColumnDesc());
    }
}
 
Example 5
Source File: ProjectL2Cache.java    From Kylin with Apache License 2.0 5 votes vote down vote up
private boolean sanityCheck(ProjectCache prjCache, IRealization realization) {
    MetadataManager metaMgr = mgr.getMetadataManager();

    List<TblColRef> allColumns = realization.getAllColumns();
    if (allColumns == null || allColumns.isEmpty()) {
        logger.error("Realization '" + realization.getCanonicalName() + "' does not report any columns");
        return false;
    }

    for (TblColRef col : allColumns) {
        TableDesc table = metaMgr.getTableDesc(col.getTable());
        if (table == null) {
            logger.error("Realization '" + realization.getCanonicalName() + "' reports column '" + col.getCanonicalName() + "', but its table is not found by MetadataManager");
            return false;
        }
        ColumnDesc foundCol = table.findColumnByName(col.getName());
        if (col.getColumn().equals(foundCol) == false) {
            logger.error("Realization '" + realization.getCanonicalName() + "' reports column '" + col.getCanonicalName() + "', but it is not equal to '" + foundCol + "' according to MetadataManager");
            return false;
        }

        // auto-define table required by realization for some legacy test case
        if (prjCache.tables.get(table.getIdentity()) == null) {
            prjCache.tables.put(table.getIdentity(), new TableCache(table));
            logger.warn("Realization '" + realization.getCanonicalName() + "' reports columcn '" + col.getCanonicalName() + "' whose table is not defined in project '" + prjCache.project + "'");
        }
    }

    return true;
}
 
Example 6
Source File: ProjectL2Cache.java    From Kylin with Apache License 2.0 5 votes vote down vote up
private void markExposedTablesAndColumns(ProjectCache prjCache, IRealization realization) {
    if (!realization.isReady()) {
        return;
    }

    for (TblColRef col : realization.getAllColumns()) {
        TableCache tableCache = prjCache.tables.get(col.getTable());
        prjCache.exposedTables.add(tableCache.tableDesc);
        tableCache.exposed = true;
        tableCache.exposedColumns.add(col.getColumn());
    }
}
 
Example 7
Source File: ProjectL2Cache.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
private void mapTableToRealization(ProjectCache prjCache, IRealization realization) {
    for (TblColRef col : realization.getAllColumns()) {
        TableCache tableCache = prjCache.tables.get(col.getTable());
        tableCache.realizations.add(realization);
    }
}
 
Example 8
Source File: ProjectL2Cache.java    From kylin with Apache License 2.0 4 votes vote down vote up
private void mapTableToRealization(ProjectCache prjCache, IRealization realization) {
    for (TblColRef col : realization.getAllColumns()) {
        TableCache tableCache = prjCache.tables.get(col.getTable());
        tableCache.realizations.add(realization);
    }
}
 
Example 9
Source File: ProjectL2Cache.java    From Kylin with Apache License 2.0 4 votes vote down vote up
private void mapTableToRealization(ProjectCache prjCache, IRealization realization) {
    for (TblColRef col : realization.getAllColumns()) {
        TableCache tableCache = prjCache.tables.get(col.getTable());
        tableCache.realizations.add(realization);
    }
}