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
122,900
apache/spark
common/sketch/src/main/java/org/apache/spark/util/sketch/Murmur3_x86_32.java
Murmur3_x86_32.fmix
private static int fmix(int h1, int length) { h1 ^= length; h1 ^= h1 >>> 16; h1 *= 0x85ebca6b; h1 ^= h1 >>> 13; h1 *= 0xc2b2ae35; h1 ^= h1 >>> 16; return h1; }
java
private static int fmix(int h1, int length) { h1 ^= length; h1 ^= h1 >>> 16; h1 *= 0x85ebca6b; h1 ^= h1 >>> 13; h1 *= 0xc2b2ae35; h1 ^= h1 >>> 16; return h1; }
[ "private", "static", "int", "fmix", "(", "int", "h1", ",", "int", "length", ")", "{", "h1", "^=", "length", ";", "h1", "^=", "h1", ">>>", "16", ";", "h1", "*=", "0x85ebca6b", ";", "h1", "^=", "h1", ">>>", "13", ";", "h1", "*=", "0xc2b2ae35", ";",...
Finalization mix - force all bits of a hash block to avalanche
[ "Finalization", "mix", "-", "force", "all", "bits", "of", "a", "hash", "block", "to", "avalanche" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/sketch/src/main/java/org/apache/spark/util/sketch/Murmur3_x86_32.java#L133-L141
122,901
apache/spark
common/network-common/src/main/java/org/apache/spark/network/server/TransportChannelHandler.java
TransportChannelHandler.acceptInboundMessage
@Override public boolean acceptInboundMessage(Object msg) throws Exception { if (msg instanceof ChunkFetchRequest) { return false; } else { return super.acceptInboundMessage(msg); } }
java
@Override public boolean acceptInboundMessage(Object msg) throws Exception { if (msg instanceof ChunkFetchRequest) { return false; } else { return super.acceptInboundMessage(msg); } }
[ "@", "Override", "public", "boolean", "acceptInboundMessage", "(", "Object", "msg", ")", "throws", "Exception", "{", "if", "(", "msg", "instanceof", "ChunkFetchRequest", ")", "{", "return", "false", ";", "}", "else", "{", "return", "super", ".", "acceptInbound...
Overwrite acceptInboundMessage to properly delegate ChunkFetchRequest messages to ChunkFetchRequestHandler.
[ "Overwrite", "acceptInboundMessage", "to", "properly", "delegate", "ChunkFetchRequest", "messages", "to", "ChunkFetchRequestHandler", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/TransportChannelHandler.java#L125-L132
122,902
apache/spark
common/network-common/src/main/java/org/apache/spark/network/TransportContext.java
TransportContext.createServer
public TransportServer createServer(int port, List<TransportServerBootstrap> bootstraps) { return new TransportServer(this, null, port, rpcHandler, bootstraps); }
java
public TransportServer createServer(int port, List<TransportServerBootstrap> bootstraps) { return new TransportServer(this, null, port, rpcHandler, bootstraps); }
[ "public", "TransportServer", "createServer", "(", "int", "port", ",", "List", "<", "TransportServerBootstrap", ">", "bootstraps", ")", "{", "return", "new", "TransportServer", "(", "this", ",", "null", ",", "port", ",", "rpcHandler", ",", "bootstraps", ")", ";...
Create a server which will attempt to bind to a specific port.
[ "Create", "a", "server", "which", "will", "attempt", "to", "bind", "to", "a", "specific", "port", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/TransportContext.java#L150-L152
122,903
apache/spark
common/network-common/src/main/java/org/apache/spark/network/TransportContext.java
TransportContext.createServer
public TransportServer createServer( String host, int port, List<TransportServerBootstrap> bootstraps) { return new TransportServer(this, host, port, rpcHandler, bootstraps); }
java
public TransportServer createServer( String host, int port, List<TransportServerBootstrap> bootstraps) { return new TransportServer(this, host, port, rpcHandler, bootstraps); }
[ "public", "TransportServer", "createServer", "(", "String", "host", ",", "int", "port", ",", "List", "<", "TransportServerBootstrap", ">", "bootstraps", ")", "{", "return", "new", "TransportServer", "(", "this", ",", "host", ",", "port", ",", "rpcHandler", ","...
Create a server which will attempt to bind to a specific host and port.
[ "Create", "a", "server", "which", "will", "attempt", "to", "bind", "to", "a", "specific", "host", "and", "port", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/TransportContext.java#L155-L158
122,904
apache/spark
common/network-common/src/main/java/org/apache/spark/network/TransportContext.java
TransportContext.createChunkFetchHandler
private ChunkFetchRequestHandler createChunkFetchHandler(TransportChannelHandler channelHandler, RpcHandler rpcHandler) { return new ChunkFetchRequestHandler(channelHandler.getClient(), rpcHandler.getStreamManager(), conf.maxChunksBeingTransferred()); }
java
private ChunkFetchRequestHandler createChunkFetchHandler(TransportChannelHandler channelHandler, RpcHandler rpcHandler) { return new ChunkFetchRequestHandler(channelHandler.getClient(), rpcHandler.getStreamManager(), conf.maxChunksBeingTransferred()); }
[ "private", "ChunkFetchRequestHandler", "createChunkFetchHandler", "(", "TransportChannelHandler", "channelHandler", ",", "RpcHandler", "rpcHandler", ")", "{", "return", "new", "ChunkFetchRequestHandler", "(", "channelHandler", ".", "getClient", "(", ")", ",", "rpcHandler", ...
Creates the dedicated ChannelHandler for ChunkFetchRequest messages.
[ "Creates", "the", "dedicated", "ChannelHandler", "for", "ChunkFetchRequest", "messages", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/TransportContext.java#L229-L233
122,905
apache/spark
launcher/src/main/java/org/apache/spark/launcher/ChildProcAppHandle.java
ChildProcAppHandle.monitorChild
void monitorChild() { Process proc = childProc; if (proc == null) { // Process may have already been disposed of, e.g. by calling kill(). return; } while (proc.isAlive()) { try { proc.waitFor(); } catch (Exception e) { LOG.log(Level.WARNING, "Exception waiting fo...
java
void monitorChild() { Process proc = childProc; if (proc == null) { // Process may have already been disposed of, e.g. by calling kill(). return; } while (proc.isAlive()) { try { proc.waitFor(); } catch (Exception e) { LOG.log(Level.WARNING, "Exception waiting fo...
[ "void", "monitorChild", "(", ")", "{", "Process", "proc", "=", "childProc", ";", "if", "(", "proc", "==", "null", ")", "{", "// Process may have already been disposed of, e.g. by calling kill().", "return", ";", "}", "while", "(", "proc", ".", "isAlive", "(", ")...
Wait for the child process to exit and update the handle's state if necessary, according to the exit code.
[ "Wait", "for", "the", "child", "process", "to", "exit", "and", "update", "the", "handle", "s", "state", "if", "necessary", "according", "to", "the", "exit", "code", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/ChildProcAppHandle.java#L97-L135
122,906
apache/spark
launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java
AbstractLauncher.setPropertiesFile
public T setPropertiesFile(String path) { checkNotNull(path, "path"); builder.setPropertiesFile(path); return self(); }
java
public T setPropertiesFile(String path) { checkNotNull(path, "path"); builder.setPropertiesFile(path); return self(); }
[ "public", "T", "setPropertiesFile", "(", "String", "path", ")", "{", "checkNotNull", "(", "path", ",", "\"path\"", ")", ";", "builder", ".", "setPropertiesFile", "(", "path", ")", ";", "return", "self", "(", ")", ";", "}" ]
Set a custom properties file with Spark configuration for the application. @param path Path to custom properties file to use. @return This launcher.
[ "Set", "a", "custom", "properties", "file", "with", "Spark", "configuration", "for", "the", "application", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L45-L49
122,907
apache/spark
launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java
AbstractLauncher.setConf
public T setConf(String key, String value) { checkNotNull(key, "key"); checkNotNull(value, "value"); checkArgument(key.startsWith("spark."), "'key' must start with 'spark.'"); builder.conf.put(key, value); return self(); }
java
public T setConf(String key, String value) { checkNotNull(key, "key"); checkNotNull(value, "value"); checkArgument(key.startsWith("spark."), "'key' must start with 'spark.'"); builder.conf.put(key, value); return self(); }
[ "public", "T", "setConf", "(", "String", "key", ",", "String", "value", ")", "{", "checkNotNull", "(", "key", ",", "\"key\"", ")", ";", "checkNotNull", "(", "value", ",", "\"value\"", ")", ";", "checkArgument", "(", "key", ".", "startsWith", "(", "\"spar...
Set a single configuration value for the application. @param key Configuration key. @param value The value to use. @return This launcher.
[ "Set", "a", "single", "configuration", "value", "for", "the", "application", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L58-L64
122,908
apache/spark
launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java
AbstractLauncher.setAppName
public T setAppName(String appName) { checkNotNull(appName, "appName"); builder.appName = appName; return self(); }
java
public T setAppName(String appName) { checkNotNull(appName, "appName"); builder.appName = appName; return self(); }
[ "public", "T", "setAppName", "(", "String", "appName", ")", "{", "checkNotNull", "(", "appName", ",", "\"appName\"", ")", ";", "builder", ".", "appName", "=", "appName", ";", "return", "self", "(", ")", ";", "}" ]
Set the application name. @param appName Application name. @return This launcher.
[ "Set", "the", "application", "name", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L72-L76
122,909
apache/spark
launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java
AbstractLauncher.setMaster
public T setMaster(String master) { checkNotNull(master, "master"); builder.master = master; return self(); }
java
public T setMaster(String master) { checkNotNull(master, "master"); builder.master = master; return self(); }
[ "public", "T", "setMaster", "(", "String", "master", ")", "{", "checkNotNull", "(", "master", ",", "\"master\"", ")", ";", "builder", ".", "master", "=", "master", ";", "return", "self", "(", ")", ";", "}" ]
Set the Spark master for the application. @param master Spark master. @return This launcher.
[ "Set", "the", "Spark", "master", "for", "the", "application", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L84-L88
122,910
apache/spark
launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java
AbstractLauncher.setDeployMode
public T setDeployMode(String mode) { checkNotNull(mode, "mode"); builder.deployMode = mode; return self(); }
java
public T setDeployMode(String mode) { checkNotNull(mode, "mode"); builder.deployMode = mode; return self(); }
[ "public", "T", "setDeployMode", "(", "String", "mode", ")", "{", "checkNotNull", "(", "mode", ",", "\"mode\"", ")", ";", "builder", ".", "deployMode", "=", "mode", ";", "return", "self", "(", ")", ";", "}" ]
Set the deploy mode for the application. @param mode Deploy mode. @return This launcher.
[ "Set", "the", "deploy", "mode", "for", "the", "application", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L96-L100
122,911
apache/spark
launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java
AbstractLauncher.addAppArgs
public T addAppArgs(String... args) { for (String arg : args) { checkNotNull(arg, "arg"); builder.appArgs.add(arg); } return self(); }
java
public T addAppArgs(String... args) { for (String arg : args) { checkNotNull(arg, "arg"); builder.appArgs.add(arg); } return self(); }
[ "public", "T", "addAppArgs", "(", "String", "...", "args", ")", "{", "for", "(", "String", "arg", ":", "args", ")", "{", "checkNotNull", "(", "arg", ",", "\"arg\"", ")", ";", "builder", ".", "appArgs", ".", "add", "(", "arg", ")", ";", "}", "return...
Adds command line arguments for the application. @param args Arguments to pass to the application's main class. @return This launcher.
[ "Adds", "command", "line", "arguments", "for", "the", "application", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L202-L208
122,912
apache/spark
launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java
AbstractLauncher.addJar
public T addJar(String jar) { checkNotNull(jar, "jar"); builder.jars.add(jar); return self(); }
java
public T addJar(String jar) { checkNotNull(jar, "jar"); builder.jars.add(jar); return self(); }
[ "public", "T", "addJar", "(", "String", "jar", ")", "{", "checkNotNull", "(", "jar", ",", "\"jar\"", ")", ";", "builder", ".", "jars", ".", "add", "(", "jar", ")", ";", "return", "self", "(", ")", ";", "}" ]
Adds a jar file to be submitted with the application. @param jar Path to the jar file. @return This launcher.
[ "Adds", "a", "jar", "file", "to", "be", "submitted", "with", "the", "application", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L216-L220
122,913
apache/spark
launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java
AbstractLauncher.addFile
public T addFile(String file) { checkNotNull(file, "file"); builder.files.add(file); return self(); }
java
public T addFile(String file) { checkNotNull(file, "file"); builder.files.add(file); return self(); }
[ "public", "T", "addFile", "(", "String", "file", ")", "{", "checkNotNull", "(", "file", ",", "\"file\"", ")", ";", "builder", ".", "files", ".", "add", "(", "file", ")", ";", "return", "self", "(", ")", ";", "}" ]
Adds a file to be submitted with the application. @param file Path to the file. @return This launcher.
[ "Adds", "a", "file", "to", "be", "submitted", "with", "the", "application", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/AbstractLauncher.java#L228-L232
122,914
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/array/LongArray.java
LongArray.zeroOut
public void zeroOut() { for (long off = baseOffset; off < baseOffset + length * WIDTH; off += WIDTH) { Platform.putLong(baseObj, off, 0); } }
java
public void zeroOut() { for (long off = baseOffset; off < baseOffset + length * WIDTH; off += WIDTH) { Platform.putLong(baseObj, off, 0); } }
[ "public", "void", "zeroOut", "(", ")", "{", "for", "(", "long", "off", "=", "baseOffset", ";", "off", "<", "baseOffset", "+", "length", "*", "WIDTH", ";", "off", "+=", "WIDTH", ")", "{", "Platform", ".", "putLong", "(", "baseObj", ",", "off", ",", ...
Fill this all with 0L.
[ "Fill", "this", "all", "with", "0L", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/array/LongArray.java#L71-L75
122,915
apache/spark
sql/catalyst/src/main/java/org/apache/spark/sql/catalog/v2/Catalogs.java
Catalogs.catalogOptions
private static CaseInsensitiveStringMap catalogOptions(String name, SQLConf conf) { Map<String, String> allConfs = mapAsJavaMapConverter(conf.getAllConfs()).asJava(); Pattern prefix = Pattern.compile("^spark\\.sql\\.catalog\\." + name + "\\.(.+)"); HashMap<String, String> options = new HashMap<>(); for...
java
private static CaseInsensitiveStringMap catalogOptions(String name, SQLConf conf) { Map<String, String> allConfs = mapAsJavaMapConverter(conf.getAllConfs()).asJava(); Pattern prefix = Pattern.compile("^spark\\.sql\\.catalog\\." + name + "\\.(.+)"); HashMap<String, String> options = new HashMap<>(); for...
[ "private", "static", "CaseInsensitiveStringMap", "catalogOptions", "(", "String", "name", ",", "SQLConf", "conf", ")", "{", "Map", "<", "String", ",", "String", ">", "allConfs", "=", "mapAsJavaMapConverter", "(", "conf", ".", "getAllConfs", "(", ")", ")", ".",...
Extracts a named catalog's configuration from a SQLConf. @param name a catalog name @param conf a SQLConf @return a case insensitive string map of options starting with spark.sql.catalog.(name).
[ "Extracts", "a", "named", "catalog", "s", "configuration", "from", "a", "SQLConf", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalog/v2/Catalogs.java#L98-L111
122,916
apache/spark
launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java
LauncherServer.registerHandle
synchronized String registerHandle(AbstractAppHandle handle) { String secret = createSecret(); secretToPendingApps.put(secret, handle); return secret; }
java
synchronized String registerHandle(AbstractAppHandle handle) { String secret = createSecret(); secretToPendingApps.put(secret, handle); return secret; }
[ "synchronized", "String", "registerHandle", "(", "AbstractAppHandle", "handle", ")", "{", "String", "secret", "=", "createSecret", "(", ")", ";", "secretToPendingApps", ".", "put", "(", "secret", ",", "handle", ")", ";", "return", "secret", ";", "}" ]
Registers a handle with the server, and returns the secret the child app needs to connect back.
[ "Registers", "a", "handle", "with", "the", "server", "and", "returns", "the", "secret", "the", "child", "app", "needs", "to", "connect", "back", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java#L150-L154
122,917
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java
RadixSort.sort
public static int sort( LongArray array, long numRecords, int startByteIndex, int endByteIndex, boolean desc, boolean signed) { assert startByteIndex >= 0 : "startByteIndex (" + startByteIndex + ") should >= 0"; assert endByteIndex <= 7 : "endByteIndex (" + endByteIndex + ") should <= 7"; assert...
java
public static int sort( LongArray array, long numRecords, int startByteIndex, int endByteIndex, boolean desc, boolean signed) { assert startByteIndex >= 0 : "startByteIndex (" + startByteIndex + ") should >= 0"; assert endByteIndex <= 7 : "endByteIndex (" + endByteIndex + ") should <= 7"; assert...
[ "public", "static", "int", "sort", "(", "LongArray", "array", ",", "long", "numRecords", ",", "int", "startByteIndex", ",", "int", "endByteIndex", ",", "boolean", "desc", ",", "boolean", "signed", ")", "{", "assert", "startByteIndex", ">=", "0", ":", "\"star...
Sorts a given array of longs using least-significant-digit radix sort. This routine assumes you have extra space at the end of the array at least equal to the number of records. The sort is destructive and may relocate the data positioned within the array. @param array array of long elements followed by at least that ...
[ "Sorts", "a", "given", "array", "of", "longs", "using", "least", "-", "significant", "-", "digit", "radix", "sort", ".", "This", "routine", "assumes", "you", "have", "extra", "space", "at", "the", "end", "of", "the", "array", "at", "least", "equal", "to"...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java#L44-L67
122,918
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java
RadixSort.sortAtByte
private static void sortAtByte( LongArray array, long numRecords, long[] counts, int byteIdx, long inIndex, long outIndex, boolean desc, boolean signed) { assert counts.length == 256; long[] offsets = transformCountsToOffsets( counts, numRecords, array.getBaseOffset() + outIndex * 8L, 8, desc,...
java
private static void sortAtByte( LongArray array, long numRecords, long[] counts, int byteIdx, long inIndex, long outIndex, boolean desc, boolean signed) { assert counts.length == 256; long[] offsets = transformCountsToOffsets( counts, numRecords, array.getBaseOffset() + outIndex * 8L, 8, desc,...
[ "private", "static", "void", "sortAtByte", "(", "LongArray", "array", ",", "long", "numRecords", ",", "long", "[", "]", "counts", ",", "int", "byteIdx", ",", "long", "inIndex", ",", "long", "outIndex", ",", "boolean", "desc", ",", "boolean", "signed", ")",...
Performs a partial sort by copying data into destination offsets for each byte value at the specified byte offset. @param array array to partially sort. @param numRecords number of data records in the array. @param counts counts for each byte value. This routine destructively modifies this array. @param byteIdx the by...
[ "Performs", "a", "partial", "sort", "by", "copying", "data", "into", "destination", "offsets", "for", "each", "byte", "value", "at", "the", "specified", "byte", "offset", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java#L82-L97
122,919
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java
RadixSort.getCounts
private static long[][] getCounts( LongArray array, long numRecords, int startByteIndex, int endByteIndex) { long[][] counts = new long[8][]; // Optimization: do a fast pre-pass to determine which byte indices we can skip for sorting. // If all the byte values at a particular index are the same we don...
java
private static long[][] getCounts( LongArray array, long numRecords, int startByteIndex, int endByteIndex) { long[][] counts = new long[8][]; // Optimization: do a fast pre-pass to determine which byte indices we can skip for sorting. // If all the byte values at a particular index are the same we don...
[ "private", "static", "long", "[", "]", "[", "]", "getCounts", "(", "LongArray", "array", ",", "long", "numRecords", ",", "int", "startByteIndex", ",", "int", "endByteIndex", ")", "{", "long", "[", "]", "[", "]", "counts", "=", "new", "long", "[", "8", ...
Computes a value histogram for each byte in the given array. @param array array to count records in. @param numRecords number of data records in the array. @param startByteIndex the first byte to compute counts for (the prior are skipped). @param endByteIndex the last byte to compute counts for. @return an array of e...
[ "Computes", "a", "value", "histogram", "for", "each", "byte", "in", "the", "given", "array", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java#L110-L136
122,920
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java
RadixSort.transformCountsToOffsets
private static long[] transformCountsToOffsets( long[] counts, long numRecords, long outputOffset, long bytesPerRecord, boolean desc, boolean signed) { assert counts.length == 256; int start = signed ? 128 : 0; // output the negative records first (values 129-255). if (desc) { long pos = ...
java
private static long[] transformCountsToOffsets( long[] counts, long numRecords, long outputOffset, long bytesPerRecord, boolean desc, boolean signed) { assert counts.length == 256; int start = signed ? 128 : 0; // output the negative records first (values 129-255). if (desc) { long pos = ...
[ "private", "static", "long", "[", "]", "transformCountsToOffsets", "(", "long", "[", "]", "counts", ",", "long", "numRecords", ",", "long", "outputOffset", ",", "long", "bytesPerRecord", ",", "boolean", "desc", ",", "boolean", "signed", ")", "{", "assert", "...
Transforms counts into the proper unsafe output offsets for the sort type. @param counts counts for each byte value. This routine destructively modifies this array. @param numRecords number of data records in the original data array. @param outputOffset output offset in bytes from the base array object. @param bytesPe...
[ "Transforms", "counts", "into", "the", "proper", "unsafe", "output", "offsets", "for", "the", "sort", "type", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java#L150-L170
122,921
apache/spark
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java
VectorizedParquetRecordReader.initialize
@Override public void initialize(String path, List<String> columns) throws IOException, UnsupportedOperationException { super.initialize(path, columns); initializeInternal(); }
java
@Override public void initialize(String path, List<String> columns) throws IOException, UnsupportedOperationException { super.initialize(path, columns); initializeInternal(); }
[ "@", "Override", "public", "void", "initialize", "(", "String", "path", ",", "List", "<", "String", ">", "columns", ")", "throws", "IOException", ",", "UnsupportedOperationException", "{", "super", ".", "initialize", "(", "path", ",", "columns", ")", ";", "i...
Utility API that will read all the data in path. This circumvents the need to create Hadoop objects to use this class. `columns` can contain the list of columns to project.
[ "Utility", "API", "that", "will", "read", "all", "the", "data", "in", "path", ".", "This", "circumvents", "the", "need", "to", "create", "Hadoop", "objects", "to", "use", "this", "class", ".", "columns", "can", "contain", "the", "list", "of", "columns", ...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java#L139-L144
122,922
apache/spark
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java
VectorizedParquetRecordReader.nextBatch
public boolean nextBatch() throws IOException { for (WritableColumnVector vector : columnVectors) { vector.reset(); } columnarBatch.setNumRows(0); if (rowsReturned >= totalRowCount) return false; checkEndOfRowGroup(); int num = (int) Math.min((long) capacity, totalCountLoadedSoFar - rowsR...
java
public boolean nextBatch() throws IOException { for (WritableColumnVector vector : columnVectors) { vector.reset(); } columnarBatch.setNumRows(0); if (rowsReturned >= totalRowCount) return false; checkEndOfRowGroup(); int num = (int) Math.min((long) capacity, totalCountLoadedSoFar - rowsR...
[ "public", "boolean", "nextBatch", "(", ")", "throws", "IOException", "{", "for", "(", "WritableColumnVector", "vector", ":", "columnVectors", ")", "{", "vector", ".", "reset", "(", ")", ";", "}", "columnarBatch", ".", "setNumRows", "(", "0", ")", ";", "if"...
Advances to the next batch of rows. Returns false if there are no more.
[ "Advances", "to", "the", "next", "batch", "of", "rows", ".", "Returns", "false", "if", "there", "are", "no", "more", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedParquetRecordReader.java#L250-L268
122,923
apache/spark
common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java
JavaUtils.closeQuietly
public static void closeQuietly(Closeable closeable) { try { if (closeable != null) { closeable.close(); } } catch (IOException e) { logger.error("IOException should not have been thrown.", e); } }
java
public static void closeQuietly(Closeable closeable) { try { if (closeable != null) { closeable.close(); } } catch (IOException e) { logger.error("IOException should not have been thrown.", e); } }
[ "public", "static", "void", "closeQuietly", "(", "Closeable", "closeable", ")", "{", "try", "{", "if", "(", "closeable", "!=", "null", ")", "{", "closeable", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ...
Closes the given object, ignoring IOExceptions.
[ "Closes", "the", "given", "object", "ignoring", "IOExceptions", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L50-L58
122,924
apache/spark
common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java
JavaUtils.deleteRecursively
public static void deleteRecursively(File file, FilenameFilter filter) throws IOException { if (file == null) { return; } // On Unix systems, use operating system command to run faster // If that does not work out, fallback to the Java IO way if (SystemUtils.IS_OS_UNIX && filter == null) { try { ...
java
public static void deleteRecursively(File file, FilenameFilter filter) throws IOException { if (file == null) { return; } // On Unix systems, use operating system command to run faster // If that does not work out, fallback to the Java IO way if (SystemUtils.IS_OS_UNIX && filter == null) { try { ...
[ "public", "static", "void", "deleteRecursively", "(", "File", "file", ",", "FilenameFilter", "filter", ")", "throws", "IOException", "{", "if", "(", "file", "==", "null", ")", "{", "return", ";", "}", "// On Unix systems, use operating system command to run faster", ...
Delete a file or directory and its contents recursively. Don't follow directories if they are symlinks. @param file Input file / dir to be deleted @param filter A filename filter that make sure only files / dirs with the satisfied filenames are deleted. @throws IOException if deletion is unsuccessful
[ "Delete", "a", "file", "or", "directory", "and", "its", "contents", "recursively", ".", "Don", "t", "follow", "directories", "if", "they", "are", "symlinks", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L103-L119
122,925
apache/spark
common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java
JavaUtils.bufferToArray
public static byte[] bufferToArray(ByteBuffer buffer) { if (buffer.hasArray() && buffer.arrayOffset() == 0 && buffer.array().length == buffer.remaining()) { return buffer.array(); } else { byte[] bytes = new byte[buffer.remaining()]; buffer.get(bytes); return bytes; } }
java
public static byte[] bufferToArray(ByteBuffer buffer) { if (buffer.hasArray() && buffer.arrayOffset() == 0 && buffer.array().length == buffer.remaining()) { return buffer.array(); } else { byte[] bytes = new byte[buffer.remaining()]; buffer.get(bytes); return bytes; } }
[ "public", "static", "byte", "[", "]", "bufferToArray", "(", "ByteBuffer", "buffer", ")", "{", "if", "(", "buffer", ".", "hasArray", "(", ")", "&&", "buffer", ".", "arrayOffset", "(", ")", "==", "0", "&&", "buffer", ".", "array", "(", ")", ".", "lengt...
Returns a byte array with the buffer's contents, trying to avoid copying the data if possible.
[ "Returns", "a", "byte", "array", "with", "the", "buffer", "s", "contents", "trying", "to", "avoid", "copying", "the", "data", "if", "possible", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L354-L363
122,926
apache/spark
common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java
JavaUtils.readFully
public static void readFully(ReadableByteChannel channel, ByteBuffer dst) throws IOException { int expected = dst.remaining(); while (dst.hasRemaining()) { if (channel.read(dst) < 0) { throw new EOFException(String.format("Not enough bytes in channel (expected %d).", expected)); } ...
java
public static void readFully(ReadableByteChannel channel, ByteBuffer dst) throws IOException { int expected = dst.remaining(); while (dst.hasRemaining()) { if (channel.read(dst) < 0) { throw new EOFException(String.format("Not enough bytes in channel (expected %d).", expected)); } ...
[ "public", "static", "void", "readFully", "(", "ReadableByteChannel", "channel", ",", "ByteBuffer", "dst", ")", "throws", "IOException", "{", "int", "expected", "=", "dst", ".", "remaining", "(", ")", ";", "while", "(", "dst", ".", "hasRemaining", "(", ")", ...
Fills a buffer with data read from the channel.
[ "Fills", "a", "buffer", "with", "data", "read", "from", "the", "channel", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java#L368-L376
122,927
apache/spark
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeMapData.java
UnsafeMapData.pointTo
public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) { // Read the numBytes of key array from the first 8 bytes. final long keyArraySize = Platform.getLong(baseObject, baseOffset); assert keyArraySize >= 0 : "keyArraySize (" + keyArraySize + ") should >= 0"; assert keyArraySize <= In...
java
public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) { // Read the numBytes of key array from the first 8 bytes. final long keyArraySize = Platform.getLong(baseObject, baseOffset); assert keyArraySize >= 0 : "keyArraySize (" + keyArraySize + ") should >= 0"; assert keyArraySize <= In...
[ "public", "void", "pointTo", "(", "Object", "baseObject", ",", "long", "baseOffset", ",", "int", "sizeInBytes", ")", "{", "// Read the numBytes of key array from the first 8 bytes.", "final", "long", "keyArraySize", "=", "Platform", ".", "getLong", "(", "baseObject", ...
Update this UnsafeMapData to point to different backing data. @param baseObject the base object @param baseOffset the offset within the base object @param sizeInBytes the size of this map's backing data, in bytes
[ "Update", "this", "UnsafeMapData", "to", "point", "to", "different", "backing", "data", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeMapData.java#L81-L98
122,928
apache/spark
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java
WritableColumnVector.reset
public void reset() { if (isConstant) return; if (childColumns != null) { for (ColumnVector c: childColumns) { ((WritableColumnVector) c).reset(); } } elementsAppended = 0; if (numNulls > 0) { putNotNulls(0, capacity); numNulls = 0; } }
java
public void reset() { if (isConstant) return; if (childColumns != null) { for (ColumnVector c: childColumns) { ((WritableColumnVector) c).reset(); } } elementsAppended = 0; if (numNulls > 0) { putNotNulls(0, capacity); numNulls = 0; } }
[ "public", "void", "reset", "(", ")", "{", "if", "(", "isConstant", ")", "return", ";", "if", "(", "childColumns", "!=", "null", ")", "{", "for", "(", "ColumnVector", "c", ":", "childColumns", ")", "{", "(", "(", "WritableColumnVector", ")", "c", ")", ...
Resets this column for writing. The currently stored values are no longer accessible.
[ "Resets", "this", "column", "for", "writing", ".", "The", "currently", "stored", "values", "are", "no", "longer", "accessible", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java#L52-L65
122,929
apache/spark
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java
WritableColumnVector.reserveDictionaryIds
public WritableColumnVector reserveDictionaryIds(int capacity) { if (dictionaryIds == null) { dictionaryIds = reserveNewColumn(capacity, DataTypes.IntegerType); } else { dictionaryIds.reset(); dictionaryIds.reserve(capacity); } return dictionaryIds; }
java
public WritableColumnVector reserveDictionaryIds(int capacity) { if (dictionaryIds == null) { dictionaryIds = reserveNewColumn(capacity, DataTypes.IntegerType); } else { dictionaryIds.reset(); dictionaryIds.reserve(capacity); } return dictionaryIds; }
[ "public", "WritableColumnVector", "reserveDictionaryIds", "(", "int", "capacity", ")", "{", "if", "(", "dictionaryIds", "==", "null", ")", "{", "dictionaryIds", "=", "reserveNewColumn", "(", "capacity", ",", "DataTypes", ".", "IntegerType", ")", ";", "}", "else"...
Reserve a integer column for ids of dictionary.
[ "Reserve", "a", "integer", "column", "for", "ids", "of", "dictionary", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java#L165-L173
122,930
apache/spark
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java
WritableColumnVector.getArray
@Override public final ColumnarArray getArray(int rowId) { if (isNullAt(rowId)) return null; return new ColumnarArray(arrayData(), getArrayOffset(rowId), getArrayLength(rowId)); }
java
@Override public final ColumnarArray getArray(int rowId) { if (isNullAt(rowId)) return null; return new ColumnarArray(arrayData(), getArrayOffset(rowId), getArrayLength(rowId)); }
[ "@", "Override", "public", "final", "ColumnarArray", "getArray", "(", "int", "rowId", ")", "{", "if", "(", "isNullAt", "(", "rowId", ")", ")", "return", "null", ";", "return", "new", "ColumnarArray", "(", "arrayData", "(", ")", ",", "getArrayOffset", "(", ...
array offsets and lengths in the current column vector.
[ "array", "offsets", "and", "lengths", "in", "the", "current", "column", "vector", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java#L623-L627
122,931
apache/spark
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java
WritableColumnVector.getMap
@Override public final ColumnarMap getMap(int rowId) { if (isNullAt(rowId)) return null; return new ColumnarMap(getChild(0), getChild(1), getArrayOffset(rowId), getArrayLength(rowId)); }
java
@Override public final ColumnarMap getMap(int rowId) { if (isNullAt(rowId)) return null; return new ColumnarMap(getChild(0), getChild(1), getArrayOffset(rowId), getArrayLength(rowId)); }
[ "@", "Override", "public", "final", "ColumnarMap", "getMap", "(", "int", "rowId", ")", "{", "if", "(", "isNullAt", "(", "rowId", ")", ")", "return", "null", ";", "return", "new", "ColumnarMap", "(", "getChild", "(", "0", ")", ",", "getChild", "(", "1",...
second child column vector, and puts the offsets and lengths in the current column vector.
[ "second", "child", "column", "vector", "and", "puts", "the", "offsets", "and", "lengths", "in", "the", "current", "column", "vector", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java#L631-L635
122,932
apache/spark
sql/core/src/main/java/org/apache/spark/sql/expressions/javalang/typed.java
typed.avg
public static <T> TypedColumn<T, Double> avg(MapFunction<T, Double> f) { return new TypedAverage<T>(f).toColumnJava(); }
java
public static <T> TypedColumn<T, Double> avg(MapFunction<T, Double> f) { return new TypedAverage<T>(f).toColumnJava(); }
[ "public", "static", "<", "T", ">", "TypedColumn", "<", "T", ",", "Double", ">", "avg", "(", "MapFunction", "<", "T", ",", "Double", ">", "f", ")", "{", "return", "new", "TypedAverage", "<", "T", ">", "(", "f", ")", ".", "toColumnJava", "(", ")", ...
Average aggregate function. @since 2.0.0
[ "Average", "aggregate", "function", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/expressions/javalang/typed.java#L45-L47
122,933
apache/spark
sql/core/src/main/java/org/apache/spark/sql/expressions/javalang/typed.java
typed.count
public static <T> TypedColumn<T, Long> count(MapFunction<T, Object> f) { return new TypedCount<T>(f).toColumnJava(); }
java
public static <T> TypedColumn<T, Long> count(MapFunction<T, Object> f) { return new TypedCount<T>(f).toColumnJava(); }
[ "public", "static", "<", "T", ">", "TypedColumn", "<", "T", ",", "Long", ">", "count", "(", "MapFunction", "<", "T", ",", "Object", ">", "f", ")", "{", "return", "new", "TypedCount", "<", "T", ">", "(", "f", ")", ".", "toColumnJava", "(", ")", ";...
Count aggregate function. @since 2.0.0
[ "Count", "aggregate", "function", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/expressions/javalang/typed.java#L54-L56
122,934
apache/spark
core/src/main/java/org/apache/spark/io/ReadAheadInputStream.java
ReadAheadInputStream.readAsync
private void readAsync() throws IOException { stateChangeLock.lock(); final byte[] arr = readAheadBuffer.array(); try { if (endOfStream || readInProgress) { return; } checkReadException(); readAheadBuffer.position(0); readAheadBuffer.flip(); readInProgress = true;...
java
private void readAsync() throws IOException { stateChangeLock.lock(); final byte[] arr = readAheadBuffer.array(); try { if (endOfStream || readInProgress) { return; } checkReadException(); readAheadBuffer.position(0); readAheadBuffer.flip(); readInProgress = true;...
[ "private", "void", "readAsync", "(", ")", "throws", "IOException", "{", "stateChangeLock", ".", "lock", "(", ")", ";", "final", "byte", "[", "]", "arr", "=", "readAheadBuffer", ".", "array", "(", ")", ";", "try", "{", "if", "(", "endOfStream", "||", "r...
Read data from underlyingInputStream to readAheadBuffer asynchronously.
[ "Read", "data", "from", "underlyingInputStream", "to", "readAheadBuffer", "asynchronously", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/io/ReadAheadInputStream.java#L124-L192
122,935
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/server/ThreadWithGarbageCleanup.java
ThreadWithGarbageCleanup.cacheThreadLocalRawStore
public void cacheThreadLocalRawStore() { Long threadId = this.getId(); RawStore threadLocalRawStore = HiveMetaStore.HMSHandler.getRawStore(); if (threadLocalRawStore != null && !threadRawStoreMap.containsKey(threadId)) { LOG.debug("Adding RawStore: " + threadLocalRawStore + ", for the thread: " + ...
java
public void cacheThreadLocalRawStore() { Long threadId = this.getId(); RawStore threadLocalRawStore = HiveMetaStore.HMSHandler.getRawStore(); if (threadLocalRawStore != null && !threadRawStoreMap.containsKey(threadId)) { LOG.debug("Adding RawStore: " + threadLocalRawStore + ", for the thread: " + ...
[ "public", "void", "cacheThreadLocalRawStore", "(", ")", "{", "Long", "threadId", "=", "this", ".", "getId", "(", ")", ";", "RawStore", "threadLocalRawStore", "=", "HiveMetaStore", ".", "HMSHandler", ".", "getRawStore", "(", ")", ";", "if", "(", "threadLocalRaw...
Cache the ThreadLocal RawStore object. Called from the corresponding thread.
[ "Cache", "the", "ThreadLocal", "RawStore", "object", ".", "Called", "from", "the", "corresponding", "thread", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/server/ThreadWithGarbageCleanup.java#L68-L76
122,936
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/MetadataOperation.java
MetadataOperation.convertPattern
private String convertPattern(final String pattern, boolean datanucleusFormat) { String wStr; if (datanucleusFormat) { wStr = "*"; } else { wStr = ".*"; } return pattern .replaceAll("([^\\\\])%", "$1" + wStr).replaceAll("\\\\%", "%").replaceAll("^%", wStr) .replaceAll("([...
java
private String convertPattern(final String pattern, boolean datanucleusFormat) { String wStr; if (datanucleusFormat) { wStr = "*"; } else { wStr = ".*"; } return pattern .replaceAll("([^\\\\])%", "$1" + wStr).replaceAll("\\\\%", "%").replaceAll("^%", wStr) .replaceAll("([...
[ "private", "String", "convertPattern", "(", "final", "String", "pattern", ",", "boolean", "datanucleusFormat", ")", "{", "String", "wStr", ";", "if", "(", "datanucleusFormat", ")", "{", "wStr", "=", "\"*\"", ";", "}", "else", "{", "wStr", "=", "\".*\"", ";...
Convert a pattern containing JDBC catalog search wildcards into Java regex patterns. @param pattern input which may contain '%' or '_' wildcard characters, or these characters escaped using {@link #getSearchStringEscape()}. @return replace %/_ with regex search characters, also handle escaped characters. The datanucl...
[ "Convert", "a", "pattern", "containing", "JDBC", "catalog", "search", "wildcards", "into", "Java", "regex", "patterns", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/MetadataOperation.java#L97-L107
122,937
apache/spark
sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnarBatch.java
ColumnarBatch.rowIterator
public Iterator<InternalRow> rowIterator() { final int maxRows = numRows; final MutableColumnarRow row = new MutableColumnarRow(columns); return new Iterator<InternalRow>() { int rowId = 0; @Override public boolean hasNext() { return rowId < maxRows; } @Override ...
java
public Iterator<InternalRow> rowIterator() { final int maxRows = numRows; final MutableColumnarRow row = new MutableColumnarRow(columns); return new Iterator<InternalRow>() { int rowId = 0; @Override public boolean hasNext() { return rowId < maxRows; } @Override ...
[ "public", "Iterator", "<", "InternalRow", ">", "rowIterator", "(", ")", "{", "final", "int", "maxRows", "=", "numRows", ";", "final", "MutableColumnarRow", "row", "=", "new", "MutableColumnarRow", "(", "columns", ")", ";", "return", "new", "Iterator", "<", "...
Returns an iterator over the rows in this batch.
[ "Returns", "an", "iterator", "over", "the", "rows", "in", "this", "batch", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnarBatch.java#L51-L76
122,938
apache/spark
sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnarBatch.java
ColumnarBatch.getRow
public InternalRow getRow(int rowId) { assert(rowId >= 0 && rowId < numRows); row.rowId = rowId; return row; }
java
public InternalRow getRow(int rowId) { assert(rowId >= 0 && rowId < numRows); row.rowId = rowId; return row; }
[ "public", "InternalRow", "getRow", "(", "int", "rowId", ")", "{", "assert", "(", "rowId", ">=", "0", "&&", "rowId", "<", "numRows", ")", ";", "row", ".", "rowId", "=", "rowId", ";", "return", "row", ";", "}" ]
Returns the row in this batch at `rowId`. Returned row is reused across calls.
[ "Returns", "the", "row", "in", "this", "batch", "at", "rowId", ".", "Returned", "row", "is", "reused", "across", "calls", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/vectorized/ColumnarBatch.java#L103-L107
122,939
apache/spark
common/network-common/src/main/java/org/apache/spark/network/client/TransportClient.java
TransportClient.sendRpc
public long sendRpc(ByteBuffer message, RpcResponseCallback callback) { if (logger.isTraceEnabled()) { logger.trace("Sending RPC to {}", getRemoteAddress(channel)); } long requestId = requestId(); handler.addRpcRequest(requestId, callback); RpcChannelListener listener = new RpcChannelListene...
java
public long sendRpc(ByteBuffer message, RpcResponseCallback callback) { if (logger.isTraceEnabled()) { logger.trace("Sending RPC to {}", getRemoteAddress(channel)); } long requestId = requestId(); handler.addRpcRequest(requestId, callback); RpcChannelListener listener = new RpcChannelListene...
[ "public", "long", "sendRpc", "(", "ByteBuffer", "message", ",", "RpcResponseCallback", "callback", ")", "{", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "{", "logger", ".", "trace", "(", "\"Sending RPC to {}\"", ",", "getRemoteAddress", "(", "ch...
Sends an opaque message to the RpcHandler on the server-side. The callback will be invoked with the server's response or upon any failure. @param message The message to send. @param callback Callback to handle the RPC's reply. @return The RPC's id.
[ "Sends", "an", "opaque", "message", "to", "the", "RpcHandler", "on", "the", "server", "-", "side", ".", "The", "callback", "will", "be", "invoked", "with", "the", "server", "s", "response", "or", "upon", "any", "failure", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/client/TransportClient.java#L187-L200
122,940
apache/spark
common/network-common/src/main/java/org/apache/spark/network/client/TransportClient.java
TransportClient.sendRpcSync
public ByteBuffer sendRpcSync(ByteBuffer message, long timeoutMs) { final SettableFuture<ByteBuffer> result = SettableFuture.create(); sendRpc(message, new RpcResponseCallback() { @Override public void onSuccess(ByteBuffer response) { ByteBuffer copy = ByteBuffer.allocate(response.remaining...
java
public ByteBuffer sendRpcSync(ByteBuffer message, long timeoutMs) { final SettableFuture<ByteBuffer> result = SettableFuture.create(); sendRpc(message, new RpcResponseCallback() { @Override public void onSuccess(ByteBuffer response) { ByteBuffer copy = ByteBuffer.allocate(response.remaining...
[ "public", "ByteBuffer", "sendRpcSync", "(", "ByteBuffer", "message", ",", "long", "timeoutMs", ")", "{", "final", "SettableFuture", "<", "ByteBuffer", ">", "result", "=", "SettableFuture", ".", "create", "(", ")", ";", "sendRpc", "(", "message", ",", "new", ...
Synchronously sends an opaque message to the RpcHandler on the server-side, waiting for up to a specified timeout for a response.
[ "Synchronously", "sends", "an", "opaque", "message", "to", "the", "RpcHandler", "on", "the", "server", "-", "side", "waiting", "for", "up", "to", "a", "specified", "timeout", "for", "a", "response", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/client/TransportClient.java#L234-L260
122,941
apache/spark
core/src/main/java/org/apache/spark/io/NioBufferedFileInputStream.java
NioBufferedFileInputStream.refill
private boolean refill() throws IOException { if (!byteBuffer.hasRemaining()) { byteBuffer.clear(); int nRead = 0; while (nRead == 0) { nRead = fileChannel.read(byteBuffer); } if (nRead < 0) { return false; } byteBuffer.flip(); } return true; }
java
private boolean refill() throws IOException { if (!byteBuffer.hasRemaining()) { byteBuffer.clear(); int nRead = 0; while (nRead == 0) { nRead = fileChannel.read(byteBuffer); } if (nRead < 0) { return false; } byteBuffer.flip(); } return true; }
[ "private", "boolean", "refill", "(", ")", "throws", "IOException", "{", "if", "(", "!", "byteBuffer", ".", "hasRemaining", "(", ")", ")", "{", "byteBuffer", ".", "clear", "(", ")", ";", "int", "nRead", "=", "0", ";", "while", "(", "nRead", "==", "0",...
Checks weather data is left to be read from the input stream. @return true if data is left, false otherwise @throws IOException
[ "Checks", "weather", "data", "is", "left", "to", "be", "read", "from", "the", "input", "stream", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/io/NioBufferedFileInputStream.java#L56-L69
122,942
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/CookieSigner.java
CookieSigner.signCookie
public String signCookie(String str) { if (str == null || str.isEmpty()) { throw new IllegalArgumentException("NULL or empty string to sign"); } String signature = getSignature(str); if (LOG.isDebugEnabled()) { LOG.debug("Signature generated for " + str + " is " + signature); } retu...
java
public String signCookie(String str) { if (str == null || str.isEmpty()) { throw new IllegalArgumentException("NULL or empty string to sign"); } String signature = getSignature(str); if (LOG.isDebugEnabled()) { LOG.debug("Signature generated for " + str + " is " + signature); } retu...
[ "public", "String", "signCookie", "(", "String", "str", ")", "{", "if", "(", "str", "==", "null", "||", "str", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"NULL or empty string to sign\"", ")", ";", "}", "String", ...
Sign the cookie given the string token as input. @param str Input token @return Signed token that can be used to create a cookie
[ "Sign", "the", "cookie", "given", "the", "string", "token", "as", "input", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/CookieSigner.java#L55-L65
122,943
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/CookieSigner.java
CookieSigner.verifyAndExtract
public String verifyAndExtract(String signedStr) { int index = signedStr.lastIndexOf(SIGNATURE); if (index == -1) { throw new IllegalArgumentException("Invalid input sign: " + signedStr); } String originalSignature = signedStr.substring(index + SIGNATURE.length()); String rawValue = signedStr....
java
public String verifyAndExtract(String signedStr) { int index = signedStr.lastIndexOf(SIGNATURE); if (index == -1) { throw new IllegalArgumentException("Invalid input sign: " + signedStr); } String originalSignature = signedStr.substring(index + SIGNATURE.length()); String rawValue = signedStr....
[ "public", "String", "verifyAndExtract", "(", "String", "signedStr", ")", "{", "int", "index", "=", "signedStr", ".", "lastIndexOf", "(", "SIGNATURE", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "...
Verify a signed string and extracts the original string. @param signedStr The already signed string @return Raw Value of the string without the signature
[ "Verify", "a", "signed", "string", "and", "extracts", "the", "original", "string", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/CookieSigner.java#L72-L89
122,944
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/CookieSigner.java
CookieSigner.getSignature
private String getSignature(String str) { try { MessageDigest md = MessageDigest.getInstance(SHA_STRING); md.update(str.getBytes()); md.update(secretBytes); byte[] digest = md.digest(); return new Base64(0).encodeToString(digest); } catch (NoSuchAlgorithmException ex) { throw...
java
private String getSignature(String str) { try { MessageDigest md = MessageDigest.getInstance(SHA_STRING); md.update(str.getBytes()); md.update(secretBytes); byte[] digest = md.digest(); return new Base64(0).encodeToString(digest); } catch (NoSuchAlgorithmException ex) { throw...
[ "private", "String", "getSignature", "(", "String", "str", ")", "{", "try", "{", "MessageDigest", "md", "=", "MessageDigest", ".", "getInstance", "(", "SHA_STRING", ")", ";", "md", ".", "update", "(", "str", ".", "getBytes", "(", ")", ")", ";", "md", "...
Get the signature of the input string based on SHA digest algorithm. @param str Input token @return Signed String
[ "Get", "the", "signature", "of", "the", "input", "string", "based", "on", "SHA", "digest", "algorithm", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/CookieSigner.java#L96-L107
122,945
apache/spark
common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDB.java
LevelDB.closeIterator
void closeIterator(LevelDBIterator<?> it) throws IOException { synchronized (this._db) { DB _db = this._db.get(); if (_db != null) { it.close(); } } }
java
void closeIterator(LevelDBIterator<?> it) throws IOException { synchronized (this._db) { DB _db = this._db.get(); if (_db != null) { it.close(); } } }
[ "void", "closeIterator", "(", "LevelDBIterator", "<", "?", ">", "it", ")", "throws", "IOException", "{", "synchronized", "(", "this", ".", "_db", ")", "{", "DB", "_db", "=", "this", ".", "_db", ".", "get", "(", ")", ";", "if", "(", "_db", "!=", "nu...
Closes the given iterator if the DB is still open. Trying to close a JNI LevelDB handle with a closed DB can cause JVM crashes, so this ensures that situation does not happen.
[ "Closes", "the", "given", "iterator", "if", "the", "DB", "is", "still", "open", ".", "Trying", "to", "close", "a", "JNI", "LevelDB", "handle", "with", "a", "closed", "DB", "can", "cause", "JVM", "crashes", "so", "this", "ensures", "that", "situation", "d...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDB.java#L237-L244
122,946
apache/spark
common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDB.java
LevelDB.getTypeInfo
LevelDBTypeInfo getTypeInfo(Class<?> type) throws Exception { LevelDBTypeInfo ti = types.get(type); if (ti == null) { LevelDBTypeInfo tmp = new LevelDBTypeInfo(this, type, getTypeAlias(type)); ti = types.putIfAbsent(type, tmp); if (ti == null) { ti = tmp; } } return ti; ...
java
LevelDBTypeInfo getTypeInfo(Class<?> type) throws Exception { LevelDBTypeInfo ti = types.get(type); if (ti == null) { LevelDBTypeInfo tmp = new LevelDBTypeInfo(this, type, getTypeAlias(type)); ti = types.putIfAbsent(type, tmp); if (ti == null) { ti = tmp; } } return ti; ...
[ "LevelDBTypeInfo", "getTypeInfo", "(", "Class", "<", "?", ">", "type", ")", "throws", "Exception", "{", "LevelDBTypeInfo", "ti", "=", "types", ".", "get", "(", "type", ")", ";", "if", "(", "ti", "==", "null", ")", "{", "LevelDBTypeInfo", "tmp", "=", "n...
Returns metadata about indices for the given type.
[ "Returns", "metadata", "about", "indices", "for", "the", "given", "type", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDB.java#L247-L257
122,947
apache/spark
common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDB.java
LevelDB.db
DB db() { DB _db = this._db.get(); if (_db == null) { throw new IllegalStateException("DB is closed."); } return _db; }
java
DB db() { DB _db = this._db.get(); if (_db == null) { throw new IllegalStateException("DB is closed."); } return _db; }
[ "DB", "db", "(", ")", "{", "DB", "_db", "=", "this", ".", "_db", ".", "get", "(", ")", ";", "if", "(", "_db", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"DB is closed.\"", ")", ";", "}", "return", "_db", ";", "}" ]
Try to avoid use-after close since that has the tendency of crashing the JVM. This doesn't prevent methods that retrieved the instance from using it after close, but hopefully will catch most cases; otherwise, we'll need some kind of locking.
[ "Try", "to", "avoid", "use", "-", "after", "close", "since", "that", "has", "the", "tendency", "of", "crashing", "the", "JVM", ".", "This", "doesn", "t", "prevent", "methods", "that", "retrieved", "the", "instance", "from", "using", "it", "after", "close",...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/kvstore/src/main/java/org/apache/spark/util/kvstore/LevelDB.java#L264-L270
122,948
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/sasl/ShuffleSecretManager.java
ShuffleSecretManager.registerApp
public void registerApp(String appId, String shuffleSecret) { // Always put the new secret information to make sure it's the most up to date. // Otherwise we have to specifically look at the application attempt in addition // to the applicationId since the secrets change between application attempts on yarn...
java
public void registerApp(String appId, String shuffleSecret) { // Always put the new secret information to make sure it's the most up to date. // Otherwise we have to specifically look at the application attempt in addition // to the applicationId since the secrets change between application attempts on yarn...
[ "public", "void", "registerApp", "(", "String", "appId", ",", "String", "shuffleSecret", ")", "{", "// Always put the new secret information to make sure it's the most up to date.", "// Otherwise we have to specifically look at the application attempt in addition", "// to the applicationId...
Register an application with its secret. Executors need to first authenticate themselves with the same secret before fetching shuffle files written by other executors in this application.
[ "Register", "an", "application", "with", "its", "secret", ".", "Executors", "need", "to", "first", "authenticate", "themselves", "with", "the", "same", "secret", "before", "fetching", "shuffle", "files", "written", "by", "other", "executors", "in", "this", "appl...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/sasl/ShuffleSecretManager.java#L49-L55
122,949
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/sasl/ShuffleSecretManager.java
ShuffleSecretManager.registerApp
public void registerApp(String appId, ByteBuffer shuffleSecret) { registerApp(appId, JavaUtils.bytesToString(shuffleSecret)); }
java
public void registerApp(String appId, ByteBuffer shuffleSecret) { registerApp(appId, JavaUtils.bytesToString(shuffleSecret)); }
[ "public", "void", "registerApp", "(", "String", "appId", ",", "ByteBuffer", "shuffleSecret", ")", "{", "registerApp", "(", "appId", ",", "JavaUtils", ".", "bytesToString", "(", "shuffleSecret", ")", ")", ";", "}" ]
Register an application with its secret specified as a byte buffer.
[ "Register", "an", "application", "with", "its", "secret", "specified", "as", "a", "byte", "buffer", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/sasl/ShuffleSecretManager.java#L60-L62
122,950
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeInMemorySorter.java
UnsafeInMemorySorter.free
public void free() { if (consumer != null) { if (array != null) { consumer.freeArray(array); } array = null; } }
java
public void free() { if (consumer != null) { if (array != null) { consumer.freeArray(array); } array = null; } }
[ "public", "void", "free", "(", ")", "{", "if", "(", "consumer", "!=", "null", ")", "{", "if", "(", "array", "!=", "null", ")", "{", "consumer", ".", "freeArray", "(", "array", ")", ";", "}", "array", "=", "null", ";", "}", "}" ]
Free the memory used by pointer array.
[ "Free", "the", "memory", "used", "by", "pointer", "array", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeInMemorySorter.java#L165-L172
122,951
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeInMemorySorter.java
UnsafeInMemorySorter.insertRecord
public void insertRecord(long recordPointer, long keyPrefix, boolean prefixIsNull) { if (!hasSpaceForAnotherRecord()) { throw new IllegalStateException("There is no space for new record"); } if (prefixIsNull && radixSortSupport != null) { // Swap forward a non-null record to make room for this o...
java
public void insertRecord(long recordPointer, long keyPrefix, boolean prefixIsNull) { if (!hasSpaceForAnotherRecord()) { throw new IllegalStateException("There is no space for new record"); } if (prefixIsNull && radixSortSupport != null) { // Swap forward a non-null record to make room for this o...
[ "public", "void", "insertRecord", "(", "long", "recordPointer", ",", "long", "keyPrefix", ",", "boolean", "prefixIsNull", ")", "{", "if", "(", "!", "hasSpaceForAnotherRecord", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"There is no space f...
Inserts a record to be sorted. Assumes that the record pointer points to a record length stored as a 4-byte integer, followed by the record's bytes. @param recordPointer pointer to a record in a data page, encoded by {@link TaskMemoryManager}. @param keyPrefix a user-defined key prefix
[ "Inserts", "a", "record", "to", "be", "sorted", ".", "Assumes", "that", "the", "record", "pointer", "points", "to", "a", "record", "length", "stored", "as", "a", "4", "-", "byte", "integer", "followed", "by", "the", "record", "s", "bytes", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeInMemorySorter.java#L239-L260
122,952
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java
ByteArrayMethods.nextPowerOf2
public static long nextPowerOf2(long num) { final long highBit = Long.highestOneBit(num); return (highBit == num) ? num : highBit << 1; }
java
public static long nextPowerOf2(long num) { final long highBit = Long.highestOneBit(num); return (highBit == num) ? num : highBit << 1; }
[ "public", "static", "long", "nextPowerOf2", "(", "long", "num", ")", "{", "final", "long", "highBit", "=", "Long", ".", "highestOneBit", "(", "num", ")", ";", "return", "(", "highBit", "==", "num", ")", "?", "num", ":", "highBit", "<<", "1", ";", "}"...
Returns the next number greater or equal num that is power of 2.
[ "Returns", "the", "next", "number", "greater", "or", "equal", "num", "that", "is", "power", "of", "2", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java#L29-L32
122,953
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java
ByteArrayMethods.arrayEquals
public static boolean arrayEquals( Object leftBase, long leftOffset, Object rightBase, long rightOffset, final long length) { int i = 0; // check if stars align and we can get both offsets to be aligned if ((leftOffset % 8) == (rightOffset % 8)) { while ((leftOffset + i) % 8 != 0 && i < length)...
java
public static boolean arrayEquals( Object leftBase, long leftOffset, Object rightBase, long rightOffset, final long length) { int i = 0; // check if stars align and we can get both offsets to be aligned if ((leftOffset % 8) == (rightOffset % 8)) { while ((leftOffset + i) % 8 != 0 && i < length)...
[ "public", "static", "boolean", "arrayEquals", "(", "Object", "leftBase", ",", "long", "leftOffset", ",", "Object", "rightBase", ",", "long", "rightOffset", ",", "final", "long", "length", ")", "{", "int", "i", "=", "0", ";", "// check if stars align and we can g...
Optimized byte array equality check for byte arrays. @return true if the arrays are equal, false otherwise
[ "Optimized", "byte", "array", "equality", "check", "for", "byte", "arrays", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java#L59-L93
122,954
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/protocol/BlockTransferMessage.java
BlockTransferMessage.toByteBuffer
public ByteBuffer toByteBuffer() { // Allow room for encoded message, plus the type byte ByteBuf buf = Unpooled.buffer(encodedLength() + 1); buf.writeByte(type().id); encode(buf); assert buf.writableBytes() == 0 : "Writable bytes remain: " + buf.writableBytes(); return buf.nioBuffer(); }
java
public ByteBuffer toByteBuffer() { // Allow room for encoded message, plus the type byte ByteBuf buf = Unpooled.buffer(encodedLength() + 1); buf.writeByte(type().id); encode(buf); assert buf.writableBytes() == 0 : "Writable bytes remain: " + buf.writableBytes(); return buf.nioBuffer(); }
[ "public", "ByteBuffer", "toByteBuffer", "(", ")", "{", "// Allow room for encoded message, plus the type byte", "ByteBuf", "buf", "=", "Unpooled", ".", "buffer", "(", "encodedLength", "(", ")", "+", "1", ")", ";", "buf", ".", "writeByte", "(", "type", "(", ")", ...
Serializes the 'type' byte followed by the message itself.
[ "Serializes", "the", "type", "byte", "followed", "by", "the", "message", "itself", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/protocol/BlockTransferMessage.java#L77-L84
122,955
apache/spark
launcher/src/main/java/org/apache/spark/launcher/SparkLauncher.java
SparkLauncher.setSparkHome
public SparkLauncher setSparkHome(String sparkHome) { checkNotNull(sparkHome, "sparkHome"); builder.childEnv.put(ENV_SPARK_HOME, sparkHome); return this; }
java
public SparkLauncher setSparkHome(String sparkHome) { checkNotNull(sparkHome, "sparkHome"); builder.childEnv.put(ENV_SPARK_HOME, sparkHome); return this; }
[ "public", "SparkLauncher", "setSparkHome", "(", "String", "sparkHome", ")", "{", "checkNotNull", "(", "sparkHome", ",", "\"sparkHome\"", ")", ";", "builder", ".", "childEnv", ".", "put", "(", "ENV_SPARK_HOME", ",", "sparkHome", ")", ";", "return", "this", ";",...
Set a custom Spark installation location for the application. @param sparkHome Path to the Spark installation to use. @return This launcher.
[ "Set", "a", "custom", "Spark", "installation", "location", "for", "the", "application", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/SparkLauncher.java#L149-L153
122,956
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeSorterSpillMerger.java
UnsafeSorterSpillMerger.addSpillIfNotEmpty
public void addSpillIfNotEmpty(UnsafeSorterIterator spillReader) throws IOException { if (spillReader.hasNext()) { // We only add the spillReader to the priorityQueue if it is not empty. We do this to // make sure the hasNext method of UnsafeSorterIterator returned by getSortedIterator // does not...
java
public void addSpillIfNotEmpty(UnsafeSorterIterator spillReader) throws IOException { if (spillReader.hasNext()) { // We only add the spillReader to the priorityQueue if it is not empty. We do this to // make sure the hasNext method of UnsafeSorterIterator returned by getSortedIterator // does not...
[ "public", "void", "addSpillIfNotEmpty", "(", "UnsafeSorterIterator", "spillReader", ")", "throws", "IOException", "{", "if", "(", "spillReader", ".", "hasNext", "(", ")", ")", "{", "// We only add the spillReader to the priorityQueue if it is not empty. We do this to", "// ma...
Add an UnsafeSorterIterator to this merger
[ "Add", "an", "UnsafeSorterIterator", "to", "this", "merger" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeSorterSpillMerger.java#L50-L61
122,957
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/OneForOneBlockFetcher.java
OneForOneBlockFetcher.failRemainingBlocks
private void failRemainingBlocks(String[] failedBlockIds, Throwable e) { for (String blockId : failedBlockIds) { try { listener.onBlockFetchFailure(blockId, e); } catch (Exception e2) { logger.error("Error in block fetch failure callback", e2); } } }
java
private void failRemainingBlocks(String[] failedBlockIds, Throwable e) { for (String blockId : failedBlockIds) { try { listener.onBlockFetchFailure(blockId, e); } catch (Exception e2) { logger.error("Error in block fetch failure callback", e2); } } }
[ "private", "void", "failRemainingBlocks", "(", "String", "[", "]", "failedBlockIds", ",", "Throwable", "e", ")", "{", "for", "(", "String", "blockId", ":", "failedBlockIds", ")", "{", "try", "{", "listener", ".", "onBlockFetchFailure", "(", "blockId", ",", "...
Invokes the "onBlockFetchFailure" callback for every listed block id.
[ "Invokes", "the", "onBlockFetchFailure", "callback", "for", "every", "listed", "block", "id", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/OneForOneBlockFetcher.java#L145-L153
122,958
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
ThriftHttpServlet.getClientNameFromCookie
private String getClientNameFromCookie(Cookie[] cookies) { // Current Cookie Name, Current Cookie Value String currName, currValue; // Following is the main loop which iterates through all the cookies send by the client. // The HS2 generated cookies are of the format hive.server2.auth=<value> // A ...
java
private String getClientNameFromCookie(Cookie[] cookies) { // Current Cookie Name, Current Cookie Value String currName, currValue; // Following is the main loop which iterates through all the cookies send by the client. // The HS2 generated cookies are of the format hive.server2.auth=<value> // A ...
[ "private", "String", "getClientNameFromCookie", "(", "Cookie", "[", "]", "cookies", ")", "{", "// Current Cookie Name, Current Cookie Value", "String", "currName", ",", "currValue", ";", "// Following is the main loop which iterates through all the cookies send by the client.", "//...
Retrieves the client name from cookieString. If the cookie does not correspond to a valid client, the function returns null. @param cookies HTTP Request cookies. @return Client Username if cookieString has a HS2 Generated cookie that is currently valid. Else, returns null.
[ "Retrieves", "the", "client", "name", "from", "cookieString", ".", "If", "the", "cookie", "does", "not", "correspond", "to", "a", "valid", "client", "the", "function", "returns", "null", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L196-L234
122,959
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
ThriftHttpServlet.toCookieStr
private String toCookieStr(Cookie[] cookies) { String cookieStr = ""; for (Cookie c : cookies) { cookieStr += c.getName() + "=" + c.getValue() + " ;\n"; } return cookieStr; }
java
private String toCookieStr(Cookie[] cookies) { String cookieStr = ""; for (Cookie c : cookies) { cookieStr += c.getName() + "=" + c.getValue() + " ;\n"; } return cookieStr; }
[ "private", "String", "toCookieStr", "(", "Cookie", "[", "]", "cookies", ")", "{", "String", "cookieStr", "=", "\"\"", ";", "for", "(", "Cookie", "c", ":", "cookies", ")", "{", "cookieStr", "+=", "c", ".", "getName", "(", ")", "+", "\"=\"", "+", "c", ...
Convert cookie array to human readable cookie string @param cookies Cookie Array @return String containing all the cookies separated by a newline character. Each cookie is of the format [key]=[value]
[ "Convert", "cookie", "array", "to", "human", "readable", "cookie", "string" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L242-L249
122,960
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
ThriftHttpServlet.createCookie
private Cookie createCookie(String str) throws UnsupportedEncodingException { if (LOG.isDebugEnabled()) { LOG.debug("Cookie name = " + AUTH_COOKIE + " value = " + str); } Cookie cookie = new Cookie(AUTH_COOKIE, str); cookie.setMaxAge(cookieMaxAge); if (cookieDomain != null) { cookie.set...
java
private Cookie createCookie(String str) throws UnsupportedEncodingException { if (LOG.isDebugEnabled()) { LOG.debug("Cookie name = " + AUTH_COOKIE + " value = " + str); } Cookie cookie = new Cookie(AUTH_COOKIE, str); cookie.setMaxAge(cookieMaxAge); if (cookieDomain != null) { cookie.set...
[ "private", "Cookie", "createCookie", "(", "String", "str", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Cookie name = \"", "+", "AUTH_COOKIE", "+", "\" value = \"", ...
Generate a server side cookie given the cookie value as the input. @param str Input string token. @return The generated cookie. @throws UnsupportedEncodingException
[ "Generate", "a", "server", "side", "cookie", "given", "the", "cookie", "value", "as", "the", "input", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L281-L296
122,961
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
ThriftHttpServlet.getHttpOnlyCookieHeader
private static String getHttpOnlyCookieHeader(Cookie cookie) { NewCookie newCookie = new NewCookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion(), cookie.getComment(), cookie.getMaxAge(), cookie.getSecure()); return newCookie + "; HttpOnly"; }
java
private static String getHttpOnlyCookieHeader(Cookie cookie) { NewCookie newCookie = new NewCookie(cookie.getName(), cookie.getValue(), cookie.getPath(), cookie.getDomain(), cookie.getVersion(), cookie.getComment(), cookie.getMaxAge(), cookie.getSecure()); return newCookie + "; HttpOnly"; }
[ "private", "static", "String", "getHttpOnlyCookieHeader", "(", "Cookie", "cookie", ")", "{", "NewCookie", "newCookie", "=", "new", "NewCookie", "(", "cookie", ".", "getName", "(", ")", ",", "cookie", ".", "getValue", "(", ")", ",", "cookie", ".", "getPath", ...
Generate httponly cookie from HS2 cookie @param cookie HS2 generated cookie @return The httponly cookie
[ "Generate", "httponly", "cookie", "from", "HS2", "cookie" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L303-L308
122,962
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
ThriftHttpServlet.doKerberosAuth
private String doKerberosAuth(HttpServletRequest request) throws HttpAuthenticationException { // Try authenticating with the http/_HOST principal if (httpUGI != null) { try { return httpUGI.doAs(new HttpKerberosServerAction(request, httpUGI)); } catch (Exception e) { LOG.info(...
java
private String doKerberosAuth(HttpServletRequest request) throws HttpAuthenticationException { // Try authenticating with the http/_HOST principal if (httpUGI != null) { try { return httpUGI.doAs(new HttpKerberosServerAction(request, httpUGI)); } catch (Exception e) { LOG.info(...
[ "private", "String", "doKerberosAuth", "(", "HttpServletRequest", "request", ")", "throws", "HttpAuthenticationException", "{", "// Try authenticating with the http/_HOST principal", "if", "(", "httpUGI", "!=", "null", ")", "{", "try", "{", "return", "httpUGI", ".", "do...
Do the GSS-API kerberos authentication. We already have a logged in subject in the form of serviceUGI, which GSS-API will extract information from. In case of a SPNego request we use the httpUGI, for the authenticating service tickets. @param request @return @throws HttpAuthenticationException
[ "Do", "the", "GSS", "-", "API", "kerberos", "authentication", ".", "We", "already", "have", "a", "logged", "in", "subject", "in", "the", "form", "of", "serviceUGI", "which", "GSS", "-", "API", "will", "extract", "information", "from", ".", "In", "case", ...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L344-L363
122,963
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java
ThriftHttpServlet.getAuthHeader
private String getAuthHeader(HttpServletRequest request, String authType) throws HttpAuthenticationException { String authHeader = request.getHeader(HttpAuthUtils.AUTHORIZATION); // Each http request must have an Authorization header if (authHeader == null || authHeader.isEmpty()) { throw new Ht...
java
private String getAuthHeader(HttpServletRequest request, String authType) throws HttpAuthenticationException { String authHeader = request.getHeader(HttpAuthUtils.AUTHORIZATION); // Each http request must have an Authorization header if (authHeader == null || authHeader.isEmpty()) { throw new Ht...
[ "private", "String", "getAuthHeader", "(", "HttpServletRequest", "request", ",", "String", "authType", ")", "throws", "HttpAuthenticationException", "{", "String", "authHeader", "=", "request", ".", "getHeader", "(", "HttpAuthUtils", ".", "AUTHORIZATION", ")", ";", ...
Returns the base64 encoded auth header payload @param request @param authType @return @throws HttpAuthenticationException
[ "Returns", "the", "base64", "encoded", "auth", "header", "payload" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/thrift/ThriftHttpServlet.java#L496-L520
122,964
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.join
static String join(String sep, String... elements) { StringBuilder sb = new StringBuilder(); for (String e : elements) { if (e != null) { if (sb.length() > 0) { sb.append(sep); } sb.append(e); } } return sb.toString(); }
java
static String join(String sep, String... elements) { StringBuilder sb = new StringBuilder(); for (String e : elements) { if (e != null) { if (sb.length() > 0) { sb.append(sep); } sb.append(e); } } return sb.toString(); }
[ "static", "String", "join", "(", "String", "sep", ",", "String", "...", "elements", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "e", ":", "elements", ")", "{", "if", "(", "e", "!=", "null", ")", ...
Joins a list of strings using the given separator.
[ "Joins", "a", "list", "of", "strings", "using", "the", "given", "separator", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L40-L51
122,965
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.firstNonEmptyValue
static String firstNonEmptyValue(String key, Map<?, ?>... maps) { for (Map<?, ?> map : maps) { String value = (String) map.get(key); if (!isEmpty(value)) { return value; } } return null; }
java
static String firstNonEmptyValue(String key, Map<?, ?>... maps) { for (Map<?, ?> map : maps) { String value = (String) map.get(key); if (!isEmpty(value)) { return value; } } return null; }
[ "static", "String", "firstNonEmptyValue", "(", "String", "key", ",", "Map", "<", "?", ",", "?", ">", "...", "maps", ")", "{", "for", "(", "Map", "<", "?", ",", "?", ">", "map", ":", "maps", ")", "{", "String", "value", "=", "(", "String", ")", ...
Returns the first non-empty value mapped to the given key in the given maps, or null otherwise.
[ "Returns", "the", "first", "non", "-", "empty", "value", "mapped", "to", "the", "given", "key", "in", "the", "given", "maps", "or", "null", "otherwise", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L70-L78
122,966
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.firstNonEmpty
static String firstNonEmpty(String... candidates) { for (String s : candidates) { if (!isEmpty(s)) { return s; } } return null; }
java
static String firstNonEmpty(String... candidates) { for (String s : candidates) { if (!isEmpty(s)) { return s; } } return null; }
[ "static", "String", "firstNonEmpty", "(", "String", "...", "candidates", ")", "{", "for", "(", "String", "s", ":", "candidates", ")", "{", "if", "(", "!", "isEmpty", "(", "s", ")", ")", "{", "return", "s", ";", "}", "}", "return", "null", ";", "}" ...
Returns the first non-empty, non-null string in the given list, or null otherwise.
[ "Returns", "the", "first", "non", "-", "empty", "non", "-", "null", "string", "in", "the", "given", "list", "or", "null", "otherwise", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L81-L88
122,967
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.checkNotNull
static void checkNotNull(Object o, String arg) { if (o == null) { throw new IllegalArgumentException(String.format("'%s' must not be null.", arg)); } }
java
static void checkNotNull(Object o, String arg) { if (o == null) { throw new IllegalArgumentException(String.format("'%s' must not be null.", arg)); } }
[ "static", "void", "checkNotNull", "(", "Object", "o", ",", "String", "arg", ")", "{", "if", "(", "o", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"'%s' must not be null.\"", ",", "arg", ")", ")",...
Throws IllegalArgumentException if the given object is null.
[ "Throws", "IllegalArgumentException", "if", "the", "given", "object", "is", "null", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L212-L216
122,968
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.checkArgument
static void checkArgument(boolean check, String msg, Object... args) { if (!check) { throw new IllegalArgumentException(String.format(msg, args)); } }
java
static void checkArgument(boolean check, String msg, Object... args) { if (!check) { throw new IllegalArgumentException(String.format(msg, args)); } }
[ "static", "void", "checkArgument", "(", "boolean", "check", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "if", "(", "!", "check", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "msg", ",", "args"...
Throws IllegalArgumentException with the given message if the check is false.
[ "Throws", "IllegalArgumentException", "with", "the", "given", "message", "if", "the", "check", "is", "false", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L219-L223
122,969
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.checkState
static void checkState(boolean check, String msg, Object... args) { if (!check) { throw new IllegalStateException(String.format(msg, args)); } }
java
static void checkState(boolean check, String msg, Object... args) { if (!check) { throw new IllegalStateException(String.format(msg, args)); } }
[ "static", "void", "checkState", "(", "boolean", "check", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "if", "(", "!", "check", ")", "{", "throw", "new", "IllegalStateException", "(", "String", ".", "format", "(", "msg", ",", "args", ")...
Throws IllegalStateException with the given message if the check is false.
[ "Throws", "IllegalStateException", "with", "the", "given", "message", "if", "the", "check", "is", "false", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L226-L230
122,970
apache/spark
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
CommandBuilderUtils.findJarsDir
static String findJarsDir(String sparkHome, String scalaVersion, boolean failIfNotFound) { // TODO: change to the correct directory once the assembly build is changed. File libdir = new File(sparkHome, "jars"); if (!libdir.isDirectory()) { libdir = new File(sparkHome, String.format("assembly/target/sc...
java
static String findJarsDir(String sparkHome, String scalaVersion, boolean failIfNotFound) { // TODO: change to the correct directory once the assembly build is changed. File libdir = new File(sparkHome, "jars"); if (!libdir.isDirectory()) { libdir = new File(sparkHome, String.format("assembly/target/sc...
[ "static", "String", "findJarsDir", "(", "String", "sparkHome", ",", "String", "scalaVersion", ",", "boolean", "failIfNotFound", ")", "{", "// TODO: change to the correct directory once the assembly build is changed.", "File", "libdir", "=", "new", "File", "(", "sparkHome", ...
Find the location of the Spark jars dir, depending on whether we're looking at a build or a distribution directory.
[ "Find", "the", "location", "of", "the", "Spark", "jars", "dir", "depending", "on", "whether", "we", "re", "looking", "at", "a", "build", "or", "a", "distribution", "directory", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L316-L329
122,971
apache/spark
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeArrayData.java
UnsafeArrayData.pointTo
public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) { // Read the number of elements from the first 8 bytes. final long numElements = Platform.getLong(baseObject, baseOffset); assert numElements >= 0 : "numElements (" + numElements + ") should >= 0"; assert numElements <= Integer.MA...
java
public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) { // Read the number of elements from the first 8 bytes. final long numElements = Platform.getLong(baseObject, baseOffset); assert numElements >= 0 : "numElements (" + numElements + ") should >= 0"; assert numElements <= Integer.MA...
[ "public", "void", "pointTo", "(", "Object", "baseObject", ",", "long", "baseOffset", ",", "int", "sizeInBytes", ")", "{", "// Read the number of elements from the first 8 bytes.", "final", "long", "numElements", "=", "Platform", ".", "getLong", "(", "baseObject", ",",...
Update this UnsafeArrayData to point to different backing data. @param baseObject the base object @param baseOffset the offset within the base object @param sizeInBytes the size of this array's backing data, in bytes
[ "Update", "this", "UnsafeArrayData", "to", "point", "to", "different", "backing", "data", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeArrayData.java#L128-L140
122,972
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/SQLOperation.java
SQLOperation.getCurrentUGI
private UserGroupInformation getCurrentUGI(HiveConf opConfig) throws HiveSQLException { try { return Utils.getUGI(); } catch (Exception e) { throw new HiveSQLException("Unable to get current user", e); } }
java
private UserGroupInformation getCurrentUGI(HiveConf opConfig) throws HiveSQLException { try { return Utils.getUGI(); } catch (Exception e) { throw new HiveSQLException("Unable to get current user", e); } }
[ "private", "UserGroupInformation", "getCurrentUGI", "(", "HiveConf", "opConfig", ")", "throws", "HiveSQLException", "{", "try", "{", "return", "Utils", ".", "getUGI", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "HiveSQLExcepti...
Returns the current UGI on the stack @param opConfig @return UserGroupInformation @throws HiveSQLException
[ "Returns", "the", "current", "UGI", "on", "the", "stack" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/SQLOperation.java#L255-L261
122,973
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/SQLOperation.java
SQLOperation.prepareFromRow
private RowSet prepareFromRow(List<Object> rows, RowSet rowSet) throws Exception { for (Object row : rows) { rowSet.addRow((Object[]) row); } return rowSet; }
java
private RowSet prepareFromRow(List<Object> rows, RowSet rowSet) throws Exception { for (Object row : rows) { rowSet.addRow((Object[]) row); } return rowSet; }
[ "private", "RowSet", "prepareFromRow", "(", "List", "<", "Object", ">", "rows", ",", "RowSet", "rowSet", ")", "throws", "Exception", "{", "for", "(", "Object", "row", ":", "rows", ")", "{", "rowSet", ".", "addRow", "(", "(", "Object", "[", "]", ")", ...
already encoded to thrift-able object in ThriftFormatter
[ "already", "encoded", "to", "thrift", "-", "able", "object", "in", "ThriftFormatter" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/SQLOperation.java#L357-L362
122,974
apache/spark
sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/SQLOperation.java
SQLOperation.getConfigForOperation
private HiveConf getConfigForOperation() throws HiveSQLException { HiveConf sqlOperationConf = getParentSession().getHiveConf(); if (!getConfOverlay().isEmpty() || shouldRunAsync()) { // clone the parent session config for this query sqlOperationConf = new HiveConf(sqlOperationConf); // apply...
java
private HiveConf getConfigForOperation() throws HiveSQLException { HiveConf sqlOperationConf = getParentSession().getHiveConf(); if (!getConfOverlay().isEmpty() || shouldRunAsync()) { // clone the parent session config for this query sqlOperationConf = new HiveConf(sqlOperationConf); // apply...
[ "private", "HiveConf", "getConfigForOperation", "(", ")", "throws", "HiveSQLException", "{", "HiveConf", "sqlOperationConf", "=", "getParentSession", "(", ")", ".", "getHiveConf", "(", ")", ";", "if", "(", "!", "getConfOverlay", "(", ")", ".", "isEmpty", "(", ...
If there are query specific settings to overlay, then create a copy of config There are two cases we need to clone the session config that's being passed to hive driver 1. Async query - If the client changes a config setting, that shouldn't reflect in the execution already underway 2. confOverlay - The query specific s...
[ "If", "there", "are", "query", "specific", "settings", "to", "overlay", "then", "create", "a", "copy", "of", "config", "There", "are", "two", "cases", "we", "need", "to", "clone", "the", "session", "config", "that", "s", "being", "passed", "to", "hive", ...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/hive-thriftserver/src/main/java/org/apache/hive/service/cli/operation/SQLOperation.java#L443-L459
122,975
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RetryingBlockFetcher.java
RetryingBlockFetcher.shouldRetry
private synchronized boolean shouldRetry(Throwable e) { boolean isIOException = e instanceof IOException || (e.getCause() != null && e.getCause() instanceof IOException); boolean hasRemainingRetries = retryCount < maxRetries; return isIOException && hasRemainingRetries; }
java
private synchronized boolean shouldRetry(Throwable e) { boolean isIOException = e instanceof IOException || (e.getCause() != null && e.getCause() instanceof IOException); boolean hasRemainingRetries = retryCount < maxRetries; return isIOException && hasRemainingRetries; }
[ "private", "synchronized", "boolean", "shouldRetry", "(", "Throwable", "e", ")", "{", "boolean", "isIOException", "=", "e", "instanceof", "IOException", "||", "(", "e", ".", "getCause", "(", ")", "!=", "null", "&&", "e", ".", "getCause", "(", ")", "instanc...
Returns true if we should retry due a block fetch failure. We will retry if and only if the exception was an IOException and we haven't retried 'maxRetries' times already.
[ "Returns", "true", "if", "we", "should", "retry", "due", "a", "block", "fetch", "failure", ".", "We", "will", "retry", "if", "and", "only", "if", "the", "exception", "was", "an", "IOException", "and", "we", "haven", "t", "retried", "maxRetries", "times", ...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/RetryingBlockFetcher.java#L177-L182
122,976
apache/spark
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/FixedLengthRowBasedKeyValueBatch.java
FixedLengthRowBasedKeyValueBatch.appendRow
@Override public UnsafeRow appendRow(Object kbase, long koff, int klen, Object vbase, long voff, int vlen) { // if run out of max supported rows or page size, return null if (numRows >= capacity || page == null || page.size() - pageCursor < recordLength) { return null; }...
java
@Override public UnsafeRow appendRow(Object kbase, long koff, int klen, Object vbase, long voff, int vlen) { // if run out of max supported rows or page size, return null if (numRows >= capacity || page == null || page.size() - pageCursor < recordLength) { return null; }...
[ "@", "Override", "public", "UnsafeRow", "appendRow", "(", "Object", "kbase", ",", "long", "koff", ",", "int", "klen", ",", "Object", "vbase", ",", "long", "voff", ",", "int", "vlen", ")", "{", "// if run out of max supported rows or page size, return null", "if", ...
Append a key value pair. It copies data into the backing MemoryBlock. Returns an UnsafeRow pointing to the value if succeeds, otherwise returns null.
[ "Append", "a", "key", "value", "pair", ".", "It", "copies", "data", "into", "the", "backing", "MemoryBlock", ".", "Returns", "an", "UnsafeRow", "pointing", "to", "the", "value", "if", "succeeds", "otherwise", "returns", "null", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/FixedLengthRowBasedKeyValueBatch.java#L45-L68
122,977
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.fromString
public static UTF8String fromString(String str) { return str == null ? null : fromBytes(str.getBytes(StandardCharsets.UTF_8)); }
java
public static UTF8String fromString(String str) { return str == null ? null : fromBytes(str.getBytes(StandardCharsets.UTF_8)); }
[ "public", "static", "UTF8String", "fromString", "(", "String", "str", ")", "{", "return", "str", "==", "null", "?", "null", ":", "fromBytes", "(", "str", ".", "getBytes", "(", "StandardCharsets", ".", "UTF_8", ")", ")", ";", "}" ]
Creates an UTF8String from String.
[ "Creates", "an", "UTF8String", "from", "String", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L141-L143
122,978
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.blankString
public static UTF8String blankString(int length) { byte[] spaces = new byte[length]; Arrays.fill(spaces, (byte) ' '); return fromBytes(spaces); }
java
public static UTF8String blankString(int length) { byte[] spaces = new byte[length]; Arrays.fill(spaces, (byte) ' '); return fromBytes(spaces); }
[ "public", "static", "UTF8String", "blankString", "(", "int", "length", ")", "{", "byte", "[", "]", "spaces", "=", "new", "byte", "[", "length", "]", ";", "Arrays", ".", "fill", "(", "spaces", ",", "(", "byte", ")", "'", "'", ")", ";", "return", "fr...
Creates an UTF8String that contains `length` spaces.
[ "Creates", "an", "UTF8String", "that", "contains", "length", "spaces", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L148-L152
122,979
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.writeToMemory
public void writeToMemory(Object target, long targetOffset) { Platform.copyMemory(base, offset, target, targetOffset, numBytes); }
java
public void writeToMemory(Object target, long targetOffset) { Platform.copyMemory(base, offset, target, targetOffset, numBytes); }
[ "public", "void", "writeToMemory", "(", "Object", "target", ",", "long", "targetOffset", ")", "{", "Platform", ".", "copyMemory", "(", "base", ",", "offset", ",", "target", ",", "targetOffset", ",", "numBytes", ")", ";", "}" ]
Writes the content of this string into a memory address, identified by an object and an offset. The target memory address must already been allocated, and have enough space to hold all the bytes in this string.
[ "Writes", "the", "content", "of", "this", "string", "into", "a", "memory", "address", "identified", "by", "an", "object", "and", "an", "offset", ".", "The", "target", "memory", "address", "must", "already", "been", "allocated", "and", "have", "enough", "spac...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L170-L172
122,980
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.getBytes
public byte[] getBytes() { // avoid copy if `base` is `byte[]` if (offset == BYTE_ARRAY_OFFSET && base instanceof byte[] && ((byte[]) base).length == numBytes) { return (byte[]) base; } else { byte[] bytes = new byte[numBytes]; copyMemory(base, offset, bytes, BYTE_ARRAY_OFFSET, numBy...
java
public byte[] getBytes() { // avoid copy if `base` is `byte[]` if (offset == BYTE_ARRAY_OFFSET && base instanceof byte[] && ((byte[]) base).length == numBytes) { return (byte[]) base; } else { byte[] bytes = new byte[numBytes]; copyMemory(base, offset, bytes, BYTE_ARRAY_OFFSET, numBy...
[ "public", "byte", "[", "]", "getBytes", "(", ")", "{", "// avoid copy if `base` is `byte[]`", "if", "(", "offset", "==", "BYTE_ARRAY_OFFSET", "&&", "base", "instanceof", "byte", "[", "]", "&&", "(", "(", "byte", "[", "]", ")", "base", ")", ".", "length", ...
Returns the underline bytes, will be a copy of it if it's part of another array.
[ "Returns", "the", "underline", "bytes", "will", "be", "a", "copy", "of", "it", "if", "it", "s", "part", "of", "another", "array", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L291-L301
122,981
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.contains
public boolean contains(final UTF8String substring) { if (substring.numBytes == 0) { return true; } byte first = substring.getByte(0); for (int i = 0; i <= numBytes - substring.numBytes; i++) { if (getByte(i) == first && matchAt(substring, i)) { return true; } } return...
java
public boolean contains(final UTF8String substring) { if (substring.numBytes == 0) { return true; } byte first = substring.getByte(0); for (int i = 0; i <= numBytes - substring.numBytes; i++) { if (getByte(i) == first && matchAt(substring, i)) { return true; } } return...
[ "public", "boolean", "contains", "(", "final", "UTF8String", "substring", ")", "{", "if", "(", "substring", ".", "numBytes", "==", "0", ")", "{", "return", "true", ";", "}", "byte", "first", "=", "substring", ".", "getByte", "(", "0", ")", ";", "for", ...
Returns whether this contains `substring` or not.
[ "Returns", "whether", "this", "contains", "substring", "or", "not", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L351-L363
122,982
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.toUpperCase
public UTF8String toUpperCase() { if (numBytes == 0) { return EMPTY_UTF8; } byte[] bytes = new byte[numBytes]; bytes[0] = (byte) Character.toTitleCase(getByte(0)); for (int i = 0; i < numBytes; i++) { byte b = getByte(i); if (numBytesForFirstByte(b) != 1) { // fallback ...
java
public UTF8String toUpperCase() { if (numBytes == 0) { return EMPTY_UTF8; } byte[] bytes = new byte[numBytes]; bytes[0] = (byte) Character.toTitleCase(getByte(0)); for (int i = 0; i < numBytes; i++) { byte b = getByte(i); if (numBytesForFirstByte(b) != 1) { // fallback ...
[ "public", "UTF8String", "toUpperCase", "(", ")", "{", "if", "(", "numBytes", "==", "0", ")", "{", "return", "EMPTY_UTF8", ";", "}", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "numBytes", "]", ";", "bytes", "[", "0", "]", "=", "(", "byte", ...
Returns the upper case of this string
[ "Returns", "the", "upper", "case", "of", "this", "string" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L390-L411
122,983
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.toLowerCase
public UTF8String toLowerCase() { if (numBytes == 0) { return EMPTY_UTF8; } byte[] bytes = new byte[numBytes]; bytes[0] = (byte) Character.toTitleCase(getByte(0)); for (int i = 0; i < numBytes; i++) { byte b = getByte(i); if (numBytesForFirstByte(b) != 1) { // fallback ...
java
public UTF8String toLowerCase() { if (numBytes == 0) { return EMPTY_UTF8; } byte[] bytes = new byte[numBytes]; bytes[0] = (byte) Character.toTitleCase(getByte(0)); for (int i = 0; i < numBytes; i++) { byte b = getByte(i); if (numBytesForFirstByte(b) != 1) { // fallback ...
[ "public", "UTF8String", "toLowerCase", "(", ")", "{", "if", "(", "numBytes", "==", "0", ")", "{", "return", "EMPTY_UTF8", ";", "}", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "numBytes", "]", ";", "bytes", "[", "0", "]", "=", "(", "byte", ...
Returns the lower case of this string
[ "Returns", "the", "lower", "case", "of", "this", "string" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L420-L441
122,984
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.toTitleCase
public UTF8String toTitleCase() { if (numBytes == 0) { return EMPTY_UTF8; } byte[] bytes = new byte[numBytes]; for (int i = 0; i < numBytes; i++) { byte b = getByte(i); if (i == 0 || getByte(i - 1) == ' ') { if (numBytesForFirstByte(b) != 1) { // fallback r...
java
public UTF8String toTitleCase() { if (numBytes == 0) { return EMPTY_UTF8; } byte[] bytes = new byte[numBytes]; for (int i = 0; i < numBytes; i++) { byte b = getByte(i); if (i == 0 || getByte(i - 1) == ' ') { if (numBytesForFirstByte(b) != 1) { // fallback r...
[ "public", "UTF8String", "toTitleCase", "(", ")", "{", "if", "(", "numBytes", "==", "0", ")", "{", "return", "EMPTY_UTF8", ";", "}", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "numBytes", "]", ";", "for", "(", "int", "i", "=", "0", ";", "...
Returns the title case of this string, that could be used as title.
[ "Returns", "the", "title", "case", "of", "this", "string", "that", "could", "be", "used", "as", "title", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L450-L474
122,985
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.copyUTF8String
private UTF8String copyUTF8String(int start, int end) { int len = end - start + 1; byte[] newBytes = new byte[len]; copyMemory(base, offset + start, newBytes, BYTE_ARRAY_OFFSET, len); return UTF8String.fromBytes(newBytes); }
java
private UTF8String copyUTF8String(int start, int end) { int len = end - start + 1; byte[] newBytes = new byte[len]; copyMemory(base, offset + start, newBytes, BYTE_ARRAY_OFFSET, len); return UTF8String.fromBytes(newBytes); }
[ "private", "UTF8String", "copyUTF8String", "(", "int", "start", ",", "int", "end", ")", "{", "int", "len", "=", "end", "-", "start", "+", "1", ";", "byte", "[", "]", "newBytes", "=", "new", "byte", "[", "len", "]", ";", "copyMemory", "(", "base", "...
Copy the bytes from the current UTF8String, and make a new UTF8String. @param start the start position of the current UTF8String in bytes. @param end the end position of the current UTF8String in bytes. @return a new UTF8String in the position of [start, end] of current UTF8String bytes.
[ "Copy", "the", "bytes", "from", "the", "current", "UTF8String", "and", "make", "a", "new", "UTF8String", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L525-L530
122,986
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.trim
public UTF8String trim(UTF8String trimString) { if (trimString != null) { return trimLeft(trimString).trimRight(trimString); } else { return null; } }
java
public UTF8String trim(UTF8String trimString) { if (trimString != null) { return trimLeft(trimString).trimRight(trimString); } else { return null; } }
[ "public", "UTF8String", "trim", "(", "UTF8String", "trimString", ")", "{", "if", "(", "trimString", "!=", "null", ")", "{", "return", "trimLeft", "(", "trimString", ")", ".", "trimRight", "(", "trimString", ")", ";", "}", "else", "{", "return", "null", "...
Based on the given trim string, trim this string starting from both ends This method searches for each character in the source string, removes the character if it is found in the trim string, stops at the first not found. It calls the trimLeft first, then trimRight. It returns a new string in which both ends trim chara...
[ "Based", "on", "the", "given", "trim", "string", "trim", "this", "string", "starting", "from", "both", "ends", "This", "method", "searches", "for", "each", "character", "in", "the", "source", "string", "removes", "the", "character", "if", "it", "is", "found"...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L553-L559
122,987
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.trimLeft
public UTF8String trimLeft(UTF8String trimString) { if (trimString == null) return null; // the searching byte position in the source string int srchIdx = 0; // the first beginning byte position of a non-matching character int trimIdx = 0; while (srchIdx < numBytes) { UTF8String searchCha...
java
public UTF8String trimLeft(UTF8String trimString) { if (trimString == null) return null; // the searching byte position in the source string int srchIdx = 0; // the first beginning byte position of a non-matching character int trimIdx = 0; while (srchIdx < numBytes) { UTF8String searchCha...
[ "public", "UTF8String", "trimLeft", "(", "UTF8String", "trimString", ")", "{", "if", "(", "trimString", "==", "null", ")", "return", "null", ";", "// the searching byte position in the source string", "int", "srchIdx", "=", "0", ";", "// the first beginning byte positio...
Based on the given trim string, trim this string starting from left end This method searches each character in the source string starting from the left end, removes the character if it is in the trim string, stops at the first character which is not in the trim string, returns the new string. @param trimString the trim...
[ "Based", "on", "the", "given", "trim", "string", "trim", "this", "string", "starting", "from", "left", "end", "This", "method", "searches", "each", "character", "in", "the", "source", "string", "starting", "from", "the", "left", "end", "removes", "the", "cha...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L580-L607
122,988
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.trimRight
public UTF8String trimRight(UTF8String trimString) { if (trimString == null) return null; int charIdx = 0; // number of characters from the source string int numChars = 0; // array of character length for the source string int[] stringCharLen = new int[numBytes]; // array of the first byte p...
java
public UTF8String trimRight(UTF8String trimString) { if (trimString == null) return null; int charIdx = 0; // number of characters from the source string int numChars = 0; // array of character length for the source string int[] stringCharLen = new int[numBytes]; // array of the first byte p...
[ "public", "UTF8String", "trimRight", "(", "UTF8String", "trimString", ")", "{", "if", "(", "trimString", "==", "null", ")", "return", "null", ";", "int", "charIdx", "=", "0", ";", "// number of characters from the source string", "int", "numChars", "=", "0", ";"...
Based on the given trim string, trim this string starting from right end This method searches each character in the source string starting from the right end, removes the character if it is in the trim string, stops at the first character which is not in the trim string, returns the new string. @param trimString the tr...
[ "Based", "on", "the", "given", "trim", "string", "trim", "this", "string", "starting", "from", "right", "end", "This", "method", "searches", "each", "character", "in", "the", "source", "string", "starting", "from", "the", "right", "end", "removes", "the", "c...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L629-L667
122,989
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.find
private int find(UTF8String str, int start) { assert (str.numBytes > 0); while (start <= numBytes - str.numBytes) { if (ByteArrayMethods.arrayEquals(base, offset + start, str.base, str.offset, str.numBytes)) { return start; } start += 1; } return -1; }
java
private int find(UTF8String str, int start) { assert (str.numBytes > 0); while (start <= numBytes - str.numBytes) { if (ByteArrayMethods.arrayEquals(base, offset + start, str.base, str.offset, str.numBytes)) { return start; } start += 1; } return -1; }
[ "private", "int", "find", "(", "UTF8String", "str", ",", "int", "start", ")", "{", "assert", "(", "str", ".", "numBytes", ">", "0", ")", ";", "while", "(", "start", "<=", "numBytes", "-", "str", ".", "numBytes", ")", "{", "if", "(", "ByteArrayMethods...
Find the `str` from left to right.
[ "Find", "the", "str", "from", "left", "to", "right", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L740-L749
122,990
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.concat
public static UTF8String concat(UTF8String... inputs) { // Compute the total length of the result. long totalLength = 0; for (int i = 0; i < inputs.length; i++) { if (inputs[i] != null) { totalLength += (long)inputs[i].numBytes; } else { return null; } } // Allocat...
java
public static UTF8String concat(UTF8String... inputs) { // Compute the total length of the result. long totalLength = 0; for (int i = 0; i < inputs.length; i++) { if (inputs[i] != null) { totalLength += (long)inputs[i].numBytes; } else { return null; } } // Allocat...
[ "public", "static", "UTF8String", "concat", "(", "UTF8String", "...", "inputs", ")", "{", "// Compute the total length of the result.", "long", "totalLength", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inputs", ".", "length", ";", "i", ...
Concatenates input strings together into a single string. Returns null if any input is null.
[ "Concatenates", "input", "strings", "together", "into", "a", "single", "string", ".", "Returns", "null", "if", "any", "input", "is", "null", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L884-L907
122,991
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.toLong
public boolean toLong(LongWrapper toLongResult) { if (numBytes == 0) { return false; } byte b = getByte(0); final boolean negative = b == '-'; int offset = 0; if (negative || b == '+') { offset++; if (numBytes == 1) { return false; } } final byte separat...
java
public boolean toLong(LongWrapper toLongResult) { if (numBytes == 0) { return false; } byte b = getByte(0); final boolean negative = b == '-'; int offset = 0; if (negative || b == '+') { offset++; if (numBytes == 1) { return false; } } final byte separat...
[ "public", "boolean", "toLong", "(", "LongWrapper", "toLongResult", ")", "{", "if", "(", "numBytes", "==", "0", ")", "{", "return", "false", ";", "}", "byte", "b", "=", "getByte", "(", "0", ")", ";", "final", "boolean", "negative", "=", "b", "==", "'"...
Parses this UTF8String to long. Note that, in this method we accumulate the result in negative format, and convert it to positive format at the end, if this string is not started with '-'. This is because min value is bigger than max value in digits, e.g. Long.MAX_VALUE is '9223372036854775807' and Long.MIN_VALUE is '...
[ "Parses", "this", "UTF8String", "to", "long", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L1032-L1104
122,992
apache/spark
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
UTF8String.toInt
public boolean toInt(IntWrapper intWrapper) { if (numBytes == 0) { return false; } byte b = getByte(0); final boolean negative = b == '-'; int offset = 0; if (negative || b == '+') { offset++; if (numBytes == 1) { return false; } } final byte separator =...
java
public boolean toInt(IntWrapper intWrapper) { if (numBytes == 0) { return false; } byte b = getByte(0); final boolean negative = b == '-'; int offset = 0; if (negative || b == '+') { offset++; if (numBytes == 1) { return false; } } final byte separator =...
[ "public", "boolean", "toInt", "(", "IntWrapper", "intWrapper", ")", "{", "if", "(", "numBytes", "==", "0", ")", "{", "return", "false", ";", "}", "byte", "b", "=", "getByte", "(", "0", ")", ";", "final", "boolean", "negative", "=", "b", "==", "'", ...
Parses this UTF8String to int. Note that, in this method we accumulate the result in negative format, and convert it to positive format at the end, if this string is not started with '-'. This is because min value is bigger than max value in digits, e.g. Integer.MAX_VALUE is '2147483647' and Integer.MIN_VALUE is '-214...
[ "Parses", "this", "UTF8String", "to", "int", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L1123-L1194
122,993
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleClient.java
ExternalShuffleClient.registerWithShuffleServer
public void registerWithShuffleServer( String host, int port, String execId, ExecutorShuffleInfo executorInfo) throws IOException, InterruptedException { checkInit(); try (TransportClient client = clientFactory.createUnmanagedClient(host, port)) { ByteBuffer registerMessage = new R...
java
public void registerWithShuffleServer( String host, int port, String execId, ExecutorShuffleInfo executorInfo) throws IOException, InterruptedException { checkInit(); try (TransportClient client = clientFactory.createUnmanagedClient(host, port)) { ByteBuffer registerMessage = new R...
[ "public", "void", "registerWithShuffleServer", "(", "String", "host", ",", "int", "port", ",", "String", "execId", ",", "ExecutorShuffleInfo", "executorInfo", ")", "throws", "IOException", ",", "InterruptedException", "{", "checkInit", "(", ")", ";", "try", "(", ...
Registers this executor with an external shuffle server. This registration is required to inform the shuffle server about where and how we store our shuffle files. @param host Host of shuffle server. @param port Port of shuffle server. @param execId This Executor's id. @param executorInfo Contains all info necessary f...
[ "Registers", "this", "executor", "with", "an", "external", "shuffle", "server", ".", "This", "registration", "is", "required", "to", "inform", "the", "shuffle", "server", "about", "where", "and", "how", "we", "store", "our", "shuffle", "files", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleClient.java#L136-L146
122,994
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
UnsafeExternalSorter.spill
@Override public long spill(long size, MemoryConsumer trigger) throws IOException { if (trigger != this) { if (readingIterator != null) { return readingIterator.spill(); } return 0L; // this should throw exception } if (inMemSorter == null || inMemSorter.numRecords() <= 0) { ...
java
@Override public long spill(long size, MemoryConsumer trigger) throws IOException { if (trigger != this) { if (readingIterator != null) { return readingIterator.spill(); } return 0L; // this should throw exception } if (inMemSorter == null || inMemSorter.numRecords() <= 0) { ...
[ "@", "Override", "public", "long", "spill", "(", "long", "size", ",", "MemoryConsumer", "trigger", ")", "throws", "IOException", "{", "if", "(", "trigger", "!=", "this", ")", "{", "if", "(", "readingIterator", "!=", "null", ")", "{", "return", "readingIter...
Sort and spill the current records in response to memory pressure.
[ "Sort", "and", "spill", "the", "current", "records", "in", "response", "to", "memory", "pressure", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L196-L236
122,995
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
UnsafeExternalSorter.getMemoryUsage
private long getMemoryUsage() { long totalPageSize = 0; for (MemoryBlock page : allocatedPages) { totalPageSize += page.size(); } return ((inMemSorter == null) ? 0 : inMemSorter.getMemoryUsage()) + totalPageSize; }
java
private long getMemoryUsage() { long totalPageSize = 0; for (MemoryBlock page : allocatedPages) { totalPageSize += page.size(); } return ((inMemSorter == null) ? 0 : inMemSorter.getMemoryUsage()) + totalPageSize; }
[ "private", "long", "getMemoryUsage", "(", ")", "{", "long", "totalPageSize", "=", "0", ";", "for", "(", "MemoryBlock", "page", ":", "allocatedPages", ")", "{", "totalPageSize", "+=", "page", ".", "size", "(", ")", ";", "}", "return", "(", "(", "inMemSort...
Return the total memory usage of this sorter, including the data pages and the sorter's pointer array.
[ "Return", "the", "total", "memory", "usage", "of", "this", "sorter", "including", "the", "data", "pages", "and", "the", "sorter", "s", "pointer", "array", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L242-L248
122,996
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
UnsafeExternalSorter.freeMemory
private long freeMemory() { updatePeakMemoryUsed(); long memoryFreed = 0; for (MemoryBlock block : allocatedPages) { memoryFreed += block.size(); freePage(block); } allocatedPages.clear(); currentPage = null; pageCursor = 0; return memoryFreed; }
java
private long freeMemory() { updatePeakMemoryUsed(); long memoryFreed = 0; for (MemoryBlock block : allocatedPages) { memoryFreed += block.size(); freePage(block); } allocatedPages.clear(); currentPage = null; pageCursor = 0; return memoryFreed; }
[ "private", "long", "freeMemory", "(", ")", "{", "updatePeakMemoryUsed", "(", ")", ";", "long", "memoryFreed", "=", "0", ";", "for", "(", "MemoryBlock", "block", ":", "allocatedPages", ")", "{", "memoryFreed", "+=", "block", ".", "size", "(", ")", ";", "f...
Free this sorter's data pages. @return the number of bytes freed.
[ "Free", "this", "sorter", "s", "data", "pages", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L293-L304
122,997
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
UnsafeExternalSorter.deleteSpillFiles
private void deleteSpillFiles() { for (UnsafeSorterSpillWriter spill : spillWriters) { File file = spill.getFile(); if (file != null && file.exists()) { if (!file.delete()) { logger.error("Was unable to delete spill file {}", file.getAbsolutePath()); } } } }
java
private void deleteSpillFiles() { for (UnsafeSorterSpillWriter spill : spillWriters) { File file = spill.getFile(); if (file != null && file.exists()) { if (!file.delete()) { logger.error("Was unable to delete spill file {}", file.getAbsolutePath()); } } } }
[ "private", "void", "deleteSpillFiles", "(", ")", "{", "for", "(", "UnsafeSorterSpillWriter", "spill", ":", "spillWriters", ")", "{", "File", "file", "=", "spill", ".", "getFile", "(", ")", ";", "if", "(", "file", "!=", "null", "&&", "file", ".", "exists"...
Deletes any spill files created by this sorter.
[ "Deletes", "any", "spill", "files", "created", "by", "this", "sorter", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L309-L318
122,998
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
UnsafeExternalSorter.growPointerArrayIfNecessary
private void growPointerArrayIfNecessary() throws IOException { assert(inMemSorter != null); if (!inMemSorter.hasSpaceForAnotherRecord()) { long used = inMemSorter.getMemoryUsage(); LongArray array; try { // could trigger spilling array = allocateArray(used / 8 * 2); } ca...
java
private void growPointerArrayIfNecessary() throws IOException { assert(inMemSorter != null); if (!inMemSorter.hasSpaceForAnotherRecord()) { long used = inMemSorter.getMemoryUsage(); LongArray array; try { // could trigger spilling array = allocateArray(used / 8 * 2); } ca...
[ "private", "void", "growPointerArrayIfNecessary", "(", ")", "throws", "IOException", "{", "assert", "(", "inMemSorter", "!=", "null", ")", ";", "if", "(", "!", "inMemSorter", ".", "hasSpaceForAnotherRecord", "(", ")", ")", "{", "long", "used", "=", "inMemSorte...
Checks whether there is enough space to insert an additional record in to the sort pointer array and grows the array if additional space is required. If the required space cannot be obtained, then the in-memory data will be spilled to disk.
[ "Checks", "whether", "there", "is", "enough", "space", "to", "insert", "an", "additional", "record", "in", "to", "the", "sort", "pointer", "array", "and", "grows", "the", "array", "if", "additional", "space", "is", "required", ".", "If", "the", "required", ...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L339-L366
122,999
apache/spark
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
UnsafeExternalSorter.acquireNewPageIfNecessary
private void acquireNewPageIfNecessary(int required) { if (currentPage == null || pageCursor + required > currentPage.getBaseOffset() + currentPage.size()) { // TODO: try to find space on previous pages currentPage = allocatePage(required); pageCursor = currentPage.getBaseOffset(); all...
java
private void acquireNewPageIfNecessary(int required) { if (currentPage == null || pageCursor + required > currentPage.getBaseOffset() + currentPage.size()) { // TODO: try to find space on previous pages currentPage = allocatePage(required); pageCursor = currentPage.getBaseOffset(); all...
[ "private", "void", "acquireNewPageIfNecessary", "(", "int", "required", ")", "{", "if", "(", "currentPage", "==", "null", "||", "pageCursor", "+", "required", ">", "currentPage", ".", "getBaseOffset", "(", ")", "+", "currentPage", ".", "size", "(", ")", ")",...
Allocates more memory in order to insert an additional record. This will request additional memory from the memory manager and spill if the requested memory can not be obtained. @param required the required space in the data page, in bytes, including space for storing the record size. This must be less than or equal t...
[ "Allocates", "more", "memory", "in", "order", "to", "insert", "an", "additional", "record", ".", "This", "will", "request", "additional", "memory", "from", "the", "memory", "manager", "and", "spill", "if", "the", "requested", "memory", "can", "not", "be", "o...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java#L377-L385