Package com.odiago.flumebase.lang

Examples of com.odiago.flumebase.lang.PreciseType


  private Number getState(Bucket<Number> bucket, Type type) {
    Number state = bucket.getState();
    if (null == state) {
      if (type.getPrimitiveTypeName().equals(Type.TypeName.PRECISE)) {
        PreciseType pt = PreciseType.toPreciseType(type);
        state = pt.parseStringInput("0");
      } else {
        state = Integer.valueOf(0);
      }
    }
View Full Code Here


   */
  private void runPreciseTest(List<String> eventStrings, String query, String outColName,
      List<String> outStrings) throws IOException, InterruptedException {
    MemStreamBuilder streamBuilder = new MemStreamBuilder("f");

    streamBuilder.addField(new TypedField("x", new PreciseType(1)));
    for (String eventStr : eventStrings) {
      streamBuilder.addEvent(eventStr);
    }
    StreamSymbol stream = streamBuilder.build();
    getSymbolTable().addSymbol(stream);
View Full Code Here

    } else if (val instanceof BigDecimal) {
      if (outputType.getPrimitiveTypeName().equals(Type.TypeName.PRECISE)) {
        // If we know the scale associated with the result PRECISE object,
        // make sure we use the appropriate scale (the scale used during
        // computation may be overly precise as a result of math operations).
        PreciseType preciseType = PreciseType.toPreciseType(outputType);
        BigDecimal bigDec = (BigDecimal) val;
        return bigDec.setScale(preciseType.getScale(), RoundingMode.HALF_EVEN).toString();
      } else {
        // Not sure what would cause a BigDecimal to be coerced to some
        // non-PRECISE output type, but in any case, it will be represented
        // as a string.
        return val.toString();
View Full Code Here

      // fields. We need to work on this... it should not just be a 'long'
      // representation.
      out = CharBufferUtils.parseLong(chars);
      break;
    case PRECISE:
      PreciseType preciseType = PreciseType.toPreciseType(expectedType);
      out = preciseType.parseStringInput(chars.toString());
      break;
    case LIST:
      out = parseList(chars, ListType.toListType(expectedType).getElementType(),
          nullStr, listDelim);
      break;
View Full Code Here

  private Object avroToNative(Object in, Type expectedType) {
    if (null == in) {
      return null;
    } else if (expectedType.getPrimitiveTypeName().equals(Type.TypeName.PRECISE)) {
      // Convert string input to precise type.
      PreciseType preciseType = PreciseType.toPreciseType(expectedType);
      return preciseType.parseStringInput((String) in);
    } else {
      return in; // All other types map to themselves.
    }
  }
View Full Code Here

TOP

Related Classes of com.odiago.flumebase.lang.PreciseType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.