• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ValueDataUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.di.core.row.ValueDataUtil的典型用法代码示例。如果您正苦于以下问题:Java ValueDataUtil类的具体用法?Java ValueDataUtil怎么用?Java ValueDataUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ValueDataUtil类属于org.pentaho.di.core.row包,在下文中一共展示了ValueDataUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addCumulativeSums

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
private void addCumulativeSums(Object[] row) throws KettleValueException {

		// We need to adjust this row with cumulative averages?
        //
        for (int i=0;i<data.cumulativeSumSourceIndexes.size();i++)
        {
        	int sourceIndex = data.cumulativeSumSourceIndexes.get(i);
        	Object previousTarget = data.previousSums[i];
        	Object sourceValue = row[sourceIndex];
        	
        	int targetIndex = data.cumulativeSumTargetIndexes.get(i);
        	
        	ValueMetaInterface sourceMeta = data.inputRowMeta.getValueMeta(sourceIndex);
    		ValueMetaInterface targetMeta = data.outputRowMeta.getValueMeta(targetIndex);

    		// If the first values where null, or this is the first time around, just take the source value...
    		//
        	if (targetMeta.isNull(previousTarget))
        	{
        		row[targetIndex]=sourceMeta.convertToNormalStorageType(sourceValue);
        	}
        	else
        	{
        		// If the source value is null, just take the previous target value
        		//
        		if (sourceMeta.isNull(sourceValue))
        		{
        			row[targetIndex] = previousTarget;
        		}
        		else
        		{
            		row[targetIndex] = ValueDataUtil.plus(targetMeta, data.previousSums[i], sourceMeta, row[sourceIndex]);
        		}
        	}
        	data.previousSums[i] = row[targetIndex];
        }

	}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:39,代码来源:GroupBy.java


示例2: getAggregateResult

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
private Object[] getAggregateResult() throws KettleValueException
{
    Object[] result = new Object[data.subjectnrs.length];

    if (data.subjectnrs!=null)
    {
        for (int i=0;i<data.subjectnrs.length;i++)
        {
            Object ag = data.agg[i];
            switch(meta.getAggregateType()[i])
            {
                case GroupByMeta.TYPE_GROUP_SUM            : break; 
                case GroupByMeta.TYPE_GROUP_AVERAGE        :
                		ag=ValueDataUtil.divide(data.aggMeta.getValueMeta(i), ag, 
                				new ValueMeta("c",ValueMetaInterface.TYPE_INTEGER), new Long(data.counts[i])); 
                		break;  //$NON-NLS-1$
                case GroupByMeta.TYPE_GROUP_COUNT_ALL      : ag=new Long(data.counts[i]); break;
                case GroupByMeta.TYPE_GROUP_COUNT_DISTINCT : break;
                case GroupByMeta.TYPE_GROUP_MIN            : break; 
                case GroupByMeta.TYPE_GROUP_MAX            : break; 
                case GroupByMeta.TYPE_GROUP_STANDARD_DEVIATION :
                	double sum = (Double)ag / data.counts[i];
                	ag = Double.valueOf( Math.sqrt( sum ) );
                	break;
                case GroupByMeta.TYPE_GROUP_CONCAT_COMMA:;
                case GroupByMeta.TYPE_GROUP_CONCAT_STRING: 
                    ag = ((StringBuilder) ag).toString();
                    break;
                default: break;
            }
            result[i]=ag;
        }
    }

    return result;

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:38,代码来源:GroupBy.java


示例3: getAggregateResult

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
private Object[] getAggregateResult(Aggregate aggregate) throws KettleValueException
{
    Object[] result = new Object[data.subjectnrs.length];

    if (data.subjectnrs!=null)
    {
        for (int i=0;i<data.subjectnrs.length;i++)
        {
            Object ag = aggregate.agg[i];
            switch(meta.getAggregateType()[i])
            {
                case MemoryGroupByMeta.TYPE_GROUP_SUM            : break; 
                case MemoryGroupByMeta.TYPE_GROUP_AVERAGE        :
                		ag=ValueDataUtil.divide(data.aggMeta.getValueMeta(i), ag, 
                				new ValueMeta("c",ValueMetaInterface.TYPE_INTEGER), new Long(aggregate.counts[i])); 
                		break;  //$NON-NLS-1$
                case MemoryGroupByMeta.TYPE_GROUP_COUNT_ALL      : ag=new Long(aggregate.counts[i]); break;
                case MemoryGroupByMeta.TYPE_GROUP_COUNT_DISTINCT : break;
                case MemoryGroupByMeta.TYPE_GROUP_MIN            : break; 
                case MemoryGroupByMeta.TYPE_GROUP_MAX            : break; 
                case MemoryGroupByMeta.TYPE_GROUP_STANDARD_DEVIATION :
                	double sum = (Double)ag / aggregate.counts[i];
                	ag = Double.valueOf( Math.sqrt( sum ) );
                	break;
                case GroupByMeta.TYPE_GROUP_CONCAT_COMMA:;
                case GroupByMeta.TYPE_GROUP_CONCAT_STRING: 
                  ag = ((StringBuilder) ag).toString();
                  break;
                default: break;
            }
            result[i]=ag;
        }
    }

    return result;

}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:38,代码来源:MemoryGroupBy.java


示例4: getAggregateResult

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
private Object[] getAggregateResult() throws KettleValueException
{
    Object[] result = new Object[data.subjectnrs.length];

    if (data.subjectnrs!=null)
    {
        for (int i=0;i<data.subjectnrs.length;i++)
        {
            Object ag = data.agg[i];
            switch(meta.getAggregateType()[i])
            {
                case GroupByMeta.TYPE_GROUP_SUM            : break; 
                case GroupByMeta.TYPE_GROUP_AVERAGE        :
                		ag=ValueDataUtil.divide(data.aggMeta.getValueMeta(i), ag, 
                				new ValueMeta("c",ValueMetaInterface.TYPE_INTEGER), new Long(data.counts[i])); 
                		break;  //$NON-NLS-1$
                case GroupByMeta.TYPE_GROUP_COUNT_ANY      : 
                case GroupByMeta.TYPE_GROUP_COUNT_ALL      : ag=new Long(data.counts[i]); break;
                case GroupByMeta.TYPE_GROUP_COUNT_DISTINCT : break;
                case GroupByMeta.TYPE_GROUP_MIN            : break; 
                case GroupByMeta.TYPE_GROUP_MAX            : break; 
                case GroupByMeta.TYPE_GROUP_STANDARD_DEVIATION :
                	double sum = (Double)ag / data.counts[i];
                	ag = Double.valueOf( Math.sqrt( sum ) );
                	break;
                case GroupByMeta.TYPE_GROUP_CONCAT_COMMA:;
                case GroupByMeta.TYPE_GROUP_CONCAT_STRING: 
                    ag = ((StringBuilder) ag).toString();
                    break;
                default: break;
            }
            result[i]=ag;
        }
    }

    return result;

}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:39,代码来源:GroupBy.java


示例5: getAggregateResult

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
private Object[] getAggregateResult(Aggregate aggregate) throws KettleValueException
{
    Object[] result = new Object[data.subjectnrs.length];

    if (data.subjectnrs!=null)
    {
        for (int i=0;i<data.subjectnrs.length;i++)
        {
            Object ag = aggregate.agg[i];
            switch(meta.getAggregateType()[i])
            {
                case MemoryGroupByMeta.TYPE_GROUP_SUM            : break; 
                case MemoryGroupByMeta.TYPE_GROUP_AVERAGE        :
                		ag=ValueDataUtil.divide(data.aggMeta.getValueMeta(i), ag, 
                				new ValueMeta("c",ValueMetaInterface.TYPE_INTEGER), new Long(aggregate.counts[i])); 
                		break;  //$NON-NLS-1$
                case MemoryGroupByMeta.TYPE_GROUP_COUNT_ANY      : 
                case MemoryGroupByMeta.TYPE_GROUP_COUNT_ALL      : ag=new Long(aggregate.counts[i]); break;
                case MemoryGroupByMeta.TYPE_GROUP_COUNT_DISTINCT : break;
                case MemoryGroupByMeta.TYPE_GROUP_MIN            : break; 
                case MemoryGroupByMeta.TYPE_GROUP_MAX            : break; 
                case MemoryGroupByMeta.TYPE_GROUP_STANDARD_DEVIATION :
                	double sum = (Double)ag / aggregate.counts[i];
                	ag = Double.valueOf( Math.sqrt( sum ) );
                	break;
                case MemoryGroupByMeta.TYPE_GROUP_CONCAT_COMMA:;
                case MemoryGroupByMeta.TYPE_GROUP_CONCAT_STRING: 
                    ag = ((StringBuilder) ag).toString();
                    break;
                default: break;
            }
            result[i]=ag;
        }
    }

    return result;

}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:39,代码来源:MemoryGroupBy.java


示例6: addCumulativeSums

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
private void addCumulativeSums( Object[] row ) throws KettleValueException {

    // We need to adjust this row with cumulative averages?
    //
    for ( int i = 0; i < data.cumulativeSumSourceIndexes.size(); i++ ) {
      int sourceIndex = data.cumulativeSumSourceIndexes.get( i );
      Object previousTarget = data.previousSums[ i ];
      Object sourceValue = row[ sourceIndex ];

      int targetIndex = data.cumulativeSumTargetIndexes.get( i );

      ValueMetaInterface sourceMeta = data.inputRowMeta.getValueMeta( sourceIndex );
      ValueMetaInterface targetMeta = data.outputRowMeta.getValueMeta( targetIndex );

      // If the first values where null, or this is the first time around, just take the source value...
      //
      if ( targetMeta.isNull( previousTarget ) ) {
        row[ targetIndex ] = sourceMeta.convertToNormalStorageType( sourceValue );
      } else {
        // If the source value is null, just take the previous target value
        //
        if ( sourceMeta.isNull( sourceValue ) ) {
          row[ targetIndex ] = previousTarget;
        } else {
          row[ targetIndex ] = ValueDataUtil.plus( targetMeta, data.previousSums[ i ], sourceMeta, row[ sourceIndex ] );
        }
      }
      data.previousSums[ i ] = row[ targetIndex ];
    }

  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:32,代码来源:GroupBy.java


示例7: getRound2Mode

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
/**
 * Get value of private static field ValueDataUtil.ROUND_2_MODE.
 *
 * @return
 */
private static int getRound2Mode() {
  int value = -1;
  try {
    Class<ValueDataUtil> cls = ValueDataUtil.class;
    Field f = cls.getDeclaredField( SYS_PROPERTY_ROUND_2_MODE );
    f.setAccessible( true );
    value = (Integer) f.get( null );
    f.setAccessible( false );
  } catch ( Exception e ) {
    throw new RuntimeException( e );
  }
  return value;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:19,代码来源:CalculatorBackwardCompatibilityUnitTest.java


示例8: setRound2Mode

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
/**
 * Set new value of value of private static field ValueDataUtil.ROUND_2_MODE.
 *
 * @param newValue
 */
private static void setRound2Mode( int newValue ) {
  try {
    Class<ValueDataUtil> cls = ValueDataUtil.class;
    Field f = cls.getDeclaredField( SYS_PROPERTY_ROUND_2_MODE );
    f.setAccessible( true );
    f.set( null, newValue );
    f.setAccessible( false );
  } catch ( Exception e ) {
    throw new RuntimeException( e );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:17,代码来源:CalculatorBackwardCompatibilityUnitTest.java


示例9: addCumulativeAverages

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
private void addCumulativeAverages(Object[] row) throws KettleValueException {

		// We need to adjust this row with cumulative sums
        //
        for (int i=0;i<data.cumulativeAvgSourceIndexes.size();i++)
        {
        	int sourceIndex = data.cumulativeAvgSourceIndexes.get(i);
        	Object previousTarget = data.previousAvgSum[i];
        	Object sourceValue = row[sourceIndex];
        	
        	int targetIndex = data.cumulativeAvgTargetIndexes.get(i);
        	
        	ValueMetaInterface sourceMeta = data.inputRowMeta.getValueMeta(sourceIndex);
    		ValueMetaInterface targetMeta = data.outputRowMeta.getValueMeta(targetIndex);

    		// If the first values where null, or this is the first time around, just take the source value...
    		//
    		Object sum = null;
    		
        	if (targetMeta.isNull(previousTarget))
        	{
        		sum=sourceMeta.convertToNormalStorageType(sourceValue);
        	}
        	else
        	{
        		// If the source value is null, just take the previous target value
        		//
        		if (sourceMeta.isNull(sourceValue))
        		{
        			sum = previousTarget;
        		}
        		else
        		{
        			if (sourceMeta.isInteger())
        			{
        				sum = ValueDataUtil.plus(data.valueMetaInteger, data.previousAvgSum[i], sourceMeta, row[sourceIndex]);
        			}
        			else
        			{
        				sum = ValueDataUtil.plus(targetMeta, data.previousAvgSum[i], sourceMeta, row[sourceIndex]);
        			}
        		}
        	}
        	data.previousAvgSum[i] = sum;

        	if (!sourceMeta.isNull(sourceValue)) data.previousAvgCount[i]++;
        	
        	if (sourceMeta.isInteger()) {
        		// Change to number as the exception
        		//
        		if (sum==null)
        		{
        			row[targetIndex] = null;
        		}
        		else 
        		{
        			row[targetIndex] = new Double( ((Long)sum).doubleValue() / data.previousAvgCount[i] );
        		}
        	}
        	else
        	{
        		row[targetIndex] = ValueDataUtil.divide(targetMeta, sum, data.valueMetaInteger, data.previousAvgCount[i]);
        	}
        }

	}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:67,代码来源:GroupBy.java


示例10: multiply

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
public Value multiply(Value      v) throws KettleValueException
{
	// a number and a string!
	if (isNull() || v.isNull())
	{
		setNull();
		return this;
	}

	if ((v.isString() && isNumeric()) || (v.isNumeric() && isString()))
	{
		StringBuffer s;
		String append="";
		int n;
		if (v.isString())
		{
			s=new StringBuffer(v.getString());
			append=v.getString();
			n=(int)getInteger();
		}
		else
		{
			s=new StringBuffer(getString());
			append=getString();
			n=(int)v.getInteger();
		}

		if (n==0) s.setLength(0);
		else
		for (int i=1;i<n;i++) s.append(append);

		setValue(s);
	}
	else
       // big numbers
       if (isBigNumber() || v.isBigNumber())
       {
           setValue(ValueDataUtil.multiplyBigDecimals(getBigNumber(), v.getBigNumber(), null));
       }
       else
	// numbers
	if (isNumber() || v.isNumber())
	{
		setValue(getNumber()*v.getNumber());
	}
	else
	// integers
	if (isInteger() || v.isInteger())
	{
		setValue(getInteger()*v.getInteger());
	}
	else
	{
		 throw new KettleValueException("Multiplication can only be done with numbers or a number and a string!");
	}
	return this;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:58,代码来源:Value.java


示例11: addCumulativeAverages

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
private void addCumulativeAverages( Object[] row ) throws KettleValueException {

    // We need to adjust this row with cumulative sums
    //
    for ( int i = 0; i < data.cumulativeAvgSourceIndexes.size(); i++ ) {
      int sourceIndex = data.cumulativeAvgSourceIndexes.get( i );
      Object previousTarget = data.previousAvgSum[ i ];
      Object sourceValue = row[ sourceIndex ];

      int targetIndex = data.cumulativeAvgTargetIndexes.get( i );

      ValueMetaInterface sourceMeta = data.inputRowMeta.getValueMeta( sourceIndex );
      ValueMetaInterface targetMeta = data.outputRowMeta.getValueMeta( targetIndex );

      // If the first values where null, or this is the first time around, just take the source value...
      //
      Object sum = null;

      if ( targetMeta.isNull( previousTarget ) ) {
        sum = sourceMeta.convertToNormalStorageType( sourceValue );
      } else {
        // If the source value is null, just take the previous target value
        //
        if ( sourceMeta.isNull( sourceValue ) ) {
          sum = previousTarget;
        } else {
          if ( sourceMeta.isInteger() ) {
            sum = ValueDataUtil.plus( data.valueMetaInteger, data.previousAvgSum[ i ], sourceMeta, row[ sourceIndex ] );
          } else {
            sum = ValueDataUtil.plus( targetMeta, data.previousAvgSum[ i ], sourceMeta, row[ sourceIndex ] );
          }
        }
      }
      data.previousAvgSum[ i ] = sum;

      if ( !sourceMeta.isNull( sourceValue ) ) {
        data.previousAvgCount[ i ]++;
      }

      if ( sourceMeta.isInteger() ) {
        // Change to number as the exception
        //
        if ( sum == null ) {
          row[ targetIndex ] = null;
        } else {
          row[ targetIndex ] = new Double( ( (Long) sum ).doubleValue() / data.previousAvgCount[ i ] );
        }
      } else {
        row[ targetIndex ] = ValueDataUtil.divide( targetMeta, sum, data.valueMetaInteger, data.previousAvgCount[ i ] );
      }
    }

  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:54,代码来源:GroupBy.java


示例12: getAggregateResult

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
/**
 * Used for junits in GroupByAggregationNullsTest
 *
 * @return
 * @throws KettleValueException
 */
Object[] getAggregateResult() throws KettleValueException {

  if ( data.subjectnrs == null ) {
    return new Object[ 0 ];
  }

  Object[] result = new Object[ data.subjectnrs.length ];

  for ( int i = 0; i < data.subjectnrs.length; i++ ) {
    Object ag = data.agg[ i ];
    switch ( meta.getAggregateType()[ i ] ) {
      case GroupByMeta.TYPE_GROUP_SUM:
        break;
      case GroupByMeta.TYPE_GROUP_AVERAGE:
        ag =
            ValueDataUtil.divide( data.aggMeta.getValueMeta( i ), ag,
                new ValueMetaInteger( "c" ), new Long( data.counts[ i ] ) );
        break;
      case GroupByMeta.TYPE_GROUP_MEDIAN:
      case GroupByMeta.TYPE_GROUP_PERCENTILE:
        double percentile = 50.0;
        if ( meta.getAggregateType()[ i ] == GroupByMeta.TYPE_GROUP_PERCENTILE ) {
          percentile = Double.parseDouble( meta.getValueField()[ i ] );
        }
        @SuppressWarnings( "unchecked" )
        List<Double> valuesList = (List<Double>) data.agg[ i ];
        double[] values = new double[ valuesList.size() ];
        for ( int v = 0; v < values.length; v++ ) {
          values[ v ] = valuesList.get( v );
        }
        ag = new Percentile().evaluate( values, percentile );
        break;
      case GroupByMeta.TYPE_GROUP_COUNT_ANY:
      case GroupByMeta.TYPE_GROUP_COUNT_ALL:
        ag = new Long( data.counts[ i ] );
        break;
      case GroupByMeta.TYPE_GROUP_COUNT_DISTINCT:
        break;
      case GroupByMeta.TYPE_GROUP_MIN:
        break;
      case GroupByMeta.TYPE_GROUP_MAX:
        break;
      case GroupByMeta.TYPE_GROUP_STANDARD_DEVIATION:
        if ( ag == null ) {
          // PMD-1037 - when all input data is null ag is null, npe on access ag
          break;
        }
        double sum = (Double) ag / data.counts[ i ];
        ag = Double.valueOf( Math.sqrt( sum ) );
        break;
      case GroupByMeta.TYPE_GROUP_CONCAT_COMMA:
      case GroupByMeta.TYPE_GROUP_CONCAT_STRING:
        ag = ( (StringBuilder) ag ).toString();
        break;
      default:
        break;
    }
    if ( ag == null && allNullsAreZero ) {
      // PDI-10250, 6960 seems all rows for min function was nulls...
      // get output subject meta based on original subject meta calculation
      ValueMetaInterface vm = data.aggMeta.getValueMeta( i );
      ag = ValueDataUtil.getZeroForValueMetaType( vm );
    }
    result[ i ] = ag;
  }

  return result;

}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:76,代码来源:GroupBy.java


示例13: getAggregateResult

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
/**
 * Used for junits in MemoryGroupByAggregationNullsTest
 *
 * @param aggregate
 * @return
 * @throws KettleValueException
 */
Object[] getAggregateResult( Aggregate aggregate ) throws KettleValueException {
  Object[] result = new Object[data.subjectnrs.length];

  if ( data.subjectnrs != null ) {
    for ( int i = 0; i < data.subjectnrs.length; i++ ) {
      Object ag = aggregate.agg[i];
      switch ( meta.getAggregateType()[i] ) {
        case MemoryGroupByMeta.TYPE_GROUP_SUM:
          break;
        case MemoryGroupByMeta.TYPE_GROUP_AVERAGE:
          ag = ValueDataUtil.divide(
            data.aggMeta.getValueMeta( i ), ag,
            new ValueMetaInteger( "c" ), aggregate.counts[i]
          );
          break;
        case MemoryGroupByMeta.TYPE_GROUP_MEDIAN:
        case MemoryGroupByMeta.TYPE_GROUP_PERCENTILE:
          double percentile = 50.0;
          if ( meta.getAggregateType()[i] == MemoryGroupByMeta.TYPE_GROUP_PERCENTILE ) {
            percentile = Double.parseDouble( meta.getValueField()[i] );
          }
          @SuppressWarnings( "unchecked" )
          List<Double> valuesList = (List<Double>) aggregate.agg[i];
          double[] values = new double[valuesList.size()];
          for ( int v = 0; v < values.length; v++ ) {
            values[v] = valuesList.get( v );
          }
          ag = new Percentile().evaluate( values, percentile );
          break;
        case MemoryGroupByMeta.TYPE_GROUP_COUNT_ANY:
        case MemoryGroupByMeta.TYPE_GROUP_COUNT_ALL:
        case MemoryGroupByMeta.TYPE_GROUP_COUNT_DISTINCT:
          ag = aggregate.counts[i];
          break;
        case MemoryGroupByMeta.TYPE_GROUP_MIN:
          break;
        case MemoryGroupByMeta.TYPE_GROUP_MAX:
          break;
        case MemoryGroupByMeta.TYPE_GROUP_STANDARD_DEVIATION:
          double sum = (Double) ag / aggregate.counts[i];
          ag = Double.valueOf( Math.sqrt( sum ) );
          break;
        case MemoryGroupByMeta.TYPE_GROUP_CONCAT_COMMA:
        case MemoryGroupByMeta.TYPE_GROUP_CONCAT_STRING:
          ag = ( (StringBuilder) ag ).toString();
          break;
        default:
          break;
      }
      if ( ag == null && allNullsAreZero ) {
        // PDI-11530 seems all rows for min function was nulls...
        ValueMetaInterface vm = data.aggMeta.getValueMeta( i );
        ag = ValueDataUtil.getZeroForValueMetaType( vm );
      }
      result[i] = ag;
    }
  }

  return result;

}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:69,代码来源:MemoryGroupBy.java


示例14: getZero

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
private Object getZero( int field ) throws KettleValueException {
  ValueMetaInterface vm = data.outputRowMeta.getValueMeta( field );
  return ValueDataUtil.getZeroForValueMetaType( vm );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:5,代码来源:Denormaliser.java


示例15: multiply

import org.pentaho.di.core.row.ValueDataUtil; //导入依赖的package包/类
public Value multiply( Value v ) throws KettleValueException {
  // a number and a string!
  if ( isNull() || v.isNull() ) {
    setNull();
    return this;
  }

  if ( ( v.isString() && isNumeric() ) || ( v.isNumeric() && isString() ) ) {
    StringBuilder s;
    String append = "";
    int n;
    if ( v.isString() ) {
      s = new StringBuilder( v.getString() );
      append = v.getString();
      n = (int) getInteger();
    } else {
      s = new StringBuilder( getString() );
      append = getString();
      n = (int) v.getInteger();
    }

    if ( n == 0 ) {
      s.setLength( 0 );
    } else {
      for ( int i = 1; i < n; i++ ) {
        s.append( append );
      }
    }

    setValue( s );
  } else if ( isBigNumber() || v.isBigNumber() ) {
    // big numbers
    setValue( ValueDataUtil.multiplyBigDecimals( getBigNumber(), v.getBigNumber(), null ) );
  } else if ( isNumber() || v.isNumber() ) {
    // numbers
    setValue( getNumber() * v.getNumber() );
  } else if ( isInteger() || v.isInteger() ) {
    // integers
    setValue( getInteger() * v.getInteger() );
  } else {
    throw new KettleValueException( "Multiplication can only be done with numbers or a number and a string!" );
  }
  return this;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:45,代码来源:Value.java



注:本文中的org.pentaho.di.core.row.ValueDataUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CombinatorCondition类代码示例发布时间:2022-05-22
下一篇:
Java JpsModuleType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap