Java Code Examples for com.facebook.presto.spi.type.StandardTypes#DOUBLE
The following examples show how to use
com.facebook.presto.spi.type.StandardTypes#DOUBLE .
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: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 5 votes |
@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); }
Example 2
Source File: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 5 votes |
@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); }
Example 3
Source File: BloomFilterGetFalsePositivePercentageScalarFunction.java From presto-bloomfilter with Apache License 2.0 | 5 votes |
@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(); }
Example 4
Source File: BloomFilterAggregation.java From presto-bloomfilter with Apache License 2.0 | 5 votes |
@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 5
Source File: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 4 votes |
@ScalarFunction("eth_gasPrice") @Description("Returns current gas price") @SqlType(StandardTypes.DOUBLE) public static double ethGasPrice() throws IOException { return web3j.ethGasPrice().send().getGasPrice().doubleValue(); }
Example 6
Source File: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 4 votes |
@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(); }
Example 7
Source File: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 4 votes |
@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 8
Source File: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 4 votes |
@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(); }