public CannotFilterExtendedColumnException(TblColRef tblColRef) { super(tblColRef == null ? "null" : tblColRef.getCanonicalName()); } }
public String toString() { return columnRef.getCanonicalName(); }
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; 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; logger.warn("Realization '" + realization.getCanonicalName() + "' reports column '" + col.getCanonicalName() + "' whose table is not defined in project '" + prjCache.project + "'");
public String getCanonicalName() { return colRef.getCanonicalName(); }
@Test public void testDateAndTimePartition() { PartitionDesc partitionDesc = new PartitionDesc(); TblColRef col1 = TblColRef.mockup(TableDesc.mockup("DEFAULT.TABLE_NAME"), 1, "DATE_COLUMN", "string"); partitionDesc.setPartitionDateColumnRef(col1); partitionDesc.setPartitionDateColumn(col1.getCanonicalName()); partitionDesc.setPartitionDateFormat("yyyy-MM-dd"); TblColRef col2 = TblColRef.mockup(TableDesc.mockup("DEFAULT.TABLE_NAME"), 2, "HOUR_COLUMN", "string"); partitionDesc.setPartitionTimeColumnRef(col2); partitionDesc.setPartitionTimeColumn(col2.getCanonicalName()); partitionDesc.setPartitionTimeFormat("H"); TSRange range = new TSRange(DateFormat.stringToMillis("2016-02-22 00:00:00"), DateFormat.stringToMillis("2016-02-23 01:00:00")); String condition = partitionConditionBuilder.buildDateRangeCondition(partitionDesc, null, range); Assert.assertEquals( "((UNKNOWN_ALIAS.DATE_COLUMN = '2016-02-22' AND UNKNOWN_ALIAS.HOUR_COLUMN >= '0') OR (UNKNOWN_ALIAS.DATE_COLUMN > '2016-02-22')) AND ((UNKNOWN_ALIAS.DATE_COLUMN = '2016-02-23' AND UNKNOWN_ALIAS.HOUR_COLUMN < '1') OR (UNKNOWN_ALIAS.DATE_COLUMN < '2016-02-23'))", condition); }
@Test public void testTimePartition() { PartitionDesc partitionDesc = new PartitionDesc(); TblColRef col = TblColRef.mockup(TableDesc.mockup("DEFAULT.TABLE_NAME"), 2, "HOUR_COLUMN", "string"); partitionDesc.setPartitionTimeColumnRef(col); partitionDesc.setPartitionTimeColumn(col.getCanonicalName()); partitionDesc.setPartitionTimeFormat("HH"); TSRange range = new TSRange(DateFormat.stringToMillis("2016-02-22 00:00:00"), DateFormat.stringToMillis("2016-02-23 01:00:00")); String condition = partitionConditionBuilder.buildDateRangeCondition(partitionDesc, null, range); Assert.assertEquals("UNKNOWN_ALIAS.HOUR_COLUMN >= '00' AND UNKNOWN_ALIAS.HOUR_COLUMN < '01'", condition); }
@Test public void testDatePartition() { PartitionDesc partitionDesc = new PartitionDesc(); TblColRef col = TblColRef.mockup(TableDesc.mockup("DEFAULT.TABLE_NAME"), 1, "DATE_COLUMN", "string"); partitionDesc.setPartitionDateColumnRef(col); partitionDesc.setPartitionDateColumn(col.getCanonicalName()); partitionDesc.setPartitionDateFormat("yyyy-MM-dd"); TSRange range = new TSRange(DateFormat.stringToMillis("2016-02-22"), DateFormat.stringToMillis("2016-02-23")); String condition = partitionConditionBuilder.buildDateRangeCondition(partitionDesc, null, range); Assert.assertEquals("UNKNOWN_ALIAS.DATE_COLUMN >= '2016-02-22' AND UNKNOWN_ALIAS.DATE_COLUMN < '2016-02-23'", condition); range = new TSRange(0L, 0L); condition = partitionConditionBuilder.buildDateRangeCondition(partitionDesc, null, range); Assert.assertEquals("1=0", condition); }
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; }
int columnIndex = 0; for (TblColRef col : cubeDesc.listDimensionColumnsExcludingDerived()) { dimensionIndexMap.put(colName(col.getCanonicalName()), columnIndex); columnList.add(new IntermediateColumnDesc(String.valueOf(columnIndex), col)); columnIndex++; rowKeyColumnIndexes = new int[rowkeyColCount]; for (int i = 0; i < rowkeyColCount; i++) { String colName = colName(cuboidColumns.get(i).getCanonicalName()); Integer dimIdx = dimensionIndexMap.get(colName); if (dimIdx == null) {
public String toString() { return columnRef.getCanonicalName(); }
public CannotFilterExtendedColumnException(TblColRef tblColRef) { super(tblColRef == null ? "null" : tblColRef.getCanonicalName()); } }
public String getCanonicalName() { return colRef.getCanonicalName(); }
@Override public void validate(FunctionDesc functionDesc) throws IllegalArgumentException { if (FUNC_COUNT_DISTINCT.equals(functionDesc.getExpression()) == false) throw new IllegalArgumentException("BitmapMeasureType func is not " + FUNC_COUNT_DISTINCT + " but " + functionDesc.getExpression()); if (DATATYPE_BITMAP.equals(functionDesc.getReturnDataType().getName()) == false) throw new IllegalArgumentException("BitmapMeasureType datatype is not " + DATATYPE_BITMAP + " but " + functionDesc.getReturnDataType().getName()); List<TblColRef> colRefs = functionDesc.getParameter().getColRefs(); if (colRefs.size() != 1) { throw new IllegalArgumentException("BitmapMeasureType col parameters count is not 1 but " + colRefs.size()); } TblColRef colRef = colRefs.get(0); DataType type = colRef.getType(); if (!type.isIntegerFamily()) { throw new IllegalArgumentException("BitmapMeasureType col type is not IntegerFamily but " + type.getName() + " of column " + colRef.getCanonicalName()); } }
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 column '" + col.getCanonicalName() + "' whose table is not defined in project '" + prjCache.project + "'"); } } return true; }
int columnIndex = 0; for (TblColRef col : cubeDesc.listDimensionColumnsExcludingDerived()) { dimensionIndexMap.put(colName(col.getCanonicalName()), columnIndex); columnList.add(new IntermediateColumnDesc(String.valueOf(columnIndex), col)); columnIndex++; rowKeyColumnIndexes = new int[rowkeyColCount]; for (int i = 0; i < rowkeyColCount; i++) { String colName = colName(cuboidColumns.get(i).getCanonicalName()); Integer dimIdx = dimensionIndexMap.get(colName); if (dimIdx == null) {
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; 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; logger.warn("Realization '" + realization.getCanonicalName() + "' reports column '" + col.getCanonicalName() + "' whose table is not defined in project '" + prjCache.project + "'");