Search in sources :

Example 6 with RangeIndicator

use of org.talend.dataquality.indicators.RangeIndicator in project tdq-studio-se by Talend.

the class SummaryStastictisExplorer method getOutRangeRowsStatement.

/**
 * DOC hcheng Comment method "getOutRangeRowsStatement".
 *
 * @return
 */
private String getOutRangeRowsStatement() {
    Double upperValue = null;
    Double lowerValue = null;
    if (indicator instanceof RangeIndicator) {
        upperValue = ((RangeIndicator) indicator).getUpperValue().getRealValue();
        lowerValue = ((RangeIndicator) indicator).getLowerValue().getRealValue();
    } else if (indicator instanceof IQRIndicator) {
        upperValue = ((IQRIndicator) indicator).getUpperValue().getRealValue();
        lowerValue = ((IQRIndicator) indicator).getLowerValue().getRealValue();
    }
    String whereClause = dbmsLanguage.where() + this.columnName + dbmsLanguage.less() + lowerValue + dbmsLanguage.or() + this.columnName + dbmsLanguage.greater() + upperValue;
    TdColumn column = (TdColumn) indicator.getAnalyzedElement();
    return SELECT_ALL + dbmsLanguage.from() + getFullyQualifiedTableName(column) + whereClause;
}
Also used : TdColumn(org.talend.cwm.relational.TdColumn) RangeIndicator(org.talend.dataquality.indicators.RangeIndicator) IQRIndicator(org.talend.dataquality.indicators.IQRIndicator)

Example 7 with RangeIndicator

use of org.talend.dataquality.indicators.RangeIndicator in project tdq-studio-se by Talend.

the class ModelElementIndicatorImpl method createCategoryIndicatorUnits.

/**
 * create indicatorMappings according category indicatorEnum.
 *
 * @param categoryEnums
 * @return
 */
private IndicatorUnit[] createCategoryIndicatorUnits(IndicatorEnum[] categoryEnums) {
    List<IndicatorUnit> indicatorUnitList = new ArrayList<IndicatorUnit>();
    IndicatorUnit indicatorUnit;
    for (IndicatorEnum categoryEnum : categoryEnums) {
        if (null == categoryEnum) {
            continue;
        }
        if (!IndicatorEnum.isPlainIndicatorEnum(categoryEnum)) {
            // tempSpecialIndicatorEnumList.add(categoryEnum);
            continue;
        }
        indicatorUnit = getPlainIndicatorUnit(categoryEnum);
        switch(categoryEnum) {
            case CountsIndicatorEnum:
                CountsIndicator countsIndicator = (CountsIndicator) indicatorUnit.getIndicator();
                countsIndicator.setBlankCountIndicator((BlankCountIndicator) getPlainIndicatorUnit(IndicatorEnum.BlankCountIndicatorEnum).getIndicator());
                countsIndicator.setDistinctCountIndicator((DistinctCountIndicator) getPlainIndicatorUnit(IndicatorEnum.DistinctCountIndicatorEnum).getIndicator());
                countsIndicator.setDuplicateCountIndicator((DuplicateCountIndicator) getPlainIndicatorUnit(IndicatorEnum.DuplicateCountIndicatorEnum).getIndicator());
                countsIndicator.setRowCountIndicator((RowCountIndicator) getPlainIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum).getIndicator());
                countsIndicator.setNullCountIndicator((NullCountIndicator) getPlainIndicatorUnit(IndicatorEnum.NullCountIndicatorEnum).getIndicator());
                countsIndicator.setUniqueCountIndicator((UniqueCountIndicator) getPlainIndicatorUnit(IndicatorEnum.UniqueIndicatorEnum).getIndicator());
                // MOD klliu bug 13411 2010-06-03
                countsIndicator.setDefaultValueIndicator((DefValueCountIndicator) getPlainIndicatorUnit(IndicatorEnum.DefValueCountIndicatorEnum).getIndicator());
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.CountsIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            case TextIndicatorEnum:
                TextIndicator textIndicator = (TextIndicator) indicatorUnit.getIndicator();
                textIndicator.setMinLengthIndicator((MinLengthIndicator) getPlainIndicatorUnit(IndicatorEnum.MinLengthIndicatorEnum).getIndicator());
                textIndicator.setMaxLengthIndicator((MaxLengthIndicator) getPlainIndicatorUnit(IndicatorEnum.MaxLengthIndicatorEnum).getIndicator());
                textIndicator.setAverageLengthIndicator((AverageLengthIndicator) getPlainIndicatorUnit(IndicatorEnum.AverageLengthIndicatorEnum).getIndicator());
                // MOD yyi 2010-08-05
                textIndicator.setAvgLengthWithBlankIndicator((AvgLengthWithBlankIndicator) getPlainIndicatorUnit(IndicatorEnum.AverageLengthWithBlankIndicatorEnum).getIndicator());
                textIndicator.setAvgLengthWithNullIndicator((AvgLengthWithNullIndicator) getPlainIndicatorUnit(IndicatorEnum.AverageLengthWithNullIndicatorEnum).getIndicator());
                textIndicator.setAvgLengthWithBlankNullIndicator((AvgLengthWithBlankNullIndicator) getPlainIndicatorUnit(IndicatorEnum.AverageLengthWithNullBlankIndicatorEnum).getIndicator());
                textIndicator.setMinLengthWithBlankIndicator((MinLengthWithBlankIndicator) getPlainIndicatorUnit(IndicatorEnum.MinLengthWithBlankIndicatorEnum).getIndicator());
                textIndicator.setMinLengthWithNullIndicator((MinLengthWithNullIndicator) getPlainIndicatorUnit(IndicatorEnum.MinLengthWithNullIndicatorEnum).getIndicator());
                textIndicator.setMinLengthWithBlankNullIndicator((MinLengthWithBlankNullIndicator) getPlainIndicatorUnit(IndicatorEnum.MinLengthWithBlankNullIndicatorEnum).getIndicator());
                textIndicator.setMaxLengthWithBlankIndicator((MaxLengthWithBlankIndicator) getPlainIndicatorUnit(IndicatorEnum.MaxLengthWithBlankIndicatorEnum).getIndicator());
                textIndicator.setMaxLengthWithNullIndicator((MaxLengthWithNullIndicator) getPlainIndicatorUnit(IndicatorEnum.MaxLengthWithNullIndicatorEnum).getIndicator());
                textIndicator.setMaxLengthWithBlankNullIndicator((MaxLengthWithBlankNullIndicator) getPlainIndicatorUnit(IndicatorEnum.MaxLengthWithBlankNullIndicatorEnum).getIndicator());
                // ~
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.TextIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            case BoxIIndicatorEnum:
                BoxIndicator boxtIndicator = (BoxIndicator) indicatorUnit.getIndicator();
                boxtIndicator.setRangeIndicator((RangeIndicator) getPlainIndicatorUnit(IndicatorEnum.RangeIndicatorEnum).getIndicator());
                boxtIndicator.setIQR((IQRIndicator) getPlainIndicatorUnit(IndicatorEnum.IQRIndicatorEnum).getIndicator());
                boxtIndicator.setMeanIndicator((MeanIndicator) getPlainIndicatorUnit(IndicatorEnum.MeanIndicatorEnum).getIndicator());
                boxtIndicator.setMedianIndicator((MedianIndicator) getPlainIndicatorUnit(IndicatorEnum.MedianIndicatorEnum).getIndicator());
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.BoxIIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            case IQRIndicatorEnum:
                IQRIndicator iqrIndicator = (IQRIndicator) indicatorUnit.getIndicator();
                iqrIndicator.setLowerValue((LowerQuartileIndicator) getPlainIndicatorUnit(IndicatorEnum.LowerQuartileIndicatorEnum).getIndicator());
                iqrIndicator.setUpperValue((UpperQuartileIndicator) getPlainIndicatorUnit(IndicatorEnum.UpperQuartileIndicatorEnum).getIndicator());
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.IQRIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            case RangeIndicatorEnum:
                RangeIndicator rangeIndicator = (RangeIndicator) indicatorUnit.getIndicator();
                rangeIndicator.setLowerValue((MinValueIndicator) getPlainIndicatorUnit(IndicatorEnum.MinValueIndicatorEnum).getIndicator());
                rangeIndicator.setUpperValue((MaxValueIndicator) getPlainIndicatorUnit(IndicatorEnum.MaxValueIndicatorEnum).getIndicator());
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.RangeIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            case PhoneNumbStatisticsIndicatorEnum:
                PhoneNumbStatisticsIndicator phoneNumbIndicator = (PhoneNumbStatisticsIndicator) indicatorUnit.getIndicator();
                phoneNumbIndicator.setValidPhoneCountIndicator((ValidPhoneCountIndicator) getPlainIndicatorUnit(IndicatorEnum.ValidPhoneCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setPossiblePhoneCountIndicator((PossiblePhoneCountIndicator) getPlainIndicatorUnit(IndicatorEnum.PossiblePhoneCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setValidRegCodeCountIndicator((ValidRegCodeCountIndicator) getPlainIndicatorUnit(IndicatorEnum.ValidRegCodeCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setInvalidRegCodeCountIndicator((InvalidRegCodeCountIndicator) getPlainIndicatorUnit(IndicatorEnum.InvalidRegCodeCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setWellFormE164PhoneCountIndicator((WellFormE164PhoneCountIndicator) getPlainIndicatorUnit(IndicatorEnum.WellFormE164PhoneCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setWellFormIntePhoneCountIndicator((WellFormIntePhoneCountIndicatorImpl) getPlainIndicatorUnit(IndicatorEnum.WellFormIntePhoneCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setWellFormNationalPhoneCountIndicator((WellFormNationalPhoneCountIndicatorImpl) getPlainIndicatorUnit(IndicatorEnum.WellFormNationalPhoneCountIndicatorEnum).getIndicator());
                phoneNumbIndicator.setFormatFreqPieIndicator((FormatFreqPieIndicatorImpl) getPlainIndicatorUnit(IndicatorEnum.FormatFreqPieIndictorEnum).getIndicator());
                indicatorUnit.setChildren(createCategoryIndicatorUnits(IndicatorEnum.PhoneNumbStatisticsIndicatorEnum.getChildren()));
                indicatorUnitList.add(indicatorUnit);
                break;
            default:
                indicatorUnitList.add(indicatorUnit);
                break;
        }
    }
    return indicatorUnitList.toArray(new IndicatorUnit[indicatorUnitList.size()]);
}
Also used : BoxIndicator(org.talend.dataquality.indicators.BoxIndicator) TextIndicator(org.talend.dataquality.indicators.TextIndicator) IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) CountsIndicator(org.talend.dataquality.indicators.CountsIndicator) RangeIndicator(org.talend.dataquality.indicators.RangeIndicator) PhoneNumbStatisticsIndicator(org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) ArrayList(java.util.ArrayList) IQRIndicator(org.talend.dataquality.indicators.IQRIndicator)

Aggregations

RangeIndicator (org.talend.dataquality.indicators.RangeIndicator)7 IQRIndicator (org.talend.dataquality.indicators.IQRIndicator)5 BoxIndicator (org.talend.dataquality.indicators.BoxIndicator)3 MaxValueIndicator (org.talend.dataquality.indicators.MaxValueIndicator)3 MeanIndicator (org.talend.dataquality.indicators.MeanIndicator)3 MedianIndicator (org.talend.dataquality.indicators.MedianIndicator)3 MinValueIndicator (org.talend.dataquality.indicators.MinValueIndicator)3 PhoneNumbStatisticsIndicator (org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator)3 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)3 TdColumn (org.talend.cwm.relational.TdColumn)2 AverageLengthIndicator (org.talend.dataquality.indicators.AverageLengthIndicator)2 BlankCountIndicator (org.talend.dataquality.indicators.BlankCountIndicator)2 DefValueCountIndicator (org.talend.dataquality.indicators.DefValueCountIndicator)2 DistinctCountIndicator (org.talend.dataquality.indicators.DistinctCountIndicator)2 DuplicateCountIndicator (org.talend.dataquality.indicators.DuplicateCountIndicator)2 InvalidRegCodeCountIndicator (org.talend.dataquality.indicators.InvalidRegCodeCountIndicator)2 LowerQuartileIndicator (org.talend.dataquality.indicators.LowerQuartileIndicator)2 MaxLengthIndicator (org.talend.dataquality.indicators.MaxLengthIndicator)2 MinLengthIndicator (org.talend.dataquality.indicators.MinLengthIndicator)2 ModeIndicator (org.talend.dataquality.indicators.ModeIndicator)2