Java Code Examples for com.facebook.presto.spi.type.StandardTypes#BIGINT

The following examples show how to use com.facebook.presto.spi.type.StandardTypes#BIGINT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BloomFilterGetExpectedInsertionsScalarFunction.java    From presto-bloomfilter with Apache License 2.0 5 votes vote down vote up
@SqlType(StandardTypes.BIGINT)
@Nullable
@SqlNullable
public static Long bloomFilterExpectedInsertions(@SqlNullable @SqlType(BloomFilterType.TYPE) Slice bloomFilterSlice)
{
    BloomFilter bf = getOrLoadBloomFilter(bloomFilterSlice);
    return (long) bf.getExpectedInsertions();
}
 
Example 2
Source File: BloomFilterAggregation.java    From presto-bloomfilter with Apache License 2.0 5 votes vote down vote up
@InputFunction
public static void input(
        BloomFilterState state,
        @SqlType(VARCHAR) Slice slice,
        @SqlType(StandardTypes.BIGINT) long expectedInsertions)
{
    BloomFilter bf = getOrCreateBloomFilter(state, (int) expectedInsertions, BloomFilter.DEFAULT_BLOOM_FILTER_FALSE_POSITIVE_PERCENTAGE);
    // Note: do not update the memory size as this is constant to our bloom filter implementation
    bf.put(slice);
}
 
Example 3
Source File: BloomFilterAggregation.java    From presto-bloomfilter with Apache License 2.0 5 votes vote down vote up
@InputFunction
public static void input(
        BloomFilterState state,
        @SqlType(VARCHAR) Slice slice,
        @SqlType(StandardTypes.BIGINT) long expectedInsertions,
        @SqlType(StandardTypes.DOUBLE) double falsePositivePercentage)
{
    BloomFilter bf = getOrCreateBloomFilter(state, (int) expectedInsertions, falsePositivePercentage);
    // Note: do not update the memory size as this is constant to our bloom filter implementation
    bf.put(slice);
}
 
Example 4
Source File: EthereumUDFs.java    From presto-ethereum with Apache License 2.0 4 votes vote down vote up
@ScalarFunction("eth_blockNumber")
@Description("Returns current block number")
@SqlType(StandardTypes.BIGINT)
public static long ethBlockNumber() throws IOException {
    return web3j.ethBlockNumber().send().getBlockNumber().longValue();
}
 
Example 5
Source File: EthereumUDFs.java    From presto-ethereum with Apache License 2.0 4 votes vote down vote up
@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();
}
 
Example 6
Source File: EthereumUDFs.java    From presto-ethereum with Apache License 2.0 4 votes vote down vote up
@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();
}
 
Example 7
Source File: EthereumUDFs.java    From presto-ethereum with Apache License 2.0 4 votes vote down vote up
@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();
}
 
Example 8
Source File: EthereumUDFs.java    From presto-ethereum with Apache License 2.0 4 votes vote down vote up
@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();
}