id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
128,900
JakeWharton/butterknife
butterknife-compiler/src/main/java/butterknife/compiler/BindingSet.java
BindingSet.hasResourceBindingsNeedingResource
private boolean hasResourceBindingsNeedingResource(int sdk) { for (ResourceBinding binding : resourceBindings) { if (binding.requiresResources(sdk)) { return true; } } return false; }
java
private boolean hasResourceBindingsNeedingResource(int sdk) { for (ResourceBinding binding : resourceBindings) { if (binding.requiresResources(sdk)) { return true; } } return false; }
[ "private", "boolean", "hasResourceBindingsNeedingResource", "(", "int", "sdk", ")", "{", "for", "(", "ResourceBinding", "binding", ":", "resourceBindings", ")", "{", "if", "(", "binding", ".", "requiresResources", "(", "sdk", ")", ")", "{", "return", "true", "...
True when this type's bindings use Resource directly instead of Context.
[ "True", "when", "this", "type", "s", "bindings", "use", "Resource", "directly", "instead", "of", "Context", "." ]
0ead8a7b21620effcf78c728089fc16ae9d664c0
https://github.com/JakeWharton/butterknife/blob/0ead8a7b21620effcf78c728089fc16ae9d664c0/butterknife-compiler/src/main/java/butterknife/compiler/BindingSet.java#L619-L626
128,901
JakeWharton/butterknife
butterknife-reflect/src/main/java/butterknife/ButterKnife.java
ButterKnife.validateReturnType
private static boolean validateReturnType(Method method, Class<?> expected) { Class<?> returnType = method.getReturnType(); if (returnType == void.class) { return false; } if (returnType != expected) { String expectedType = "'" + expected.getName() + "'"; if (expected != void.class) { ...
java
private static boolean validateReturnType(Method method, Class<?> expected) { Class<?> returnType = method.getReturnType(); if (returnType == void.class) { return false; } if (returnType != expected) { String expectedType = "'" + expected.getName() + "'"; if (expected != void.class) { ...
[ "private", "static", "boolean", "validateReturnType", "(", "Method", "method", ",", "Class", "<", "?", ">", "expected", ")", "{", "Class", "<", "?", ">", "returnType", "=", "method", ".", "getReturnType", "(", ")", ";", "if", "(", "returnType", "==", "vo...
Returns true when the return value should be propagated. Use a default otherwise.
[ "Returns", "true", "when", "the", "return", "value", "should", "be", "propagated", ".", "Use", "a", "default", "otherwise", "." ]
0ead8a7b21620effcf78c728089fc16ae9d664c0
https://github.com/JakeWharton/butterknife/blob/0ead8a7b21620effcf78c728089fc16ae9d664c0/butterknife-reflect/src/main/java/butterknife/ButterKnife.java#L993-L1010
128,902
code4craft/webmagic
webmagic-extension/src/main/java/us/codecraft/webmagic/monitor/SpiderMonitor.java
SpiderMonitor.register
public synchronized SpiderMonitor register(Spider... spiders) throws JMException { for (Spider spider : spiders) { MonitorSpiderListener monitorSpiderListener = new MonitorSpiderListener(); if (spider.getSpiderListeners() == null) { List<SpiderListener> spiderListeners = ...
java
public synchronized SpiderMonitor register(Spider... spiders) throws JMException { for (Spider spider : spiders) { MonitorSpiderListener monitorSpiderListener = new MonitorSpiderListener(); if (spider.getSpiderListeners() == null) { List<SpiderListener> spiderListeners = ...
[ "public", "synchronized", "SpiderMonitor", "register", "(", "Spider", "...", "spiders", ")", "throws", "JMException", "{", "for", "(", "Spider", "spider", ":", "spiders", ")", "{", "MonitorSpiderListener", "monitorSpiderListener", "=", "new", "MonitorSpiderListener", ...
Register spider for monitor. @param spiders spiders @return this @throws JMException JMException
[ "Register", "spider", "for", "monitor", "." ]
be892b80bf6682cd063d30ac25a79be0c079a901
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-extension/src/main/java/us/codecraft/webmagic/monitor/SpiderMonitor.java#L50-L65
128,903
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/downloader/AbstractDownloader.java
AbstractDownloader.download
public Html download(String url, String charset) { Page page = download(new Request(url), Site.me().setCharset(charset).toTask()); return (Html) page.getHtml(); }
java
public Html download(String url, String charset) { Page page = download(new Request(url), Site.me().setCharset(charset).toTask()); return (Html) page.getHtml(); }
[ "public", "Html", "download", "(", "String", "url", ",", "String", "charset", ")", "{", "Page", "page", "=", "download", "(", "new", "Request", "(", "url", ")", ",", "Site", ".", "me", "(", ")", ".", "setCharset", "(", "charset", ")", ".", "toTask", ...
A simple method to download a url. @param url url @param charset charset @return html
[ "A", "simple", "method", "to", "download", "a", "url", "." ]
be892b80bf6682cd063d30ac25a79be0c079a901
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/downloader/AbstractDownloader.java#L33-L36
128,904
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/Page.java
Page.getHtml
public Html getHtml() { if (html == null) { html = new Html(rawText, request.getUrl()); } return html; }
java
public Html getHtml() { if (html == null) { html = new Html(rawText, request.getUrl()); } return html; }
[ "public", "Html", "getHtml", "(", ")", "{", "if", "(", "html", "==", "null", ")", "{", "html", "=", "new", "Html", "(", "rawText", ",", "request", ".", "getUrl", "(", ")", ")", ";", "}", "return", "html", ";", "}" ]
get html content of page @return html
[ "get", "html", "content", "of", "page" ]
be892b80bf6682cd063d30ac25a79be0c079a901
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Page.java#L86-L91
128,905
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/Page.java
Page.addTargetRequests
public void addTargetRequests(List<String> requests) { for (String s : requests) { if (StringUtils.isBlank(s) || s.equals("#") || s.startsWith("javascript:")) { continue; } s = UrlUtils.canonicalizeUrl(s, url.toString()); targetRequests.add(new Req...
java
public void addTargetRequests(List<String> requests) { for (String s : requests) { if (StringUtils.isBlank(s) || s.equals("#") || s.startsWith("javascript:")) { continue; } s = UrlUtils.canonicalizeUrl(s, url.toString()); targetRequests.add(new Req...
[ "public", "void", "addTargetRequests", "(", "List", "<", "String", ">", "requests", ")", "{", "for", "(", "String", "s", ":", "requests", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "s", ")", "||", "s", ".", "equals", "(", "\"#\"", ")", ...
add urls to fetch @param requests requests
[ "add", "urls", "to", "fetch" ]
be892b80bf6682cd063d30ac25a79be0c079a901
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Page.java#L124-L132
128,906
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/Page.java
Page.addTargetRequest
public void addTargetRequest(String requestString) { if (StringUtils.isBlank(requestString) || requestString.equals("#")) { return; } requestString = UrlUtils.canonicalizeUrl(requestString, url.toString()); targetRequests.add(new Request(requestString)); }
java
public void addTargetRequest(String requestString) { if (StringUtils.isBlank(requestString) || requestString.equals("#")) { return; } requestString = UrlUtils.canonicalizeUrl(requestString, url.toString()); targetRequests.add(new Request(requestString)); }
[ "public", "void", "addTargetRequest", "(", "String", "requestString", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "requestString", ")", "||", "requestString", ".", "equals", "(", "\"#\"", ")", ")", "{", "return", ";", "}", "requestString", "=", ...
add url to fetch @param requestString requestString
[ "add", "url", "to", "fetch" ]
be892b80bf6682cd063d30ac25a79be0c079a901
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Page.java#L155-L161
128,907
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/selector/Json.java
Json.removePadding
public Json removePadding(String padding) { String text = getFirstSourceText(); XTokenQueue tokenQueue = new XTokenQueue(text); tokenQueue.consumeWhitespace(); tokenQueue.consume(padding); tokenQueue.consumeWhitespace(); String chompBalanced = tokenQueue.chompBalancedNotI...
java
public Json removePadding(String padding) { String text = getFirstSourceText(); XTokenQueue tokenQueue = new XTokenQueue(text); tokenQueue.consumeWhitespace(); tokenQueue.consume(padding); tokenQueue.consumeWhitespace(); String chompBalanced = tokenQueue.chompBalancedNotI...
[ "public", "Json", "removePadding", "(", "String", "padding", ")", "{", "String", "text", "=", "getFirstSourceText", "(", ")", ";", "XTokenQueue", "tokenQueue", "=", "new", "XTokenQueue", "(", "text", ")", ";", "tokenQueue", ".", "consumeWhitespace", "(", ")", ...
remove padding for JSONP @param padding padding @return json after padding removed
[ "remove", "padding", "for", "JSONP" ]
be892b80bf6682cd063d30ac25a79be0c079a901
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/selector/Json.java#L28-L36
128,908
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/Spider.java
Spider.setScheduler
public Spider setScheduler(Scheduler scheduler) { checkIfRunning(); Scheduler oldScheduler = this.scheduler; this.scheduler = scheduler; if (oldScheduler != null) { Request request; while ((request = oldScheduler.poll(this)) != null) { this.schedul...
java
public Spider setScheduler(Scheduler scheduler) { checkIfRunning(); Scheduler oldScheduler = this.scheduler; this.scheduler = scheduler; if (oldScheduler != null) { Request request; while ((request = oldScheduler.poll(this)) != null) { this.schedul...
[ "public", "Spider", "setScheduler", "(", "Scheduler", "scheduler", ")", "{", "checkIfRunning", "(", ")", ";", "Scheduler", "oldScheduler", "=", "this", ".", "scheduler", ";", "this", ".", "scheduler", "=", "scheduler", ";", "if", "(", "oldScheduler", "!=", "...
set scheduler for Spider @param scheduler scheduler @return this @see Scheduler @since 0.2.1
[ "set", "scheduler", "for", "Spider" ]
be892b80bf6682cd063d30ac25a79be0c079a901
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Spider.java#L190-L201
128,909
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/Spider.java
Spider.getAll
public <T> List<T> getAll(Collection<String> urls) { destroyWhenExit = false; spawnUrl = false; if (startRequests!=null){ startRequests.clear(); } for (Request request : UrlUtils.convertToRequests(urls)) { addRequest(request); } CollectorPi...
java
public <T> List<T> getAll(Collection<String> urls) { destroyWhenExit = false; spawnUrl = false; if (startRequests!=null){ startRequests.clear(); } for (Request request : UrlUtils.convertToRequests(urls)) { addRequest(request); } CollectorPi...
[ "public", "<", "T", ">", "List", "<", "T", ">", "getAll", "(", "Collection", "<", "String", ">", "urls", ")", "{", "destroyWhenExit", "=", "false", ";", "spawnUrl", "=", "false", ";", "if", "(", "startRequests", "!=", "null", ")", "{", "startRequests",...
Download urls synchronizing. @param urls urls @param <T> type of process result @return list downloaded
[ "Download", "urls", "synchronizing", "." ]
be892b80bf6682cd063d30ac25a79be0c079a901
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Spider.java#L507-L522
128,910
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/Spider.java
Spider.thread
public Spider thread(ExecutorService executorService, int threadNum) { checkIfRunning(); this.threadNum = threadNum; if (threadNum <= 0) { throw new IllegalArgumentException("threadNum should be more than one!"); } this.executorService = executorService; retur...
java
public Spider thread(ExecutorService executorService, int threadNum) { checkIfRunning(); this.threadNum = threadNum; if (threadNum <= 0) { throw new IllegalArgumentException("threadNum should be more than one!"); } this.executorService = executorService; retur...
[ "public", "Spider", "thread", "(", "ExecutorService", "executorService", ",", "int", "threadNum", ")", "{", "checkIfRunning", "(", ")", ";", "this", ".", "threadNum", "=", "threadNum", ";", "if", "(", "threadNum", "<=", "0", ")", "{", "throw", "new", "Ille...
start with more than one threads @param executorService executorService to run the spider @param threadNum threadNum @return this
[ "start", "with", "more", "than", "one", "threads" ]
be892b80bf6682cd063d30ac25a79be0c079a901
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Spider.java#L610-L618
128,911
code4craft/webmagic
webmagic-core/src/main/java/us/codecraft/webmagic/Site.java
Site.addCookie
public Site addCookie(String domain, String name, String value) { if (!cookies.containsKey(domain)){ cookies.put(domain,new HashMap<String, String>()); } cookies.get(domain).put(name, value); return this; }
java
public Site addCookie(String domain, String name, String value) { if (!cookies.containsKey(domain)){ cookies.put(domain,new HashMap<String, String>()); } cookies.get(domain).put(name, value); return this; }
[ "public", "Site", "addCookie", "(", "String", "domain", ",", "String", "name", ",", "String", "value", ")", "{", "if", "(", "!", "cookies", ".", "containsKey", "(", "domain", ")", ")", "{", "cookies", ".", "put", "(", "domain", ",", "new", "HashMap", ...
Add a cookie with specific domain. @param domain domain @param name name @param value value @return this
[ "Add", "a", "cookie", "with", "specific", "domain", "." ]
be892b80bf6682cd063d30ac25a79be0c079a901
https://github.com/code4craft/webmagic/blob/be892b80bf6682cd063d30ac25a79be0c079a901/webmagic-core/src/main/java/us/codecraft/webmagic/Site.java#L79-L85
128,912
pagehelper/Mybatis-PageHelper
src/main/java/com/github/pagehelper/parser/OrderByParser.java
OrderByParser.extraOrderBy
public static List<OrderByElement> extraOrderBy(SelectBody selectBody) { if (selectBody instanceof PlainSelect) { List<OrderByElement> orderByElements = ((PlainSelect) selectBody).getOrderByElements(); ((PlainSelect) selectBody).setOrderByElements(null); return orderByElement...
java
public static List<OrderByElement> extraOrderBy(SelectBody selectBody) { if (selectBody instanceof PlainSelect) { List<OrderByElement> orderByElements = ((PlainSelect) selectBody).getOrderByElements(); ((PlainSelect) selectBody).setOrderByElements(null); return orderByElement...
[ "public", "static", "List", "<", "OrderByElement", ">", "extraOrderBy", "(", "SelectBody", "selectBody", ")", "{", "if", "(", "selectBody", "instanceof", "PlainSelect", ")", "{", "List", "<", "OrderByElement", ">", "orderByElements", "=", "(", "(", "PlainSelect"...
extra order by and set default orderby to null @param selectBody
[ "extra", "order", "by", "and", "set", "default", "orderby", "to", "null" ]
319750fd47cf75328ff321f38125fa15e954e60f
https://github.com/pagehelper/Mybatis-PageHelper/blob/319750fd47cf75328ff321f38125fa15e954e60f/src/main/java/com/github/pagehelper/parser/OrderByParser.java#L74-L92
128,913
prestodb/presto
presto-array/src/main/java/com/facebook/presto/array/ReferenceCountMap.java
ReferenceCountMap.decrementAndGet
public int decrementAndGet(Object key) { long hashCode = getHashCode(key); int previousCount = addTo(hashCode, -1); if (previousCount == 1) { remove(hashCode); } return previousCount - 1; }
java
public int decrementAndGet(Object key) { long hashCode = getHashCode(key); int previousCount = addTo(hashCode, -1); if (previousCount == 1) { remove(hashCode); } return previousCount - 1; }
[ "public", "int", "decrementAndGet", "(", "Object", "key", ")", "{", "long", "hashCode", "=", "getHashCode", "(", "key", ")", ";", "int", "previousCount", "=", "addTo", "(", "hashCode", ",", "-", "1", ")", ";", "if", "(", "previousCount", "==", "1", ")"...
Decrements the reference count of an object by 1 and returns the updated reference count
[ "Decrements", "the", "reference", "count", "of", "an", "object", "by", "1", "and", "returns", "the", "updated", "reference", "count" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-array/src/main/java/com/facebook/presto/array/ReferenceCountMap.java#L52-L60
128,914
prestodb/presto
presto-array/src/main/java/com/facebook/presto/array/ReferenceCountMap.java
ReferenceCountMap.sizeOf
public long sizeOf() { return INSTANCE_SIZE + SizeOf.sizeOf(key) + SizeOf.sizeOf(value) + SizeOf.sizeOf(used); }
java
public long sizeOf() { return INSTANCE_SIZE + SizeOf.sizeOf(key) + SizeOf.sizeOf(value) + SizeOf.sizeOf(used); }
[ "public", "long", "sizeOf", "(", ")", "{", "return", "INSTANCE_SIZE", "+", "SizeOf", ".", "sizeOf", "(", "key", ")", "+", "SizeOf", ".", "sizeOf", "(", "value", ")", "+", "SizeOf", ".", "sizeOf", "(", "used", ")", ";", "}" ]
Returns the size of this map in bytes.
[ "Returns", "the", "size", "of", "this", "map", "in", "bytes", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-array/src/main/java/com/facebook/presto/array/ReferenceCountMap.java#L65-L68
128,915
prestodb/presto
presto-array/src/main/java/com/facebook/presto/array/ReferenceCountMap.java
ReferenceCountMap.getHashCode
private static long getHashCode(Object key) { // identityHashCode of two objects are not guaranteed to be different. // Any additional identity information can reduce collisions. // In the most cases below, we use size of an object to be the extra identity. // Experiments show that w...
java
private static long getHashCode(Object key) { // identityHashCode of two objects are not guaranteed to be different. // Any additional identity information can reduce collisions. // In the most cases below, we use size of an object to be the extra identity. // Experiments show that w...
[ "private", "static", "long", "getHashCode", "(", "Object", "key", ")", "{", "// identityHashCode of two objects are not guaranteed to be different.", "// Any additional identity information can reduce collisions.", "// In the most cases below, we use size of an object to be the extra identity....
Get the 64-bit hash code for an object
[ "Get", "the", "64", "-", "bit", "hash", "code", "for", "an", "object" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-array/src/main/java/com/facebook/presto/array/ReferenceCountMap.java#L73-L101
128,916
prestodb/presto
presto-main/src/main/java/com/facebook/presto/metadata/StaticFunctionNamespace.java
StaticFunctionNamespace.isMoreSpecificThan
private boolean isMoreSpecificThan(ApplicableFunction left, ApplicableFunction right) { List<TypeSignatureProvider> resolvedTypes = fromTypeSignatures(left.getBoundSignature().getArgumentTypes()); Optional<BoundVariables> boundVariables = new SignatureBinder(typeManager, right.getDeclaredSignature()...
java
private boolean isMoreSpecificThan(ApplicableFunction left, ApplicableFunction right) { List<TypeSignatureProvider> resolvedTypes = fromTypeSignatures(left.getBoundSignature().getArgumentTypes()); Optional<BoundVariables> boundVariables = new SignatureBinder(typeManager, right.getDeclaredSignature()...
[ "private", "boolean", "isMoreSpecificThan", "(", "ApplicableFunction", "left", ",", "ApplicableFunction", "right", ")", "{", "List", "<", "TypeSignatureProvider", ">", "resolvedTypes", "=", "fromTypeSignatures", "(", "left", ".", "getBoundSignature", "(", ")", ".", ...
One method is more specific than another if invocation handled by the first method could be passed on to the other one
[ "One", "method", "is", "more", "specific", "than", "another", "if", "invocation", "handled", "by", "the", "first", "method", "could", "be", "passed", "on", "to", "the", "other", "one" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/metadata/StaticFunctionNamespace.java#L1178-L1184
128,917
prestodb/presto
presto-kudu/src/main/java/com/facebook/presto/kudu/KuduClientSession.java
KuduClientSession.addConstraintPredicates
private boolean addConstraintPredicates(KuduTable table, KuduScanToken.KuduScanTokenBuilder builder, TupleDomain<ColumnHandle> constraintSummary) { if (constraintSummary.isNone()) { return false; } else if (!constraintSummary.isAll()) { Schema schema = tab...
java
private boolean addConstraintPredicates(KuduTable table, KuduScanToken.KuduScanTokenBuilder builder, TupleDomain<ColumnHandle> constraintSummary) { if (constraintSummary.isNone()) { return false; } else if (!constraintSummary.isAll()) { Schema schema = tab...
[ "private", "boolean", "addConstraintPredicates", "(", "KuduTable", "table", ",", "KuduScanToken", ".", "KuduScanTokenBuilder", "builder", ",", "TupleDomain", "<", "ColumnHandle", ">", "constraintSummary", ")", "{", "if", "(", "constraintSummary", ".", "isNone", "(", ...
translates TupleDomain to KuduPredicates. @return false if TupleDomain or one of its domains is none
[ "translates", "TupleDomain", "to", "KuduPredicates", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-kudu/src/main/java/com/facebook/presto/kudu/KuduClientSession.java#L451-L511
128,918
prestodb/presto
presto-resource-group-managers/src/main/java/com/facebook/presto/resourceGroups/db/DbResourceGroupConfigurationManager.java
DbResourceGroupConfigurationManager.populateFromDbHelper
private synchronized void populateFromDbHelper(Map<Long, ResourceGroupSpecBuilder> recordMap, Set<Long> rootGroupIds, Map<Long, ResourceGroupIdTemplate> resourceGroupIdTemplateMap, Map<Long, Set<Long>> subGroupIdsToBuild) { List<ResourceGroupSpecBuilder> records = dao.get...
java
private synchronized void populateFromDbHelper(Map<Long, ResourceGroupSpecBuilder> recordMap, Set<Long> rootGroupIds, Map<Long, ResourceGroupIdTemplate> resourceGroupIdTemplateMap, Map<Long, Set<Long>> subGroupIdsToBuild) { List<ResourceGroupSpecBuilder> records = dao.get...
[ "private", "synchronized", "void", "populateFromDbHelper", "(", "Map", "<", "Long", ",", "ResourceGroupSpecBuilder", ">", "recordMap", ",", "Set", "<", "Long", ">", "rootGroupIds", ",", "Map", "<", "Long", ",", "ResourceGroupIdTemplate", ">", "resourceGroupIdTemplat...
Populate temporary data structures to build resource group specs and selectors from db
[ "Populate", "temporary", "data", "structures", "to", "build", "resource", "group", "specs", "and", "selectors", "from", "db" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-resource-group-managers/src/main/java/com/facebook/presto/resourceGroups/db/DbResourceGroupConfigurationManager.java#L249-L265
128,919
prestodb/presto
presto-main/src/main/java/com/facebook/presto/memory/ClusterMemoryManager.java
ClusterMemoryManager.updateAssignments
private synchronized MemoryPoolAssignmentsRequest updateAssignments(Iterable<QueryExecution> queries) { ClusterMemoryPool reservedPool = pools.get(RESERVED_POOL); ClusterMemoryPool generalPool = pools.get(GENERAL_POOL); verify(generalPool != null, "generalPool is null"); verify(reser...
java
private synchronized MemoryPoolAssignmentsRequest updateAssignments(Iterable<QueryExecution> queries) { ClusterMemoryPool reservedPool = pools.get(RESERVED_POOL); ClusterMemoryPool generalPool = pools.get(GENERAL_POOL); verify(generalPool != null, "generalPool is null"); verify(reser...
[ "private", "synchronized", "MemoryPoolAssignmentsRequest", "updateAssignments", "(", "Iterable", "<", "QueryExecution", ">", "queries", ")", "{", "ClusterMemoryPool", "reservedPool", "=", "pools", ".", "get", "(", "RESERVED_POOL", ")", ";", "ClusterMemoryPool", "general...
RemoteNodeMemory as we don't need to POST anything.
[ "RemoteNodeMemory", "as", "we", "don", "t", "need", "to", "POST", "anything", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/memory/ClusterMemoryManager.java#L409-L447
128,920
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/DictionaryCompressionOptimizer.java
DictionaryCompressionOptimizer.selectDictionaryColumnToConvert
private DictionaryCompressionProjection selectDictionaryColumnToConvert(int totalNonDictionaryBytes, int stripeRowCount) { checkState(!directConversionCandidates.isEmpty()); int totalNonDictionaryBytesPerRow = totalNonDictionaryBytes / stripeRowCount; // rawBytes = sum of the length of eve...
java
private DictionaryCompressionProjection selectDictionaryColumnToConvert(int totalNonDictionaryBytes, int stripeRowCount) { checkState(!directConversionCandidates.isEmpty()); int totalNonDictionaryBytesPerRow = totalNonDictionaryBytes / stripeRowCount; // rawBytes = sum of the length of eve...
[ "private", "DictionaryCompressionProjection", "selectDictionaryColumnToConvert", "(", "int", "totalNonDictionaryBytes", ",", "int", "stripeRowCount", ")", "{", "checkState", "(", "!", "directConversionCandidates", ".", "isEmpty", "(", ")", ")", ";", "int", "totalNonDictio...
Choose a dictionary column to convert to direct encoding. We do this by predicting the compression ration of the stripe if a singe column is flipped to direct. So for each column, we try to predict the row count when we will hit a stripe flush limit if that column were converted to direct. Once we know the row count...
[ "Choose", "a", "dictionary", "column", "to", "convert", "to", "direct", "encoding", ".", "We", "do", "this", "by", "predicting", "the", "compression", "ration", "of", "the", "stripe", "if", "a", "singe", "column", "is", "flipped", "to", "direct", ".", "So"...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/DictionaryCompressionOptimizer.java#L233-L296
128,921
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/predicate/Domain.java
Domain.simplify
public Domain simplify() { ValueSet simplifiedValueSet = values.getValuesProcessor().<Optional<ValueSet>>transform( ranges -> { if (ranges.getOrderedRanges().size() <= 32) { return Optional.empty(); } return ...
java
public Domain simplify() { ValueSet simplifiedValueSet = values.getValuesProcessor().<Optional<ValueSet>>transform( ranges -> { if (ranges.getOrderedRanges().size() <= 32) { return Optional.empty(); } return ...
[ "public", "Domain", "simplify", "(", ")", "{", "ValueSet", "simplifiedValueSet", "=", "values", ".", "getValuesProcessor", "(", ")", ".", "<", "Optional", "<", "ValueSet", ">", ">", "transform", "(", "ranges", "->", "{", "if", "(", "ranges", ".", "getOrder...
Reduces the number of discrete components in the Domain if there are too many.
[ "Reduces", "the", "number", "of", "discrete", "components", "in", "the", "Domain", "if", "there", "are", "too", "many", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/predicate/Domain.java#L259-L277
128,922
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddExchanges.java
AddExchanges.matchedLayoutPreference
private static <T> Comparator<List<Optional<LocalProperty<T>>>> matchedLayoutPreference() { return (matchLayout1, matchLayout2) -> { Iterator<Optional<LocalProperty<T>>> match1Iterator = matchLayout1.iterator(); Iterator<Optional<LocalProperty<T>>> match2Iterator = matchLayout2.itera...
java
private static <T> Comparator<List<Optional<LocalProperty<T>>>> matchedLayoutPreference() { return (matchLayout1, matchLayout2) -> { Iterator<Optional<LocalProperty<T>>> match1Iterator = matchLayout1.iterator(); Iterator<Optional<LocalProperty<T>>> match2Iterator = matchLayout2.itera...
[ "private", "static", "<", "T", ">", "Comparator", "<", "List", "<", "Optional", "<", "LocalProperty", "<", "T", ">", ">", ">", ">", "matchedLayoutPreference", "(", ")", "{", "return", "(", "matchLayout1", ",", "matchLayout2", ")", "->", "{", "Iterator", ...
Prefer the match result that satisfied the most requirements
[ "Prefer", "the", "match", "result", "that", "satisfied", "the", "most", "requirements" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/AddExchanges.java#L1403-L1424
128,923
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java
NumericHistogram.store
private void store(PriorityQueue<Entry> queue) { nextIndex = 0; for (Entry entry : queue) { if (entry.isValid()) { values[nextIndex] = entry.getValue(); weights[nextIndex] = entry.getWeight(); nextIndex++; } } so...
java
private void store(PriorityQueue<Entry> queue) { nextIndex = 0; for (Entry entry : queue) { if (entry.isValid()) { values[nextIndex] = entry.getValue(); weights[nextIndex] = entry.getWeight(); nextIndex++; } } so...
[ "private", "void", "store", "(", "PriorityQueue", "<", "Entry", ">", "queue", ")", "{", "nextIndex", "=", "0", ";", "for", "(", "Entry", "entry", ":", "queue", ")", "{", "if", "(", "entry", ".", "isValid", "(", ")", ")", "{", "values", "[", "nextIn...
Dump the entries in the queue back into the bucket arrays The values are guaranteed to be sorted in increasing order after this method completes
[ "Dump", "the", "entries", "in", "the", "queue", "back", "into", "the", "bucket", "arrays", "The", "values", "are", "guaranteed", "to", "be", "sorted", "in", "increasing", "order", "after", "this", "method", "completes" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java#L222-L233
128,924
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java
NumericHistogram.concat
private static void concat(double[] target, double[] first, int firstLength, double[] second, int secondLength) { System.arraycopy(first, 0, target, 0, firstLength); System.arraycopy(second, 0, target, firstLength, secondLength); }
java
private static void concat(double[] target, double[] first, int firstLength, double[] second, int secondLength) { System.arraycopy(first, 0, target, 0, firstLength); System.arraycopy(second, 0, target, firstLength, secondLength); }
[ "private", "static", "void", "concat", "(", "double", "[", "]", "target", ",", "double", "[", "]", "first", ",", "int", "firstLength", ",", "double", "[", "]", "second", ",", "int", "secondLength", ")", "{", "System", ".", "arraycopy", "(", "first", ",...
Copy two arrays back-to-back onto the target array starting at offset 0
[ "Copy", "two", "arrays", "back", "-", "to", "-", "back", "onto", "the", "target", "array", "starting", "at", "offset", "0" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java#L238-L242
128,925
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java
NumericHistogram.mergeSameBuckets
private static int mergeSameBuckets(double[] values, double[] weights, int nextIndex) { sort(values, weights, nextIndex); int current = 0; for (int i = 1; i < nextIndex; i++) { if (values[current] == values[i]) { weights[current] += weights[i]; } ...
java
private static int mergeSameBuckets(double[] values, double[] weights, int nextIndex) { sort(values, weights, nextIndex); int current = 0; for (int i = 1; i < nextIndex; i++) { if (values[current] == values[i]) { weights[current] += weights[i]; } ...
[ "private", "static", "int", "mergeSameBuckets", "(", "double", "[", "]", "values", ",", "double", "[", "]", "weights", ",", "int", "nextIndex", ")", "{", "sort", "(", "values", ",", "weights", ",", "nextIndex", ")", ";", "int", "current", "=", "0", ";"...
Simple pass that merges entries with the same value
[ "Simple", "pass", "that", "merges", "entries", "with", "the", "same", "value" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java#L247-L263
128,926
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java
NumericHistogram.initializeQueue
private static PriorityQueue<Entry> initializeQueue(double[] values, double[] weights, int nextIndex) { checkArgument(nextIndex > 0, "nextIndex must be > 0"); PriorityQueue<Entry> queue = new PriorityQueue<>(nextIndex); Entry right = new Entry(nextIndex - 1, values[nextIndex - 1], weights[...
java
private static PriorityQueue<Entry> initializeQueue(double[] values, double[] weights, int nextIndex) { checkArgument(nextIndex > 0, "nextIndex must be > 0"); PriorityQueue<Entry> queue = new PriorityQueue<>(nextIndex); Entry right = new Entry(nextIndex - 1, values[nextIndex - 1], weights[...
[ "private", "static", "PriorityQueue", "<", "Entry", ">", "initializeQueue", "(", "double", "[", "]", "values", ",", "double", "[", "]", "weights", ",", "int", "nextIndex", ")", "{", "checkArgument", "(", "nextIndex", ">", "0", ",", "\"nextIndex must be > 0\"",...
Create a priority queue with an entry for each bucket, ordered by the penalty score with respect to the bucket to its right The inputs must be sorted by "value" in increasing order The last bucket has a penalty of infinity Entries are doubly-linked to keep track of the relative position of each bucket
[ "Create", "a", "priority", "queue", "with", "an", "entry", "for", "each", "bucket", "ordered", "by", "the", "penalty", "score", "with", "respect", "to", "the", "bucket", "to", "its", "right", "The", "inputs", "must", "be", "sorted", "by", "value", "in", ...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/NumericHistogram.java#L271-L286
128,927
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/SortedPositionLinks.java
SortedPositionLinks.lowerBound
private int lowerBound(JoinFilterFunction searchFunction, int[] links, int first, int last, int probePosition, Page allProbeChannelsPage) { int middle; int step; int count = last - first; while (count > 0) { step = count / 2; middle = first + step; ...
java
private int lowerBound(JoinFilterFunction searchFunction, int[] links, int first, int last, int probePosition, Page allProbeChannelsPage) { int middle; int step; int count = last - first; while (count > 0) { step = count / 2; middle = first + step; ...
[ "private", "int", "lowerBound", "(", "JoinFilterFunction", "searchFunction", ",", "int", "[", "]", "links", ",", "int", "first", ",", "int", "last", ",", "int", "probePosition", ",", "Page", "allProbeChannelsPage", ")", "{", "int", "middle", ";", "int", "ste...
Find the first element in position links that is NOT smaller than probePosition
[ "Find", "the", "first", "element", "in", "position", "links", "that", "is", "NOT", "smaller", "than", "probePosition" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/SortedPositionLinks.java#L259-L276
128,928
prestodb/presto
presto-main/src/main/java/com/facebook/presto/cost/SemiJoinStatsCalculator.java
SemiJoinStatsCalculator.computeSemiJoin
public static PlanNodeStatsEstimate computeSemiJoin(PlanNodeStatsEstimate sourceStats, PlanNodeStatsEstimate filteringSourceStats, Symbol sourceJoinSymbol, Symbol filteringSourceJoinSymbol) { return compute(sourceStats, filteringSourceStats, sourceJoinSymbol, filteringSourceJoinSymbol, (sour...
java
public static PlanNodeStatsEstimate computeSemiJoin(PlanNodeStatsEstimate sourceStats, PlanNodeStatsEstimate filteringSourceStats, Symbol sourceJoinSymbol, Symbol filteringSourceJoinSymbol) { return compute(sourceStats, filteringSourceStats, sourceJoinSymbol, filteringSourceJoinSymbol, (sour...
[ "public", "static", "PlanNodeStatsEstimate", "computeSemiJoin", "(", "PlanNodeStatsEstimate", "sourceStats", ",", "PlanNodeStatsEstimate", "filteringSourceStats", ",", "Symbol", "sourceJoinSymbol", ",", "Symbol", "filteringSourceJoinSymbol", ")", "{", "return", "compute", "("...
Basically it works as low and high values were the same for source and filteringSource and just looks at NDVs.
[ "Basically", "it", "works", "as", "low", "and", "high", "values", "were", "the", "same", "for", "source", "and", "filteringSource", "and", "just", "looks", "at", "NDVs", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/cost/SemiJoinStatsCalculator.java#L33-L38
128,929
prestodb/presto
presto-main/src/main/java/com/facebook/presto/cost/PlanNodeStatsEstimateMath.java
PlanNodeStatsEstimateMath.subtractSubsetStats
public static PlanNodeStatsEstimate subtractSubsetStats(PlanNodeStatsEstimate superset, PlanNodeStatsEstimate subset) { if (superset.isOutputRowCountUnknown() || subset.isOutputRowCountUnknown()) { return PlanNodeStatsEstimate.unknown(); } double supersetRowCount = superset.getO...
java
public static PlanNodeStatsEstimate subtractSubsetStats(PlanNodeStatsEstimate superset, PlanNodeStatsEstimate subset) { if (superset.isOutputRowCountUnknown() || subset.isOutputRowCountUnknown()) { return PlanNodeStatsEstimate.unknown(); } double supersetRowCount = superset.getO...
[ "public", "static", "PlanNodeStatsEstimate", "subtractSubsetStats", "(", "PlanNodeStatsEstimate", "superset", ",", "PlanNodeStatsEstimate", "subset", ")", "{", "if", "(", "superset", ".", "isOutputRowCountUnknown", "(", ")", "||", "subset", ".", "isOutputRowCountUnknown",...
Subtracts subset stats from supersets stats. It is assumed that each NDV from subset has a matching NDV in superset.
[ "Subtracts", "subset", "stats", "from", "supersets", "stats", ".", "It", "is", "assumed", "that", "each", "NDV", "from", "subset", "has", "a", "matching", "NDV", "in", "superset", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/cost/PlanNodeStatsEstimateMath.java#L32-L101
128,930
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatStreamReader.java
MapFlatStreamReader.copyStreamDescriptorWithSequence
private static StreamDescriptor copyStreamDescriptorWithSequence(StreamDescriptor streamDescriptor, int sequence) { List<StreamDescriptor> streamDescriptors = streamDescriptor.getNestedStreams().stream() .map(stream -> copyStreamDescriptorWithSequence(stream, sequence)) .coll...
java
private static StreamDescriptor copyStreamDescriptorWithSequence(StreamDescriptor streamDescriptor, int sequence) { List<StreamDescriptor> streamDescriptors = streamDescriptor.getNestedStreams().stream() .map(stream -> copyStreamDescriptorWithSequence(stream, sequence)) .coll...
[ "private", "static", "StreamDescriptor", "copyStreamDescriptorWithSequence", "(", "StreamDescriptor", "streamDescriptor", ",", "int", "sequence", ")", "{", "List", "<", "StreamDescriptor", ">", "streamDescriptors", "=", "streamDescriptor", ".", "getNestedStreams", "(", ")...
Creates StreamDescriptor which is a copy of this one with the value of sequence changed to the value passed in. Recursively calls itself on the nested streams.
[ "Creates", "StreamDescriptor", "which", "is", "a", "copy", "of", "this", "one", "with", "the", "value", "of", "sequence", "changed", "to", "the", "value", "passed", "in", ".", "Recursively", "calls", "itself", "on", "the", "nested", "streams", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/reader/MapFlatStreamReader.java#L263-L277
128,931
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/TupleDomainOrcPredicate.java
TupleDomainOrcPredicate.checkInBloomFilter
@VisibleForTesting public static boolean checkInBloomFilter(BloomFilter bloomFilter, Object predicateValue, Type sqlType) { if (sqlType == TINYINT || sqlType == SMALLINT || sqlType == INTEGER || sqlType == BIGINT) { return bloomFilter.testLong(((Number) predicateValue).longValue()); ...
java
@VisibleForTesting public static boolean checkInBloomFilter(BloomFilter bloomFilter, Object predicateValue, Type sqlType) { if (sqlType == TINYINT || sqlType == SMALLINT || sqlType == INTEGER || sqlType == BIGINT) { return bloomFilter.testLong(((Number) predicateValue).longValue()); ...
[ "@", "VisibleForTesting", "public", "static", "boolean", "checkInBloomFilter", "(", "BloomFilter", "bloomFilter", ",", "Object", "predicateValue", ",", "Type", "sqlType", ")", "{", "if", "(", "sqlType", "==", "TINYINT", "||", "sqlType", "==", "SMALLINT", "||", "...
checks whether a value part of the effective predicate is likely to be part of this bloom filter
[ "checks", "whether", "a", "value", "part", "of", "the", "effective", "predicate", "is", "likely", "to", "be", "part", "of", "this", "bloom", "filter" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/TupleDomainOrcPredicate.java#L162-L179
128,932
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/state/StateCompiler.java
StateCompiler.enumerateFields
private static List<StateField> enumerateFields(Class<?> clazz, Map<String, Type> fieldTypes) { ImmutableList.Builder<StateField> builder = ImmutableList.builder(); final Set<Class<?>> primitiveClasses = ImmutableSet.of(byte.class, boolean.class, long.class, double.class, int.class); Set<Cla...
java
private static List<StateField> enumerateFields(Class<?> clazz, Map<String, Type> fieldTypes) { ImmutableList.Builder<StateField> builder = ImmutableList.builder(); final Set<Class<?>> primitiveClasses = ImmutableSet.of(byte.class, boolean.class, long.class, double.class, int.class); Set<Cla...
[ "private", "static", "List", "<", "StateField", ">", "enumerateFields", "(", "Class", "<", "?", ">", "clazz", ",", "Map", "<", "String", ",", "Type", ">", "fieldTypes", ")", "{", "ImmutableList", ".", "Builder", "<", "StateField", ">", "builder", "=", "I...
Enumerates all the fields in this state interface. @param clazz a subclass of AccumulatorState @param fieldTypes a map of field name and Type @return list of state fields. Ordering is guaranteed to be stable, and have all primitive fields at the beginning.
[ "Enumerates", "all", "the", "fields", "in", "this", "state", "interface", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/state/StateCompiler.java#L574-L617
128,933
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloMetadata.java
AccumuloMetadata.listViews
private List<SchemaTableName> listViews(Optional<String> filterSchema) { ImmutableList.Builder<SchemaTableName> builder = ImmutableList.builder(); if (filterSchema.isPresent()) { for (String view : client.getViewNames(filterSchema.get())) { builder.add(new SchemaTableName...
java
private List<SchemaTableName> listViews(Optional<String> filterSchema) { ImmutableList.Builder<SchemaTableName> builder = ImmutableList.builder(); if (filterSchema.isPresent()) { for (String view : client.getViewNames(filterSchema.get())) { builder.add(new SchemaTableName...
[ "private", "List", "<", "SchemaTableName", ">", "listViews", "(", "Optional", "<", "String", ">", "filterSchema", ")", "{", "ImmutableList", ".", "Builder", "<", "SchemaTableName", ">", "builder", "=", "ImmutableList", ".", "builder", "(", ")", ";", "if", "(...
Gets all views in the given schema, or all schemas if null. @param filterSchema Schema to filter the views, or absent to list all schemas @return List of views
[ "Gets", "all", "views", "in", "the", "given", "schema", "or", "all", "schemas", "if", "null", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloMetadata.java#L187-L204
128,934
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/SubqueryPlanner.java
SubqueryPlanner.tryResolveMissingExpression
private static Optional<Expression> tryResolveMissingExpression(PlanBuilder subPlan, Expression expression) { Expression rewritten = subPlan.rewrite(expression); if (rewritten != expression) { return Optional.of(rewritten); } return Optional.empty(); }
java
private static Optional<Expression> tryResolveMissingExpression(PlanBuilder subPlan, Expression expression) { Expression rewritten = subPlan.rewrite(expression); if (rewritten != expression) { return Optional.of(rewritten); } return Optional.empty(); }
[ "private", "static", "Optional", "<", "Expression", ">", "tryResolveMissingExpression", "(", "PlanBuilder", "subPlan", ",", "Expression", "expression", ")", "{", "Expression", "rewritten", "=", "subPlan", ".", "rewrite", "(", "expression", ")", ";", "if", "(", "...
Checks if give reference expression can resolved within given plan.
[ "Checks", "if", "give", "reference", "expression", "can", "resolved", "within", "given", "plan", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/SubqueryPlanner.java#L468-L475
128,935
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/MergeHashSort.java
MergeHashSort.merge
public WorkProcessor<Page> merge(List<Type> keyTypes, List<Type> allTypes, List<WorkProcessor<Page>> channels, DriverYieldSignal driverYieldSignal) { InterpretedHashGenerator hashGenerator = createHashGenerator(keyTypes); return mergeSortedPages( channels, createHashP...
java
public WorkProcessor<Page> merge(List<Type> keyTypes, List<Type> allTypes, List<WorkProcessor<Page>> channels, DriverYieldSignal driverYieldSignal) { InterpretedHashGenerator hashGenerator = createHashGenerator(keyTypes); return mergeSortedPages( channels, createHashP...
[ "public", "WorkProcessor", "<", "Page", ">", "merge", "(", "List", "<", "Type", ">", "keyTypes", ",", "List", "<", "Type", ">", "allTypes", ",", "List", "<", "WorkProcessor", "<", "Page", ">", ">", "channels", ",", "DriverYieldSignal", "driverYieldSignal", ...
Rows with same hash value are guaranteed to be in the same result page.
[ "Rows", "with", "same", "hash", "value", "are", "guaranteed", "to", "be", "in", "the", "same", "result", "page", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/MergeHashSort.java#L50-L62
128,936
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/QueryStateMachine.java
QueryStateMachine.begin
public static QueryStateMachine begin( String query, Session session, URI self, ResourceGroupId resourceGroup, Optional<QueryType> queryType, boolean transactionControl, TransactionManager transactionManager, AccessControl a...
java
public static QueryStateMachine begin( String query, Session session, URI self, ResourceGroupId resourceGroup, Optional<QueryType> queryType, boolean transactionControl, TransactionManager transactionManager, AccessControl a...
[ "public", "static", "QueryStateMachine", "begin", "(", "String", "query", ",", "Session", "session", ",", "URI", "self", ",", "ResourceGroupId", "resourceGroup", ",", "Optional", "<", "QueryType", ">", "queryType", ",", "boolean", "transactionControl", ",", "Trans...
Created QueryStateMachines must be transitioned to terminal states to clean up resources.
[ "Created", "QueryStateMachines", "must", "be", "transitioned", "to", "terminal", "states", "to", "clean", "up", "resources", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/QueryStateMachine.java#L179-L205
128,937
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/index/StreamingIndexedData.java
StreamingIndexedData.extractNonEmptyPage
private static Page extractNonEmptyPage(PageBuffer pageBuffer) { Page page = pageBuffer.poll(); while (page != null && page.getPositionCount() == 0) { page = pageBuffer.poll(); } return page; }
java
private static Page extractNonEmptyPage(PageBuffer pageBuffer) { Page page = pageBuffer.poll(); while (page != null && page.getPositionCount() == 0) { page = pageBuffer.poll(); } return page; }
[ "private", "static", "Page", "extractNonEmptyPage", "(", "PageBuffer", "pageBuffer", ")", "{", "Page", "page", "=", "pageBuffer", ".", "poll", "(", ")", ";", "while", "(", "page", "!=", "null", "&&", "page", ".", "getPositionCount", "(", ")", "==", "0", ...
Return the next page from pageBuffer that has a non-zero position count, or null if none available
[ "Return", "the", "next", "page", "from", "pageBuffer", "that", "has", "a", "non", "-", "zero", "position", "count", "or", "null", "if", "none", "available" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/index/StreamingIndexedData.java#L113-L120
128,938
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/KeyValuePairs.java
KeyValuePairs.add
public void add(Block key, Block value, int keyPosition, int valuePosition) { if (!keyExists(key, keyPosition)) { addKey(key, keyPosition); if (value.isNull(valuePosition)) { valueBlockBuilder.appendNull(); } else { valueType.ap...
java
public void add(Block key, Block value, int keyPosition, int valuePosition) { if (!keyExists(key, keyPosition)) { addKey(key, keyPosition); if (value.isNull(valuePosition)) { valueBlockBuilder.appendNull(); } else { valueType.ap...
[ "public", "void", "add", "(", "Block", "key", ",", "Block", "value", ",", "int", "keyPosition", ",", "int", "valuePosition", ")", "{", "if", "(", "!", "keyExists", "(", "key", ",", "keyPosition", ")", ")", "{", "addKey", "(", "key", ",", "keyPosition",...
Only add this key value pair if we haven't seen this key before. Otherwise, ignore it.
[ "Only", "add", "this", "key", "value", "pair", "if", "we", "haven", "t", "seen", "this", "key", "before", ".", "Otherwise", "ignore", "it", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/KeyValuePairs.java#L111-L122
128,939
prestodb/presto
presto-main/src/main/java/com/facebook/presto/server/smile/SmileCodec.java
SmileCodec.toBytes
@Override public byte[] toBytes(T instance) throws IllegalArgumentException { try { return mapper.writeValueAsBytes(instance); } catch (IOException e) { throw new IllegalArgumentException(format("%s could not be converted to SMILE", instance.getClass()...
java
@Override public byte[] toBytes(T instance) throws IllegalArgumentException { try { return mapper.writeValueAsBytes(instance); } catch (IOException e) { throw new IllegalArgumentException(format("%s could not be converted to SMILE", instance.getClass()...
[ "@", "Override", "public", "byte", "[", "]", "toBytes", "(", "T", "instance", ")", "throws", "IllegalArgumentException", "{", "try", "{", "return", "mapper", ".", "writeValueAsBytes", "(", "instance", ")", ";", "}", "catch", "(", "IOException", "e", ")", "...
Converts the specified instance to smile encoded bytes. @param instance the instance to convert to smile encoded bytes @return smile encoded bytes (UTF-8) @throws IllegalArgumentException if the specified instance can not be converted to smile
[ "Converts", "the", "specified", "instance", "to", "smile", "encoded", "bytes", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/server/smile/SmileCodec.java#L145-L155
128,940
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/predicate/SortedRangeSet.java
SortedRangeSet.of
static SortedRangeSet of(Type type, Object first, Object... rest) { List<Range> ranges = new ArrayList<>(rest.length + 1); ranges.add(Range.equal(type, first)); for (Object value : rest) { ranges.add(Range.equal(type, value)); } return copyOf(type, ranges); }
java
static SortedRangeSet of(Type type, Object first, Object... rest) { List<Range> ranges = new ArrayList<>(rest.length + 1); ranges.add(Range.equal(type, first)); for (Object value : rest) { ranges.add(Range.equal(type, value)); } return copyOf(type, ranges); }
[ "static", "SortedRangeSet", "of", "(", "Type", "type", ",", "Object", "first", ",", "Object", "...", "rest", ")", "{", "List", "<", "Range", ">", "ranges", "=", "new", "ArrayList", "<>", "(", "rest", ".", "length", "+", "1", ")", ";", "ranges", ".", ...
Provided discrete values that are unioned together to form the SortedRangeSet
[ "Provided", "discrete", "values", "that", "are", "unioned", "together", "to", "form", "the", "SortedRangeSet" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/predicate/SortedRangeSet.java#L74-L82
128,941
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/LocalProperties.java
LocalProperties.translate
public static <X, Y> List<LocalProperty<Y>> translate(List<? extends LocalProperty<X>> properties, Function<X, Optional<Y>> translator) { properties = normalizeAndPrune(properties); ImmutableList.Builder<LocalProperty<Y>> builder = ImmutableList.builder(); for (LocalProperty<X> property : p...
java
public static <X, Y> List<LocalProperty<Y>> translate(List<? extends LocalProperty<X>> properties, Function<X, Optional<Y>> translator) { properties = normalizeAndPrune(properties); ImmutableList.Builder<LocalProperty<Y>> builder = ImmutableList.builder(); for (LocalProperty<X> property : p...
[ "public", "static", "<", "X", ",", "Y", ">", "List", "<", "LocalProperty", "<", "Y", ">", ">", "translate", "(", "List", "<", "?", "extends", "LocalProperty", "<", "X", ">", ">", "properties", ",", "Function", "<", "X", ",", "Optional", "<", "Y", "...
Translates the properties as much as possible, and truncates at the first non-translatable property
[ "Translates", "the", "properties", "as", "much", "as", "possible", "and", "truncates", "at", "the", "first", "non", "-", "translatable", "property" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/LocalProperties.java#L72-L88
128,942
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/LocalProperties.java
LocalProperties.normalize
public static <T> List<Optional<LocalProperty<T>>> normalize(List<? extends LocalProperty<T>> localProperties) { List<Optional<LocalProperty<T>>> normalizedProperties = new ArrayList<>(localProperties.size()); Set<T> constants = new HashSet<>(); for (LocalProperty<T> localProperty : localPro...
java
public static <T> List<Optional<LocalProperty<T>>> normalize(List<? extends LocalProperty<T>> localProperties) { List<Optional<LocalProperty<T>>> normalizedProperties = new ArrayList<>(localProperties.size()); Set<T> constants = new HashSet<>(); for (LocalProperty<T> localProperty : localPro...
[ "public", "static", "<", "T", ">", "List", "<", "Optional", "<", "LocalProperty", "<", "T", ">", ">", ">", "normalize", "(", "List", "<", "?", "extends", "LocalProperty", "<", "T", ">", ">", "localProperties", ")", "{", "List", "<", "Optional", "<", ...
Normalizes the local properties by removing redundant symbols, but retains the original local property positions
[ "Normalizes", "the", "local", "properties", "by", "removing", "redundant", "symbols", "but", "retains", "the", "original", "local", "property", "positions" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/LocalProperties.java#L131-L140
128,943
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java
ThriftMetastoreUtil.fromMetastoreDistinctValuesCount
private static OptionalLong fromMetastoreDistinctValuesCount(OptionalLong distinctValuesCount, OptionalLong nullsCount, OptionalLong rowCount) { if (distinctValuesCount.isPresent() && nullsCount.isPresent() && rowCount.isPresent()) { return OptionalLong.of(fromMetastoreDistinctValuesCount(distin...
java
private static OptionalLong fromMetastoreDistinctValuesCount(OptionalLong distinctValuesCount, OptionalLong nullsCount, OptionalLong rowCount) { if (distinctValuesCount.isPresent() && nullsCount.isPresent() && rowCount.isPresent()) { return OptionalLong.of(fromMetastoreDistinctValuesCount(distin...
[ "private", "static", "OptionalLong", "fromMetastoreDistinctValuesCount", "(", "OptionalLong", "distinctValuesCount", ",", "OptionalLong", "nullsCount", ",", "OptionalLong", "rowCount", ")", "{", "if", "(", "distinctValuesCount", ".", "isPresent", "(", ")", "&&", "nullsC...
Hive calculates NDV considering null as a distinct value
[ "Hive", "calculates", "NDV", "considering", "null", "as", "a", "distinct", "value" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/metastore/thrift/ThriftMetastoreUtil.java#L602-L608
128,944
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/scalar/ArraysOverlapFunction.java
ArraysOverlapFunction.sortAbstractLongArray
private static int sortAbstractLongArray(Block array, long[] buffer, AbstractType type) { int arraySize = array.getPositionCount(); int nonNullSize = 0; for (int i = 0; i < arraySize; i++) { if (!array.isNull(i)) { buffer[nonNullSize++] = type.getLong(array, i); ...
java
private static int sortAbstractLongArray(Block array, long[] buffer, AbstractType type) { int arraySize = array.getPositionCount(); int nonNullSize = 0; for (int i = 0; i < arraySize; i++) { if (!array.isNull(i)) { buffer[nonNullSize++] = type.getLong(array, i); ...
[ "private", "static", "int", "sortAbstractLongArray", "(", "Block", "array", ",", "long", "[", "]", "buffer", ",", "AbstractType", "type", ")", "{", "int", "arraySize", "=", "array", ".", "getPositionCount", "(", ")", ";", "int", "nonNullSize", "=", "0", ";...
Assumes buffer is long enough, returns count of non-null elements.
[ "Assumes", "buffer", "is", "long", "enough", "returns", "count", "of", "non", "-", "null", "elements", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/scalar/ArraysOverlapFunction.java#L181-L197
128,945
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/AddIntermediateAggregations.java
AddIntermediateAggregations.recurseToPartial
private Optional<PlanNode> recurseToPartial(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator) { if (node instanceof AggregationNode && ((AggregationNode) node).getStep() == PARTIAL) { return Optional.of(addGatheringIntermediate((AggregationNode) node, idAllocator)); } ...
java
private Optional<PlanNode> recurseToPartial(PlanNode node, Lookup lookup, PlanNodeIdAllocator idAllocator) { if (node instanceof AggregationNode && ((AggregationNode) node).getStep() == PARTIAL) { return Optional.of(addGatheringIntermediate((AggregationNode) node, idAllocator)); } ...
[ "private", "Optional", "<", "PlanNode", ">", "recurseToPartial", "(", "PlanNode", "node", ",", "Lookup", "lookup", ",", "PlanNodeIdAllocator", "idAllocator", ")", "{", "if", "(", "node", "instanceof", "AggregationNode", "&&", "(", "(", "AggregationNode", ")", "n...
Recurse through a series of preceding ExchangeNodes and ProjectNodes to find the preceding PARTIAL aggregation
[ "Recurse", "through", "a", "series", "of", "preceding", "ExchangeNodes", "and", "ProjectNodes", "to", "find", "the", "preceding", "PARTIAL", "aggregation" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/AddIntermediateAggregations.java#L132-L151
128,946
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java
AccumuloClient.validateCreateTable
private void validateCreateTable(ConnectorTableMetadata meta) { validateColumns(meta); validateLocalityGroups(meta); if (!AccumuloTableProperties.isExternal(meta.getProperties())) { validateInternalTable(meta); } }
java
private void validateCreateTable(ConnectorTableMetadata meta) { validateColumns(meta); validateLocalityGroups(meta); if (!AccumuloTableProperties.isExternal(meta.getProperties())) { validateInternalTable(meta); } }
[ "private", "void", "validateCreateTable", "(", "ConnectorTableMetadata", "meta", ")", "{", "validateColumns", "(", "meta", ")", ";", "validateLocalityGroups", "(", "meta", ")", ";", "if", "(", "!", "AccumuloTableProperties", ".", "isExternal", "(", "meta", ".", ...
Validates the given metadata for a series of conditions to ensure the table is well-formed. @param meta Table metadata
[ "Validates", "the", "given", "metadata", "for", "a", "series", "of", "conditions", "to", "ensure", "the", "table", "is", "well", "-", "formed", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java#L163-L170
128,947
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java
AccumuloClient.getRowIdColumn
private static String getRowIdColumn(ConnectorTableMetadata meta) { Optional<String> rowIdColumn = AccumuloTableProperties.getRowId(meta.getProperties()); return rowIdColumn.orElse(meta.getColumns().get(0).getName()).toLowerCase(Locale.ENGLISH); }
java
private static String getRowIdColumn(ConnectorTableMetadata meta) { Optional<String> rowIdColumn = AccumuloTableProperties.getRowId(meta.getProperties()); return rowIdColumn.orElse(meta.getColumns().get(0).getName()).toLowerCase(Locale.ENGLISH); }
[ "private", "static", "String", "getRowIdColumn", "(", "ConnectorTableMetadata", "meta", ")", "{", "Optional", "<", "String", ">", "rowIdColumn", "=", "AccumuloTableProperties", ".", "getRowId", "(", "meta", ".", "getProperties", "(", ")", ")", ";", "return", "ro...
Gets the row ID based on a table properties or the first column name. @param meta ConnectorTableMetadata @return Lowercase Presto column name mapped to the Accumulo row ID
[ "Gets", "the", "row", "ID", "based", "on", "a", "table", "properties", "or", "the", "first", "column", "name", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java#L280-L284
128,948
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java
AccumuloClient.getColumnLocalityGroup
private static Optional<String> getColumnLocalityGroup(String columnName, Optional<Map<String, Set<String>>> groups) { if (groups.isPresent()) { for (Map.Entry<String, Set<String>> group : groups.get().entrySet()) { if (group.getValue().contains(columnName.toLowerCase(Locale.ENGL...
java
private static Optional<String> getColumnLocalityGroup(String columnName, Optional<Map<String, Set<String>>> groups) { if (groups.isPresent()) { for (Map.Entry<String, Set<String>> group : groups.get().entrySet()) { if (group.getValue().contains(columnName.toLowerCase(Locale.ENGL...
[ "private", "static", "Optional", "<", "String", ">", "getColumnLocalityGroup", "(", "String", "columnName", ",", "Optional", "<", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", ">", "groups", ")", "{", "if", "(", "groups", ".", "isPresent", "...
Searches through the given locality groups to find if this column has a locality group. @param columnName Column name to get the locality group of @param groups Optional locality group configuration @return Optional string containing the name of the locality group, if present
[ "Searches", "through", "the", "given", "locality", "groups", "to", "find", "if", "this", "column", "has", "a", "locality", "group", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java#L426-L437
128,949
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java
AccumuloClient.getTabletLocation
private Optional<String> getTabletLocation(String table, Key key) { try { // Get the Accumulo table ID so we can scan some fun stuff String tableId = connector.tableOperations().tableIdMap().get(table); // Create our scanner against the metadata table, fetching 'loc' fam...
java
private Optional<String> getTabletLocation(String table, Key key) { try { // Get the Accumulo table ID so we can scan some fun stuff String tableId = connector.tableOperations().tableIdMap().get(table); // Create our scanner against the metadata table, fetching 'loc' fam...
[ "private", "Optional", "<", "String", ">", "getTabletLocation", "(", "String", "table", ",", "Key", "key", ")", "{", "try", "{", "// Get the Accumulo table ID so we can scan some fun stuff", "String", "tableId", "=", "connector", ".", "tableOperations", "(", ")", "....
Gets the TabletServer hostname for where the given key is located in the given table @param table Fully-qualified table name @param key Key to locate @return The tablet location, or DUMMY_LOCATION if an error occurs
[ "Gets", "the", "TabletServer", "hostname", "for", "where", "the", "given", "key", "is", "located", "in", "the", "given", "table" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java#L780-L854
128,950
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java
AccumuloClient.getRangesFromDomain
public static Collection<Range> getRangesFromDomain(Optional<Domain> domain, AccumuloRowSerializer serializer) throws TableNotFoundException { // if we have no predicate pushdown, use the full range if (!domain.isPresent()) { return ImmutableSet.of(new Range()); } ...
java
public static Collection<Range> getRangesFromDomain(Optional<Domain> domain, AccumuloRowSerializer serializer) throws TableNotFoundException { // if we have no predicate pushdown, use the full range if (!domain.isPresent()) { return ImmutableSet.of(new Range()); } ...
[ "public", "static", "Collection", "<", "Range", ">", "getRangesFromDomain", "(", "Optional", "<", "Domain", ">", "domain", ",", "AccumuloRowSerializer", "serializer", ")", "throws", "TableNotFoundException", "{", "// if we have no predicate pushdown, use the full range", "i...
Gets a collection of Accumulo Range objects from the given Presto domain. This maps the column constraints of the given Domain to an Accumulo Range scan. @param domain Domain, can be null (returns (-inf, +inf) Range) @param serializer Instance of an {@link AccumuloRowSerializer} @return A collection of Accumulo Range ...
[ "Gets", "a", "collection", "of", "Accumulo", "Range", "objects", "from", "the", "given", "Presto", "domain", ".", "This", "maps", "the", "column", "constraints", "of", "the", "given", "Domain", "to", "an", "Accumulo", "Range", "scan", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java#L896-L910
128,951
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/gen/RowExpressionCompiler.java
RowExpressionCompiler.compile
public BytecodeNode compile(RowExpression rowExpression, Scope scope, Optional<Variable> outputBlockVariable, Optional<Class> lambdaInterface) { return rowExpression.accept(new Visitor(), new Context(scope, outputBlockVariable, lambdaInterface)); }
java
public BytecodeNode compile(RowExpression rowExpression, Scope scope, Optional<Variable> outputBlockVariable, Optional<Class> lambdaInterface) { return rowExpression.accept(new Visitor(), new Context(scope, outputBlockVariable, lambdaInterface)); }
[ "public", "BytecodeNode", "compile", "(", "RowExpression", "rowExpression", ",", "Scope", "scope", ",", "Optional", "<", "Variable", ">", "outputBlockVariable", ",", "Optional", "<", "Class", ">", "lambdaInterface", ")", "{", "return", "rowExpression", ".", "accep...
otherwise the value will be left on stack.
[ "otherwise", "the", "value", "will", "be", "left", "on", "stack", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/gen/RowExpressionCompiler.java#L78-L81
128,952
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/Page.java
Page.getSingleValuePage
public Page getSingleValuePage(int position) { Block[] singleValueBlocks = new Block[this.blocks.length]; for (int i = 0; i < this.blocks.length; i++) { singleValueBlocks[i] = this.blocks[i].getSingleValueBlock(position); } return new Page(1, singleValueBlocks); }
java
public Page getSingleValuePage(int position) { Block[] singleValueBlocks = new Block[this.blocks.length]; for (int i = 0; i < this.blocks.length; i++) { singleValueBlocks[i] = this.blocks[i].getSingleValueBlock(position); } return new Page(1, singleValueBlocks); }
[ "public", "Page", "getSingleValuePage", "(", "int", "position", ")", "{", "Block", "[", "]", "singleValueBlocks", "=", "new", "Block", "[", "this", ".", "blocks", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", ...
Gets the values at the specified position as a single element page. The method creates independent copy of the data.
[ "Gets", "the", "values", "at", "the", "specified", "position", "as", "a", "single", "element", "page", ".", "The", "method", "creates", "independent", "copy", "of", "the", "data", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/Page.java#L110-L117
128,953
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/io/AccumuloRecordCursor.java
AccumuloRecordCursor.checkFieldType
private void checkFieldType(int field, Type... expected) { Type actual = getType(field); for (Type type : expected) { if (actual.equals(type)) { return; } } throw new IllegalArgumentException(format("Expected field %s to be a type of %s but is...
java
private void checkFieldType(int field, Type... expected) { Type actual = getType(field); for (Type type : expected) { if (actual.equals(type)) { return; } } throw new IllegalArgumentException(format("Expected field %s to be a type of %s but is...
[ "private", "void", "checkFieldType", "(", "int", "field", ",", "Type", "...", "expected", ")", "{", "Type", "actual", "=", "getType", "(", "field", ")", ";", "for", "(", "Type", "type", ":", "expected", ")", "{", "if", "(", "actual", ".", "equals", "...
Checks that the given field is one of the provided types. @param field Ordinal of the field @param expected An array of expected types @throws IllegalArgumentException If the given field does not match one of the types
[ "Checks", "that", "the", "given", "field", "is", "one", "of", "the", "provided", "types", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/io/AccumuloRecordCursor.java#L298-L308
128,954
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/PagesIndexOrdering.java
PagesIndexOrdering.median3
private int median3(PagesIndex pagesIndex, int a, int b, int c) { int ab = comparator.compareTo(pagesIndex, a, b); int ac = comparator.compareTo(pagesIndex, a, c); int bc = comparator.compareTo(pagesIndex, b, c); return (ab < 0 ? (bc < 0 ? b : ac < 0 ? c : a) : ...
java
private int median3(PagesIndex pagesIndex, int a, int b, int c) { int ab = comparator.compareTo(pagesIndex, a, b); int ac = comparator.compareTo(pagesIndex, a, c); int bc = comparator.compareTo(pagesIndex, b, c); return (ab < 0 ? (bc < 0 ? b : ac < 0 ? c : a) : ...
[ "private", "int", "median3", "(", "PagesIndex", "pagesIndex", ",", "int", "a", ",", "int", "b", ",", "int", "c", ")", "{", "int", "ab", "=", "comparator", ".", "compareTo", "(", "pagesIndex", ",", "a", ",", "b", ")", ";", "int", "ac", "=", "compara...
Returns the index of the median of the three positions.
[ "Returns", "the", "index", "of", "the", "median", "of", "the", "three", "positions", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/PagesIndexOrdering.java#L144-L152
128,955
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/gen/BytecodeGeneratorContext.java
BytecodeGeneratorContext.generateCall
public BytecodeNode generateCall( String name, ScalarFunctionImplementation function, List<BytecodeNode> arguments, Optional<OutputBlockVariableAndType> outputBlockVariableAndType) { Optional<BytecodeNode> instance = Optional.empty(); if (function.getI...
java
public BytecodeNode generateCall( String name, ScalarFunctionImplementation function, List<BytecodeNode> arguments, Optional<OutputBlockVariableAndType> outputBlockVariableAndType) { Optional<BytecodeNode> instance = Optional.empty(); if (function.getI...
[ "public", "BytecodeNode", "generateCall", "(", "String", "name", ",", "ScalarFunctionImplementation", "function", ",", "List", "<", "BytecodeNode", ">", "arguments", ",", "Optional", "<", "OutputBlockVariableAndType", ">", "outputBlockVariableAndType", ")", "{", "Option...
Generates a function call with null handling, automatic binding of session parameter, etc.
[ "Generates", "a", "function", "call", "with", "null", "handling", "automatic", "binding", "of", "session", "parameter", "etc", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/gen/BytecodeGeneratorContext.java#L94-L106
128,956
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/Util.java
Util.transpose
public static PlanNode transpose(PlanNode parent, PlanNode child) { return child.replaceChildren(ImmutableList.of( parent.replaceChildren( child.getSources()))); }
java
public static PlanNode transpose(PlanNode parent, PlanNode child) { return child.replaceChildren(ImmutableList.of( parent.replaceChildren( child.getSources()))); }
[ "public", "static", "PlanNode", "transpose", "(", "PlanNode", "parent", ",", "PlanNode", "child", ")", "{", "return", "child", ".", "replaceChildren", "(", "ImmutableList", ".", "of", "(", "parent", ".", "replaceChildren", "(", "child", ".", "getSources", "(",...
Transforms a plan like P->C->X to C->P->X
[ "Transforms", "a", "plan", "like", "P", "-", ">", "C", "-", ">", "X", "to", "C", "-", ">", "P", "-", ">", "X" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/Util.java#L61-L66
128,957
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/MapBlock.java
MapBlock.fromKeyValueBlock
public static MapBlock fromKeyValueBlock( Optional<boolean[]> mapIsNull, int[] offsets, Block keyBlock, Block valueBlock, MapType mapType, MethodHandle keyBlockNativeEquals, MethodHandle keyNativeHashCode, MethodHandle keyBl...
java
public static MapBlock fromKeyValueBlock( Optional<boolean[]> mapIsNull, int[] offsets, Block keyBlock, Block valueBlock, MapType mapType, MethodHandle keyBlockNativeEquals, MethodHandle keyNativeHashCode, MethodHandle keyBl...
[ "public", "static", "MapBlock", "fromKeyValueBlock", "(", "Optional", "<", "boolean", "[", "]", ">", "mapIsNull", ",", "int", "[", "]", "offsets", ",", "Block", "keyBlock", ",", "Block", "valueBlock", ",", "MapType", "mapType", ",", "MethodHandle", "keyBlockNa...
Create a map block directly from columnar nulls, keys, values, and offsets into the keys and values. A null map must have no entries. @param mapType key type K @param keyBlockNativeEquals equality between key stack type and a block+position; signature is (K, Block, int)boolean @param keyNativeHashCode hash of a key st...
[ "Create", "a", "map", "block", "directly", "from", "columnar", "nulls", "keys", "values", "and", "offsets", "into", "the", "keys", "and", "values", ".", "A", "null", "map", "must", "have", "no", "entries", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/MapBlock.java#L58-L84
128,958
prestodb/presto
presto-resource-group-managers/src/main/java/com/facebook/presto/resourceGroups/ResourceGroupSpec.java
ResourceGroupSpec.sameConfig
public boolean sameConfig(ResourceGroupSpec other) { if (other == null) { return false; } return (name.equals(other.name) && softMemoryLimit.equals(other.softMemoryLimit) && maxQueued == other.maxQueued && softConcurrencyLimit.equal...
java
public boolean sameConfig(ResourceGroupSpec other) { if (other == null) { return false; } return (name.equals(other.name) && softMemoryLimit.equals(other.softMemoryLimit) && maxQueued == other.maxQueued && softConcurrencyLimit.equal...
[ "public", "boolean", "sameConfig", "(", "ResourceGroupSpec", "other", ")", "{", "if", "(", "other", "==", "null", ")", "{", "return", "false", ";", "}", "return", "(", "name", ".", "equals", "(", "other", ".", "name", ")", "&&", "softMemoryLimit", ".", ...
Subgroups not included, used to determine whether a group needs to be reconfigured
[ "Subgroups", "not", "included", "used", "to", "determine", "whether", "a", "group", "needs", "to", "be", "reconfigured" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-resource-group-managers/src/main/java/com/facebook/presto/resourceGroups/ResourceGroupSpec.java#L191-L206
128,959
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/SymbolsExtractor.java
SymbolsExtractor.extractNames
public static Set<QualifiedName> extractNames(Expression expression, Set<NodeRef<Expression>> columnReferences) { ImmutableSet.Builder<QualifiedName> builder = ImmutableSet.builder(); new QualifiedNameBuilderVisitor(columnReferences).process(expression, builder); return builder.build(); ...
java
public static Set<QualifiedName> extractNames(Expression expression, Set<NodeRef<Expression>> columnReferences) { ImmutableSet.Builder<QualifiedName> builder = ImmutableSet.builder(); new QualifiedNameBuilderVisitor(columnReferences).process(expression, builder); return builder.build(); ...
[ "public", "static", "Set", "<", "QualifiedName", ">", "extractNames", "(", "Expression", "expression", ",", "Set", "<", "NodeRef", "<", "Expression", ">", ">", "columnReferences", ")", "{", "ImmutableSet", ".", "Builder", "<", "QualifiedName", ">", "builder", ...
to extract qualified name with prefix
[ "to", "extract", "qualified", "name", "with", "prefix" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/SymbolsExtractor.java#L108-L113
128,960
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/S3SelectRecordCursor.java
S3SelectRecordCursor.updateSplitSchema
static Properties updateSplitSchema(Properties splitSchema, List<HiveColumnHandle> columns) { requireNonNull(splitSchema, "splitSchema is null"); requireNonNull(columns, "columns is null"); // clone split properties for update so as not to affect the original one Properties updatedSc...
java
static Properties updateSplitSchema(Properties splitSchema, List<HiveColumnHandle> columns) { requireNonNull(splitSchema, "splitSchema is null"); requireNonNull(columns, "columns is null"); // clone split properties for update so as not to affect the original one Properties updatedSc...
[ "static", "Properties", "updateSplitSchema", "(", "Properties", "splitSchema", ",", "List", "<", "HiveColumnHandle", ">", "columns", ")", "{", "requireNonNull", "(", "splitSchema", ",", "\"splitSchema is null\"", ")", ";", "requireNonNull", "(", "columns", ",", "\"c...
otherwise, Serde could not deserialize output from s3select to row data correctly
[ "otherwise", "Serde", "could", "not", "deserialize", "output", "from", "s3select", "to", "row", "data", "correctly" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/S3SelectRecordCursor.java#L62-L75
128,961
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloTableManager.java
AccumuloTableManager.ensureNamespace
public void ensureNamespace(String schema) { try { // If the table schema is not "default" and the namespace does not exist, create it if (!schema.equals(DEFAULT) && !connector.namespaceOperations().exists(schema)) { connector.namespaceOperations().create(schema); ...
java
public void ensureNamespace(String schema) { try { // If the table schema is not "default" and the namespace does not exist, create it if (!schema.equals(DEFAULT) && !connector.namespaceOperations().exists(schema)) { connector.namespaceOperations().create(schema); ...
[ "public", "void", "ensureNamespace", "(", "String", "schema", ")", "{", "try", "{", "// If the table schema is not \"default\" and the namespace does not exist, create it", "if", "(", "!", "schema", ".", "equals", "(", "DEFAULT", ")", "&&", "!", "connector", ".", "nam...
Ensures the given Accumulo namespace exist, creating it if necessary @param schema Presto schema (Accumulo namespace)
[ "Ensures", "the", "given", "Accumulo", "namespace", "exist", "creating", "it", "if", "necessary" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloTableManager.java#L60-L75
128,962
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/GroupingOperationRewriter.java
GroupingOperationRewriter.calculateGrouping
static long calculateGrouping(Set<Integer> groupingSet, List<Integer> columns) { long grouping = (1L << columns.size()) - 1; for (int index = 0; index < columns.size(); index++) { int column = columns.get(index); if (groupingSet.contains(column)) { // Leftmo...
java
static long calculateGrouping(Set<Integer> groupingSet, List<Integer> columns) { long grouping = (1L << columns.size()) - 1; for (int index = 0; index < columns.size(); index++) { int column = columns.get(index); if (groupingSet.contains(column)) { // Leftmo...
[ "static", "long", "calculateGrouping", "(", "Set", "<", "Integer", ">", "groupingSet", ",", "List", "<", "Integer", ">", "columns", ")", "{", "long", "grouping", "=", "(", "1L", "<<", "columns", ".", "size", "(", ")", ")", "-", "1", ";", "for", "(", ...
The grouping function is used in conjunction with GROUPING SETS, ROLLUP and CUBE to indicate which columns are present in that grouping. <p>The grouping function must be invoked with arguments that exactly match the columns referenced in the corresponding GROUPING SET, ROLLUP or CUBE clause at the associated query lev...
[ "The", "grouping", "function", "is", "used", "in", "conjunction", "with", "GROUPING", "SETS", "ROLLUP", "and", "CUBE", "to", "indicate", "which", "columns", "are", "present", "in", "that", "grouping", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/GroupingOperationRewriter.java#L107-L123
128,963
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/scheduler/TopologyAwareNodeSelector.java
TopologyAwareNodeSelector.calculateMaxPendingSplits
private int calculateMaxPendingSplits(int splitAffinity, int totalDepth) { if (totalDepth == 0) { return maxPendingSplitsPerTask; } // Use half the queue for any split // Reserve the other half for splits that have some amount of network affinity double queueFract...
java
private int calculateMaxPendingSplits(int splitAffinity, int totalDepth) { if (totalDepth == 0) { return maxPendingSplitsPerTask; } // Use half the queue for any split // Reserve the other half for splits that have some amount of network affinity double queueFract...
[ "private", "int", "calculateMaxPendingSplits", "(", "int", "splitAffinity", ",", "int", "totalDepth", ")", "{", "if", "(", "totalDepth", "==", "0", ")", "{", "return", "maxPendingSplitsPerTask", ";", "}", "// Use half the queue for any split", "// Reserve the other half...
Computes how much of the queue can be filled by splits with the network topology distance to a node given by splitAffinity. A split with zero affinity can only fill half the queue, whereas one that matches exactly can fill the entire queue.
[ "Computes", "how", "much", "of", "the", "queue", "can", "be", "filled", "by", "splits", "with", "the", "network", "topology", "distance", "to", "a", "node", "given", "by", "splitAffinity", ".", "A", "split", "with", "zero", "affinity", "can", "only", "fill...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/scheduler/TopologyAwareNodeSelector.java#L209-L218
128,964
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/SqlQueryManager.java
SqlQueryManager.enforceMemoryLimits
private void enforceMemoryLimits() { List<QueryExecution> runningQueries = queryTracker.getAllQueries().stream() .filter(query -> query.getState() == RUNNING) .collect(toImmutableList()); memoryManager.process(runningQueries, this::getQueries); }
java
private void enforceMemoryLimits() { List<QueryExecution> runningQueries = queryTracker.getAllQueries().stream() .filter(query -> query.getState() == RUNNING) .collect(toImmutableList()); memoryManager.process(runningQueries, this::getQueries); }
[ "private", "void", "enforceMemoryLimits", "(", ")", "{", "List", "<", "QueryExecution", ">", "runningQueries", "=", "queryTracker", ".", "getAllQueries", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "query", "->", "query", ".", "getState", "(", "...
Enforce memory limits at the query level
[ "Enforce", "memory", "limits", "at", "the", "query", "level" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/SqlQueryManager.java#L502-L508
128,965
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/SqlQueryManager.java
SqlQueryManager.enforceCpuLimits
private void enforceCpuLimits() { for (QueryExecution query : queryTracker.getAllQueries()) { Duration cpuTime = query.getTotalCpuTime(); Duration sessionLimit = getQueryMaxCpuTime(query.getSession()); Duration limit = Ordering.natural().min(maxQueryCpuTime, sessionLimit)...
java
private void enforceCpuLimits() { for (QueryExecution query : queryTracker.getAllQueries()) { Duration cpuTime = query.getTotalCpuTime(); Duration sessionLimit = getQueryMaxCpuTime(query.getSession()); Duration limit = Ordering.natural().min(maxQueryCpuTime, sessionLimit)...
[ "private", "void", "enforceCpuLimits", "(", ")", "{", "for", "(", "QueryExecution", "query", ":", "queryTracker", ".", "getAllQueries", "(", ")", ")", "{", "Duration", "cpuTime", "=", "query", ".", "getTotalCpuTime", "(", ")", ";", "Duration", "sessionLimit", ...
Enforce query CPU time limits
[ "Enforce", "query", "CPU", "time", "limits" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/SqlQueryManager.java#L513-L523
128,966
prestodb/presto
presto-accumulo/src/main/java/org/apache/log4j/JulAppender.java
JulAppender.append
@Override protected void append(LoggingEvent loggingEvent) { java.util.logging.Logger logger = java.util.logging.Logger.getLogger(loggingEvent.getLoggerName()); if (logger == null) { LogLog.warn(format("Cannot obtain JUL %s. Verify that this appender is used while an appropriate LogM...
java
@Override protected void append(LoggingEvent loggingEvent) { java.util.logging.Logger logger = java.util.logging.Logger.getLogger(loggingEvent.getLoggerName()); if (logger == null) { LogLog.warn(format("Cannot obtain JUL %s. Verify that this appender is used while an appropriate LogM...
[ "@", "Override", "protected", "void", "append", "(", "LoggingEvent", "loggingEvent", ")", "{", "java", ".", "util", ".", "logging", ".", "Logger", "logger", "=", "java", ".", "util", ".", "logging", ".", "Logger", ".", "getLogger", "(", "loggingEvent", "."...
Append a log event at the appropriate JUL level, depending on the log4j level.
[ "Append", "a", "log", "event", "at", "the", "appropriate", "JUL", "level", "depending", "on", "the", "log4j", "level", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/org/apache/log4j/JulAppender.java#L36-L57
128,967
prestodb/presto
presto-raptor/src/main/java/com/facebook/presto/raptor/util/DatabaseUtil.java
DatabaseUtil.mySqlErrorCodeMatches
private static boolean mySqlErrorCodeMatches(Exception e, int errorCode) { return Throwables.getCausalChain(e).stream() .filter(SQLException.class::isInstance) .map(SQLException.class::cast) .filter(t -> t.getErrorCode() == errorCode) .map(Thro...
java
private static boolean mySqlErrorCodeMatches(Exception e, int errorCode) { return Throwables.getCausalChain(e).stream() .filter(SQLException.class::isInstance) .map(SQLException.class::cast) .filter(t -> t.getErrorCode() == errorCode) .map(Thro...
[ "private", "static", "boolean", "mySqlErrorCodeMatches", "(", "Exception", "e", ",", "int", "errorCode", ")", "{", "return", "Throwables", ".", "getCausalChain", "(", "e", ")", ".", "stream", "(", ")", ".", "filter", "(", "SQLException", ".", "class", "::", ...
Check if an exception is caused by a MySQL exception of certain error code
[ "Check", "if", "an", "exception", "is", "caused", "by", "a", "MySQL", "exception", "of", "certain", "error", "code" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-raptor/src/main/java/com/facebook/presto/raptor/util/DatabaseUtil.java#L155-L163
128,968
prestodb/presto
presto-raptor/src/main/java/com/facebook/presto/raptor/util/ArrayUtil.java
ArrayUtil.intArrayFromBytes
public static List<Integer> intArrayFromBytes(byte[] bytes) { ImmutableList.Builder<Integer> list = ImmutableList.builder(); ByteBuffer buffer = ByteBuffer.wrap(bytes); while (buffer.hasRemaining()) { list.add(buffer.getInt()); } return list.build(); }
java
public static List<Integer> intArrayFromBytes(byte[] bytes) { ImmutableList.Builder<Integer> list = ImmutableList.builder(); ByteBuffer buffer = ByteBuffer.wrap(bytes); while (buffer.hasRemaining()) { list.add(buffer.getInt()); } return list.build(); }
[ "public", "static", "List", "<", "Integer", ">", "intArrayFromBytes", "(", "byte", "[", "]", "bytes", ")", "{", "ImmutableList", ".", "Builder", "<", "Integer", ">", "list", "=", "ImmutableList", ".", "builder", "(", ")", ";", "ByteBuffer", "buffer", "=", ...
Unpack an array of big endian ints.
[ "Unpack", "an", "array", "of", "big", "endian", "ints", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-raptor/src/main/java/com/facebook/presto/raptor/util/ArrayUtil.java#L29-L37
128,969
prestodb/presto
presto-raptor/src/main/java/com/facebook/presto/raptor/util/ArrayUtil.java
ArrayUtil.intArrayToBytes
public static byte[] intArrayToBytes(Collection<Integer> values) { ByteBuffer buffer = ByteBuffer.allocate(values.size() * Integer.BYTES); for (int value : values) { buffer.putInt(value); } return buffer.array(); }
java
public static byte[] intArrayToBytes(Collection<Integer> values) { ByteBuffer buffer = ByteBuffer.allocate(values.size() * Integer.BYTES); for (int value : values) { buffer.putInt(value); } return buffer.array(); }
[ "public", "static", "byte", "[", "]", "intArrayToBytes", "(", "Collection", "<", "Integer", ">", "values", ")", "{", "ByteBuffer", "buffer", "=", "ByteBuffer", ".", "allocate", "(", "values", ".", "size", "(", ")", "*", "Integer", ".", "BYTES", ")", ";",...
Pack an array of ints as big endian.
[ "Pack", "an", "array", "of", "ints", "as", "big", "endian", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-raptor/src/main/java/com/facebook/presto/raptor/util/ArrayUtil.java#L42-L49
128,970
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/stream/BooleanInputStream.java
BooleanInputStream.getUnsetBits
public int getUnsetBits(int batchSize, boolean[] vector, int offset) throws IOException { int count = 0; for (int i = offset; i < batchSize + offset; i++) { vector[i] = !nextBit(); count += vector[i] ? 1 : 0; } return count; }
java
public int getUnsetBits(int batchSize, boolean[] vector, int offset) throws IOException { int count = 0; for (int i = offset; i < batchSize + offset; i++) { vector[i] = !nextBit(); count += vector[i] ? 1 : 0; } return count; }
[ "public", "int", "getUnsetBits", "(", "int", "batchSize", ",", "boolean", "[", "]", "vector", ",", "int", "offset", ")", "throws", "IOException", "{", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "offset", ";", "i", "<", "batchSize", "...
Sets the vector element to true for the batchSize number of elements starting at offset if the bit is not set.
[ "Sets", "the", "vector", "element", "to", "true", "for", "the", "batchSize", "number", "of", "elements", "starting", "at", "offset", "if", "the", "bit", "is", "not", "set", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/stream/BooleanInputStream.java#L182-L191
128,971
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/stream/BooleanInputStream.java
BooleanInputStream.getUnsetBits
public int getUnsetBits(int batchSize) throws IOException { int count = 0; for (int i = 0; i < batchSize; i++) { count += nextBit() ? 0 : 1; } return count; }
java
public int getUnsetBits(int batchSize) throws IOException { int count = 0; for (int i = 0; i < batchSize; i++) { count += nextBit() ? 0 : 1; } return count; }
[ "public", "int", "getUnsetBits", "(", "int", "batchSize", ")", "throws", "IOException", "{", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "batchSize", ";", "i", "++", ")", "{", "count", "+=", "nextBit", "(", ")", ...
Return the number of unset bits
[ "Return", "the", "number", "of", "unset", "bits" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/stream/BooleanInputStream.java#L196-L204
128,972
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/SingleMapBlock.java
SingleMapBlock.seekKeyExact
public int seekKeyExact(long nativeValue) { if (positionCount == 0) { return -1; } mapBlock.ensureHashTableLoaded(); int[] hashTable = mapBlock.getHashTables().get().get(); long hashCode; try { hashCode = (long) mapBlock.keyNativeHashCode.inv...
java
public int seekKeyExact(long nativeValue) { if (positionCount == 0) { return -1; } mapBlock.ensureHashTableLoaded(); int[] hashTable = mapBlock.getHashTables().get().get(); long hashCode; try { hashCode = (long) mapBlock.keyNativeHashCode.inv...
[ "public", "int", "seekKeyExact", "(", "long", "nativeValue", ")", "{", "if", "(", "positionCount", "==", "0", ")", "{", "return", "-", "1", ";", "}", "mapBlock", ".", "ensureHashTableLoaded", "(", ")", ";", "int", "[", "]", "hashTable", "=", "mapBlock", ...
except MethodHandle.invoke is replaced with invokeExact.
[ "except", "MethodHandle", ".", "invoke", "is", "replaced", "with", "invokeExact", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/SingleMapBlock.java#L190-L232
128,973
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/EncoderUtil.java
EncoderUtil.encodeNullsAsBits
@SuppressWarnings({"NarrowingCompoundAssignment", "ImplicitNumericConversion"}) public static void encodeNullsAsBits(SliceOutput sliceOutput, Block block) { boolean mayHaveNull = block.mayHaveNull(); sliceOutput.writeBoolean(mayHaveNull); if (!mayHaveNull) { return; }...
java
@SuppressWarnings({"NarrowingCompoundAssignment", "ImplicitNumericConversion"}) public static void encodeNullsAsBits(SliceOutput sliceOutput, Block block) { boolean mayHaveNull = block.mayHaveNull(); sliceOutput.writeBoolean(mayHaveNull); if (!mayHaveNull) { return; }...
[ "@", "SuppressWarnings", "(", "{", "\"NarrowingCompoundAssignment\"", ",", "\"ImplicitNumericConversion\"", "}", ")", "public", "static", "void", "encodeNullsAsBits", "(", "SliceOutput", "sliceOutput", ",", "Block", "block", ")", "{", "boolean", "mayHaveNull", "=", "b...
Append null values for the block as a stream of bits.
[ "Append", "null", "values", "for", "the", "block", "as", "a", "stream", "of", "bits", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/EncoderUtil.java#L30-L63
128,974
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/EncoderUtil.java
EncoderUtil.decodeNullBits
public static Optional<boolean[]> decodeNullBits(SliceInput sliceInput, int positionCount) { if (!sliceInput.readBoolean()) { return Optional.empty(); } // read null bits 8 at a time boolean[] valueIsNull = new boolean[positionCount]; for (int position = 0; posit...
java
public static Optional<boolean[]> decodeNullBits(SliceInput sliceInput, int positionCount) { if (!sliceInput.readBoolean()) { return Optional.empty(); } // read null bits 8 at a time boolean[] valueIsNull = new boolean[positionCount]; for (int position = 0; posit...
[ "public", "static", "Optional", "<", "boolean", "[", "]", ">", "decodeNullBits", "(", "SliceInput", "sliceInput", ",", "int", "positionCount", ")", "{", "if", "(", "!", "sliceInput", ".", "readBoolean", "(", ")", ")", "{", "return", "Optional", ".", "empty...
Decode the bit stream created by encodeNullsAsBits.
[ "Decode", "the", "bit", "stream", "created", "by", "encodeNullsAsBits", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/EncoderUtil.java#L68-L99
128,975
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/BlockUtil.java
BlockUtil.compactSlice
static Slice compactSlice(Slice slice, int index, int length) { if (slice.isCompact() && index == 0 && length == slice.length()) { return slice; } return Slices.copyOf(slice, index, length); }
java
static Slice compactSlice(Slice slice, int index, int length) { if (slice.isCompact() && index == 0 && length == slice.length()) { return slice; } return Slices.copyOf(slice, index, length); }
[ "static", "Slice", "compactSlice", "(", "Slice", "slice", ",", "int", "index", ",", "int", "length", ")", "{", "if", "(", "slice", ".", "isCompact", "(", ")", "&&", "index", "==", "0", "&&", "length", "==", "slice", ".", "length", "(", ")", ")", "{...
Returns a slice containing values in the specified range of the specified slice. If the range matches the entire slice, the input slice will be returned. Otherwise, a copy will be returned.
[ "Returns", "a", "slice", "containing", "values", "in", "the", "specified", "range", "of", "the", "specified", "slice", ".", "If", "the", "range", "matches", "the", "entire", "slice", "the", "input", "slice", "will", "be", "returned", ".", "Otherwise", "a", ...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/BlockUtil.java#L131-L137
128,976
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/BlockUtil.java
BlockUtil.compactArray
static boolean[] compactArray(boolean[] array, int index, int length) { if (index == 0 && length == array.length) { return array; } return Arrays.copyOfRange(array, index, index + length); }
java
static boolean[] compactArray(boolean[] array, int index, int length) { if (index == 0 && length == array.length) { return array; } return Arrays.copyOfRange(array, index, index + length); }
[ "static", "boolean", "[", "]", "compactArray", "(", "boolean", "[", "]", "array", ",", "int", "index", ",", "int", "length", ")", "{", "if", "(", "index", "==", "0", "&&", "length", "==", "array", ".", "length", ")", "{", "return", "array", ";", "}...
Returns an array containing elements in the specified range of the specified array. If the range matches the entire array, the input array will be returned. Otherwise, a copy will be returned.
[ "Returns", "an", "array", "containing", "elements", "in", "the", "specified", "range", "of", "the", "specified", "array", ".", "If", "the", "range", "matches", "the", "entire", "array", "the", "input", "array", "will", "be", "returned", ".", "Otherwise", "a"...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/BlockUtil.java#L144-L150
128,977
prestodb/presto
presto-main/src/main/java/com/facebook/presto/metadata/FunctionManager.java
FunctionManager.resolveFunction
public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes) { // TODO Actually use session // Session will be used to provide information about the order of function namespaces to through resolving the function. // This is likely to ...
java
public FunctionHandle resolveFunction(Session session, QualifiedName name, List<TypeSignatureProvider> parameterTypes) { // TODO Actually use session // Session will be used to provide information about the order of function namespaces to through resolving the function. // This is likely to ...
[ "public", "FunctionHandle", "resolveFunction", "(", "Session", "session", ",", "QualifiedName", "name", ",", "List", "<", "TypeSignatureProvider", ">", "parameterTypes", ")", "{", "// TODO Actually use session", "// Session will be used to provide information about the order of f...
Resolves a function using the SQL path, and implicit type coercions. @throws PrestoException if there are no matches or multiple matches
[ "Resolves", "a", "function", "using", "the", "SQL", "path", "and", "implicit", "type", "coercions", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/metadata/FunctionManager.java#L72-L80
128,978
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/stream/LongDecode.java
LongDecode.decodeBitWidth
public static int decodeBitWidth(int n) { if (n >= ONE.ordinal() && n <= TWENTY_FOUR.ordinal()) { return n + 1; } else if (n == TWENTY_SIX.ordinal()) { return 26; } else if (n == TWENTY_EIGHT.ordinal()) { return 28; } else i...
java
public static int decodeBitWidth(int n) { if (n >= ONE.ordinal() && n <= TWENTY_FOUR.ordinal()) { return n + 1; } else if (n == TWENTY_SIX.ordinal()) { return 26; } else if (n == TWENTY_EIGHT.ordinal()) { return 28; } else i...
[ "public", "static", "int", "decodeBitWidth", "(", "int", "n", ")", "{", "if", "(", "n", ">=", "ONE", ".", "ordinal", "(", ")", "&&", "n", "<=", "TWENTY_FOUR", ".", "ordinal", "(", ")", ")", "{", "return", "n", "+", "1", ";", "}", "else", "if", ...
Decodes the ordinal fixed bit value to actual fixed bit width value.
[ "Decodes", "the", "ordinal", "fixed", "bit", "value", "to", "actual", "fixed", "bit", "width", "value", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/stream/LongDecode.java#L53-L82
128,979
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/stream/LongDecode.java
LongDecode.getClosestFixedBits
public static int getClosestFixedBits(int width) { if (width == 0) { return 1; } if (width >= 1 && width <= 24) { return width; } else if (width > 24 && width <= 26) { return 26; } else if (width > 26 && width <= 28) { ...
java
public static int getClosestFixedBits(int width) { if (width == 0) { return 1; } if (width >= 1 && width <= 24) { return width; } else if (width > 24 && width <= 26) { return 26; } else if (width > 26 && width <= 28) { ...
[ "public", "static", "int", "getClosestFixedBits", "(", "int", "width", ")", "{", "if", "(", "width", "==", "0", ")", "{", "return", "1", ";", "}", "if", "(", "width", ">=", "1", "&&", "width", "<=", "24", ")", "{", "return", "width", ";", "}", "e...
Gets the closest supported fixed bit width for the specified bit width.
[ "Gets", "the", "closest", "supported", "fixed", "bit", "width", "for", "the", "specified", "bit", "width", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/stream/LongDecode.java#L87-L120
128,980
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java
FloatingPointBitsConverterUtil.doubleToSortableLong
public static long doubleToSortableLong(double value) { long bits = Double.doubleToLongBits(value); return bits ^ (bits >> 63) & Long.MAX_VALUE; }
java
public static long doubleToSortableLong(double value) { long bits = Double.doubleToLongBits(value); return bits ^ (bits >> 63) & Long.MAX_VALUE; }
[ "public", "static", "long", "doubleToSortableLong", "(", "double", "value", ")", "{", "long", "bits", "=", "Double", ".", "doubleToLongBits", "(", "value", ")", ";", "return", "bits", "^", "(", "bits", ">>", "63", ")", "&", "Long", ".", "MAX_VALUE", ";",...
Converts a double value to a sortable long. The value is converted by getting their IEEE 754 floating-point bit layout. Some bits are swapped to be able to compare the result as long.
[ "Converts", "a", "double", "value", "to", "a", "sortable", "long", ".", "The", "value", "is", "converted", "by", "getting", "their", "IEEE", "754", "floating", "-", "point", "bit", "layout", ".", "Some", "bits", "are", "swapped", "to", "be", "able", "to"...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java#L24-L28
128,981
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java
FloatingPointBitsConverterUtil.sortableLongToDouble
public static double sortableLongToDouble(long value) { value = value ^ (value >> 63) & Long.MAX_VALUE; return Double.longBitsToDouble(value); }
java
public static double sortableLongToDouble(long value) { value = value ^ (value >> 63) & Long.MAX_VALUE; return Double.longBitsToDouble(value); }
[ "public", "static", "double", "sortableLongToDouble", "(", "long", "value", ")", "{", "value", "=", "value", "^", "(", "value", ">>", "63", ")", "&", "Long", ".", "MAX_VALUE", ";", "return", "Double", ".", "longBitsToDouble", "(", "value", ")", ";", "}" ...
Converts a sortable long to double. @see #sortableLongToDouble(long)
[ "Converts", "a", "sortable", "long", "to", "double", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java#L35-L39
128,982
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java
FloatingPointBitsConverterUtil.floatToSortableInt
public static int floatToSortableInt(float value) { int bits = Float.floatToIntBits(value); return bits ^ (bits >> 31) & Integer.MAX_VALUE; }
java
public static int floatToSortableInt(float value) { int bits = Float.floatToIntBits(value); return bits ^ (bits >> 31) & Integer.MAX_VALUE; }
[ "public", "static", "int", "floatToSortableInt", "(", "float", "value", ")", "{", "int", "bits", "=", "Float", ".", "floatToIntBits", "(", "value", ")", ";", "return", "bits", "^", "(", "bits", ">>", "31", ")", "&", "Integer", ".", "MAX_VALUE", ";", "}...
Converts a float value to a sortable int. @see #doubleToSortableLong(double)
[ "Converts", "a", "float", "value", "to", "a", "sortable", "int", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java#L46-L50
128,983
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java
FloatingPointBitsConverterUtil.sortableIntToFloat
public static float sortableIntToFloat(int value) { value = value ^ (value >> 31) & Integer.MAX_VALUE; return Float.intBitsToFloat(value); }
java
public static float sortableIntToFloat(int value) { value = value ^ (value >> 31) & Integer.MAX_VALUE; return Float.intBitsToFloat(value); }
[ "public", "static", "float", "sortableIntToFloat", "(", "int", "value", ")", "{", "value", "=", "value", "^", "(", "value", ">>", "31", ")", "&", "Integer", ".", "MAX_VALUE", ";", "return", "Float", ".", "intBitsToFloat", "(", "value", ")", ";", "}" ]
Coverts a sortable int to float. @see #sortableLongToDouble(long)
[ "Coverts", "a", "sortable", "int", "to", "float", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/FloatingPointBitsConverterUtil.java#L57-L61
128,984
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/plan/SetOperationNode.java
SetOperationNode.sourceSymbolMap
public Map<Symbol, Symbol> sourceSymbolMap(int sourceIndex) { ImmutableMap.Builder<Symbol, Symbol> builder = ImmutableMap.builder(); for (Map.Entry<Symbol, Collection<Symbol>> entry : outputToInputs.asMap().entrySet()) { builder.put(entry.getKey(), Iterables.get(entry.getValue(), sourceI...
java
public Map<Symbol, Symbol> sourceSymbolMap(int sourceIndex) { ImmutableMap.Builder<Symbol, Symbol> builder = ImmutableMap.builder(); for (Map.Entry<Symbol, Collection<Symbol>> entry : outputToInputs.asMap().entrySet()) { builder.put(entry.getKey(), Iterables.get(entry.getValue(), sourceI...
[ "public", "Map", "<", "Symbol", ",", "Symbol", ">", "sourceSymbolMap", "(", "int", "sourceIndex", ")", "{", "ImmutableMap", ".", "Builder", "<", "Symbol", ",", "Symbol", ">", "builder", "=", "ImmutableMap", ".", "builder", "(", ")", ";", "for", "(", "Map...
Returns the output to input symbol mapping for the given source channel
[ "Returns", "the", "output", "to", "input", "symbol", "mapping", "for", "the", "given", "source", "channel" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/plan/SetOperationNode.java#L106-L114
128,985
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/plan/SetOperationNode.java
SetOperationNode.outputSymbolMap
public Multimap<Symbol, Symbol> outputSymbolMap(int sourceIndex) { return FluentIterable.from(getOutputSymbols()) .toMap(outputSymbol -> outputToInputs.get(outputSymbol).get(sourceIndex)) .asMultimap() .inverse(); }
java
public Multimap<Symbol, Symbol> outputSymbolMap(int sourceIndex) { return FluentIterable.from(getOutputSymbols()) .toMap(outputSymbol -> outputToInputs.get(outputSymbol).get(sourceIndex)) .asMultimap() .inverse(); }
[ "public", "Multimap", "<", "Symbol", ",", "Symbol", ">", "outputSymbolMap", "(", "int", "sourceIndex", ")", "{", "return", "FluentIterable", ".", "from", "(", "getOutputSymbols", "(", ")", ")", ".", "toMap", "(", "outputSymbol", "->", "outputToInputs", ".", ...
Returns the input to output symbol mapping for the given source channel. A single input symbol can map to multiple output symbols, thus requiring a Multimap.
[ "Returns", "the", "input", "to", "output", "symbol", "mapping", "for", "the", "given", "source", "channel", ".", "A", "single", "input", "symbol", "can", "map", "to", "multiple", "output", "symbols", "thus", "requiring", "a", "Multimap", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/plan/SetOperationNode.java#L120-L126
128,986
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java
Indexer.getMetricIterators
public static Collection<IteratorSetting> getMetricIterators(AccumuloTable table) { String cardQualifier = new String(CARDINALITY_CQ); String rowsFamily = new String(METRICS_TABLE_ROWS_CF.array()); // Build a string for all columns where the summing combiner should be applied, // i....
java
public static Collection<IteratorSetting> getMetricIterators(AccumuloTable table) { String cardQualifier = new String(CARDINALITY_CQ); String rowsFamily = new String(METRICS_TABLE_ROWS_CF.array()); // Build a string for all columns where the summing combiner should be applied, // i....
[ "public", "static", "Collection", "<", "IteratorSetting", ">", "getMetricIterators", "(", "AccumuloTable", "table", ")", "{", "String", "cardQualifier", "=", "new", "String", "(", "CARDINALITY_CQ", ")", ";", "String", "rowsFamily", "=", "new", "String", "(", "ME...
Gets a collection of iterator settings that should be added to the metric table for the given Accumulo table. Don't forget! Please! @param table Table for retrieving metrics iterators, see AccumuloClient#getTable @return Collection of iterator settings
[ "Gets", "a", "collection", "of", "iterator", "settings", "that", "should", "be", "added", "to", "the", "metric", "table", "for", "the", "given", "Accumulo", "table", ".", "Don", "t", "forget!", "Please!" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java#L363-L388
128,987
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java
Indexer.getIndexColumnFamily
public static ByteBuffer getIndexColumnFamily(byte[] columnFamily, byte[] columnQualifier) { return wrap(ArrayUtils.addAll(ArrayUtils.add(columnFamily, UNDERSCORE), columnQualifier)); }
java
public static ByteBuffer getIndexColumnFamily(byte[] columnFamily, byte[] columnQualifier) { return wrap(ArrayUtils.addAll(ArrayUtils.add(columnFamily, UNDERSCORE), columnQualifier)); }
[ "public", "static", "ByteBuffer", "getIndexColumnFamily", "(", "byte", "[", "]", "columnFamily", ",", "byte", "[", "]", "columnQualifier", ")", "{", "return", "wrap", "(", "ArrayUtils", ".", "addAll", "(", "ArrayUtils", ".", "add", "(", "columnFamily", ",", ...
Gets the column family of the index table based on the given column family and qualifier. @param columnFamily Presto column family @param columnQualifier Presto column qualifier @return ByteBuffer of the given index column family
[ "Gets", "the", "column", "family", "of", "the", "index", "table", "based", "on", "the", "given", "column", "family", "and", "qualifier", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java#L397-L400
128,988
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java
Indexer.getIndexTableName
public static String getIndexTableName(String schema, String table) { return schema.equals("default") ? table + "_idx" : schema + '.' + table + "_idx"; }
java
public static String getIndexTableName(String schema, String table) { return schema.equals("default") ? table + "_idx" : schema + '.' + table + "_idx"; }
[ "public", "static", "String", "getIndexTableName", "(", "String", "schema", ",", "String", "table", ")", "{", "return", "schema", ".", "equals", "(", "\"default\"", ")", "?", "table", "+", "\"_idx\"", ":", "schema", "+", "'", "'", "+", "table", "+", "\"_...
Gets the fully-qualified index table name for the given table. @param schema Schema name @param table Table name @return Qualified index table name
[ "Gets", "the", "fully", "-", "qualified", "index", "table", "name", "for", "the", "given", "table", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java#L431-L434
128,989
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java
Indexer.getMetricsTableName
public static String getMetricsTableName(String schema, String table) { return schema.equals("default") ? table + "_idx_metrics" : schema + '.' + table + "_idx_metrics"; }
java
public static String getMetricsTableName(String schema, String table) { return schema.equals("default") ? table + "_idx_metrics" : schema + '.' + table + "_idx_metrics"; }
[ "public", "static", "String", "getMetricsTableName", "(", "String", "schema", ",", "String", "table", ")", "{", "return", "schema", ".", "equals", "(", "\"default\"", ")", "?", "table", "+", "\"_idx_metrics\"", ":", "schema", "+", "'", "'", "+", "table", "...
Gets the fully-qualified index metrics table name for the given table. @param schema Schema name @param table Table name @return Qualified index metrics table name
[ "Gets", "the", "fully", "-", "qualified", "index", "metrics", "table", "name", "for", "the", "given", "table", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java#L454-L458
128,990
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/predicate/Marker.java
Marker.isAdjacent
public boolean isAdjacent(Marker other) { checkTypeCompatibility(other); if (isUpperUnbounded() || isLowerUnbounded() || other.isUpperUnbounded() || other.isLowerUnbounded()) { return false; } if (type.compareTo(valueBlock.get(), 0, other.valueBlock.get(), 0) != 0) { ...
java
public boolean isAdjacent(Marker other) { checkTypeCompatibility(other); if (isUpperUnbounded() || isLowerUnbounded() || other.isUpperUnbounded() || other.isLowerUnbounded()) { return false; } if (type.compareTo(valueBlock.get(), 0, other.valueBlock.get(), 0) != 0) { ...
[ "public", "boolean", "isAdjacent", "(", "Marker", "other", ")", "{", "checkTypeCompatibility", "(", "other", ")", ";", "if", "(", "isUpperUnbounded", "(", ")", "||", "isLowerUnbounded", "(", ")", "||", "other", ".", "isUpperUnbounded", "(", ")", "||", "other...
Adjacency is defined by two Markers being infinitesimally close to each other. This means they must share the same value and have adjacent Bounds.
[ "Adjacency", "is", "defined", "by", "two", "Markers", "being", "infinitesimally", "close", "to", "each", "other", ".", "This", "means", "they", "must", "share", "the", "same", "value", "and", "have", "adjacent", "Bounds", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/predicate/Marker.java#L166-L177
128,991
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/LiteralEncoder.java
LiteralEncoder.toRowExpression
public static RowExpression toRowExpression(Object object, Type type) { requireNonNull(type, "type is null"); if (object instanceof RowExpression) { return (RowExpression) object; } if (object == null) { return constantNull(type); } return c...
java
public static RowExpression toRowExpression(Object object, Type type) { requireNonNull(type, "type is null"); if (object instanceof RowExpression) { return (RowExpression) object; } if (object == null) { return constantNull(type); } return c...
[ "public", "static", "RowExpression", "toRowExpression", "(", "Object", "object", ",", "Type", "type", ")", "{", "requireNonNull", "(", "type", ",", "\"type is null\"", ")", ";", "if", "(", "object", "instanceof", "RowExpression", ")", "{", "return", "(", "RowE...
Unlike toExpression, toRowExpression should be very straightforward given object is serializable
[ "Unlike", "toExpression", "toRowExpression", "should", "be", "very", "straightforward", "given", "object", "is", "serializable" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/LiteralEncoder.java#L101-L114
128,992
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java
RelationType.indexOf
public int indexOf(Field field) { requireNonNull(field, "field cannot be null"); Integer index = fieldIndexes.get(field); checkArgument(index != null, "Field %s not found", field); return index; }
java
public int indexOf(Field field) { requireNonNull(field, "field cannot be null"); Integer index = fieldIndexes.get(field); checkArgument(index != null, "Field %s not found", field); return index; }
[ "public", "int", "indexOf", "(", "Field", "field", ")", "{", "requireNonNull", "(", "field", ",", "\"field cannot be null\"", ")", ";", "Integer", "index", "=", "fieldIndexes", ".", "get", "(", "field", ")", ";", "checkArgument", "(", "index", "!=", "null", ...
Gets the index of the specified field. @throws IllegalArgumentException when field is not found
[ "Gets", "the", "index", "of", "the", "specified", "field", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java#L70-L76
128,993
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java
RelationType.getFieldByIndex
public Field getFieldByIndex(int fieldIndex) { checkElementIndex(fieldIndex, allFields.size(), "fieldIndex"); return allFields.get(fieldIndex); }
java
public Field getFieldByIndex(int fieldIndex) { checkElementIndex(fieldIndex, allFields.size(), "fieldIndex"); return allFields.get(fieldIndex); }
[ "public", "Field", "getFieldByIndex", "(", "int", "fieldIndex", ")", "{", "checkElementIndex", "(", "fieldIndex", ",", "allFields", ".", "size", "(", ")", ",", "\"fieldIndex\"", ")", ";", "return", "allFields", ".", "get", "(", "fieldIndex", ")", ";", "}" ]
Gets the field at the specified index.
[ "Gets", "the", "field", "at", "the", "specified", "index", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java#L81-L85
128,994
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java
RelationType.resolveFields
public List<Field> resolveFields(QualifiedName name) { return allFields.stream() .filter(input -> input.canResolve(name)) .collect(toImmutableList()); }
java
public List<Field> resolveFields(QualifiedName name) { return allFields.stream() .filter(input -> input.canResolve(name)) .collect(toImmutableList()); }
[ "public", "List", "<", "Field", ">", "resolveFields", "(", "QualifiedName", "name", ")", "{", "return", "allFields", ".", "stream", "(", ")", ".", "filter", "(", "input", "->", "input", ".", "canResolve", "(", "name", ")", ")", ".", "collect", "(", "to...
Gets the index of all columns matching the specified name
[ "Gets", "the", "index", "of", "all", "columns", "matching", "the", "specified", "name" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java#L133-L138
128,995
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java
RelationType.joinWith
public RelationType joinWith(RelationType other) { List<Field> fields = ImmutableList.<Field>builder() .addAll(this.allFields) .addAll(other.allFields) .build(); return new RelationType(fields); }
java
public RelationType joinWith(RelationType other) { List<Field> fields = ImmutableList.<Field>builder() .addAll(this.allFields) .addAll(other.allFields) .build(); return new RelationType(fields); }
[ "public", "RelationType", "joinWith", "(", "RelationType", "other", ")", "{", "List", "<", "Field", ">", "fields", "=", "ImmutableList", ".", "<", "Field", ">", "builder", "(", ")", ".", "addAll", "(", "this", ".", "allFields", ")", ".", "addAll", "(", ...
Creates a new tuple descriptor containing all fields from this tuple descriptor and all fields from the specified tuple descriptor.
[ "Creates", "a", "new", "tuple", "descriptor", "containing", "all", "fields", "from", "this", "tuple", "descriptor", "and", "all", "fields", "from", "the", "specified", "tuple", "descriptor", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java#L149-L157
128,996
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java
RelationType.withAlias
public RelationType withAlias(String relationAlias, List<String> columnAliases) { if (columnAliases != null) { checkArgument(columnAliases.size() == visibleFields.size(), "Column alias list has %s entries but '%s' has %s columns available", columnAliases.s...
java
public RelationType withAlias(String relationAlias, List<String> columnAliases) { if (columnAliases != null) { checkArgument(columnAliases.size() == visibleFields.size(), "Column alias list has %s entries but '%s' has %s columns available", columnAliases.s...
[ "public", "RelationType", "withAlias", "(", "String", "relationAlias", ",", "List", "<", "String", ">", "columnAliases", ")", "{", "if", "(", "columnAliases", "!=", "null", ")", "{", "checkArgument", "(", "columnAliases", ".", "size", "(", ")", "==", "visibl...
Creates a new tuple descriptor with the relation, and, optionally, the columns aliased.
[ "Creates", "a", "new", "tuple", "descriptor", "with", "the", "relation", "and", "optionally", "the", "columns", "aliased", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/analyzer/RelationType.java#L162-L201
128,997
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/plan/ChildReplacer.java
ChildReplacer.replaceChildren
public static PlanNode replaceChildren(PlanNode node, List<PlanNode> children) { for (int i = 0; i < node.getSources().size(); i++) { if (children.get(i) != node.getSources().get(i)) { return node.replaceChildren(children); } } return node; }
java
public static PlanNode replaceChildren(PlanNode node, List<PlanNode> children) { for (int i = 0; i < node.getSources().size(); i++) { if (children.get(i) != node.getSources().get(i)) { return node.replaceChildren(children); } } return node; }
[ "public", "static", "PlanNode", "replaceChildren", "(", "PlanNode", "node", ",", "List", "<", "PlanNode", ">", "children", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getSources", "(", ")", ".", "size", "(", ")", ";", "...
Return an identical copy of the given node with its children replaced
[ "Return", "an", "identical", "copy", "of", "the", "given", "node", "with", "its", "children", "replaced" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/plan/ChildReplacer.java#L27-L35
128,998
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/AccumulatorCompiler.java
AccumulatorCompiler.pushStackType
private static void pushStackType(Scope scope, BytecodeBlock block, Type sqlType, BytecodeBlock getBlockBytecode, Class<?> parameter, CallSiteBinder callSiteBinder) { Variable position = scope.getVariable("position"); if (parameter == long.class) { block.comment("%s.getLong(block, positi...
java
private static void pushStackType(Scope scope, BytecodeBlock block, Type sqlType, BytecodeBlock getBlockBytecode, Class<?> parameter, CallSiteBinder callSiteBinder) { Variable position = scope.getVariable("position"); if (parameter == long.class) { block.comment("%s.getLong(block, positi...
[ "private", "static", "void", "pushStackType", "(", "Scope", "scope", ",", "BytecodeBlock", "block", ",", "Type", "sqlType", ",", "BytecodeBlock", "getBlockBytecode", ",", "Class", "<", "?", ">", "parameter", ",", "CallSiteBinder", "callSiteBinder", ")", "{", "Va...
Assumes that there is a variable named 'position' in the block, which is the current index
[ "Assumes", "that", "there", "is", "a", "variable", "named", "position", "in", "the", "block", "which", "is", "the", "current", "index" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AccumulatorCompiler.java#L618-L656
128,999
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/AccumulatorCompiler.java
AccumulatorCompiler.generateBlockNonNullPositionForLoop
private static BytecodeBlock generateBlockNonNullPositionForLoop(Scope scope, Variable positionVariable, BytecodeBlock loopBody) { Variable rowsVariable = scope.declareVariable(int.class, "rows"); Variable blockVariable = scope.getVariable("block"); BytecodeBlock block = new BytecodeBlock()...
java
private static BytecodeBlock generateBlockNonNullPositionForLoop(Scope scope, Variable positionVariable, BytecodeBlock loopBody) { Variable rowsVariable = scope.declareVariable(int.class, "rows"); Variable blockVariable = scope.getVariable("block"); BytecodeBlock block = new BytecodeBlock()...
[ "private", "static", "BytecodeBlock", "generateBlockNonNullPositionForLoop", "(", "Scope", "scope", ",", "Variable", "positionVariable", ",", "BytecodeBlock", "loopBody", ")", "{", "Variable", "rowsVariable", "=", "scope", ".", "declareVariable", "(", "int", ".", "cla...
loopBody will only be executed for non-null positions in the Block
[ "loopBody", "will", "only", "be", "executed", "for", "non", "-", "null", "positions", "in", "the", "Block" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AccumulatorCompiler.java#L789-L816