Java 类com.facebook.presto.spi.function.Description 实例源码

项目:presto-ethereum    文件:EthereumUDFs.java   
@ScalarFunction("fromWei")
@Description("fromWei")
@SqlType(StandardTypes.DOUBLE)
public static double fromWei(@SqlType(StandardTypes.DOUBLE) double num, @SqlType(StandardTypes.VARCHAR) Slice unit) {
    String unitStr = unit.toStringUtf8().toUpperCase();
    EthereumUnit u = EthereumUnit.valueOf(unitStr);
    return u.fromWei(num);
}
项目:presto-ethereum    文件:EthereumUDFs.java   
@ScalarFunction("toWei")
@Description("toWei")
@SqlType(StandardTypes.DOUBLE)
public static double toWei(@SqlType(StandardTypes.DOUBLE) double num, @SqlType(StandardTypes.VARCHAR) Slice unit) {
    String unitStr = unit.toStringUtf8().toUpperCase();
    EthereumUnit u = EthereumUnit.valueOf(unitStr);
    return u.toWei(num);
}
项目:presto-hyperloglog    文件:HyperLogLogScalarFunctions.java   
@Description("Returns the approximate cardinality of a HLL")
@ScalarFunction("cardinality")
@SqlType(StandardTypes.BIGINT)
public static long hllCardinality(@SqlType(HyperLogLogType.TYPE) Slice hll)
{
    return (Long) HyperLogLog.fromBytes(hll.getBytes()).approximateSize().estimate();
}
项目:presto-hyperloglog    文件:HyperLogLogScalarFunctions.java   
@Description("Create a HLL from a string")
@ScalarFunction("hll_create")
@SqlType(HyperLogLogType.TYPE)
public static Slice hllCreate(@SqlType(StandardTypes.VARCHAR) Slice string, @SqlType(StandardTypes.BIGINT) long bits)
{
    HyperLogLogMonoid monoid = new HyperLogLogMonoid((int) bits);
    DenseHLL hll = monoid.create(string.getBytes()).toDenseHLL();
    return Slices.wrappedBuffer(HyperLogLog.toBytes(hll));
}
项目:presto-bloomfilter    文件:BloomFilterGetFalsePositivePercentageScalarFunction.java   
@Description(value = "Display expected insertions from the bloom filter")
@Nullable
@SqlNullable
@SqlType(StandardTypes.DOUBLE)
public static Double bloomFilterFalsePositivePercentage(@SqlNullable @SqlType(BloomFilterType.TYPE) Slice bloomFilterSlice)
{
    BloomFilter bf = getOrLoadBloomFilter(bloomFilterSlice);
    return bf.getFalsePositivePercentage();
}
项目:presto-ethereum    文件:EthereumUDFs.java   
@ScalarFunction("eth_gasPrice")
@Description("Returns current gas price")
@SqlType(StandardTypes.DOUBLE)
public static double ethGasPrice() throws IOException {
    return web3j.ethGasPrice().send().getGasPrice().doubleValue();
}
项目:presto-ethereum    文件:EthereumUDFs.java   
@ScalarFunction("eth_blockNumber")
@Description("Returns current block number")
@SqlType(StandardTypes.BIGINT)
public static long ethBlockNumber() throws IOException {
    return web3j.ethBlockNumber().send().getBlockNumber().longValue();
}
项目:presto-ethereum    文件:EthereumUDFs.java   
@ScalarFunction("eth_getBalance")
@Description("Returns the balance of an address")
@SqlType(StandardTypes.DOUBLE)
public static double ethGetBalance(@SqlType(StandardTypes.VARCHAR) Slice address) throws IOException {
    return web3j.ethGetBalance(address.toStringUtf8(), DefaultBlockParameter.valueOf(LATEST)).send().getBalance().doubleValue();
}
项目:presto-ethereum    文件:EthereumUDFs.java   
@ScalarFunction("eth_getBalance")
@Description("Returns the balance of an address")
@SqlType(StandardTypes.DOUBLE)
public static double ethGetBalance(@SqlType(StandardTypes.VARCHAR) Slice address, @SqlType(StandardTypes.BIGINT) long blockNumber) throws IOException {
    return web3j.ethGetBalance(address.toStringUtf8(), DefaultBlockParameter.valueOf(BigInteger.valueOf(blockNumber))).send().getBalance().doubleValue();
}
项目:presto-ethereum    文件:EthereumUDFs.java   
@ScalarFunction("eth_getBalance")
@Description("Returns the balance of an address")
@SqlType(StandardTypes.DOUBLE)
public static double ethGetBalance(@SqlType(StandardTypes.VARCHAR) Slice address, @SqlType(StandardTypes.VARCHAR) Slice blockName) throws IOException {
    return web3j.ethGetBalance(address.toStringUtf8(), DefaultBlockParameter.valueOf(blockName.toStringUtf8())).send().getBalance().doubleValue();
}
项目:presto-ethereum    文件:EthereumUDFs.java   
@ScalarFunction("eth_getTransactionCount")
@Description("Returns the number of transactions from this address")
@SqlType(StandardTypes.BIGINT)
public static long ethGetTransactionCount(@SqlType(StandardTypes.VARCHAR) Slice address) throws IOException {
    return web3j.ethGetTransactionCount(address.toStringUtf8(), DefaultBlockParameter.valueOf(LATEST)).send().getTransactionCount().longValue();
}
项目:presto-ethereum    文件:EthereumUDFs.java   
@ScalarFunction("eth_getTransactionCount")
@Description("Returns the number of transactions from this address")
@SqlType(StandardTypes.BIGINT)
public static long ethGetTransactionCount(@SqlType(StandardTypes.VARCHAR) Slice address, @SqlType(StandardTypes.BIGINT) long blockNumber) throws IOException {
    return web3j.ethGetTransactionCount(address.toStringUtf8(), DefaultBlockParameter.valueOf(BigInteger.valueOf(blockNumber))).send().getTransactionCount().longValue();
}
项目:presto-ethereum    文件:EthereumUDFs.java   
@ScalarFunction("eth_getTransactionCount")
@Description("Returns the number of transactions from this address")
@SqlType(StandardTypes.BIGINT)
public static long ethGetTransactionCount(@SqlType(StandardTypes.VARCHAR) Slice address, @SqlType(StandardTypes.VARCHAR) Slice blockName) throws IOException {
    return web3j.ethGetTransactionCount(address.toStringUtf8(), DefaultBlockParameter.valueOf(blockName.toStringUtf8())).send().getTransactionCount().longValue();
}