Package org.apache.tajo.datum

Examples of org.apache.tajo.datum.Datum.asByteArray()


  @Override
  public byte[] getBytes(int fieldId) throws SQLException {
    Datum datum = cur.get(fieldId - 1);
    handleNull(datum);
    return datum.asByteArray();
  }

  @Override
  public byte[] getBytes(String name) throws SQLException {
    Datum datum = cur.get(findColumn(name));
View Full Code Here


  @Override
  public byte[] getBytes(String name) throws SQLException {
    Datum datum = cur.get(findColumn(name));
    handleNull(datum);
    return datum.asByteArray();
  }

  @Override
  public double getDouble(int fieldId) throws SQLException {
    Datum datum = cur.get(fieldId - 1);
View Full Code Here

   */
  @Override
  public byte[] getBytes(int fieldId) throws SQLException {
    Datum datum = cur.get(fieldId - 1);
    handleNull(datum);
    return datum.asByteArray();
  }

  /*
   * (non-Javadoc)
   *
 
View Full Code Here

   */
  @Override
  public byte[] getBytes(String name) throws SQLException {
    Datum datum = cur.get(findColumn(name));
    handleNull(datum);
    return datum.asByteArray();
  }

  /*
   * (non-Javadoc)
   *
 
View Full Code Here

  @Override
  public Datum eval(Tuple params) {
    Datum datum = params.get(0);
    if(datum instanceof NullDatum) return NullDatum.get();

    return DatumFactory.createInt4(datum.asByteArray().length*8);
  }
}
View Full Code Here

    Datum datum = params.get(0);
    if(datum instanceof NullDatum) return NullDatum.get();

    try {
        MessageDigest md = MessageDigest.getInstance("MD5");
        return DatumFactory.createText(new String(Hex.encodeHex(md.digest(datum.asByteArray()))));
    } catch (NoSuchAlgorithmException e){
        return NullDatum.get();
    }
  }
}
View Full Code Here

      if (searchBytes[i] == ',') {
        return DatumFactory.createInt4(0);
      }
    }

    byte[] arrayData = textArray.asByteArray();
    int findingLength = finding.size();

    int posInTextArray = 0;
    int curLengthOfCandidate = 0;
    boolean matching = true;
View Full Code Here

    Datum datum = params.get(0);
    if(datum instanceof NullDatum) {
      return NullDatum.get();
    }

    String ret = new String(Hex.encodeHex(datum.asByteArray()));
    return DatumFactory.createText(trimZero(ret));
  }
}
View Full Code Here

    Datum datum = params.get(0);
    if(datum instanceof NullDatum) {
      return NullDatum.get();
    }

    return DatumFactory.createInt4(datum.asByteArray().length);
  }
}
View Full Code Here

  @Override
  public Datum eval(Tuple params) {
    Datum datum = params.get(0);
    if (datum instanceof NullDatum) return NullDatum.get();

    byte[] bytes = datum.asByteArray();
    if (bytes.length > 0) {
      return DatumFactory.createInt4(bytes[0]);
    } else {
      return DatumFactory.createInt4(0);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.