com.facebook.presto.spi.function.Description Java Examples
The following examples show how to use
com.facebook.presto.spi.function.Description.
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: MatchQueryFunction.java From presto-connectors with Apache License 2.0 | 5 votes |
@ScalarFunction("match_phrase") @Description("es match_phrase") @SqlType(StandardTypes.VARCHAR) @SqlNullable public static Slice matchPhrase( @SqlType(StandardTypes.VARCHAR) Slice filter) { if (filter == null) { return null; } String filterStr = filter.toStringUtf8(); QueryBuilder builder = QueryBuilders.matchPhraseQuery(MATCH_COLUMN_SEP, filterStr); return Slices.utf8Slice(builder.toString()); }
Example #2
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 #3
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 #4
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 #5
Source File: MatchQueryFunction.java From presto-connectors with Apache License 2.0 | 5 votes |
@ScalarFunction("match_phrase") @Description("es match_phrase") @SqlType(StandardTypes.VARCHAR) @SqlNullable public static Slice matchPhrase( @SqlType(StandardTypes.VARCHAR) Slice filter) { if (filter == null) { return null; } String filterStr = filter.toStringUtf8(); QueryBuilder builder = QueryBuilders.matchPhraseQuery(MATCH_COLUMN_SEP, filterStr); return Slices.utf8Slice(builder.toString()); }
Example #6
Source File: MatchQueryFunction.java From presto-connectors with Apache License 2.0 | 5 votes |
@ScalarFunction("match_query") @Description("es match_query") @SqlType(StandardTypes.VARCHAR) @SqlNullable public static Slice matchQuery( @SqlType(StandardTypes.VARCHAR) Slice filter) { if (filter == null) { return null; } String filterStr = filter.toStringUtf8(); QueryBuilder builder = QueryBuilders.matchQuery(MATCH_COLUMN_SEP, filterStr); return Slices.utf8Slice(builder.toString()); }
Example #7
Source File: MatchQueryFunction.java From presto-connectors with Apache License 2.0 | 5 votes |
@ScalarFunction("match_phrase") @Description("es match_phrase") @SqlType(StandardTypes.VARCHAR) @SqlNullable public static Slice matchPhrase( @SqlType(StandardTypes.VARCHAR) Slice filter) { if (filter == null) { return null; } String filterStr = filter.toStringUtf8(); QueryBuilder builder = QueryBuilders.matchPhraseQuery(MATCH_COLUMN_SEP, filterStr); return Slices.utf8Slice(builder.toString()); }
Example #8
Source File: MatchQueryFunction.java From presto-connectors with Apache License 2.0 | 5 votes |
@ScalarFunction("match_query") @Description("es match_query") @SqlType(StandardTypes.VARCHAR) @SqlNullable public static Slice matchQuery( @SqlType(StandardTypes.VARCHAR) Slice filter) { if (filter == null) { return null; } String filterStr = filter.toStringUtf8(); QueryBuilder builder = QueryBuilders.matchQuery(MATCH_COLUMN_SEP, filterStr); return Slices.utf8Slice(builder.toString()); }
Example #9
Source File: MatchQueryFunction.java From presto-connectors with Apache License 2.0 | 5 votes |
@ScalarFunction("match_query") @Description("es match_query") @SqlType(StandardTypes.VARCHAR) @SqlNullable public static Slice matchQuery( @SqlType(StandardTypes.VARCHAR) Slice filter) { if (filter == null) { return null; } String filterStr = filter.toStringUtf8(); QueryBuilder builder = QueryBuilders.matchQuery(MATCH_COLUMN_SEP, filterStr); return Slices.utf8Slice(builder.toString()); }
Example #10
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 #11
Source File: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 4 votes |
@ScalarFunction("eth_blockNumber") @Description("Returns current block number") @SqlType(StandardTypes.BIGINT) public static long ethBlockNumber() throws IOException { return web3j.ethBlockNumber().send().getBlockNumber().longValue(); }
Example #12
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 #13
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 #14
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(); }
Example #15
Source File: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 4 votes |
@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 #16
Source File: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 4 votes |
@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 #17
Source File: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 4 votes |
@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(); }
Example #18
Source File: EthereumUDFs.java From presto-ethereum with Apache License 2.0 | 4 votes |
@ScalarFunction("isContract") @Description("isContract") @SqlType(StandardTypes.BOOLEAN) public static boolean isContract(@SqlType(StandardTypes.VARCHAR) Slice address) throws IOException { return !web3j.ethGetCode(address.toStringUtf8(), DefaultBlockParameter.valueOf(LATEST)).send().getCode().equals(ZERO_X); }