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
129,000
prestodb/presto
presto-raptor/src/main/java/com/facebook/presto/raptor/util/RebindSafeMBeanServer.java
RebindSafeMBeanServer.registerMBean
@Override public ObjectInstance registerMBean(Object object, ObjectName name) throws MBeanRegistrationException, NotCompliantMBeanException { while (true) { try { // try to register the mbean return mbeanServer.registerMBean(object, name); ...
java
@Override public ObjectInstance registerMBean(Object object, ObjectName name) throws MBeanRegistrationException, NotCompliantMBeanException { while (true) { try { // try to register the mbean return mbeanServer.registerMBean(object, name); ...
[ "@", "Override", "public", "ObjectInstance", "registerMBean", "(", "Object", "object", ",", "ObjectName", "name", ")", "throws", "MBeanRegistrationException", ",", "NotCompliantMBeanException", "{", "while", "(", "true", ")", "{", "try", "{", "// try to register the m...
Delegates to the wrapped mbean server, but if a mbean is already registered with the specified name, the existing instance is returned.
[ "Delegates", "to", "the", "wrapped", "mbean", "server", "but", "if", "a", "mbean", "is", "already", "registered", "with", "the", "specified", "name", "the", "existing", "instance", "is", "returned", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-raptor/src/main/java/com/facebook/presto/raptor/util/RebindSafeMBeanServer.java#L67-L90
129,001
prestodb/presto
presto-array/src/main/java/com/facebook/presto/array/IntBigArrays.java
IntBigArrays.set
public static void set(final int[][] array, final long index, int value) { array[segment(index)][displacement(index)] = value; }
java
public static void set(final int[][] array, final long index, int value) { array[segment(index)][displacement(index)] = value; }
[ "public", "static", "void", "set", "(", "final", "int", "[", "]", "[", "]", "array", ",", "final", "long", "index", ",", "int", "value", ")", "{", "array", "[", "segment", "(", "index", ")", "]", "[", "displacement", "(", "index", ")", "]", "=", ...
Sets the element of the given big array of specified index. @param array a big array. @param index a position in the big array.
[ "Sets", "the", "element", "of", "the", "given", "big", "array", "of", "specified", "index", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-array/src/main/java/com/facebook/presto/array/IntBigArrays.java#L70-L73
129,002
prestodb/presto
presto-array/src/main/java/com/facebook/presto/array/IntBigArrays.java
IntBigArrays.swap
public static void swap(final int[][] array, final long first, final long second) { final int t = array[segment(first)][displacement(first)]; array[segment(first)][displacement(first)] = array[segment(second)][displacement(second)]; array[segment(second)][displacement(second)] = t; }
java
public static void swap(final int[][] array, final long first, final long second) { final int t = array[segment(first)][displacement(first)]; array[segment(first)][displacement(first)] = array[segment(second)][displacement(second)]; array[segment(second)][displacement(second)] = t; }
[ "public", "static", "void", "swap", "(", "final", "int", "[", "]", "[", "]", "array", ",", "final", "long", "first", ",", "final", "long", "second", ")", "{", "final", "int", "t", "=", "array", "[", "segment", "(", "first", ")", "]", "[", "displace...
Swaps the element of the given big array of specified indices. @param array a big array. @param first a position in the big array. @param second a position in the big array.
[ "Swaps", "the", "element", "of", "the", "given", "big", "array", "of", "specified", "indices", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-array/src/main/java/com/facebook/presto/array/IntBigArrays.java#L82-L87
129,003
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/metadata/statistics/StringStatisticsBuilder.java
StringStatisticsBuilder.addStringStatistics
private void addStringStatistics(long valueCount, StringStatistics value) { requireNonNull(value, "value is null"); checkArgument(valueCount > 0, "valueCount is 0"); checkArgument(value.getMin() != null || value.getMax() != null, "min and max cannot both be null"); if (nonNullValueC...
java
private void addStringStatistics(long valueCount, StringStatistics value) { requireNonNull(value, "value is null"); checkArgument(valueCount > 0, "valueCount is 0"); checkArgument(value.getMin() != null || value.getMax() != null, "min and max cannot both be null"); if (nonNullValueC...
[ "private", "void", "addStringStatistics", "(", "long", "valueCount", ",", "StringStatistics", "value", ")", "{", "requireNonNull", "(", "value", ",", "\"value is null\"", ")", ";", "checkArgument", "(", "valueCount", ">", "0", ",", "\"valueCount is 0\"", ")", ";",...
This method can only be used in merging stats. It assumes min or max could be nulls.
[ "This", "method", "can", "only", "be", "used", "in", "merging", "stats", ".", "It", "assumes", "min", "or", "max", "could", "be", "nulls", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/metadata/statistics/StringStatisticsBuilder.java#L89-L111
129,004
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/scalar/FailureFunction.java
FailureFunction.failWithException
@Description("Decodes json to an exception and throws it") @ScalarFunction(value = "fail", hidden = true) @SqlType("unknown") public static boolean failWithException(@SqlType(StandardTypes.JSON) Slice failureInfoSlice) { FailureInfo failureInfo = JSON_CODEC.fromJson(failureInfoSlice.getBytes());...
java
@Description("Decodes json to an exception and throws it") @ScalarFunction(value = "fail", hidden = true) @SqlType("unknown") public static boolean failWithException(@SqlType(StandardTypes.JSON) Slice failureInfoSlice) { FailureInfo failureInfo = JSON_CODEC.fromJson(failureInfoSlice.getBytes());...
[ "@", "Description", "(", "\"Decodes json to an exception and throws it\"", ")", "@", "ScalarFunction", "(", "value", "=", "\"fail\"", ",", "hidden", "=", "true", ")", "@", "SqlType", "(", "\"unknown\"", ")", "public", "static", "boolean", "failWithException", "(", ...
We shouldn't be using UNKNOWN as an explicit type. This will be fixed when we fix type inference
[ "We", "shouldn", "t", "be", "using", "UNKNOWN", "as", "an", "explicit", "type", ".", "This", "will", "be", "fixed", "when", "we", "fix", "type", "inference" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/scalar/FailureFunction.java#L33-L41
129,005
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/stream/LongInputStreamV2.java
LongInputStreamV2.bytesToLongBE
private static long bytesToLongBE(InputStream input, int n) throws IOException { long out = 0; long val; while (n > 0) { n--; // store it in a long and then shift else integer overflow will occur val = input.read(); out |= (val << (...
java
private static long bytesToLongBE(InputStream input, int n) throws IOException { long out = 0; long val; while (n > 0) { n--; // store it in a long and then shift else integer overflow will occur val = input.read(); out |= (val << (...
[ "private", "static", "long", "bytesToLongBE", "(", "InputStream", "input", ",", "int", "n", ")", "throws", "IOException", "{", "long", "out", "=", "0", ";", "long", "val", ";", "while", "(", "n", ">", "0", ")", "{", "n", "--", ";", "// store it in a lo...
Read n bytes in big endian order and convert to long.
[ "Read", "n", "bytes", "in", "big", "endian", "order", "and", "convert", "to", "long", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/stream/LongInputStreamV2.java#L309-L321
129,006
prestodb/presto
presto-main/src/main/java/com/facebook/presto/connector/system/jdbc/ColumnJdbcTable.java
ColumnJdbcTable.decimalDigits
private static Integer decimalDigits(Type type) { if (type instanceof DecimalType) { return ((DecimalType) type).getScale(); } return null; }
java
private static Integer decimalDigits(Type type) { if (type instanceof DecimalType) { return ((DecimalType) type).getScale(); } return null; }
[ "private", "static", "Integer", "decimalDigits", "(", "Type", "type", ")", "{", "if", "(", "type", "instanceof", "DecimalType", ")", "{", "return", "(", "(", "DecimalType", ")", "type", ")", ".", "getScale", "(", ")", ";", "}", "return", "null", ";", "...
DECIMAL_DIGITS is the number of fractional digits
[ "DECIMAL_DIGITS", "is", "the", "number", "of", "fractional", "digits" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/connector/system/jdbc/ColumnJdbcTable.java#L276-L282
129,007
prestodb/presto
presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoSession.java
MongoSession.getTableMetadata
private Document getTableMetadata(SchemaTableName schemaTableName) throws TableNotFoundException { String schemaName = schemaTableName.getSchemaName(); String tableName = schemaTableName.getTableName(); MongoDatabase db = client.getDatabase(schemaName); MongoCollection<D...
java
private Document getTableMetadata(SchemaTableName schemaTableName) throws TableNotFoundException { String schemaName = schemaTableName.getSchemaName(); String tableName = schemaTableName.getTableName(); MongoDatabase db = client.getDatabase(schemaName); MongoCollection<D...
[ "private", "Document", "getTableMetadata", "(", "SchemaTableName", "schemaTableName", ")", "throws", "TableNotFoundException", "{", "String", "schemaName", "=", "schemaTableName", ".", "getSchemaName", "(", ")", ";", "String", "tableName", "=", "schemaTableName", ".", ...
Internal Schema management
[ "Internal", "Schema", "management" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoSession.java#L365-L393
129,008
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/MergeLimitWithDistinct.java
MergeLimitWithDistinct.isDistinct
private static boolean isDistinct(AggregationNode node) { return node.getAggregations().isEmpty() && node.getOutputSymbols().size() == node.getGroupingKeys().size() && node.getOutputSymbols().containsAll(node.getGroupingKeys()); }
java
private static boolean isDistinct(AggregationNode node) { return node.getAggregations().isEmpty() && node.getOutputSymbols().size() == node.getGroupingKeys().size() && node.getOutputSymbols().containsAll(node.getGroupingKeys()); }
[ "private", "static", "boolean", "isDistinct", "(", "AggregationNode", "node", ")", "{", "return", "node", ".", "getAggregations", "(", ")", ".", "isEmpty", "(", ")", "&&", "node", ".", "getOutputSymbols", "(", ")", ".", "size", "(", ")", "==", "node", "....
Whether this node corresponds to a DISTINCT operation in SQL
[ "Whether", "this", "node", "corresponds", "to", "a", "DISTINCT", "operation", "in", "SQL" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/MergeLimitWithDistinct.java#L41-L46
129,009
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/ArrayBlock.java
ArrayBlock.fromElementBlock
public static Block fromElementBlock(int positionCount, Optional<boolean[]> valueIsNull, int[] arrayOffset, Block values) { validateConstructorArguments(0, positionCount, valueIsNull.orElse(null), arrayOffset, values); // for performance reasons per element checks are only performed on the public co...
java
public static Block fromElementBlock(int positionCount, Optional<boolean[]> valueIsNull, int[] arrayOffset, Block values) { validateConstructorArguments(0, positionCount, valueIsNull.orElse(null), arrayOffset, values); // for performance reasons per element checks are only performed on the public co...
[ "public", "static", "Block", "fromElementBlock", "(", "int", "positionCount", ",", "Optional", "<", "boolean", "[", "]", ">", "valueIsNull", ",", "int", "[", "]", "arrayOffset", ",", "Block", "values", ")", "{", "validateConstructorArguments", "(", "0", ",", ...
Create an array block directly from columnar nulls, values, and offsets into the values. A null array must have no entries.
[ "Create", "an", "array", "block", "directly", "from", "columnar", "nulls", "values", "and", "offsets", "into", "the", "values", ".", "A", "null", "array", "must", "have", "no", "entries", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/ArrayBlock.java#L45-L60
129,010
prestodb/presto
presto-parquet/src/main/java/com/facebook/presto/parquet/ParquetTypeUtils.java
ParquetTypeUtils.lookupColumnByName
public static ColumnIO lookupColumnByName(GroupColumnIO groupColumnIO, String columnName) { ColumnIO columnIO = groupColumnIO.getChild(columnName); if (columnIO != null) { return columnIO; } for (int i = 0; i < groupColumnIO.getChildrenCount(); i++) { if (gr...
java
public static ColumnIO lookupColumnByName(GroupColumnIO groupColumnIO, String columnName) { ColumnIO columnIO = groupColumnIO.getChild(columnName); if (columnIO != null) { return columnIO; } for (int i = 0; i < groupColumnIO.getChildrenCount(); i++) { if (gr...
[ "public", "static", "ColumnIO", "lookupColumnByName", "(", "GroupColumnIO", "groupColumnIO", ",", "String", "columnName", ")", "{", "ColumnIO", "columnIO", "=", "groupColumnIO", ".", "getChild", "(", "columnName", ")", ";", "if", "(", "columnIO", "!=", "null", "...
Parquet column names are case-sensitive unlike Hive, which converts all column names to lowercase. Therefore, when we look up columns we first check for exact match, and if that fails we look for a case-insensitive match.
[ "Parquet", "column", "names", "are", "case", "-", "sensitive", "unlike", "Hive", "which", "converts", "all", "column", "names", "to", "lowercase", ".", "Therefore", "when", "we", "look", "up", "columns", "we", "first", "check", "for", "exact", "match", "and"...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-parquet/src/main/java/com/facebook/presto/parquet/ParquetTypeUtils.java#L207-L222
129,011
prestodb/presto
presto-ml/src/main/java/com/facebook/presto/ml/EvaluateClassifierPredictionsAggregation.java
EvaluateClassifierPredictionsAggregation.mergeMaps
private static int mergeMaps(Map<String, Integer> map, Map<String, Integer> other) { int deltaSize = 0; for (Map.Entry<String, Integer> entry : other.entrySet()) { if (!map.containsKey(entry.getKey())) { deltaSize += entry.getKey().getBytes().length + SIZE_OF_INT; ...
java
private static int mergeMaps(Map<String, Integer> map, Map<String, Integer> other) { int deltaSize = 0; for (Map.Entry<String, Integer> entry : other.entrySet()) { if (!map.containsKey(entry.getKey())) { deltaSize += entry.getKey().getBytes().length + SIZE_OF_INT; ...
[ "private", "static", "int", "mergeMaps", "(", "Map", "<", "String", ",", "Integer", ">", "map", ",", "Map", "<", "String", ",", "Integer", ">", "other", ")", "{", "int", "deltaSize", "=", "0", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",...
Returns the estimated memory increase in map
[ "Returns", "the", "estimated", "memory", "increase", "in", "map" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-ml/src/main/java/com/facebook/presto/ml/EvaluateClassifierPredictionsAggregation.java#L84-L94
129,012
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java
SemiTransactionalHiveMetastore.getTableSource
@GuardedBy("this") private TableSource getTableSource(String databaseName, String tableName) { checkHoldsLock(); checkReadable(); Action<TableAndMore> tableAction = tableActions.get(new SchemaTableName(databaseName, tableName)); if (tableAction == null) { return Tabl...
java
@GuardedBy("this") private TableSource getTableSource(String databaseName, String tableName) { checkHoldsLock(); checkReadable(); Action<TableAndMore> tableAction = tableActions.get(new SchemaTableName(databaseName, tableName)); if (tableAction == null) { return Tabl...
[ "@", "GuardedBy", "(", "\"this\"", ")", "private", "TableSource", "getTableSource", "(", "String", "databaseName", ",", "String", "tableName", ")", "{", "checkHoldsLock", "(", ")", ";", "checkReadable", "(", ")", ";", "Action", "<", "TableAndMore", ">", "table...
This method can only be called when the table is known to exist
[ "This", "method", "can", "only", "be", "called", "when", "the", "table", "is", "known", "to", "exist" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java#L245-L267
129,013
prestodb/presto
presto-raptor/src/main/java/com/facebook/presto/raptor/storage/organization/CompactionSetCreator.java
CompactionSetCreator.createCompactionSets
public Set<OrganizationSet> createCompactionSets(Table tableInfo, Collection<ShardIndexInfo> shards) { Collection<Collection<ShardIndexInfo>> shardsByDaysBuckets = getShardsByDaysBuckets(tableInfo, shards, temporalFunction); ImmutableSet.Builder<OrganizationSet> compactionSets = ImmutableSet.builde...
java
public Set<OrganizationSet> createCompactionSets(Table tableInfo, Collection<ShardIndexInfo> shards) { Collection<Collection<ShardIndexInfo>> shardsByDaysBuckets = getShardsByDaysBuckets(tableInfo, shards, temporalFunction); ImmutableSet.Builder<OrganizationSet> compactionSets = ImmutableSet.builde...
[ "public", "Set", "<", "OrganizationSet", ">", "createCompactionSets", "(", "Table", "tableInfo", ",", "Collection", "<", "ShardIndexInfo", ">", "shards", ")", "{", "Collection", "<", "Collection", "<", "ShardIndexInfo", ">>", "shardsByDaysBuckets", "=", "getShardsBy...
All shards provided to this method will be considered for creating a compaction set.
[ "All", "shards", "provided", "to", "this", "method", "will", "be", "considered", "for", "creating", "a", "compaction", "set", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-raptor/src/main/java/com/facebook/presto/raptor/storage/organization/CompactionSetCreator.java#L50-L59
129,014
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/RowBlock.java
RowBlock.fromFieldBlocks
public static Block fromFieldBlocks(int positionCount, Optional<boolean[]> rowIsNull, Block[] fieldBlocks) { int[] fieldBlockOffsets = new int[positionCount + 1]; for (int position = 0; position < positionCount; position++) { fieldBlockOffsets[position + 1] = fieldBlockOffsets[position] ...
java
public static Block fromFieldBlocks(int positionCount, Optional<boolean[]> rowIsNull, Block[] fieldBlocks) { int[] fieldBlockOffsets = new int[positionCount + 1]; for (int position = 0; position < positionCount; position++) { fieldBlockOffsets[position + 1] = fieldBlockOffsets[position] ...
[ "public", "static", "Block", "fromFieldBlocks", "(", "int", "positionCount", ",", "Optional", "<", "boolean", "[", "]", ">", "rowIsNull", ",", "Block", "[", "]", "fieldBlocks", ")", "{", "int", "[", "]", "fieldBlockOffsets", "=", "new", "int", "[", "positi...
Create a row block directly from columnar nulls and field blocks.
[ "Create", "a", "row", "block", "directly", "from", "columnar", "nulls", "and", "field", "blocks", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/RowBlock.java#L45-L53
129,015
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/OrcReader.java
OrcReader.isValidHeaderMagic
private static boolean isValidHeaderMagic(OrcDataSource source) throws IOException { byte[] headerMagic = new byte[MAGIC.length()]; source.readFully(0, headerMagic); return MAGIC.equals(Slices.wrappedBuffer(headerMagic)); }
java
private static boolean isValidHeaderMagic(OrcDataSource source) throws IOException { byte[] headerMagic = new byte[MAGIC.length()]; source.readFully(0, headerMagic); return MAGIC.equals(Slices.wrappedBuffer(headerMagic)); }
[ "private", "static", "boolean", "isValidHeaderMagic", "(", "OrcDataSource", "source", ")", "throws", "IOException", "{", "byte", "[", "]", "headerMagic", "=", "new", "byte", "[", "MAGIC", ".", "length", "(", ")", "]", ";", "source", ".", "readFully", "(", ...
Does the file start with the ORC magic bytes?
[ "Does", "the", "file", "start", "with", "the", "ORC", "magic", "bytes?" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/OrcReader.java#L279-L286
129,016
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/SubPlan.java
SubPlan.getAllFragments
public List<PlanFragment> getAllFragments() { ImmutableList.Builder<PlanFragment> fragments = ImmutableList.builder(); fragments.add(getFragment()); for (SubPlan child : getChildren()) { fragments.addAll(child.getAllFragments()); } return fragments.build(); ...
java
public List<PlanFragment> getAllFragments() { ImmutableList.Builder<PlanFragment> fragments = ImmutableList.builder(); fragments.add(getFragment()); for (SubPlan child : getChildren()) { fragments.addAll(child.getAllFragments()); } return fragments.build(); ...
[ "public", "List", "<", "PlanFragment", ">", "getAllFragments", "(", ")", "{", "ImmutableList", ".", "Builder", "<", "PlanFragment", ">", "fragments", "=", "ImmutableList", ".", "builder", "(", ")", ";", "fragments", ".", "add", "(", "getFragment", "(", ")", ...
Flattens the subplan and returns all PlanFragments in the tree
[ "Flattens", "the", "subplan", "and", "returns", "all", "PlanFragments", "in", "the", "tree" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/SubPlan.java#L57-L67
129,017
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/SqlStageExecution.java
SqlStageExecution.getAllTasks
public List<RemoteTask> getAllTasks() { return tasks.values().stream() .flatMap(Set::stream) .collect(toImmutableList()); }
java
public List<RemoteTask> getAllTasks() { return tasks.values().stream() .flatMap(Set::stream) .collect(toImmutableList()); }
[ "public", "List", "<", "RemoteTask", ">", "getAllTasks", "(", ")", "{", "return", "tasks", ".", "values", "(", ")", ".", "stream", "(", ")", ".", "flatMap", "(", "Set", "::", "stream", ")", ".", "collect", "(", "toImmutableList", "(", ")", ")", ";", ...
this is used for query info building which should be independent of scheduling work
[ "this", "is", "used", "for", "query", "info", "building", "which", "should", "be", "independent", "of", "scheduling", "work" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/SqlStageExecution.java#L355-L360
129,018
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/plan/GroupIdNode.java
GroupIdNode.getCommonGroupingColumns
public Set<Symbol> getCommonGroupingColumns() { Set<Symbol> intersection = new HashSet<>(groupingSets.get(0)); for (int i = 1; i < groupingSets.size(); i++) { intersection.retainAll(groupingSets.get(i)); } return ImmutableSet.copyOf(intersection); }
java
public Set<Symbol> getCommonGroupingColumns() { Set<Symbol> intersection = new HashSet<>(groupingSets.get(0)); for (int i = 1; i < groupingSets.size(); i++) { intersection.retainAll(groupingSets.get(i)); } return ImmutableSet.copyOf(intersection); }
[ "public", "Set", "<", "Symbol", ">", "getCommonGroupingColumns", "(", ")", "{", "Set", "<", "Symbol", ">", "intersection", "=", "new", "HashSet", "<>", "(", "groupingSets", ".", "get", "(", "0", ")", ")", ";", "for", "(", "int", "i", "=", "1", ";", ...
returns the common grouping columns in terms of output symbols
[ "returns", "the", "common", "grouping", "columns", "in", "terms", "of", "output", "symbols" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/plan/GroupIdNode.java#L140-L147
129,019
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/BlockBuilderStatus.java
BlockBuilderStatus.deepInstanceSize
private static int deepInstanceSize(Class<?> clazz) { if (clazz.isArray()) { throw new IllegalArgumentException(format("Cannot determine size of %s because it contains an array", clazz.getSimpleName())); } if (clazz.isInterface()) { throw new IllegalArgumentException(...
java
private static int deepInstanceSize(Class<?> clazz) { if (clazz.isArray()) { throw new IllegalArgumentException(format("Cannot determine size of %s because it contains an array", clazz.getSimpleName())); } if (clazz.isInterface()) { throw new IllegalArgumentException(...
[ "private", "static", "int", "deepInstanceSize", "(", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", ".", "isArray", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\"Cannot determine size of %s because it cont...
Computes the size of an instance of this class assuming that all reference fields are non-null
[ "Computes", "the", "size", "of", "an", "instance", "of", "this", "class", "assuming", "that", "all", "reference", "fields", "are", "non", "-", "null" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/BlockBuilderStatus.java#L60-L82
129,020
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/buffer/ClientBuffer.java
ClientBuffer.loadPagesIfNecessary
private boolean loadPagesIfNecessary(PagesSupplier pagesSupplier, DataSize maxSize) { checkState(!Thread.holdsLock(this), "Can not load pages while holding a lock on this"); boolean dataAddedOrNoMorePages; List<SerializedPageReference> pageReferences; synchronized (this) { ...
java
private boolean loadPagesIfNecessary(PagesSupplier pagesSupplier, DataSize maxSize) { checkState(!Thread.holdsLock(this), "Can not load pages while holding a lock on this"); boolean dataAddedOrNoMorePages; List<SerializedPageReference> pageReferences; synchronized (this) { ...
[ "private", "boolean", "loadPagesIfNecessary", "(", "PagesSupplier", "pagesSupplier", ",", "DataSize", "maxSize", ")", "{", "checkState", "(", "!", "Thread", ".", "holdsLock", "(", "this", ")", ",", "\"Can not load pages while holding a lock on this\"", ")", ";", "bool...
If there no data, attempt to load some from the pages supplier.
[ "If", "there", "no", "data", "attempt", "to", "load", "some", "from", "the", "pages", "supplier", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/buffer/ClientBuffer.java#L257-L291
129,021
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/buffer/ClientBuffer.java
ClientBuffer.acknowledgePages
public void acknowledgePages(long sequenceId) { checkArgument(sequenceId >= 0, "Invalid sequence id"); List<SerializedPageReference> removedPages = new ArrayList<>(); synchronized (this) { if (destroyed.get()) { return; } // if pages have...
java
public void acknowledgePages(long sequenceId) { checkArgument(sequenceId >= 0, "Invalid sequence id"); List<SerializedPageReference> removedPages = new ArrayList<>(); synchronized (this) { if (destroyed.get()) { return; } // if pages have...
[ "public", "void", "acknowledgePages", "(", "long", "sequenceId", ")", "{", "checkArgument", "(", "sequenceId", ">=", "0", ",", "\"Invalid sequence id\"", ")", ";", "List", "<", "SerializedPageReference", ">", "removedPages", "=", "new", "ArrayList", "<>", "(", "...
Drops pages up to the specified sequence id
[ "Drops", "pages", "up", "to", "the", "specified", "sequence", "id" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/buffer/ClientBuffer.java#L370-L405
129,022
prestodb/presto
presto-rcfile/src/main/java/com/facebook/presto/rcfile/RcFileDecoderUtils.java
RcFileDecoderUtils.findFirstSyncPosition
public static long findFirstSyncPosition(RcFileDataSource dataSource, long offset, long length, long syncFirst, long syncSecond) throws IOException { requireNonNull(dataSource, "dataSource is null"); checkArgument(offset >= 0, "offset is negative"); checkArgument(length >= 1, "le...
java
public static long findFirstSyncPosition(RcFileDataSource dataSource, long offset, long length, long syncFirst, long syncSecond) throws IOException { requireNonNull(dataSource, "dataSource is null"); checkArgument(offset >= 0, "offset is negative"); checkArgument(length >= 1, "le...
[ "public", "static", "long", "findFirstSyncPosition", "(", "RcFileDataSource", "dataSource", ",", "long", "offset", ",", "long", "length", ",", "long", "syncFirst", ",", "long", "syncSecond", ")", "throws", "IOException", "{", "requireNonNull", "(", "dataSource", "...
Find the beginning of the first full sync sequence that starts within the specified range.
[ "Find", "the", "beginning", "of", "the", "first", "full", "sync", "sequence", "that", "starts", "within", "the", "specified", "range", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-rcfile/src/main/java/com/facebook/presto/rcfile/RcFileDecoderUtils.java#L119-L167
129,023
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/ValueStore.java
ValueStore.addAndGetPosition
public int addAndGetPosition(Type type, Block block, int position, long valueHash) { if (values.getPositionCount() >= maxFill) { rehash(); } int bucketId = getBucketId(valueHash, mask); int valuePointer; // look for an empty slot or a slot containing this key ...
java
public int addAndGetPosition(Type type, Block block, int position, long valueHash) { if (values.getPositionCount() >= maxFill) { rehash(); } int bucketId = getBucketId(valueHash, mask); int valuePointer; // look for an empty slot or a slot containing this key ...
[ "public", "int", "addAndGetPosition", "(", "Type", "type", ",", "Block", "block", ",", "int", "position", ",", "long", "valueHash", ")", "{", "if", "(", "values", ".", "getPositionCount", "(", ")", ">=", "maxFill", ")", "{", "rehash", "(", ")", ";", "}...
This will add an item if not already in the system. It returns a pointer that is unique for multiple instances of the value. If item present, returns the pointer into the system
[ "This", "will", "add", "an", "item", "if", "not", "already", "in", "the", "system", ".", "It", "returns", "a", "pointer", "that", "is", "unique", "for", "multiple", "instances", "of", "the", "value", ".", "If", "item", "present", "returns", "the", "point...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/ValueStore.java#L71-L105
129,024
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/OrcWriter.java
OrcWriter.bufferFileFooter
private List<OrcDataOutput> bufferFileFooter() throws IOException { List<OrcDataOutput> outputData = new ArrayList<>(); Metadata metadata = new Metadata(closedStripes.stream() .map(ClosedStripe::getStatistics) .collect(toList())); Slice metadataSl...
java
private List<OrcDataOutput> bufferFileFooter() throws IOException { List<OrcDataOutput> outputData = new ArrayList<>(); Metadata metadata = new Metadata(closedStripes.stream() .map(ClosedStripe::getStatistics) .collect(toList())); Slice metadataSl...
[ "private", "List", "<", "OrcDataOutput", ">", "bufferFileFooter", "(", ")", "throws", "IOException", "{", "List", "<", "OrcDataOutput", ">", "outputData", "=", "new", "ArrayList", "<>", "(", ")", ";", "Metadata", "metadata", "=", "new", "Metadata", "(", "clo...
Collect the data for for the file footer. This is not the actual data, but instead are functions that know how to write the data.
[ "Collect", "the", "data", "for", "for", "the", "file", "footer", ".", "This", "is", "not", "the", "actual", "data", "but", "instead", "are", "functions", "that", "know", "how", "to", "write", "the", "data", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/OrcWriter.java#L450-L496
129,025
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/GroupedTypedHistogram.java
GroupedTypedHistogram.iterateGroupNodes
private void iterateGroupNodes(long groupdId, NodeReader nodeReader) { // while the index can be a long, the value is always an int int currentPointer = (int) headPointers.get(groupdId); checkArgument(currentPointer != NULL, "valid group must have non-null head pointer"); while (cur...
java
private void iterateGroupNodes(long groupdId, NodeReader nodeReader) { // while the index can be a long, the value is always an int int currentPointer = (int) headPointers.get(groupdId); checkArgument(currentPointer != NULL, "valid group must have non-null head pointer"); while (cur...
[ "private", "void", "iterateGroupNodes", "(", "long", "groupdId", ",", "NodeReader", "nodeReader", ")", "{", "// while the index can be a long, the value is always an int", "int", "currentPointer", "=", "(", "int", ")", "headPointers", ".", "get", "(", "groupdId", ")", ...
used to iterate over all non-null nodes in the data structure @param nodeReader - will be passed every non-null nodePointer
[ "used", "to", "iterate", "over", "all", "non", "-", "null", "nodes", "in", "the", "data", "structure" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/GroupedTypedHistogram.java#L268-L279
129,026
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/GroupedTypedHistogram.java
GroupedTypedHistogram.resizeNodeArrays
private void resizeNodeArrays(int newBucketCount) { // every per-bucket array needs to be updated counts.ensureCapacity(newBucketCount); valuePositions.ensureCapacity(newBucketCount); nextPointers.ensureCapacity(newBucketCount); valueAndGroupHashes.ensureCapacity(newBucketCou...
java
private void resizeNodeArrays(int newBucketCount) { // every per-bucket array needs to be updated counts.ensureCapacity(newBucketCount); valuePositions.ensureCapacity(newBucketCount); nextPointers.ensureCapacity(newBucketCount); valueAndGroupHashes.ensureCapacity(newBucketCou...
[ "private", "void", "resizeNodeArrays", "(", "int", "newBucketCount", ")", "{", "// every per-bucket array needs to be updated", "counts", ".", "ensureCapacity", "(", "newBucketCount", ")", ";", "valuePositions", ".", "ensureCapacity", "(", "newBucketCount", ")", ";", "n...
parallel arrays with data for
[ "parallel", "arrays", "with", "data", "for" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/GroupedTypedHistogram.java#L324-L332
129,027
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/AggregationFromAnnotationsParser.java
AggregationFromAnnotationsParser.parseFunctionDefinitionWithTypesConstraint
@VisibleForTesting public static ParametricAggregation parseFunctionDefinitionWithTypesConstraint(Class<?> clazz, TypeSignature returnType, List<TypeSignature> argumentTypes) { requireNonNull(returnType, "returnType is null"); requireNonNull(argumentTypes, "argumentTypes is null"); for (...
java
@VisibleForTesting public static ParametricAggregation parseFunctionDefinitionWithTypesConstraint(Class<?> clazz, TypeSignature returnType, List<TypeSignature> argumentTypes) { requireNonNull(returnType, "returnType is null"); requireNonNull(argumentTypes, "argumentTypes is null"); for (...
[ "@", "VisibleForTesting", "public", "static", "ParametricAggregation", "parseFunctionDefinitionWithTypesConstraint", "(", "Class", "<", "?", ">", "clazz", ",", "TypeSignature", "returnType", ",", "List", "<", "TypeSignature", ">", "argumentTypes", ")", "{", "requireNonN...
General purpose function matching is done through FunctionRegistry.
[ "General", "purpose", "function", "matching", "is", "done", "through", "FunctionRegistry", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AggregationFromAnnotationsParser.java#L53-L65
129,028
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/SqlTaskExecution.java
SqlTaskExecution.scheduleDriversForTaskLifeCycle
private void scheduleDriversForTaskLifeCycle() { // This method is called at the beginning of the task. // It schedules drivers for all the pipelines that have task life cycle. List<DriverSplitRunner> runners = new ArrayList<>(); for (DriverSplitRunnerFactory driverRunnerFactory : dr...
java
private void scheduleDriversForTaskLifeCycle() { // This method is called at the beginning of the task. // It schedules drivers for all the pipelines that have task life cycle. List<DriverSplitRunner> runners = new ArrayList<>(); for (DriverSplitRunnerFactory driverRunnerFactory : dr...
[ "private", "void", "scheduleDriversForTaskLifeCycle", "(", ")", "{", "// This method is called at the beginning of the task.", "// It schedules drivers for all the pipelines that have task life cycle.", "List", "<", "DriverSplitRunner", ">", "runners", "=", "new", "ArrayList", "<>", ...
They also have a few differences, making it more convenient to keep the two methods separate.
[ "They", "also", "have", "a", "few", "differences", "making", "it", "more", "convenient", "to", "keep", "the", "two", "methods", "separate", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/SqlTaskExecution.java#L509-L524
129,029
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/RowExpressionInterpreter.java
RowExpressionInterpreter.optimize
@VisibleForTesting public Object optimize(SymbolResolver inputs) { checkState(optimize, "optimize(SymbolResolver) not allowed for interpreter"); Object result = expression.accept(visitor, inputs); if (!(result instanceof RowExpression)) { // constant folding retu...
java
@VisibleForTesting public Object optimize(SymbolResolver inputs) { checkState(optimize, "optimize(SymbolResolver) not allowed for interpreter"); Object result = expression.accept(visitor, inputs); if (!(result instanceof RowExpression)) { // constant folding retu...
[ "@", "VisibleForTesting", "public", "Object", "optimize", "(", "SymbolResolver", "inputs", ")", "{", "checkState", "(", "optimize", ",", "\"optimize(SymbolResolver) not allowed for interpreter\"", ")", ";", "Object", "result", "=", "expression", ".", "accept", "(", "v...
For test only; convenient to replace symbol with constants. Production code should not replace any symbols; use the interface above
[ "For", "test", "only", ";", "convenient", "to", "replace", "symbol", "with", "constants", ".", "Production", "code", "should", "not", "replace", "any", "symbols", ";", "use", "the", "interface", "above" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/RowExpressionInterpreter.java#L160-L171
129,030
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/type/UnscaledDecimal128Arithmetic.java
UnscaledDecimal128Arithmetic.addUnsignedReturnOverflow
private static long addUnsignedReturnOverflow(Slice left, Slice right, Slice result, boolean resultNegative) { // TODO: consider two 7 bytes operations int l0 = getInt(left, 0); int l1 = getInt(left, 1); int l2 = getInt(left, 2); int l3 = getInt(left, 3); int r0 = ge...
java
private static long addUnsignedReturnOverflow(Slice left, Slice right, Slice result, boolean resultNegative) { // TODO: consider two 7 bytes operations int l0 = getInt(left, 0); int l1 = getInt(left, 1); int l2 = getInt(left, 2); int l3 = getInt(left, 3); int r0 = ge...
[ "private", "static", "long", "addUnsignedReturnOverflow", "(", "Slice", "left", ",", "Slice", "right", ",", "Slice", "result", ",", "boolean", "resultNegative", ")", "{", "// TODO: consider two 7 bytes operations", "int", "l0", "=", "getInt", "(", "left", ",", "0"...
This method ignores signs of the left and right. Returns overflow value.
[ "This", "method", "ignores", "signs", "of", "the", "left", "and", "right", ".", "Returns", "overflow", "value", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/type/UnscaledDecimal128Arithmetic.java#L371-L404
129,031
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java
PrestoS3FileSystem.getBucketName
public static String getBucketName(URI uri) { if (uri.getHost() != null) { return uri.getHost(); } if (uri.getUserInfo() == null) { return uri.getAuthority(); } throw new IllegalArgumentException("Unable to determine S3 bucket from URI."); }
java
public static String getBucketName(URI uri) { if (uri.getHost() != null) { return uri.getHost(); } if (uri.getUserInfo() == null) { return uri.getAuthority(); } throw new IllegalArgumentException("Unable to determine S3 bucket from URI."); }
[ "public", "static", "String", "getBucketName", "(", "URI", "uri", ")", "{", "if", "(", "uri", ".", "getHost", "(", ")", "!=", "null", ")", "{", "return", "uri", ".", "getHost", "(", ")", ";", "}", "if", "(", "uri", ".", "getUserInfo", "(", ")", "...
Helper function used to work around the fact that if you use an S3 bucket with an '_' that java.net.URI behaves differently and sets the host value to null whereas S3 buckets without '_' have a properly set host field. '_' is only allowed in S3 bucket names in us-east-1. @param uri The URI from which to extract a host...
[ "Helper", "function", "used", "to", "work", "around", "the", "fact", "that", "if", "you", "use", "an", "S3", "bucket", "with", "an", "_", "that", "java", ".", "net", ".", "URI", "behaves", "differently", "and", "sets", "the", "host", "value", "to", "nu...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/s3/PrestoS3FileSystem.java#L1161-L1172
129,032
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/OperatorContext.java
OperatorContext.newLocalSystemMemoryContext
public LocalMemoryContext newLocalSystemMemoryContext(String allocationTag) { return new InternalLocalMemoryContext(operatorMemoryContext.newSystemMemoryContext(allocationTag), memoryFuture, this::updatePeakMemoryReservations, true); }
java
public LocalMemoryContext newLocalSystemMemoryContext(String allocationTag) { return new InternalLocalMemoryContext(operatorMemoryContext.newSystemMemoryContext(allocationTag), memoryFuture, this::updatePeakMemoryReservations, true); }
[ "public", "LocalMemoryContext", "newLocalSystemMemoryContext", "(", "String", "allocationTag", ")", "{", "return", "new", "InternalLocalMemoryContext", "(", "operatorMemoryContext", ".", "newSystemMemoryContext", "(", "allocationTag", ")", ",", "memoryFuture", ",", "this", ...
caller should close this context as it's a new context
[ "caller", "should", "close", "this", "context", "as", "it", "s", "a", "new", "context" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/OperatorContext.java#L235-L238
129,033
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/OperatorContext.java
OperatorContext.updatePeakMemoryReservations
private void updatePeakMemoryReservations() { long userMemory = operatorMemoryContext.getUserMemory(); long systemMemory = operatorMemoryContext.getSystemMemory(); long totalMemory = userMemory + systemMemory; peakUserMemoryReservation.accumulateAndGet(userMemory, Math::max); ...
java
private void updatePeakMemoryReservations() { long userMemory = operatorMemoryContext.getUserMemory(); long systemMemory = operatorMemoryContext.getSystemMemory(); long totalMemory = userMemory + systemMemory; peakUserMemoryReservation.accumulateAndGet(userMemory, Math::max); ...
[ "private", "void", "updatePeakMemoryReservations", "(", ")", "{", "long", "userMemory", "=", "operatorMemoryContext", ".", "getUserMemory", "(", ")", ";", "long", "systemMemory", "=", "operatorMemoryContext", ".", "getSystemMemory", "(", ")", ";", "long", "totalMemo...
listen to all memory allocations and update the peak memory reservations accordingly
[ "listen", "to", "all", "memory", "allocations", "and", "update", "the", "peak", "memory", "reservations", "accordingly" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/OperatorContext.java#L271-L279
129,034
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/OperatorContext.java
OperatorContext.requestMemoryRevoking
public long requestMemoryRevoking() { long revokedMemory = 0L; Runnable listener = null; synchronized (this) { if (!isMemoryRevokingRequested() && operatorMemoryContext.getRevocableMemory() > 0) { memoryRevokingRequested = true; revokedMemory = ope...
java
public long requestMemoryRevoking() { long revokedMemory = 0L; Runnable listener = null; synchronized (this) { if (!isMemoryRevokingRequested() && operatorMemoryContext.getRevocableMemory() > 0) { memoryRevokingRequested = true; revokedMemory = ope...
[ "public", "long", "requestMemoryRevoking", "(", ")", "{", "long", "revokedMemory", "=", "0L", ";", "Runnable", "listener", "=", "null", ";", "synchronized", "(", "this", ")", "{", "if", "(", "!", "isMemoryRevokingRequested", "(", ")", "&&", "operatorMemoryCont...
Returns how much revocable memory will be revoked by the operator
[ "Returns", "how", "much", "revocable", "memory", "will", "be", "revoked", "by", "the", "operator" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/OperatorContext.java#L347-L362
129,035
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/ColumnCardinalityCache.java
ColumnCardinalityCache.getColumnCardinality
public long getColumnCardinality(String schema, String table, Authorizations auths, String family, String qualifier, Collection<Range> colValues) throws ExecutionException { LOG.debug("Getting cardinality for %s:%s", family, qualifier); // Collect all exact Accumulo Ranges, i.e. single ...
java
public long getColumnCardinality(String schema, String table, Authorizations auths, String family, String qualifier, Collection<Range> colValues) throws ExecutionException { LOG.debug("Getting cardinality for %s:%s", family, qualifier); // Collect all exact Accumulo Ranges, i.e. single ...
[ "public", "long", "getColumnCardinality", "(", "String", "schema", ",", "String", "table", ",", "Authorizations", "auths", ",", "String", "family", ",", "String", "qualifier", ",", "Collection", "<", "Range", ">", "colValues", ")", "throws", "ExecutionException", ...
Gets the column cardinality for all of the given range values. May reach out to the metrics table in Accumulo to retrieve new cache elements. @param schema Table schema @param table Table name @param auths Scan authorizations @param family Accumulo column family @param qualifier Accumulo column qualifier @param colVal...
[ "Gets", "the", "column", "cardinality", "for", "all", "of", "the", "given", "range", "values", ".", "May", "reach", "out", "to", "the", "metrics", "table", "in", "Accumulo", "to", "retrieve", "new", "cache", "elements", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/ColumnCardinalityCache.java#L188-L220
129,036
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/OrcFileWriterFactory.java
OrcFileWriterFactory.createOrcDataSink
protected OrcDataSink createOrcDataSink(ConnectorSession session, FileSystem fileSystem, Path path) throws IOException { return new OutputStreamOrcDataSink(fileSystem.create(path)); }
java
protected OrcDataSink createOrcDataSink(ConnectorSession session, FileSystem fileSystem, Path path) throws IOException { return new OutputStreamOrcDataSink(fileSystem.create(path)); }
[ "protected", "OrcDataSink", "createOrcDataSink", "(", "ConnectorSession", "session", ",", "FileSystem", "fileSystem", ",", "Path", "path", ")", "throws", "IOException", "{", "return", "new", "OutputStreamOrcDataSink", "(", "fileSystem", ".", "create", "(", "path", "...
Allow subclass to replace data sink implementation.
[ "Allow", "subclass", "to", "replace", "data", "sink", "implementation", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/OrcFileWriterFactory.java#L220-L224
129,037
prestodb/presto
presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTask.java
HttpRemoteTask.failTask
private void failTask(Throwable cause) { TaskStatus taskStatus = getTaskStatus(); if (!taskStatus.getState().isDone()) { log.debug(cause, "Remote task %s failed with %s", taskStatus.getSelf(), cause); } abort(failWith(getTaskStatus(), FAILED, ImmutableList.of(toFailure(c...
java
private void failTask(Throwable cause) { TaskStatus taskStatus = getTaskStatus(); if (!taskStatus.getState().isDone()) { log.debug(cause, "Remote task %s failed with %s", taskStatus.getSelf(), cause); } abort(failWith(getTaskStatus(), FAILED, ImmutableList.of(toFailure(c...
[ "private", "void", "failTask", "(", "Throwable", "cause", ")", "{", "TaskStatus", "taskStatus", "=", "getTaskStatus", "(", ")", ";", "if", "(", "!", "taskStatus", ".", "getState", "(", ")", ".", "isDone", "(", ")", ")", "{", "log", ".", "debug", "(", ...
Move the task directly to the failed state if there was a failure in this task
[ "Move", "the", "task", "directly", "to", "the", "failed", "state", "if", "there", "was", "a", "failure", "in", "this", "task" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/server/remotetask/HttpRemoteTask.java#L822-L830
129,038
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/util/SerDeUtils.java
SerDeUtils.serializeObject
@VisibleForTesting public static Block serializeObject(Type type, BlockBuilder builder, Object object, ObjectInspector inspector, boolean filterNullMapKeys) { switch (inspector.getCategory()) { case PRIMITIVE: serializePrimitive(type, builder, object, (PrimitiveObjectInspecto...
java
@VisibleForTesting public static Block serializeObject(Type type, BlockBuilder builder, Object object, ObjectInspector inspector, boolean filterNullMapKeys) { switch (inspector.getCategory()) { case PRIMITIVE: serializePrimitive(type, builder, object, (PrimitiveObjectInspecto...
[ "@", "VisibleForTesting", "public", "static", "Block", "serializeObject", "(", "Type", "type", ",", "BlockBuilder", "builder", ",", "Object", "object", ",", "ObjectInspector", "inspector", ",", "boolean", "filterNullMapKeys", ")", "{", "switch", "(", "inspector", ...
that contain null map keys. For production, null map keys are not allowed.
[ "that", "contain", "null", "map", "keys", ".", "For", "production", "null", "map", "keys", "are", "not", "allowed", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/util/SerDeUtils.java#L86-L101
129,039
prestodb/presto
presto-array/src/main/java/com/facebook/presto/array/ObjectBigArray.java
ObjectBigArray.get
@SuppressWarnings("unchecked") public T get(long index) { return (T) array[segment(index)][offset(index)]; }
java
@SuppressWarnings("unchecked") public T get(long index) { return (T) array[segment(index)][offset(index)]; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "get", "(", "long", "index", ")", "{", "return", "(", "T", ")", "array", "[", "segment", "(", "index", ")", "]", "[", "offset", "(", "index", ")", "]", ";", "}" ]
Returns the element of this big array at specified index. @param index a position in this big array. @return the element of this big array at the specified position.
[ "Returns", "the", "element", "of", "this", "big", "array", "at", "specified", "index", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-array/src/main/java/com/facebook/presto/array/ObjectBigArray.java#L69-L73
129,040
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/IndexLookup.java
IndexLookup.inRange
private static boolean inRange(Text text, Collection<Range> ranges) { Key kCq = new Key(text); return ranges.stream().anyMatch(r -> !r.beforeStartKey(kCq) && !r.afterEndKey(kCq)); }
java
private static boolean inRange(Text text, Collection<Range> ranges) { Key kCq = new Key(text); return ranges.stream().anyMatch(r -> !r.beforeStartKey(kCq) && !r.afterEndKey(kCq)); }
[ "private", "static", "boolean", "inRange", "(", "Text", "text", ",", "Collection", "<", "Range", ">", "ranges", ")", "{", "Key", "kCq", "=", "new", "Key", "(", "text", ")", ";", "return", "ranges", ".", "stream", "(", ")", ".", "anyMatch", "(", "r", ...
Gets a Boolean value indicating if the given value is in one of the Ranges in the given collection @param text Text object to check against the Range collection @param ranges Ranges to look into @return True if the text object is in one of the ranges, false otherwise
[ "Gets", "a", "Boolean", "value", "indicating", "if", "the", "given", "value", "is", "in", "one", "of", "the", "Ranges", "in", "the", "given", "collection" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/IndexLookup.java#L396-L400
129,041
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/DiskRange.java
DiskRange.span
public DiskRange span(DiskRange otherDiskRange) { requireNonNull(otherDiskRange, "otherDiskRange is null"); long start = Math.min(this.offset, otherDiskRange.getOffset()); long end = Math.max(getEnd(), otherDiskRange.getEnd()); return new DiskRange(start, toIntExact(end - start)); ...
java
public DiskRange span(DiskRange otherDiskRange) { requireNonNull(otherDiskRange, "otherDiskRange is null"); long start = Math.min(this.offset, otherDiskRange.getOffset()); long end = Math.max(getEnd(), otherDiskRange.getEnd()); return new DiskRange(start, toIntExact(end - start)); ...
[ "public", "DiskRange", "span", "(", "DiskRange", "otherDiskRange", ")", "{", "requireNonNull", "(", "otherDiskRange", ",", "\"otherDiskRange is null\"", ")", ";", "long", "start", "=", "Math", ".", "min", "(", "this", ".", "offset", ",", "otherDiskRange", ".", ...
Returns the minimal DiskRange that encloses both this DiskRange and otherDiskRange. If there was a gap between the ranges the new range will cover that gap.
[ "Returns", "the", "minimal", "DiskRange", "that", "encloses", "both", "this", "DiskRange", "and", "otherDiskRange", ".", "If", "there", "was", "a", "gap", "between", "the", "ranges", "the", "new", "range", "will", "cover", "that", "gap", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/DiskRange.java#L62-L68
129,042
prestodb/presto
presto-thrift-connector/src/main/java/com/facebook/presto/connector/thrift/ThriftMetadata.java
ThriftMetadata.getTableMetadataInternal
private Optional<ThriftTableMetadata> getTableMetadataInternal(SchemaTableName schemaTableName) { requireNonNull(schemaTableName, "schemaTableName is null"); PrestoThriftNullableTableMetadata thriftTableMetadata = getTableMetadata(schemaTableName); if (thriftTableMetadata.getTableMetadata() ...
java
private Optional<ThriftTableMetadata> getTableMetadataInternal(SchemaTableName schemaTableName) { requireNonNull(schemaTableName, "schemaTableName is null"); PrestoThriftNullableTableMetadata thriftTableMetadata = getTableMetadata(schemaTableName); if (thriftTableMetadata.getTableMetadata() ...
[ "private", "Optional", "<", "ThriftTableMetadata", ">", "getTableMetadataInternal", "(", "SchemaTableName", "schemaTableName", ")", "{", "requireNonNull", "(", "schemaTableName", ",", "\"schemaTableName is null\"", ")", ";", "PrestoThriftNullableTableMetadata", "thriftTableMeta...
this method makes actual thrift request and should be called only by cache load method
[ "this", "method", "makes", "actual", "thrift", "request", "and", "should", "be", "called", "only", "by", "cache", "load", "method" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-thrift-connector/src/main/java/com/facebook/presto/connector/thrift/ThriftMetadata.java#L198-L210
129,043
prestodb/presto
presto-thrift-connector-api/src/main/java/com/facebook/presto/connector/thrift/api/PrestoThriftTupleDomain.java
PrestoThriftTupleDomain.getDomains
@Nullable @ThriftField(value = 1, requiredness = OPTIONAL) public Map<String, PrestoThriftDomain> getDomains() { return domains; }
java
@Nullable @ThriftField(value = 1, requiredness = OPTIONAL) public Map<String, PrestoThriftDomain> getDomains() { return domains; }
[ "@", "Nullable", "@", "ThriftField", "(", "value", "=", "1", ",", "requiredness", "=", "OPTIONAL", ")", "public", "Map", "<", "String", ",", "PrestoThriftDomain", ">", "getDomains", "(", ")", "{", "return", "domains", ";", "}" ]
Return a map of column names to constraints.
[ "Return", "a", "map", "of", "column", "names", "to", "constraints", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-thrift-connector-api/src/main/java/com/facebook/presto/connector/thrift/api/PrestoThriftTupleDomain.java#L49-L54
129,044
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/TableParameterCodec.java
TableParameterCodec.decode
public Map<String, Object> decode(Map<String, String> tableParameters) { return ImmutableMap.of(); }
java
public Map<String, Object> decode(Map<String, String> tableParameters) { return ImmutableMap.of(); }
[ "public", "Map", "<", "String", ",", "Object", ">", "decode", "(", "Map", "<", "String", ",", "String", ">", "tableParameters", ")", "{", "return", "ImmutableMap", ".", "of", "(", ")", ";", "}" ]
Decode Hive table parameters into additional Presto table properties.
[ "Decode", "Hive", "table", "parameters", "into", "additional", "Presto", "table", "properties", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/TableParameterCodec.java#L25-L28
129,045
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/TableParameterCodec.java
TableParameterCodec.encode
public Map<String, String> encode(Map<String, Object> tableProperties) { return ImmutableMap.of(); }
java
public Map<String, String> encode(Map<String, Object> tableProperties) { return ImmutableMap.of(); }
[ "public", "Map", "<", "String", ",", "String", ">", "encode", "(", "Map", "<", "String", ",", "Object", ">", "tableProperties", ")", "{", "return", "ImmutableMap", ".", "of", "(", ")", ";", "}" ]
Encode additional Presto table properties into Hive table parameters.
[ "Encode", "additional", "Presto", "table", "properties", "into", "Hive", "table", "parameters", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/TableParameterCodec.java#L33-L36
129,046
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
InternalResourceGroup.updateEligibility
private void updateEligibility() { checkState(Thread.holdsLock(root), "Must hold lock to update eligibility"); synchronized (root) { if (!parent.isPresent()) { return; } if (isEligibleToStartNext()) { parent.get().addOrUpdateSubGrou...
java
private void updateEligibility() { checkState(Thread.holdsLock(root), "Must hold lock to update eligibility"); synchronized (root) { if (!parent.isPresent()) { return; } if (isEligibleToStartNext()) { parent.get().addOrUpdateSubGrou...
[ "private", "void", "updateEligibility", "(", ")", "{", "checkState", "(", "Thread", ".", "holdsLock", "(", "root", ")", ",", "\"Must hold lock to update eligibility\"", ")", ";", "synchronized", "(", "root", ")", "{", "if", "(", "!", "parent", ".", "isPresent"...
This method must be called whenever the group's eligibility to run more queries may have changed.
[ "This", "method", "must", "be", "called", "whenever", "the", "group", "s", "eligibility", "to", "run", "more", "queries", "may", "have", "changed", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java#L635-L651
129,047
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java
InternalResourceGroup.internalRefreshStats
protected void internalRefreshStats() { checkState(Thread.holdsLock(root), "Must hold lock to refresh stats"); synchronized (root) { if (subGroups.isEmpty()) { cachedMemoryUsageBytes = 0; for (ManagedQueryExecution query : runningQueries) { ...
java
protected void internalRefreshStats() { checkState(Thread.holdsLock(root), "Must hold lock to refresh stats"); synchronized (root) { if (subGroups.isEmpty()) { cachedMemoryUsageBytes = 0; for (ManagedQueryExecution query : runningQueries) { ...
[ "protected", "void", "internalRefreshStats", "(", ")", "{", "checkState", "(", "Thread", ".", "holdsLock", "(", "root", ")", ",", "\"Must hold lock to refresh stats\"", ")", ";", "synchronized", "(", "root", ")", "{", "if", "(", "subGroups", ".", "isEmpty", "(...
Memory usage stats are expensive to maintain, so this method must be called periodically to update them
[ "Memory", "usage", "stats", "are", "expensive", "to", "maintain", "so", "this", "method", "must", "be", "called", "periodically", "to", "update", "them" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java#L705-L731
129,048
prestodb/presto
presto-main/src/main/java/com/facebook/presto/util/JsonUtil.java
JsonUtil.currentTokenAsVarchar
public static Slice currentTokenAsVarchar(JsonParser parser) throws IOException { switch (parser.currentToken()) { case VALUE_NULL: return null; case VALUE_STRING: case FIELD_NAME: return Slices.utf8Slice(parser.getText()); ...
java
public static Slice currentTokenAsVarchar(JsonParser parser) throws IOException { switch (parser.currentToken()) { case VALUE_NULL: return null; case VALUE_STRING: case FIELD_NAME: return Slices.utf8Slice(parser.getText()); ...
[ "public", "static", "Slice", "currentTokenAsVarchar", "(", "JsonParser", "parser", ")", "throws", "IOException", "{", "switch", "(", "parser", ".", "currentToken", "(", ")", ")", "{", "case", "VALUE_NULL", ":", "return", "null", ";", "case", "VALUE_STRING", ":...
utility classes and functions for cast from JSON
[ "utility", "classes", "and", "functions", "for", "cast", "from", "JSON" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/util/JsonUtil.java#L621-L644
129,049
prestodb/presto
presto-main/src/main/java/com/facebook/presto/util/JsonUtil.java
JsonUtil.currentTokenAsJavaDecimal
private static BigDecimal currentTokenAsJavaDecimal(JsonParser parser, int precision, int scale) throws IOException { BigDecimal result; switch (parser.getCurrentToken()) { case VALUE_NULL: return null; case VALUE_STRING: case FIELD_NAM...
java
private static BigDecimal currentTokenAsJavaDecimal(JsonParser parser, int precision, int scale) throws IOException { BigDecimal result; switch (parser.getCurrentToken()) { case VALUE_NULL: return null; case VALUE_STRING: case FIELD_NAM...
[ "private", "static", "BigDecimal", "currentTokenAsJavaDecimal", "(", "JsonParser", "parser", ",", "int", "precision", ",", "int", "scale", ")", "throws", "IOException", "{", "BigDecimal", "result", ";", "switch", "(", "parser", ".", "getCurrentToken", "(", ")", ...
by calling the corresponding cast-to-decimal function, similar to other JSON cast function.
[ "by", "calling", "the", "corresponding", "cast", "-", "to", "-", "decimal", "function", "similar", "to", "other", "JSON", "cast", "function", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/util/JsonUtil.java#L825-L857
129,050
prestodb/presto
presto-main/src/main/java/com/facebook/presto/util/JsonUtil.java
JsonUtil.parseJsonToSingleRowBlock
public static void parseJsonToSingleRowBlock( JsonParser parser, SingleRowBlockWriter singleRowBlockWriter, BlockBuilderAppender[] fieldAppenders, Optional<Map<String, Integer>> fieldNameToIndex) throws IOException { if (parser.getCurrentToken() ==...
java
public static void parseJsonToSingleRowBlock( JsonParser parser, SingleRowBlockWriter singleRowBlockWriter, BlockBuilderAppender[] fieldAppenders, Optional<Map<String, Integer>> fieldNameToIndex) throws IOException { if (parser.getCurrentToken() ==...
[ "public", "static", "void", "parseJsonToSingleRowBlock", "(", "JsonParser", "parser", ",", "SingleRowBlockWriter", "singleRowBlockWriter", ",", "BlockBuilderAppender", "[", "]", "fieldAppenders", ",", "Optional", "<", "Map", "<", "String", ",", "Integer", ">", ">", ...
Thus there will be single call to this method, so this method can be inlined.
[ "Thus", "there", "will", "be", "single", "call", "to", "this", "method", "so", "this", "method", "can", "be", "inlined", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/util/JsonUtil.java#L1234-L1286
129,051
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/Driver.java
Driver.initialize
private void initialize() { activeOperators.stream() .map(Operator::getOperatorContext) .forEach(operatorContext -> operatorContext.setMemoryRevocationRequestListener(() -> driverBlockedFuture.get().set(null))); }
java
private void initialize() { activeOperators.stream() .map(Operator::getOperatorContext) .forEach(operatorContext -> operatorContext.setMemoryRevocationRequestListener(() -> driverBlockedFuture.get().set(null))); }
[ "private", "void", "initialize", "(", ")", "{", "activeOperators", ".", "stream", "(", ")", ".", "map", "(", "Operator", "::", "getOperatorContext", ")", ".", "forEach", "(", "operatorContext", "->", "operatorContext", ".", "setMemoryRevocationRequestListener", "(...
another thread, which will cause unsafe publication of this instance.
[ "another", "thread", "which", "will", "cause", "unsafe", "publication", "of", "this", "instance", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/Driver.java#L152-L157
129,052
prestodb/presto
presto-parser/src/main/java/com/facebook/presto/sql/tree/DereferenceExpression.java
DereferenceExpression.getQualifiedName
public static QualifiedName getQualifiedName(DereferenceExpression expression) { List<String> parts = tryParseParts(expression.base, expression.field.getValue().toLowerCase(Locale.ENGLISH)); return parts == null ? null : QualifiedName.of(parts); }
java
public static QualifiedName getQualifiedName(DereferenceExpression expression) { List<String> parts = tryParseParts(expression.base, expression.field.getValue().toLowerCase(Locale.ENGLISH)); return parts == null ? null : QualifiedName.of(parts); }
[ "public", "static", "QualifiedName", "getQualifiedName", "(", "DereferenceExpression", "expression", ")", "{", "List", "<", "String", ">", "parts", "=", "tryParseParts", "(", "expression", ".", "base", ",", "expression", ".", "field", ".", "getValue", "(", ")", ...
If this DereferenceExpression looks like a QualifiedName, return QualifiedName. Otherwise return null
[ "If", "this", "DereferenceExpression", "looks", "like", "a", "QualifiedName", "return", "QualifiedName", ".", "Otherwise", "return", "null" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-parser/src/main/java/com/facebook/presto/sql/tree/DereferenceExpression.java#L77-L81
129,053
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/relational/OriginalExpressionUtils.java
OriginalExpressionUtils.castToExpression
public static Expression castToExpression(RowExpression rowExpression) { checkArgument(isExpression(rowExpression)); return ((OriginalExpression) rowExpression).getExpression(); }
java
public static Expression castToExpression(RowExpression rowExpression) { checkArgument(isExpression(rowExpression)); return ((OriginalExpression) rowExpression).getExpression(); }
[ "public", "static", "Expression", "castToExpression", "(", "RowExpression", "rowExpression", ")", "{", "checkArgument", "(", "isExpression", "(", "rowExpression", ")", ")", ";", "return", "(", "(", "OriginalExpression", ")", "rowExpression", ")", ".", "getExpression...
Degrade to Expression
[ "Degrade", "to", "Expression" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/relational/OriginalExpressionUtils.java#L45-L49
129,054
prestodb/presto
presto-main/src/main/java/com/facebook/presto/cost/StatsNormalizer.java
StatsNormalizer.normalizeSymbolStats
private SymbolStatsEstimate normalizeSymbolStats(Symbol symbol, SymbolStatsEstimate symbolStats, PlanNodeStatsEstimate stats, TypeProvider types) { if (symbolStats.isUnknown()) { return SymbolStatsEstimate.unknown(); } double outputRowCount = stats.getOutputRowCount(); c...
java
private SymbolStatsEstimate normalizeSymbolStats(Symbol symbol, SymbolStatsEstimate symbolStats, PlanNodeStatsEstimate stats, TypeProvider types) { if (symbolStats.isUnknown()) { return SymbolStatsEstimate.unknown(); } double outputRowCount = stats.getOutputRowCount(); c...
[ "private", "SymbolStatsEstimate", "normalizeSymbolStats", "(", "Symbol", "symbol", ",", "SymbolStatsEstimate", "symbolStats", ",", "PlanNodeStatsEstimate", "stats", ",", "TypeProvider", "types", ")", "{", "if", "(", "symbolStats", ".", "isUnknown", "(", ")", ")", "{...
Calculates consistent stats for a symbol.
[ "Calculates", "consistent", "stats", "for", "a", "symbol", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/cost/StatsNormalizer.java#L91-L130
129,055
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/QueryTracker.java
QueryTracker.pruneExpiredQueries
private void pruneExpiredQueries() { if (expirationQueue.size() <= maxQueryHistory) { return; } int count = 0; // we're willing to keep full info for up to maxQueryHistory queries for (T query : expirationQueue) { if (expirationQueue.size() - count <=...
java
private void pruneExpiredQueries() { if (expirationQueue.size() <= maxQueryHistory) { return; } int count = 0; // we're willing to keep full info for up to maxQueryHistory queries for (T query : expirationQueue) { if (expirationQueue.size() - count <=...
[ "private", "void", "pruneExpiredQueries", "(", ")", "{", "if", "(", "expirationQueue", ".", "size", "(", ")", "<=", "maxQueryHistory", ")", "{", "return", ";", "}", "int", "count", "=", "0", ";", "// we're willing to keep full info for up to maxQueryHistory queries"...
Prune extraneous info from old queries
[ "Prune", "extraneous", "info", "from", "old", "queries" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/QueryTracker.java#L195-L210
129,056
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/QueryTracker.java
QueryTracker.removeExpiredQueries
private void removeExpiredQueries() { DateTime timeHorizon = DateTime.now().minus(minQueryExpireAge.toMillis()); // we're willing to keep queries beyond timeHorizon as long as we have fewer than maxQueryHistory while (expirationQueue.size() > maxQueryHistory) { T query = expirat...
java
private void removeExpiredQueries() { DateTime timeHorizon = DateTime.now().minus(minQueryExpireAge.toMillis()); // we're willing to keep queries beyond timeHorizon as long as we have fewer than maxQueryHistory while (expirationQueue.size() > maxQueryHistory) { T query = expirat...
[ "private", "void", "removeExpiredQueries", "(", ")", "{", "DateTime", "timeHorizon", "=", "DateTime", ".", "now", "(", ")", ".", "minus", "(", "minQueryExpireAge", ".", "toMillis", "(", ")", ")", ";", "// we're willing to keep queries beyond timeHorizon as long as we ...
Remove completed queries after a waiting period
[ "Remove", "completed", "queries", "after", "a", "waiting", "period" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/QueryTracker.java#L215-L245
129,057
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/LookupJoinOperator.java
LookupJoinOperator.joinCurrentPosition
private boolean joinCurrentPosition(LookupSource lookupSource, DriverYieldSignal yieldSignal) { // while we have a position on lookup side to join against... while (joinPosition >= 0) { if (lookupSource.isJoinPositionEligible(joinPosition, probe.getPosition(), probe.getPage())) { ...
java
private boolean joinCurrentPosition(LookupSource lookupSource, DriverYieldSignal yieldSignal) { // while we have a position on lookup side to join against... while (joinPosition >= 0) { if (lookupSource.isJoinPositionEligible(joinPosition, probe.getPosition(), probe.getPage())) { ...
[ "private", "boolean", "joinCurrentPosition", "(", "LookupSource", "lookupSource", ",", "DriverYieldSignal", "yieldSignal", ")", "{", "// while we have a position on lookup side to join against...", "while", "(", "joinPosition", ">=", "0", ")", "{", "if", "(", "lookupSource"...
Produce rows matching join condition for the current probe position. If this method was called previously for the current probe position, calling this again will produce rows that wasn't been produced in previous invocations. @return true if all eligible rows have been produced; false otherwise
[ "Produce", "rows", "matching", "join", "condition", "for", "the", "current", "probe", "position", ".", "If", "this", "method", "was", "called", "previously", "for", "the", "current", "probe", "position", "calling", "this", "again", "will", "produce", "rows", "...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/LookupJoinOperator.java#L533-L552
129,058
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/LookupJoinPageBuilder.java
LookupJoinPageBuilder.appendRow
public void appendRow(JoinProbe probe, LookupSource lookupSource, long joinPosition) { // probe side appendProbeIndex(probe); // build side buildPageBuilder.declarePosition(); lookupSource.appendTo(joinPosition, buildPageBuilder, 0); }
java
public void appendRow(JoinProbe probe, LookupSource lookupSource, long joinPosition) { // probe side appendProbeIndex(probe); // build side buildPageBuilder.declarePosition(); lookupSource.appendTo(joinPosition, buildPageBuilder, 0); }
[ "public", "void", "appendRow", "(", "JoinProbe", "probe", ",", "LookupSource", "lookupSource", ",", "long", "joinPosition", ")", "{", "// probe side", "appendProbeIndex", "(", "probe", ")", ";", "// build side", "buildPageBuilder", ".", "declarePosition", "(", ")", ...
append the index for the probe and copy the row for the build
[ "append", "the", "index", "for", "the", "probe", "and", "copy", "the", "row", "for", "the", "build" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/LookupJoinPageBuilder.java#L71-L79
129,059
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/LookupJoinPageBuilder.java
LookupJoinPageBuilder.appendNullForBuild
public void appendNullForBuild(JoinProbe probe) { // probe side appendProbeIndex(probe); // build side buildPageBuilder.declarePosition(); for (int i = 0; i < buildOutputChannelCount; i++) { buildPageBuilder.getBlockBuilder(i).appendNull(); } }
java
public void appendNullForBuild(JoinProbe probe) { // probe side appendProbeIndex(probe); // build side buildPageBuilder.declarePosition(); for (int i = 0; i < buildOutputChannelCount; i++) { buildPageBuilder.getBlockBuilder(i).appendNull(); } }
[ "public", "void", "appendNullForBuild", "(", "JoinProbe", "probe", ")", "{", "// probe side", "appendProbeIndex", "(", "probe", ")", ";", "// build side", "buildPageBuilder", ".", "declarePosition", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", ...
append the index for the probe and append nulls for the build
[ "append", "the", "index", "for", "the", "probe", "and", "append", "nulls", "for", "the", "build" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/LookupJoinPageBuilder.java#L84-L94
129,060
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/type/RowType.java
RowType.createWithTypeSignature
public static RowType createWithTypeSignature(TypeSignature typeSignature, List<Field> fields) { return new RowType(typeSignature, fields); }
java
public static RowType createWithTypeSignature(TypeSignature typeSignature, List<Field> fields) { return new RowType(typeSignature, fields); }
[ "public", "static", "RowType", "createWithTypeSignature", "(", "TypeSignature", "typeSignature", ",", "List", "<", "Field", ">", "fields", ")", "{", "return", "new", "RowType", "(", "typeSignature", ",", "fields", ")", ";", "}" ]
Only RowParametricType.createType should call this method
[ "Only", "RowParametricType", ".", "createType", "should", "call", "this", "method" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/type/RowType.java#L76-L79
129,061
prestodb/presto
presto-redis/src/main/java/com/facebook/presto/redis/RedisRecordCursor.java
RedisRecordCursor.fetchKeys
private boolean fetchKeys() { try (Jedis jedis = jedisPool.getResource()) { switch (split.getKeyDataType()) { case STRING: { String cursor = SCAN_POINTER_START; if (redisCursor != null) { cursor = redisCursor.getStri...
java
private boolean fetchKeys() { try (Jedis jedis = jedisPool.getResource()) { switch (split.getKeyDataType()) { case STRING: { String cursor = SCAN_POINTER_START; if (redisCursor != null) { cursor = redisCursor.getStri...
[ "private", "boolean", "fetchKeys", "(", ")", "{", "try", "(", "Jedis", "jedis", "=", "jedisPool", ".", "getResource", "(", ")", ")", "{", "switch", "(", "split", ".", "getKeyDataType", "(", ")", ")", "{", "case", "STRING", ":", "{", "String", "cursor",...
Otherwise they need to be found by scanning Redis
[ "Otherwise", "they", "need", "to", "be", "found", "by", "scanning", "Redis" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-redis/src/main/java/com/facebook/presto/redis/RedisRecordCursor.java#L295-L322
129,062
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/predicate/NullableValue.java
NullableValue.fromSerializable
@JsonCreator public static NullableValue fromSerializable(@JsonProperty("serializable") Serializable serializable) { Type type = serializable.getType(); Block block = serializable.getBlock(); return new NullableValue(type, block == null ? null : Utils.blockToNativeValue(type, block)); ...
java
@JsonCreator public static NullableValue fromSerializable(@JsonProperty("serializable") Serializable serializable) { Type type = serializable.getType(); Block block = serializable.getBlock(); return new NullableValue(type, block == null ? null : Utils.blockToNativeValue(type, block)); ...
[ "@", "JsonCreator", "public", "static", "NullableValue", "fromSerializable", "(", "@", "JsonProperty", "(", "\"serializable\"", ")", "Serializable", "serializable", ")", "{", "Type", "type", "=", "serializable", ".", "getType", "(", ")", ";", "Block", "block", "...
Jackson deserialization only
[ "Jackson", "deserialization", "only" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/predicate/NullableValue.java#L54-L60
129,063
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/predicate/NullableValue.java
NullableValue.getSerializable
@JsonProperty public Serializable getSerializable() { return new Serializable(type, value == null ? null : Utils.nativeValueToBlock(type, value)); }
java
@JsonProperty public Serializable getSerializable() { return new Serializable(type, value == null ? null : Utils.nativeValueToBlock(type, value)); }
[ "@", "JsonProperty", "public", "Serializable", "getSerializable", "(", ")", "{", "return", "new", "Serializable", "(", "type", ",", "value", "==", "null", "?", "null", ":", "Utils", ".", "nativeValueToBlock", "(", "type", ",", "value", ")", ")", ";", "}" ]
Jackson serialization only
[ "Jackson", "serialization", "only" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/predicate/NullableValue.java#L63-L67
129,064
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/index/PageBuffer.java
PageBuffer.add
public synchronized ListenableFuture<?> add(Page page) { checkState(!isFull(), "PageBuffer is full!"); pages.offer(page); if (isFull()) { if (settableFuture == null) { settableFuture = SettableFuture.create(); } return settableFuture; ...
java
public synchronized ListenableFuture<?> add(Page page) { checkState(!isFull(), "PageBuffer is full!"); pages.offer(page); if (isFull()) { if (settableFuture == null) { settableFuture = SettableFuture.create(); } return settableFuture; ...
[ "public", "synchronized", "ListenableFuture", "<", "?", ">", "add", "(", "Page", "page", ")", "{", "checkState", "(", "!", "isFull", "(", ")", ",", "\"PageBuffer is full!\"", ")", ";", "pages", ".", "offer", "(", "page", ")", ";", "if", "(", "isFull", ...
Adds a page to the buffer. Returns a ListenableFuture that is marked as done when the next page can be added.
[ "Adds", "a", "page", "to", "the", "buffer", ".", "Returns", "a", "ListenableFuture", "that", "is", "marked", "as", "done", "when", "the", "next", "page", "can", "be", "added", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/index/PageBuffer.java#L54-L65
129,065
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/index/PageBuffer.java
PageBuffer.poll
public synchronized Page poll() { if (settableFuture != null) { settableFuture.set(null); settableFuture = null; } return pages.poll(); }
java
public synchronized Page poll() { if (settableFuture != null) { settableFuture.set(null); settableFuture = null; } return pages.poll(); }
[ "public", "synchronized", "Page", "poll", "(", ")", "{", "if", "(", "settableFuture", "!=", "null", ")", "{", "settableFuture", ".", "set", "(", "null", ")", ";", "settableFuture", "=", "null", ";", "}", "return", "pages", ".", "poll", "(", ")", ";", ...
Return a page from the buffer, or null if none exists
[ "Return", "a", "page", "from", "the", "buffer", "or", "null", "if", "none", "exists" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/index/PageBuffer.java#L70-L77
129,066
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/PropertyDerivations.java
PropertyDerivations.filterOrRewrite
public static Optional<Symbol> filterOrRewrite(Collection<Symbol> columns, Collection<JoinNode.EquiJoinClause> equalities, Symbol column) { // symbol is exposed directly, so no translation needed if (columns.contains(column)) { return Optional.of(column); } // if the col...
java
public static Optional<Symbol> filterOrRewrite(Collection<Symbol> columns, Collection<JoinNode.EquiJoinClause> equalities, Symbol column) { // symbol is exposed directly, so no translation needed if (columns.contains(column)) { return Optional.of(column); } // if the col...
[ "public", "static", "Optional", "<", "Symbol", ">", "filterOrRewrite", "(", "Collection", "<", "Symbol", ">", "columns", ",", "Collection", "<", "JoinNode", ".", "EquiJoinClause", ">", "equalities", ",", "Symbol", "column", ")", "{", "// symbol is exposed directly...
to the other symbol if that's exposed, instead.
[ "to", "the", "other", "symbol", "if", "that", "s", "exposed", "instead", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/optimizations/PropertyDerivations.java#L820-L839
129,067
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/PushAggregationThroughOuterJoin.java
PushAggregationThroughOuterJoin.coalesceWithNullAggregation
private Optional<PlanNode> coalesceWithNullAggregation(AggregationNode aggregationNode, PlanNode outerJoin, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, Lookup lookup) { // Create an aggregation node over a row of nulls. Optional<MappedAggregationInfo> aggregationOverNullInfoRes...
java
private Optional<PlanNode> coalesceWithNullAggregation(AggregationNode aggregationNode, PlanNode outerJoin, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, Lookup lookup) { // Create an aggregation node over a row of nulls. Optional<MappedAggregationInfo> aggregationOverNullInfoRes...
[ "private", "Optional", "<", "PlanNode", ">", "coalesceWithNullAggregation", "(", "AggregationNode", "aggregationNode", ",", "PlanNode", "outerJoin", ",", "SymbolAllocator", "symbolAllocator", ",", "PlanNodeIdAllocator", "idAllocator", ",", "Lookup", "lookup", ")", "{", ...
null row.
[ "null", "row", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/iterative/rule/PushAggregationThroughOuterJoin.java#L220-L265
129,068
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java
EqualityInference.rewriteExpression
public Expression rewriteExpression(Expression expression, Predicate<Symbol> symbolScope) { checkArgument(isDeterministic(expression), "Only deterministic expressions may be considered for rewrite"); return rewriteExpression(expression, symbolScope, true); }
java
public Expression rewriteExpression(Expression expression, Predicate<Symbol> symbolScope) { checkArgument(isDeterministic(expression), "Only deterministic expressions may be considered for rewrite"); return rewriteExpression(expression, symbolScope, true); }
[ "public", "Expression", "rewriteExpression", "(", "Expression", "expression", ",", "Predicate", "<", "Symbol", ">", "symbolScope", ")", "{", "checkArgument", "(", "isDeterministic", "(", "expression", ")", ",", "\"Only deterministic expressions may be considered for rewrite...
Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope given the known equalities. Returns null if unsuccessful. This method checks if rewritten expression is non-deterministic.
[ "Attempts", "to", "rewrite", "an", "Expression", "in", "terms", "of", "the", "symbols", "allowed", "by", "the", "symbol", "scope", "given", "the", "known", "equalities", ".", "Returns", "null", "if", "unsuccessful", ".", "This", "method", "checks", "if", "re...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java#L99-L103
129,069
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java
EqualityInference.rewriteExpressionAllowNonDeterministic
public Expression rewriteExpressionAllowNonDeterministic(Expression expression, Predicate<Symbol> symbolScope) { return rewriteExpression(expression, symbolScope, true); }
java
public Expression rewriteExpressionAllowNonDeterministic(Expression expression, Predicate<Symbol> symbolScope) { return rewriteExpression(expression, symbolScope, true); }
[ "public", "Expression", "rewriteExpressionAllowNonDeterministic", "(", "Expression", "expression", ",", "Predicate", "<", "Symbol", ">", "symbolScope", ")", "{", "return", "rewriteExpression", "(", "expression", ",", "symbolScope", ",", "true", ")", ";", "}" ]
Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope given the known equalities. Returns null if unsuccessful. This method allows rewriting non-deterministic expressions.
[ "Attempts", "to", "rewrite", "an", "Expression", "in", "terms", "of", "the", "symbols", "allowed", "by", "the", "symbol", "scope", "given", "the", "known", "equalities", ".", "Returns", "null", "if", "unsuccessful", ".", "This", "method", "allows", "rewriting"...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java#L110-L113
129,070
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java
EqualityInference.getCanonical
private static Expression getCanonical(Iterable<Expression> expressions) { if (Iterables.isEmpty(expressions)) { return null; } return CANONICAL_ORDERING.min(expressions); }
java
private static Expression getCanonical(Iterable<Expression> expressions) { if (Iterables.isEmpty(expressions)) { return null; } return CANONICAL_ORDERING.min(expressions); }
[ "private", "static", "Expression", "getCanonical", "(", "Iterable", "<", "Expression", ">", "expressions", ")", "{", "if", "(", "Iterables", ".", "isEmpty", "(", "expressions", ")", ")", "{", "return", "null", ";", "}", "return", "CANONICAL_ORDERING", ".", "...
Returns the most preferrable expression to be used as the canonical expression
[ "Returns", "the", "most", "preferrable", "expression", "to", "be", "used", "as", "the", "canonical", "expression" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java#L228-L234
129,071
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java
EqualityInference.isInferenceCandidate
public static Predicate<Expression> isInferenceCandidate() { return expression -> { expression = normalizeInPredicateToEquality(expression); if (expression instanceof ComparisonExpression && isDeterministic(expression) && !mayReturnNullOnNonNul...
java
public static Predicate<Expression> isInferenceCandidate() { return expression -> { expression = normalizeInPredicateToEquality(expression); if (expression instanceof ComparisonExpression && isDeterministic(expression) && !mayReturnNullOnNonNul...
[ "public", "static", "Predicate", "<", "Expression", ">", "isInferenceCandidate", "(", ")", "{", "return", "expression", "->", "{", "expression", "=", "normalizeInPredicateToEquality", "(", "expression", ")", ";", "if", "(", "expression", "instanceof", "ComparisonExp...
Determines whether an Expression may be successfully applied to the equality inference
[ "Determines", "whether", "an", "Expression", "may", "be", "successfully", "applied", "to", "the", "equality", "inference" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java#L258-L273
129,072
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java
EqualityInference.normalizeInPredicateToEquality
private static Expression normalizeInPredicateToEquality(Expression expression) { if (expression instanceof InPredicate) { InPredicate inPredicate = (InPredicate) expression; if (inPredicate.getValueList() instanceof InListExpression) { InListExpression valueList = (I...
java
private static Expression normalizeInPredicateToEquality(Expression expression) { if (expression instanceof InPredicate) { InPredicate inPredicate = (InPredicate) expression; if (inPredicate.getValueList() instanceof InListExpression) { InListExpression valueList = (I...
[ "private", "static", "Expression", "normalizeInPredicateToEquality", "(", "Expression", "expression", ")", "{", "if", "(", "expression", "instanceof", "InPredicate", ")", "{", "InPredicate", "inPredicate", "=", "(", "InPredicate", ")", "expression", ";", "if", "(", ...
Rewrite single value InPredicates as equality if possible
[ "Rewrite", "single", "value", "InPredicates", "as", "equality", "if", "possible" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java#L278-L290
129,073
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java
EqualityInference.nonInferrableConjuncts
public static Iterable<Expression> nonInferrableConjuncts(Expression expression) { return filter(extractConjuncts(expression), not(isInferenceCandidate())); }
java
public static Iterable<Expression> nonInferrableConjuncts(Expression expression) { return filter(extractConjuncts(expression), not(isInferenceCandidate())); }
[ "public", "static", "Iterable", "<", "Expression", ">", "nonInferrableConjuncts", "(", "Expression", "expression", ")", "{", "return", "filter", "(", "extractConjuncts", "(", "expression", ")", ",", "not", "(", "isInferenceCandidate", "(", ")", ")", ")", ";", ...
Provides a convenience Iterable of Expression conjuncts which have not been added to the inference
[ "Provides", "a", "convenience", "Iterable", "of", "Expression", "conjuncts", "which", "have", "not", "been", "added", "to", "the", "inference" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/EqualityInference.java#L295-L298
129,074
prestodb/presto
presto-main/src/main/java/com/facebook/presto/spiller/SpillSpaceTracker.java
SpillSpaceTracker.reserve
public synchronized ListenableFuture<?> reserve(long bytes) { checkArgument(bytes >= 0, "bytes is negative"); if ((currentBytes + bytes) >= maxBytes) { throw exceededLocalLimit(succinctBytes(maxBytes)); } currentBytes += bytes; return NOT_BLOCKED; }
java
public synchronized ListenableFuture<?> reserve(long bytes) { checkArgument(bytes >= 0, "bytes is negative"); if ((currentBytes + bytes) >= maxBytes) { throw exceededLocalLimit(succinctBytes(maxBytes)); } currentBytes += bytes; return NOT_BLOCKED; }
[ "public", "synchronized", "ListenableFuture", "<", "?", ">", "reserve", "(", "long", "bytes", ")", "{", "checkArgument", "(", "bytes", ">=", "0", ",", "\"bytes is negative\"", ")", ";", "if", "(", "(", "currentBytes", "+", "bytes", ")", ">=", "maxBytes", "...
Reserves the given number of bytes to spill. If more than the maximum, throws an exception. @throws ExceededSpillLimitException
[ "Reserves", "the", "given", "number", "of", "bytes", "to", "spill", ".", "If", "more", "than", "the", "maximum", "throws", "an", "exception", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/spiller/SpillSpaceTracker.java#L51-L61
129,075
prestodb/presto
presto-main/src/main/java/com/facebook/presto/memory/MemoryPool.java
MemoryPool.reserve
public ListenableFuture<?> reserve(QueryId queryId, String allocationTag, long bytes) { checkArgument(bytes >= 0, "bytes is negative"); ListenableFuture<?> result; synchronized (this) { if (bytes != 0) { queryMemoryReservations.merge(queryId, bytes, Long::sum); ...
java
public ListenableFuture<?> reserve(QueryId queryId, String allocationTag, long bytes) { checkArgument(bytes >= 0, "bytes is negative"); ListenableFuture<?> result; synchronized (this) { if (bytes != 0) { queryMemoryReservations.merge(queryId, bytes, Long::sum); ...
[ "public", "ListenableFuture", "<", "?", ">", "reserve", "(", "QueryId", "queryId", ",", "String", "allocationTag", ",", "long", "bytes", ")", "{", "checkArgument", "(", "bytes", ">=", "0", ",", "\"bytes is negative\"", ")", ";", "ListenableFuture", "<", "?", ...
Reserves the given number of bytes. Caller should wait on the returned future, before allocating more memory.
[ "Reserves", "the", "given", "number", "of", "bytes", ".", "Caller", "should", "wait", "on", "the", "returned", "future", "before", "allocating", "more", "memory", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/memory/MemoryPool.java#L110-L135
129,076
prestodb/presto
presto-main/src/main/java/com/facebook/presto/memory/MemoryPool.java
MemoryPool.tryReserve
public boolean tryReserve(QueryId queryId, String allocationTag, long bytes) { checkArgument(bytes >= 0, "bytes is negative"); synchronized (this) { if (getFreeBytes() - bytes < 0) { return false; } reservedBytes += bytes; if (bytes != ...
java
public boolean tryReserve(QueryId queryId, String allocationTag, long bytes) { checkArgument(bytes >= 0, "bytes is negative"); synchronized (this) { if (getFreeBytes() - bytes < 0) { return false; } reservedBytes += bytes; if (bytes != ...
[ "public", "boolean", "tryReserve", "(", "QueryId", "queryId", ",", "String", "allocationTag", ",", "long", "bytes", ")", "{", "checkArgument", "(", "bytes", ">=", "0", ",", "\"bytes is negative\"", ")", ";", "synchronized", "(", "this", ")", "{", "if", "(", ...
Try to reserve the given number of bytes. Return value indicates whether the caller may use the requested memory.
[ "Try", "to", "reserve", "the", "given", "number", "of", "bytes", ".", "Return", "value", "indicates", "whether", "the", "caller", "may", "use", "the", "requested", "memory", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/memory/MemoryPool.java#L171-L187
129,077
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/Partitioning.java
Partitioning.jsonCreate
@JsonCreator public static Partitioning jsonCreate( @JsonProperty("handle") PartitioningHandle handle, @JsonProperty("arguments") List<ArgumentBinding> arguments) { return new Partitioning(handle, arguments); }
java
@JsonCreator public static Partitioning jsonCreate( @JsonProperty("handle") PartitioningHandle handle, @JsonProperty("arguments") List<ArgumentBinding> arguments) { return new Partitioning(handle, arguments); }
[ "@", "JsonCreator", "public", "static", "Partitioning", "jsonCreate", "(", "@", "JsonProperty", "(", "\"handle\"", ")", "PartitioningHandle", "handle", ",", "@", "JsonProperty", "(", "\"arguments\"", ")", "List", "<", "ArgumentBinding", ">", "arguments", ")", "{",...
Factory method for JSON serde only!
[ "Factory", "method", "for", "JSON", "serde", "only!" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/Partitioning.java#L59-L65
129,078
prestodb/presto
presto-main/src/main/java/com/facebook/presto/sql/planner/Partitioning.java
Partitioning.isRefinedPartitioningOver
public boolean isRefinedPartitioningOver( Partitioning right, Metadata metadata, Session session) { if (!handle.equals(right.handle) && !metadata.isRefinedPartitioningOver(session, handle, right.handle)) { return false; } return arguments.equa...
java
public boolean isRefinedPartitioningOver( Partitioning right, Metadata metadata, Session session) { if (!handle.equals(right.handle) && !metadata.isRefinedPartitioningOver(session, handle, right.handle)) { return false; } return arguments.equa...
[ "public", "boolean", "isRefinedPartitioningOver", "(", "Partitioning", "right", ",", "Metadata", "metadata", ",", "Session", "session", ")", "{", "if", "(", "!", "handle", ".", "equals", "(", "right", ".", "handle", ")", "&&", "!", "metadata", ".", "isRefine...
Refined-over relation is reflexive.
[ "Refined", "-", "over", "relation", "is", "reflexive", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/planner/Partitioning.java#L129-L139
129,079
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/predicate/TupleDomain.java
TupleDomain.extractFixedValues
public static <T> Optional<Map<T, NullableValue>> extractFixedValues(TupleDomain<T> tupleDomain) { if (!tupleDomain.getDomains().isPresent()) { return Optional.empty(); } return Optional.of(tupleDomain.getDomains().get() .entrySet().stream() .filt...
java
public static <T> Optional<Map<T, NullableValue>> extractFixedValues(TupleDomain<T> tupleDomain) { if (!tupleDomain.getDomains().isPresent()) { return Optional.empty(); } return Optional.of(tupleDomain.getDomains().get() .entrySet().stream() .filt...
[ "public", "static", "<", "T", ">", "Optional", "<", "Map", "<", "T", ",", "NullableValue", ">", ">", "extractFixedValues", "(", "TupleDomain", "<", "T", ">", "tupleDomain", ")", "{", "if", "(", "!", "tupleDomain", ".", "getDomains", "(", ")", ".", "isP...
Extract all column constraints that require exactly one value or only null in their respective Domains. Returns an empty Optional if the Domain is none.
[ "Extract", "all", "column", "constraints", "that", "require", "exactly", "one", "value", "or", "only", "null", "in", "their", "respective", "Domains", ".", "Returns", "an", "empty", "Optional", "if", "the", "Domain", "is", "none", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/predicate/TupleDomain.java#L92-L102
129,080
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/predicate/TupleDomain.java
TupleDomain.fromFixedValues
public static <T> TupleDomain<T> fromFixedValues(Map<T, NullableValue> fixedValues) { return TupleDomain.withColumnDomains(fixedValues.entrySet().stream() .collect(toLinkedMap( Map.Entry::getKey, entry -> { Type type...
java
public static <T> TupleDomain<T> fromFixedValues(Map<T, NullableValue> fixedValues) { return TupleDomain.withColumnDomains(fixedValues.entrySet().stream() .collect(toLinkedMap( Map.Entry::getKey, entry -> { Type type...
[ "public", "static", "<", "T", ">", "TupleDomain", "<", "T", ">", "fromFixedValues", "(", "Map", "<", "T", ",", "NullableValue", ">", "fixedValues", ")", "{", "return", "TupleDomain", ".", "withColumnDomains", "(", "fixedValues", ".", "entrySet", "(", ")", ...
Convert a map of columns to values into the TupleDomain which requires those columns to be fixed to those values. Null is allowed as a fixed value.
[ "Convert", "a", "map", "of", "columns", "to", "values", "into", "the", "TupleDomain", "which", "requires", "those", "columns", "to", "be", "fixed", "to", "those", "values", ".", "Null", "is", "allowed", "as", "a", "fixed", "value", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/predicate/TupleDomain.java#L108-L118
129,081
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/predicate/TupleDomain.java
TupleDomain.intersect
public TupleDomain<T> intersect(TupleDomain<T> other) { if (this.isNone() || other.isNone()) { return none(); } Map<T, Domain> intersected = new LinkedHashMap<>(this.getDomains().get()); for (Map.Entry<T, Domain> entry : other.getDomains().get().entrySet()) { ...
java
public TupleDomain<T> intersect(TupleDomain<T> other) { if (this.isNone() || other.isNone()) { return none(); } Map<T, Domain> intersected = new LinkedHashMap<>(this.getDomains().get()); for (Map.Entry<T, Domain> entry : other.getDomains().get().entrySet()) { ...
[ "public", "TupleDomain", "<", "T", ">", "intersect", "(", "TupleDomain", "<", "T", ">", "other", ")", "{", "if", "(", "this", ".", "isNone", "(", ")", "||", "other", ".", "isNone", "(", ")", ")", "{", "return", "none", "(", ")", ";", "}", "Map", ...
Returns the strict intersection of the TupleDomains. The resulting TupleDomain represents the set of tuples that would be valid in both TupleDomains.
[ "Returns", "the", "strict", "intersection", "of", "the", "TupleDomains", ".", "The", "resulting", "TupleDomain", "represents", "the", "set", "of", "tuples", "that", "would", "be", "valid", "in", "both", "TupleDomains", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/predicate/TupleDomain.java#L185-L202
129,082
prestodb/presto
presto-parquet/src/main/java/com/facebook/presto/parquet/reader/ListColumnReader.java
ListColumnReader.getCollectionSize
private static int getCollectionSize(int[] repetitionLevels, int maxRepetitionLevel, int nextIndex) { int size = 1; while (hasMoreElements(repetitionLevels, nextIndex) && !isCollectionBeginningMarker(repetitionLevels, maxRepetitionLevel, nextIndex)) { // Collection elements can not only ...
java
private static int getCollectionSize(int[] repetitionLevels, int maxRepetitionLevel, int nextIndex) { int size = 1; while (hasMoreElements(repetitionLevels, nextIndex) && !isCollectionBeginningMarker(repetitionLevels, maxRepetitionLevel, nextIndex)) { // Collection elements can not only ...
[ "private", "static", "int", "getCollectionSize", "(", "int", "[", "]", "repetitionLevels", ",", "int", "maxRepetitionLevel", ",", "int", "nextIndex", ")", "{", "int", "size", "=", "1", ";", "while", "(", "hasMoreElements", "(", "repetitionLevels", ",", "nextIn...
This method is only called for non-empty collections
[ "This", "method", "is", "only", "called", "for", "non", "-", "empty", "collections" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-parquet/src/main/java/com/facebook/presto/parquet/reader/ListColumnReader.java#L73-L85
129,083
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/HiveColumnHandle.java
HiveColumnHandle.bucketColumnHandle
public static HiveColumnHandle bucketColumnHandle() { return new HiveColumnHandle(BUCKET_COLUMN_NAME, BUCKET_HIVE_TYPE, BUCKET_TYPE_SIGNATURE, BUCKET_COLUMN_INDEX, SYNTHESIZED, Optional.empty()); }
java
public static HiveColumnHandle bucketColumnHandle() { return new HiveColumnHandle(BUCKET_COLUMN_NAME, BUCKET_HIVE_TYPE, BUCKET_TYPE_SIGNATURE, BUCKET_COLUMN_INDEX, SYNTHESIZED, Optional.empty()); }
[ "public", "static", "HiveColumnHandle", "bucketColumnHandle", "(", ")", "{", "return", "new", "HiveColumnHandle", "(", "BUCKET_COLUMN_NAME", ",", "BUCKET_HIVE_TYPE", ",", "BUCKET_TYPE_SIGNATURE", ",", "BUCKET_COLUMN_INDEX", ",", "SYNTHESIZED", ",", "Optional", ".", "emp...
The column indicating the bucket id. When table bucketing differs from partition bucketing, this column indicates what bucket the row will fall in under the table bucketing scheme.
[ "The", "column", "indicating", "the", "bucket", "id", ".", "When", "table", "bucketing", "differs", "from", "partition", "bucketing", "this", "column", "indicates", "what", "bucket", "the", "row", "will", "fall", "in", "under", "the", "table", "bucketing", "sc...
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/HiveColumnHandle.java#L183-L186
129,084
prestodb/presto
presto-parser/src/main/java/com/facebook/presto/sql/tree/QualifiedName.java
QualifiedName.getPrefix
public Optional<QualifiedName> getPrefix() { if (parts.size() == 1) { return Optional.empty(); } List<String> subList = parts.subList(0, parts.size() - 1); return Optional.of(new QualifiedName(subList, subList)); }
java
public Optional<QualifiedName> getPrefix() { if (parts.size() == 1) { return Optional.empty(); } List<String> subList = parts.subList(0, parts.size() - 1); return Optional.of(new QualifiedName(subList, subList)); }
[ "public", "Optional", "<", "QualifiedName", ">", "getPrefix", "(", ")", "{", "if", "(", "parts", ".", "size", "(", ")", "==", "1", ")", "{", "return", "Optional", ".", "empty", "(", ")", ";", "}", "List", "<", "String", ">", "subList", "=", "parts"...
For an identifier of the form "a.b.c.d", returns "a.b.c" For an identifier of the form "a", returns absent
[ "For", "an", "identifier", "of", "the", "form", "a", ".", "b", ".", "c", ".", "d", "returns", "a", ".", "b", ".", "c", "For", "an", "identifier", "of", "the", "form", "a", "returns", "absent" ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-parser/src/main/java/com/facebook/presto/sql/tree/QualifiedName.java#L82-L90
129,085
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/executor/TaskHandle.java
TaskHandle.destroy
public synchronized List<PrioritizedSplitRunner> destroy() { destroyed = true; ImmutableList.Builder<PrioritizedSplitRunner> builder = ImmutableList.builder(); builder.addAll(runningIntermediateSplits); builder.addAll(runningLeafSplits); builder.addAll(queuedLeafSplits); ...
java
public synchronized List<PrioritizedSplitRunner> destroy() { destroyed = true; ImmutableList.Builder<PrioritizedSplitRunner> builder = ImmutableList.builder(); builder.addAll(runningIntermediateSplits); builder.addAll(runningLeafSplits); builder.addAll(queuedLeafSplits); ...
[ "public", "synchronized", "List", "<", "PrioritizedSplitRunner", ">", "destroy", "(", ")", "{", "destroyed", "=", "true", ";", "ImmutableList", ".", "Builder", "<", "PrioritizedSplitRunner", ">", "builder", "=", "ImmutableList", ".", "builder", "(", ")", ";", ...
Returns any remaining splits. The caller must destroy these.
[ "Returns", "any", "remaining", "splits", ".", "The", "caller", "must", "destroy", "these", "." ]
89de5e379d8f85e139d292b0add8c537a2a01a88
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/executor/TaskHandle.java#L123-L135
129,086
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/OAuth2Utils.java
OAuth2Utils.parseParameterList
public static Set<String> parseParameterList(String values) { Set<String> result = new TreeSet<String>(); if (values != null && values.trim().length() > 0) { // the spec says the scope is separated by spaces String[] tokens = values.split("[\\s+]"); result.addAll(Arrays.asList(tokens)); } return result...
java
public static Set<String> parseParameterList(String values) { Set<String> result = new TreeSet<String>(); if (values != null && values.trim().length() > 0) { // the spec says the scope is separated by spaces String[] tokens = values.split("[\\s+]"); result.addAll(Arrays.asList(tokens)); } return result...
[ "public", "static", "Set", "<", "String", ">", "parseParameterList", "(", "String", "values", ")", "{", "Set", "<", "String", ">", "result", "=", "new", "TreeSet", "<", "String", ">", "(", ")", ";", "if", "(", "values", "!=", "null", "&&", "values", ...
Parses a string parameter value into a set of strings. @param values The values of the set. @return The set.
[ "Parses", "a", "string", "parameter", "value", "into", "a", "set", "of", "strings", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/OAuth2Utils.java#L81-L89
129,087
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/OAuth2Utils.java
OAuth2Utils.formatParameterList
public static String formatParameterList(Collection<String> value) { return value == null ? null : StringUtils.collectionToDelimitedString(value, " "); }
java
public static String formatParameterList(Collection<String> value) { return value == null ? null : StringUtils.collectionToDelimitedString(value, " "); }
[ "public", "static", "String", "formatParameterList", "(", "Collection", "<", "String", ">", "value", ")", "{", "return", "value", "==", "null", "?", "null", ":", "StringUtils", ".", "collectionToDelimitedString", "(", "value", ",", "\" \"", ")", ";", "}" ]
Formats a set of string values into a format appropriate for sending as a single-valued form value. @param value The value of the parameter. @return The value formatted for form submission etc, or null if the input is empty
[ "Formats", "a", "set", "of", "string", "values", "into", "a", "format", "appropriate", "for", "sending", "as", "a", "single", "-", "valued", "form", "value", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/OAuth2Utils.java#L97-L99
129,088
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/OAuth2Utils.java
OAuth2Utils.extractMap
public static Map<String, String> extractMap(String query) { Map<String, String> map = new HashMap<String, String>(); Properties properties = StringUtils.splitArrayElementsIntoProperties( StringUtils.delimitedListToStringArray(query, "&"), "="); if (properties != null) { for (Object key : properties.keySet...
java
public static Map<String, String> extractMap(String query) { Map<String, String> map = new HashMap<String, String>(); Properties properties = StringUtils.splitArrayElementsIntoProperties( StringUtils.delimitedListToStringArray(query, "&"), "="); if (properties != null) { for (Object key : properties.keySet...
[ "public", "static", "Map", "<", "String", ",", "String", ">", "extractMap", "(", "String", "query", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "Properties", "pro...
Extract a map from a query string. @param query a query (or fragment) string from a URI @return a Map of the values in the query
[ "Extract", "a", "map", "from", "a", "query", "string", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/OAuth2Utils.java#L107-L117
129,089
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/OAuth2Utils.java
OAuth2Utils.containsAll
public static boolean containsAll(Set<String> target, Set<String> members) { target = new HashSet<String>(target); target.retainAll(members); return target.size() == members.size(); }
java
public static boolean containsAll(Set<String> target, Set<String> members) { target = new HashSet<String>(target); target.retainAll(members); return target.size() == members.size(); }
[ "public", "static", "boolean", "containsAll", "(", "Set", "<", "String", ">", "target", ",", "Set", "<", "String", ">", "members", ")", "{", "target", "=", "new", "HashSet", "<", "String", ">", "(", "target", ")", ";", "target", ".", "retainAll", "(", ...
Compare 2 sets and check that one contains all members of the other. @param target set of strings to check @param members the members to compare to @return true if all members are in the target
[ "Compare", "2", "sets", "and", "check", "that", "one", "contains", "all", "members", "of", "the", "other", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/common/util/OAuth2Utils.java#L126-L130
129,090
spring-projects/spring-security-oauth
spring-security-oauth/src/main/java/org/springframework/security/oauth/config/OAuthProviderBeanDefinitionParser.java
OAuthProviderBeanDefinitionParser.insertIndex
private int insertIndex(List<BeanMetadataElement> filterChain) { int i; for (i = 0; i < filterChain.size(); i++) { BeanMetadataElement filter = filterChain.get(i); if (filter instanceof BeanDefinition) { String beanName = ((BeanDefinition) filter).getBeanClassName(); if (beanName.equ...
java
private int insertIndex(List<BeanMetadataElement> filterChain) { int i; for (i = 0; i < filterChain.size(); i++) { BeanMetadataElement filter = filterChain.get(i); if (filter instanceof BeanDefinition) { String beanName = ((BeanDefinition) filter).getBeanClassName(); if (beanName.equ...
[ "private", "int", "insertIndex", "(", "List", "<", "BeanMetadataElement", ">", "filterChain", ")", "{", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "filterChain", ".", "size", "(", ")", ";", "i", "++", ")", "{", "BeanMetadataElement", ...
Attempts to find the place in the filter chain to insert the spring security oauth filters. Currently, these filters are inserted after the ExceptionTranslationFilter. @param filterChain The filter chain configuration. @return The insert index.
[ "Attempts", "to", "find", "the", "place", "in", "the", "filter", "chain", "to", "insert", "the", "spring", "security", "oauth", "filters", ".", "Currently", "these", "filters", "are", "inserted", "after", "the", "ExceptionTranslationFilter", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth/src/main/java/org/springframework/security/oauth/config/OAuthProviderBeanDefinitionParser.java#L200-L212
129,091
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/client/token/AccessTokenProviderChain.java
AccessTokenProviderChain.refreshAccessToken
public OAuth2AccessToken refreshAccessToken(OAuth2ProtectedResourceDetails resource, OAuth2RefreshToken refreshToken, AccessTokenRequest request) throws UserRedirectRequiredException { for (AccessTokenProvider tokenProvider : chain) { if (tokenProvider.supportsRefresh(resource)) { DefaultOAuth2AccessToke...
java
public OAuth2AccessToken refreshAccessToken(OAuth2ProtectedResourceDetails resource, OAuth2RefreshToken refreshToken, AccessTokenRequest request) throws UserRedirectRequiredException { for (AccessTokenProvider tokenProvider : chain) { if (tokenProvider.supportsRefresh(resource)) { DefaultOAuth2AccessToke...
[ "public", "OAuth2AccessToken", "refreshAccessToken", "(", "OAuth2ProtectedResourceDetails", "resource", ",", "OAuth2RefreshToken", "refreshToken", ",", "AccessTokenRequest", "request", ")", "throws", "UserRedirectRequiredException", "{", "for", "(", "AccessTokenProvider", "toke...
Obtain a new access token for the specified resource using the refresh token. @param resource The resource. @param refreshToken The refresh token. @return The access token, or null if failed. @throws UserRedirectRequiredException
[ "Obtain", "a", "new", "access", "token", "for", "the", "specified", "resource", "using", "the", "refresh", "token", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/client/token/AccessTokenProviderChain.java#L166-L185
129,092
spring-projects/spring-security-oauth
spring-security-jwt/src/main/java/org/springframework/security/jwt/JwtHelper.java
JwtHelper.decode
public static Jwt decode(String token) { int firstPeriod = token.indexOf('.'); int lastPeriod = token.lastIndexOf('.'); if (firstPeriod <= 0 || lastPeriod <= firstPeriod) { throw new IllegalArgumentException("JWT must have 3 tokens"); } CharBuffer buffer = CharBuffer.wrap(token, 0, firstPeriod); // TODO...
java
public static Jwt decode(String token) { int firstPeriod = token.indexOf('.'); int lastPeriod = token.lastIndexOf('.'); if (firstPeriod <= 0 || lastPeriod <= firstPeriod) { throw new IllegalArgumentException("JWT must have 3 tokens"); } CharBuffer buffer = CharBuffer.wrap(token, 0, firstPeriod); // TODO...
[ "public", "static", "Jwt", "decode", "(", "String", "token", ")", "{", "int", "firstPeriod", "=", "token", ".", "indexOf", "(", "'", "'", ")", ";", "int", "lastPeriod", "=", "token", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "firstPerio...
Creates a token from an encoded token string. @param token the (non-null) encoded token (three Base-64 encoded strings separated by "." characters)
[ "Creates", "a", "token", "from", "an", "encoded", "token", "string", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-jwt/src/main/java/org/springframework/security/jwt/JwtHelper.java#L44-L73
129,093
spring-projects/spring-security-oauth
spring-security-jwt/src/main/java/org/springframework/security/jwt/JwtHelper.java
JwtImpl.bytes
@Override public byte[] bytes() { return concat(b64UrlEncode(header.bytes()), JwtHelper.PERIOD, b64UrlEncode(content), JwtHelper.PERIOD, b64UrlEncode(crypto)); }
java
@Override public byte[] bytes() { return concat(b64UrlEncode(header.bytes()), JwtHelper.PERIOD, b64UrlEncode(content), JwtHelper.PERIOD, b64UrlEncode(crypto)); }
[ "@", "Override", "public", "byte", "[", "]", "bytes", "(", ")", "{", "return", "concat", "(", "b64UrlEncode", "(", "header", ".", "bytes", "(", ")", ")", ",", "JwtHelper", ".", "PERIOD", ",", "b64UrlEncode", "(", "content", ")", ",", "JwtHelper", ".", ...
Allows retrieval of the full token. @return the encoded header, claims and crypto segments concatenated with "." characters
[ "Allows", "retrieval", "of", "the", "full", "token", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-jwt/src/main/java/org/springframework/security/jwt/JwtHelper.java#L301-L305
129,094
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/authentication/BearerTokenExtractor.java
BearerTokenExtractor.extractHeaderToken
protected String extractHeaderToken(HttpServletRequest request) { Enumeration<String> headers = request.getHeaders("Authorization"); while (headers.hasMoreElements()) { // typically there is only one (most servers enforce that) String value = headers.nextElement(); if ((value.toLowerCase().startsWith(OAuth2Ac...
java
protected String extractHeaderToken(HttpServletRequest request) { Enumeration<String> headers = request.getHeaders("Authorization"); while (headers.hasMoreElements()) { // typically there is only one (most servers enforce that) String value = headers.nextElement(); if ((value.toLowerCase().startsWith(OAuth2Ac...
[ "protected", "String", "extractHeaderToken", "(", "HttpServletRequest", "request", ")", "{", "Enumeration", "<", "String", ">", "headers", "=", "request", ".", "getHeaders", "(", "\"Authorization\"", ")", ";", "while", "(", "headers", ".", "hasMoreElements", "(", ...
Extract the OAuth bearer token from a header. @param request The request. @return The token, or null if no OAuth authorization header was supplied.
[ "Extract", "the", "OAuth", "bearer", "token", "from", "a", "header", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/authentication/BearerTokenExtractor.java#L73-L91
129,095
spring-projects/spring-security-oauth
spring-security-oauth/src/main/java/org/springframework/security/oauth/provider/token/RandomValueProviderTokenServices.java
RandomValueProviderTokenServices.isExpired
protected boolean isExpired(OAuthProviderTokenImpl authToken) { if (authToken.isAccessToken()) { if ((authToken.getTimestamp() + (getAccessTokenValiditySeconds() * 1000L)) < System.currentTimeMillis()) { return true; } } else { if ((authToken.getTimestamp() + (getRequestTokenValidi...
java
protected boolean isExpired(OAuthProviderTokenImpl authToken) { if (authToken.isAccessToken()) { if ((authToken.getTimestamp() + (getAccessTokenValiditySeconds() * 1000L)) < System.currentTimeMillis()) { return true; } } else { if ((authToken.getTimestamp() + (getRequestTokenValidi...
[ "protected", "boolean", "isExpired", "(", "OAuthProviderTokenImpl", "authToken", ")", "{", "if", "(", "authToken", ".", "isAccessToken", "(", ")", ")", "{", "if", "(", "(", "authToken", ".", "getTimestamp", "(", ")", "+", "(", "getAccessTokenValiditySeconds", ...
Whether the auth token is expired. @param authToken The auth token to check for expiration. @return Whether the auth token is expired.
[ "Whether", "the", "auth", "token", "is", "expired", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth/src/main/java/org/springframework/security/oauth/provider/token/RandomValueProviderTokenServices.java#L100-L113
129,096
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java
DefaultRedirectResolver.matchQueryParams
private boolean matchQueryParams(MultiValueMap<String, String> registeredRedirectUriQueryParams, MultiValueMap<String, String> requestedRedirectUriQueryParams) { Iterator<String> iter = registeredRedirectUriQueryParams.keySet().iterator(); while (iter.hasNext()) { String key = iter.next(); List<St...
java
private boolean matchQueryParams(MultiValueMap<String, String> registeredRedirectUriQueryParams, MultiValueMap<String, String> requestedRedirectUriQueryParams) { Iterator<String> iter = registeredRedirectUriQueryParams.keySet().iterator(); while (iter.hasNext()) { String key = iter.next(); List<St...
[ "private", "boolean", "matchQueryParams", "(", "MultiValueMap", "<", "String", ",", "String", ">", "registeredRedirectUriQueryParams", ",", "MultiValueMap", "<", "String", ",", "String", ">", "requestedRedirectUriQueryParams", ")", "{", "Iterator", "<", "String", ">",...
Checks whether the registered redirect uri query params key and values contains match the requested set The requested redirect uri query params are allowed to contain additional params which will be retained @param registeredRedirectUriQueryParams @param requestedRedirectUriQueryParams @return whether the params matc...
[ "Checks", "whether", "the", "registered", "redirect", "uri", "query", "params", "key", "and", "values", "contains", "match", "the", "requested", "set" ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java#L146-L162
129,097
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java
DefaultRedirectResolver.isEqual
private boolean isEqual(String str1, String str2) { if (StringUtils.isEmpty(str1) && StringUtils.isEmpty(str2)) { return true; } else if (!StringUtils.isEmpty(str1)) { return str1.equals(str2); } else { return false; } }
java
private boolean isEqual(String str1, String str2) { if (StringUtils.isEmpty(str1) && StringUtils.isEmpty(str2)) { return true; } else if (!StringUtils.isEmpty(str1)) { return str1.equals(str2); } else { return false; } }
[ "private", "boolean", "isEqual", "(", "String", "str1", ",", "String", "str2", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "str1", ")", "&&", "StringUtils", ".", "isEmpty", "(", "str2", ")", ")", "{", "return", "true", ";", "}", "else", ...
Compares two strings but treats empty string or null equal @param str1 @param str2 @return true if strings are equal, false otherwise
[ "Compares", "two", "strings", "but", "treats", "empty", "string", "or", "null", "equal" ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java#L173-L181
129,098
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java
DefaultRedirectResolver.hostMatches
protected boolean hostMatches(String registered, String requested) { if (matchSubdomains) { return registered.equals(requested) || requested.endsWith("." + registered); } return registered.equals(requested); }
java
protected boolean hostMatches(String registered, String requested) { if (matchSubdomains) { return registered.equals(requested) || requested.endsWith("." + registered); } return registered.equals(requested); }
[ "protected", "boolean", "hostMatches", "(", "String", "registered", ",", "String", "requested", ")", "{", "if", "(", "matchSubdomains", ")", "{", "return", "registered", ".", "equals", "(", "requested", ")", "||", "requested", ".", "endsWith", "(", "\".\"", ...
Check if host matches the registered value. @param registered the registered host @param requested the requested host @return true if they match
[ "Check", "if", "host", "matches", "the", "registered", "value", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java#L190-L195
129,099
spring-projects/spring-security-oauth
spring-security-oauth/src/main/java/org/springframework/security/oauth/common/OAuthCodec.java
OAuthCodec.oauthEncode
public static String oauthEncode(String value) { if (value == null) { return ""; } try { return new String(URLCodec.encodeUrl(SAFE_CHARACTERS, value.getBytes("UTF-8")), "US-ASCII"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
java
public static String oauthEncode(String value) { if (value == null) { return ""; } try { return new String(URLCodec.encodeUrl(SAFE_CHARACTERS, value.getBytes("UTF-8")), "US-ASCII"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
[ "public", "static", "String", "oauthEncode", "(", "String", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "\"\"", ";", "}", "try", "{", "return", "new", "String", "(", "URLCodec", ".", "encodeUrl", "(", "SAFE_CHARACTERS", ",", ...
Encode the specified value. @param value The value to encode. @return The encoded value.
[ "Encode", "the", "specified", "value", "." ]
bbae0027eceb2c74a21ac26bbc86142dc732ffbe
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth/src/main/java/org/springframework/security/oauth/common/OAuthCodec.java#L52-L63