code stringlengths 146 466k | prompt stringlengths 54 1.5k |
|---|---|
Of course, here is the Java code you requested:
```java
public static void collectMetric(
MetricsRecordBuilder metricsRecordBuilder, String name, Metric metric) {
if (metric instanceof Timer) {
Timer t = (Timer) metric;
metricsRecordBuilder
.addCounter(new ShuffleServiceMetricsInfo(name + ... | Create a Java method that does the following: "Collect a metric.". |
Of course, here is the Java code you requested:
```java
public Transform apply(String name, Expression... args) {
return LogicalExpressions.apply(name,
JavaConverters.asScalaBuffer(Arrays.asList(args)).toSeq());
}
```
Hope this helps! | Create a Java method that does the following: "Apply a Logical Expression to a CID". |
Of course, here is the Java code you requested:
```java
public Transform bucket(int numBuckets, String... columns) {
return LogicalExpressions.bucket(numBuckets,
JavaConverters.asScalaBuffer(Arrays.asList(columns)).toSeq());
}
```
Hope this helps! | Create a Java method that does the following: "Transform a sequence of columns to a sequence of buckets.". |
Of course, here is the Java code you requested:
```java
public static Properties toCryptoConf(String prefix, Iterable<Map.Entry<String, String>> conf) {
Properties props = new Properties();
for (Map.Entry<String, String> e : conf) {
String key = e.getKey();
if (key.startsWith(prefix)) {
pro... | Create a Java method that does the following: "Converts a list of map entries to a Properties object.". |
Of course, here is the Java code you requested:
```java
@Override
public void encode(ByteBuf buf) {
Encoders.Strings.encode(buf, streamId);
buf.writeLong(byteCount);
}
```
Hope this helps! | Create a Java method that does the following: "Encodes the sequence number into the specified byte buffer.". |
Of course, here is the Java code you requested:
```java
public byte[] getBytes(int rowId, int count) {
byte[] res = new byte[count];
for (int i = 0; i < count; i++) {
res[i] = getByte(rowId + i);
}
return res;
}
```
Hope this helps! | Create a Java method that does the following: "Gets the bytes from the specified row.". |
Of course, here is the Java code you requested:
```java
public int[] getInts(int rowId, int count) {
int[] res = new int[count];
for (int i = 0; i < count; i++) {
res[i] = getInt(rowId + i);
}
return res;
}
```
Hope this helps! | Create a Java method that does the following: "Gets the ints from the specified row.". |
Of course, here is the Java code you requested:
```java
public long[] getLongs(int rowId, int count) {
long[] res = new long[count];
for (int i = 0; i < count; i++) {
res[i] = getLong(rowId + i);
}
return res;
}
```
Hope this helps! | Create a Java method that does the following: "Gets the longs from the specified row.". |
Of course, here is the Java code you requested:
```java
public final CalendarInterval getInterval(int rowId) {
if (isNullAt(rowId)) return null;
final int months = getChild(0).getInt(rowId);
final long microseconds = getChild(1).getLong(rowId);
return new CalendarInterval(months, microseconds);
}
```... | Create a Java method that does the following: "Gets the calendar interval.". |
Of course, here is the Java code you requested:
```java
public TProcessorFactory getAuthProcFactory(ThriftCLIService service) throws LoginException {
if (authTypeStr.equalsIgnoreCase(AuthTypes.KERBEROS.getAuthName())) {
return KerberosSaslHelper.getKerberosProcessorFactory(saslServer, service);
} else {
... | Create a Java method that does the following: "Get the TProcessorFactory for the authentication method". |
Of course, here is the Java code you requested:
```java
public static UserGroupInformation loginFromSpnegoKeytabAndReturnUGI(HiveConf hiveConf)
throws IOException {
String principal = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_PRINCIPAL);
String keyTabFile = hiveConf.getVar(ConfVars.HIVE_SERVER2_SPNEGO_K... | Create a Java method that does the following: "login from SPNEGO principal and keytab and return the UserGroupInformation object". |
Of course, here is the Java code you requested:
```java
public static void ensureCurrentState(Service.STATE state,
Service.STATE expectedState) {
if (state != expectedState) {
throw new IllegalStateException("For this operation, the " +
... | Create a Java method that does the following: "Ensure the current state of the service is the same as the expected state.". |
Of course, here is the Java code you requested:
```java
public static void start(Service service) {
Service.STATE state = service.getServiceState();
ensureCurrentState(state, Service.STATE.INITED);
service.start();
}
```
Hope this helps! | Create a Java method that does the following: "Start the service.". |
Of course, here is the Java code you requested:
```java
public static void deploy(Service service, HiveConf configuration) {
init(service, configuration);
start(service);
}
```
Hope this helps! | Create a Java method that does the following: "Deploy a service with the given configuration.". |
Of course, here is the Java code you requested:
```java
public static void stop(Service service) {
if (service != null) {
Service.STATE state = service.getServiceState();
if (state == Service.STATE.STARTED) {
service.stop();
}
}
}
```
Hope this helps! | Create a Java method that does the following: "Stop the service.". |
Of course, here is the Java code you requested:
```java
public static Exception stopQuietly(Service service) {
try {
stop(service);
} catch (Exception e) {
LOG.warn("When stopping the service " + service.getName()
+ " : " + e,
e);
return e;
}
return n... | Create a Java method that does the following: "Stop the service and return an exception if it fails.". |
Of course, here is the Java code you requested:
```java
void readBatch(int total, WritableColumnVector column) throws IOException {
int rowId = 0;
WritableColumnVector dictionaryIds = null;
if (dictionary != null) {
// SPARK-16334: We only maintain a single dictionary per row batch, so that it can be... | Create a Java method that does the following: "Read a batch of values from the data stream.". |
Of course, here is the Java code you requested:
```java
private SchemaColumnConvertNotSupportedException constructConvertNotSupportedException(
ColumnDescriptor descriptor,
WritableColumnVector column) {
return new SchemaColumnConvertNotSupportedException(
Arrays.toString(descriptor.getPath()),
... | Create a Java method that does the following: "Construct a SchemaColumnConvertNotSupportedException from a WritableColumnVector.". |
Of course, here is the Java code you requested:
```java
private void decodeDictionaryIds(
int rowId,
int num,
WritableColumnVector column,
WritableColumnVector dictionaryIds) {
switch (descriptor.getPrimitiveType().getPrimitiveTypeName()) {
case INT32:
if (column.dataType() ==... | Create a Java method that does the following: "Decode dictionary ids.". |
Of course, here is the Java code you requested:
```java
public static void main(String[] args) {
SparkSession spark = SparkSession
.builder()
.appName("Java Spark SQL user-defined Datasets aggregation example")
.getOrCreate();
// $example on:typed_custom_aggregation$
Encoder<Employee> em... | Create a Java method that does the following: "Example of the typed custom aggregation example.". |
Of course, here is the Java code you requested:
```java
public static Class<? extends Channel> getClientChannelClass(IOMode mode) {
switch (mode) {
case NIO:
return NioSocketChannel.class;
case EPOLL:
return EpollSocketChannel.class;
default:
throw new IllegalArgumentExcep... | Create a Java method that does the following: "Gets the client channel class.". |
Of course, here is the Java code you requested:
```java
public static Class<? extends ServerChannel> getServerChannelClass(IOMode mode) {
switch (mode) {
case NIO:
return NioServerSocketChannel.class;
case EPOLL:
return EpollServerSocketChannel.class;
default:
throw new Il... | Create a Java method that does the following: "Get the server channel class for the IO mode.". |
Of course, here is the Java code you requested:
```java
public static synchronized PooledByteBufAllocator getSharedPooledByteBufAllocator(
boolean allowDirectBufs,
boolean allowCache) {
final int index = allowCache ? 0 : 1;
if (_sharedPooledByteBufAllocator[index] == null) {
_sharedPooledByte... | Create a Java method that does the following: "Get the shared pooled ByteBuf allocator.". |
Of course, here is the Java code you requested:
```java
public static void main(String[] args) {
SparkSession spark = SparkSession
.builder()
.appName("Java Spark SQL data sources example")
.config("spark.some.config.option", "some-value")
.getOrCreate();
runBasicDataSourceExample(spar... | Create a Java method that does the following: "Main method for testing.". |
Of course, here is the Java code you requested:
```java
public static void main(String[] args) {
SparkSession spark = SparkSession
.builder()
.appName("JavaALSExample")
.getOrCreate();
// $example on$
JavaRDD<Rating> ratingsRDD = spark
.read().textFile("data/mllib/als/sample_moviel... | Create a Java method that does the following: "Example of ALS recommendation model.". |
Of course, here is the Java code you requested:
```java
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case COLUMN_NAME:
return isSetColumnName();
case TYPE_DESC:
return isSetTypeDesc();
case POSITION:
... | Create a Java method that does the following: "Checks if field is set to a value of a CRAS_CTYPE object.". |
Of course, here is the Java code you requested:
```java
protected void validateFetchOrientation(FetchOrientation orientation,
EnumSet<FetchOrientation> supportedOrientations) throws HiveSQLException {
if (!supportedOrientations.contains(orientation)) {
throw new HiveSQLException("The fetch type " + ori... | Create a Java method that does the following: "Validate the fetch orientation". |
Of course, here is the Java code you requested:
```java
public static void writeToMemory(byte[] src, Object target, long targetOffset) {
Platform.copyMemory(src, Platform.BYTE_ARRAY_OFFSET, target, targetOffset, src.length);
}
```
Hope this helps! | Create a Java method that does the following: "Write to memory.". |
Of course, here is the Java code you requested:
```java
@Override
public int putByteArray(int rowId, byte[] value, int offset, int length) {
int result = arrayData().appendBytes(length, value, offset);
Platform.putInt(null, lengthData + 4L * rowId, length);
Platform.putInt(null, offsetData + 4L * rowId, ... | Create a Java method that does the following: "Override putByteArray to append bytes to the array data.". |
Of course, here is the Java code you requested:
```java
@Override
protected void reserveInternal(int newCapacity) {
int oldCapacity = (nulls == 0L) ? 0 : capacity;
if (isArray() || type instanceof MapType) {
this.lengthData =
Platform.reallocateMemory(lengthData, oldCapacity * 4L, newCapacity... | Create a Java method that does the following: "Reserve the specified number of bytes of data.". |
Of course, here is the Java code you requested:
```java
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case STATUS:
return isSetStatus();
case HAS_MORE_ROWS:
return isSetHasMoreRows();
case RESULTS:
re... | Create a Java method that does the following: "Checks if field is set to a value of a CRAsCTYPE object.". |
Of course, here is the Java code you requested:
```java
private void init(int bitWidth) {
Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32, "bitWidth must be >= 0 and <= 32");
this.bitWidth = bitWidth;
this.bytesWidth = BytesUtils.paddedByteCountFromBits(bitWidth);
this.packer = Packer.LITTL... | Create a Java method that does the following: "Initializes the object with the given bit width.". |
Of course, here is the Java code you requested:
```java
private int readIntLittleEndianPaddedOnBitWidth() throws IOException {
switch (bytesWidth) {
case 0:
return 0;
case 1:
return in.read();
case 2: {
int ch2 = in.read();
int ch1 = in.read();
return (ch1 ... | Create a Java method that does the following: "read int littleEndian Padded on bit width". |
Of course, here is the Java code you requested:
```java
private void readNextGroup() {
try {
int header = readUnsignedVarInt();
this.mode = (header & 1) == 0 ? MODE.RLE : MODE.PACKED;
switch (mode) {
case RLE:
this.currentCount = header >>> 1;
this.currentValue = readI... | Create a Java method that does the following: "Read the next group from the input stream.". |
Of course, here is the Java code you requested:
```java
@Override
public synchronized void init(HiveConf hiveConf) {
ensureCurrentState(STATE.NOTINITED);
this.hiveConf = hiveConf;
changeState(STATE.INITED);
LOG.info("Service:" + getName() + " is inited.");
}
```
Hope this helps! | Create a Java method that does the following: "Initializes the service.". |
Of course, here is the Java code you requested:
```java
@Override
public synchronized void start() {
startTime = System.currentTimeMillis();
ensureCurrentState(STATE.INITED);
changeState(STATE.STARTED);
LOG.info("Service:" + getName() + " is started.");
}
```
Hope this helps! | Create a Java method that does the following: "Start the service.". |
Of course, here is the Java code you requested:
```java
private void changeState(Service.STATE newState) {
state = newState;
// notify listeners
for (ServiceStateChangeListener l : listeners) {
l.stateChanged(this);
}
}
```
Hope this helps! | Create a Java method that does the following: "Change the state of the service.". |
Of course, here is the Java code you requested:
```java
@Override
public long transferTo(final WritableByteChannel target, final long position) throws IOException {
Preconditions.checkArgument(position == totalBytesTransferred, "Invalid position.");
// Bytes written for header in this call.
long writtenH... | Create a Java method that does the following: "This method is used to transfer the data to the target channel.". |
Of course, here is the Java code you requested:
```java
public void pointTo(Object baseObject, long baseOffset, int sizeInBytes) {
assert numFields >= 0 : "numFields (" + numFields + ") should >= 0";
assert sizeInBytes % 8 == 0 : "sizeInBytes (" + sizeInBytes + ") should be a multiple of 8";
this.baseObjec... | Create a Java method that does the following: "Point to the base object and size in bytes.". |
Of course, here is the Java code you requested:
```java
@Override
public UnsafeRow copy() {
UnsafeRow rowCopy = new UnsafeRow(numFields);
final byte[] rowDataCopy = new byte[sizeInBytes];
Platform.copyMemory(
baseObject,
baseOffset,
rowDataCopy,
Platform.BYTE_ARRAY_OFFSET,
s... | Create a Java method that does the following: "Copy the data in this row.". |
Of course, here is the Java code you requested:
```java
public void writeToStream(OutputStream out, byte[] writeBuffer) throws IOException {
if (baseObject instanceof byte[]) {
int offsetInByteArray = (int) (baseOffset - Platform.BYTE_ARRAY_OFFSET);
out.write((byte[]) baseObject, offsetInByteArray, siz... | Create a Java method that does the following: "Write the contents of this object to the given output stream.". |
Of course, here is the Java code you requested:
```java
@Override
public void doBootstrap(TransportClient client, Channel channel) {
SparkSaslClient saslClient = new SparkSaslClient(appId, secretKeyHolder, conf.saslEncryption());
try {
byte[] payload = saslClient.firstToken();
while (!saslClient... | Create a Java method that does the following: "Bootstrap the server.". |
Of course, here is the Java code you requested:
```java
SessionHandle getSessionHandle(TOpenSessionReq req, TOpenSessionResp res)
throws HiveSQLException, LoginException, IOException {
String userName = getUserName(req);
String ipAddress = getIpAddress();
TProtocolVersion protocol = getMinVersion(CLI... | Create a Java method that does the following: "Get a session handle from the input.". |
Of course, here is the Java code you requested:
```java
public double getDouble(String key, double defaultValue) {
String value = get(key);
return value == null ? defaultValue : Double.parseDouble(value);
}
```
Hope this helps! | Create a Java method that does the following: "Get a double value from the resource.". |
Of course, here is the Java code you requested:
```java
boolean set(long index) {
if (!get(index)) {
data[(int) (index >>> 6)] |= (1L << index);
bitCount++;
return true;
}
return false;
}
```
Hope this helps! | Create a Java method that does the following: "Sets the bit at the given index.". |
Of course, here is the Java code you requested:
```java
void putAll(BitArray array) {
assert data.length == array.data.length : "BitArrays must be of equal length when merging";
long bitCount = 0;
for (int i = 0; i < data.length; i++) {
data[i] |= array.data[i];
bitCount += Long.bitCount(data[i... | Create a Java method that does the following: "Merge the contents of the specified BitArray into this one.". |
Of course, here is the Java code you requested:
```java
public RpcHandler doBootstrap(Channel channel, RpcHandler rpcHandler) {
return new SaslRpcHandler(conf, channel, rpcHandler, secretKeyHolder);
}
```
Hope this helps! | Create a Java method that does the following: "This method is called by the client when the client is bootstrapped.". |
Of course, here is the Java code you requested:
```java
private List<String> readResults(int nLines) throws HiveSQLException {
if (resultReader == null) {
SessionState sessionState = getParentSession().getSessionState();
File tmp = sessionState.getTmpOutputFile();
try {
resultReader = new... | Create a Java method that does the following: "Read the results from the temp output file.". |
Of course, here is the Java code you requested:
```java
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case TYPE_CLASS_NAME:
return isSetTypeClassName();
}
throw new IllegalStateException();
}
```
Hope this hel... | Create a Java method that does the following: "Checks if the specified field is set to a value of a CRAsCTYPE object.". |
Of course, here is the Java code you requested:
```java
List<String> buildClassPath(String appClassPath) throws IOException {
String sparkHome = getSparkHome();
Set<String> cp = new LinkedHashSet<>();
addToClassPath(cp, appClassPath);
addToClassPath(cp, getConfDir());
boolean prependClasses = !i... | Create a Java method that does the following: "Build the classpath for the application.". |
Of course, here is the Java code you requested:
```java
@Override
public void initialize(
InputSplit inputSplit, TaskAttemptContext taskAttemptContext) throws IOException {
FileSplit fileSplit = (FileSplit)inputSplit;
Configuration conf = taskAttemptContext.getConfiguration();
Reader reader = OrcFi... | Create a Java method that does the following: "Initialize the sequence header.". |
Of course, here is the Java code you requested:
```java
public void initBatch(
TypeDescription orcSchema,
StructField[] requiredFields,
int[] requestedDataColIds,
int[] requestedPartitionColIds,
InternalRow partitionValues) {
wrap = new VectorizedRowBatchWrap(orcSchema.createRowBatch(... | Create a Java method that does the following: "Initialize the batch.". |
Of course, here is the Java code you requested:
```java
private boolean nextBatch() throws IOException {
recordReader.nextBatch(wrap.batch());
int batchSize = wrap.batch().size;
if (batchSize == 0) {
return false;
}
columnarBatch.setNumRows(batchSize);
for (int i = 0; i < requiredFields.... | Create a Java method that does the following: "This method is called to read the next batch of data from the record reader.". |
Of course, here is the Java code you requested:
```java
public static long parseSecondNano(String secondNano) throws IllegalArgumentException {
String[] parts = secondNano.split("\\.");
if (parts.length == 1) {
return toLongWithRange("second", parts[0], Long.MIN_VALUE / MICROS_PER_SECOND,
Long.MA... | Create a Java method that does the following: "Parse second - nano string.". |
Of course, here is the Java code you requested:
```java
public TransportClient createClient(String remoteHost, int remotePort)
throws IOException, InterruptedException {
// Get connection from the connection pool first.
// If it is not found or not active, create a new one.
// Use unresolved address ... | Create a Java method that does the following: "Create a new client from the connection pool.". |
Of course, here is the Java code you requested:
```java
private TransportClient createClient(InetSocketAddress address)
throws IOException, InterruptedException {
logger.debug("Creating new connection to {}", address);
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(workerGroup)
.channe... | Create a Java method that does the following: "Create a new connection to the remote server.". |
Of course, here is the Java code you requested:
```java
@Override
public int write(ByteBuffer src) {
int toTransfer = Math.min(src.remaining(), data.length - offset);
src.get(data, offset, toTransfer);
offset += toTransfer;
return toTransfer;
}
```
Hope this helps! | Create a Java method that does the following: "Write a sequence of bytes from the given ByteBuffer to this buffer.". |
Of course, here is the Java code you requested:
```java
public static int setVariable(String varname, String varvalue) throws Exception {
SessionState ss = SessionState.get();
if (varvalue.contains("\n")){
ss.err.println("Warning: Value had a \\n character in it.");
}
varname = varname.trim();
... | Create a Java method that does the following: "Sets a variable in the session state.". |
Of course, here is the Java code you requested:
```java
private String getUserFromToken(HiveAuthFactory authFactory, String tokenStr) throws HiveSQLException {
return authFactory.getUserFromToken(tokenStr);
}
```
Hope this helps! | Create a Java method that does the following: "getUserFromToken gets the user from the token". |
Of course, here is the Java code you requested:
```java
@Override
public void close() throws HiveSQLException {
try {
acquire(true);
cancelDelegationToken();
} finally {
try {
super.close();
} finally {
try {
FileSystem.closeAllForUGI(sessionUgi);
} c... | Create a Java method that does the following: "Close the session.". |
Of course, here is the Java code you requested:
```java
private void setDelegationToken(String delegationTokenStr) throws HiveSQLException {
this.delegationTokenStr = delegationTokenStr;
if (delegationTokenStr != null) {
getHiveConf().set("hive.metastore.token.signature", HS2TOKEN);
try {
U... | Create a Java method that does the following: "Set the delegation token in the session". |
Of course, here is the Java code you requested:
```java
public long acquireExecutionMemory(long required, MemoryConsumer consumer) {
assert(required >= 0);
assert(consumer != null);
MemoryMode mode = consumer.getMode();
// If we are allocating Tungsten pages off-heap and receive a request to allocate o... | Create a Java method that does the following: "Acquire the memory for the specified task attempt id.". |
Of course, here is the Java code you requested:
```java
public MemoryBlock allocatePage(long size, MemoryConsumer consumer) {
assert(consumer != null);
assert(consumer.getMode() == tungstenMemoryMode);
if (size > MAXIMUM_PAGE_SIZE_BYTES) {
throw new TooLargePageException(size);
}
long acquir... | Create a Java method that does the following: "Allocate a page of the given size.". |
Of course, here is the Java code you requested:
```java
public void freePage(MemoryBlock page, MemoryConsumer consumer) {
assert (page.pageNumber != MemoryBlock.NO_PAGE_NUMBER) :
"Called freePage() on memory that wasn't allocated with allocatePage()";
assert (page.pageNumber != MemoryBlock.FREED_IN_ALLOC... | Create a Java method that does the following: "Free a memory block.". |
Of course, here is the Java code you requested:
```java
public Object getPage(long pagePlusOffsetAddress) {
if (tungstenMemoryMode == MemoryMode.ON_HEAP) {
final int pageNumber = decodePageNumber(pagePlusOffsetAddress);
assert (pageNumber >= 0 && pageNumber < PAGE_TABLE_SIZE);
final MemoryBlock p... | Create a Java method that does the following: "Get the page object from the given address.". |
Of course, here is the Java code you requested:
```java
public long getOffsetInPage(long pagePlusOffsetAddress) {
final long offsetInPage = decodeOffset(pagePlusOffsetAddress);
if (tungstenMemoryMode == MemoryMode.ON_HEAP) {
return offsetInPage;
} else {
// In off-heap mode, an offset is an abs... | Create a Java method that does the following: "Get the offset in the page.". |
Of course, here is the Java code you requested:
```java
public long cleanUpAllAllocatedMemory() {
synchronized (this) {
for (MemoryConsumer c: consumers) {
if (c != null && c.getUsed() > 0) {
// In case of failed task, it's normal to see leaked memory
logger.debug("unreleased " + ... | Create a Java method that does the following: "Clean up all allocated memory.". |
Of course, here is the Java code you requested:
```java
public synchronized byte[] response(byte[] token) {
try {
return saslServer != null ? saslServer.evaluateResponse(token) : new byte[0];
} catch (SaslException e) {
throw Throwables.propagate(e);
}
}
```
Hope this helps! | Create a Java method that does the following: "Evaluate the SASL response for the given token.". |
Of course, here is the Java code you requested:
```java
@Override
public synchronized void dispose() {
if (saslServer != null) {
try {
saslServer.dispose();
} catch (SaslException e) {
// ignore
} finally {
saslServer = null;
}
}
}
```
Hope this helps! | Create a Java method that does the following: "Dispose of the SASL server.". |
Of course, here is the Java code you requested:
```java
private static String getBase64EncodedString(String str) {
ByteBuf byteBuf = null;
ByteBuf encodedByteBuf = null;
try {
byteBuf = Unpooled.wrappedBuffer(str.getBytes(StandardCharsets.UTF_8));
encodedByteBuf = Base64.encode(byteBuf);
... | Create a Java method that does the following: "Get the base 64 encoded string.". |
Of course, here is the Java code you requested:
```java
public static long packPointer(long recordPointer, int partitionId) {
assert (partitionId <= MAXIMUM_PARTITION_ID);
// Note that without word alignment we can address 2^27 bytes = 128 megabytes per page.
// Also note that this relies on some internals... | Create a Java method that does the following: "Pack a record pointer". |
Of course, here is the Java code you requested:
```java
synchronized void dispose() {
if (!isDisposed()) {
// First wait for all data from the connection to be read. Then unregister the handle.
// Otherwise, unregistering might cause the server to be stopped and all child connections
// to be clo... | Create a Java method that does the following: "Dispose of this handle.". |
Of course, here is the Java code you requested:
```java
@Override
public SessionHandle openSession(String username, String password, Map<String, String> configuration)
throws HiveSQLException {
SessionHandle sessionHandle = sessionManager.openSession(SERVER_VERSION, username, password, null, configuration,... | Create a Java method that does the following: "Override openSession to create a new session". |
Of course, here is the Java code you requested:
```java
@Override
public SessionHandle openSessionWithImpersonation(String username, String password, Map<String, String> configuration,
String delegationToken) throws HiveSQLException {
SessionHandle sessionHandle = sessionManager.openSession(SERVER_VERSION,... | Create a Java method that does the following: "Create a new session with an impersonation.". |
Of course, here is the Java code you requested:
```java
@Override
public void closeSession(SessionHandle sessionHandle)
throws HiveSQLException {
sessionManager.closeSession(sessionHandle);
LOG.debug(sessionHandle + ": closeSession()");
}
```
Hope this helps! | Create a Java method that does the following: "Close the session handle.". |
Of course, here is the Java code you requested:
```java
@Override
public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType getInfoType)
throws HiveSQLException {
GetInfoValue infoValue = sessionManager.getSession(sessionHandle)
.getInfo(getInfoType);
LOG.debug(sessionHandle + ": get... | Create a Java method that does the following: "Get the info value for the given session handle.". |
Of course, here is the Java code you requested:
```java
@Override
public OperationHandle getCatalogs(SessionHandle sessionHandle)
throws HiveSQLException {
OperationHandle opHandle = sessionManager.getSession(sessionHandle)
.getCatalogs();
LOG.debug(sessionHandle + ": getCatalogs()");
retur... | Create a Java method that does the following: "Get the catalog list for the session.". |
Of course, here is the Java code you requested:
```java
@Override
public OperationStatus getOperationStatus(OperationHandle opHandle)
throws HiveSQLException {
Operation operation = sessionManager.getOperationManager().getOperation(opHandle);
/**
* If this is a background operation run asynchronou... | Create a Java method that does the following: "Get the OperationStatus for the given operation handle.". |
Of course, here is the Java code you requested:
```java
@Override
public void closeOperation(OperationHandle opHandle)
throws HiveSQLException {
sessionManager.getOperationManager().getOperation(opHandle)
.getParentSession().closeOperation(opHandle);
LOG.debug(opHandle + ": closeOperation");
}
``... | Create a Java method that does the following: "Close an operation.". |
Of course, here is the Java code you requested:
```java
@Override
public TableSchema getResultSetMetadata(OperationHandle opHandle)
throws HiveSQLException {
TableSchema tableSchema = sessionManager.getOperationManager()
.getOperation(opHandle).getParentSession().getResultSetMetadata(opHandle);
... | Create a Java method that does the following: "Get the result set metadata table schema for the given operation handle.". |
Of course, here is the Java code you requested:
```java
public synchronized String getDelegationTokenFromMetaStore(String owner)
throws HiveSQLException, UnsupportedOperationException, LoginException, IOException {
if (!hiveConf.getBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL) ||
!hiveConf.get... | Create a Java method that does the following: "Get the delegation token from the metastore". |
Of course, here is the Java code you requested:
```java
public Integer getDecimalDigits() {
switch (this.type) {
case BOOLEAN_TYPE:
case TINYINT_TYPE:
case SMALLINT_TYPE:
case INT_TYPE:
case BIGINT_TYPE:
return 0;
case FLOAT_TYPE:
return 7;
case DOUBLE_TYPE:
return 15;... | Create a Java method that does the following: "Get the decimal digits of this type.". |
Of course, here is the Java code you requested:
```java
public PythonStreamExecutionEnvironment create_local_execution_environment(Configuration config) {
return new PythonStreamExecutionEnvironment(new LocalStreamEnvironment(config), new Path(localTmpPath), scriptName);
}
```
Hope this helps! | Create a Java method that does the following: "Create a local Python stream execution environment.". |
Of course, here is the Java code you requested:
```java
public PythonStreamExecutionEnvironment create_local_execution_environment(int parallelism, Configuration config) {
return new PythonStreamExecutionEnvironment(
StreamExecutionEnvironment.createLocalEnvironment(parallelism, config), new Path(localTmpPath), s... | Create a Java method that does the following: "Create a local Python stream execution environment.". |
Of course, here is the Java code you requested:
```java
public OperatorSubtaskState putSubtaskStateByOperatorID(
@Nonnull OperatorID operatorID,
@Nonnull OperatorSubtaskState state) {
return subtaskStatesByOperatorID.put(operatorID, Preconditions.checkNotNull(state));
}
```
Hope this helps! | Create a Java method that does the following: "Put a subtask state by operator ID.". |
Of course, here is the Java code you requested:
```java
public static <T, K> KeyedStream<T, K> reinterpretAsKeyedStream(
DataStream<T> stream,
KeySelector<T, K> keySelector,
TypeInformation<K> typeInfo) {
PartitionTransformation<T> partitionTransformation = new PartitionTransformation<>(
stream.getTransfor... | Create a Java method that does the following: "Reinterprets a data stream as a KeyedStream.". |
Of course, here is the Java code you requested:
```java
@Override
public void monitorTarget(ResourceID resourceID, HeartbeatTarget<O> heartbeatTarget) {
if (!stopped) {
if (heartbeatTargets.containsKey(resourceID)) {
log.debug("The target with resource ID {} is already been monitored.", resourceID);
} els... | Create a Java method that does the following: "Monitor the target with the given resource ID.". |
Of course, here is the Java code you requested:
```java
@Override
public void receiveHeartbeat(ResourceID heartbeatOrigin, I heartbeatPayload) {
if (!stopped) {
log.debug("Received heartbeat from {}.", heartbeatOrigin);
reportHeartbeat(heartbeatOrigin);
if (heartbeatPayload != null) {
heartbeatListene... | Create a Java method that does the following: "Receives a heartbeat from the cluster.". |
Of course, here is the Java code you requested:
```java
public static DeploymentEntry create(Map<String, Object> config) {
return new DeploymentEntry(ConfigUtil.normalizeYaml(config));
}
```
Hope this helps! | Create a Java method that does the following: "Create a new deployment entry from a map of configuration objects.". |
Of course, here is the Java code you requested:
```java
public static void main(String[] args) throws Exception {
// startup checks and logging
EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager", args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
long maxOpenFileH... | Create a Java method that does the following: "Main method for the task manager.". |
Of course, here is the Java code you requested:
```java
public static TaskExecutor startTaskManager(
Configuration configuration,
ResourceID resourceID,
RpcService rpcService,
HighAvailabilityServices highAvailabilityServices,
HeartbeatServices heartbeatServices,
MetricRegistry metricRegistry,
Blo... | Create a Java method that does the following: "Start a TaskManager with the given configuration.". |
Of course, here is the Java code you requested:
```java
long refreshAndGetTotal() {
long total = 0;
for (ResultSubpartition part : partition.getAllPartitions()) {
total += part.unsynchronizedGetNumberOfQueuedBuffers();
}
return total;
}
```
Hope this helps! | Create a Java method that does the following: "This method is used to refresh the result and return the total number of queued buffers in the result.". |
Of course, here is the Java code you requested:
```java
int refreshAndGetMin() {
int min = Integer.MAX_VALUE;
ResultSubpartition[] allPartitions = partition.getAllPartitions();
if (allPartitions.length == 0) {
// meaningful value when no channels exist:
return 0;
}
for (ResultSubpartition part : allP... | Create a Java method that does the following: "Refresh the minimum number of queued buffers in the sub - partitions.". |
Of course, here is the Java code you requested:
```java
public synchronized URL addFile(File localFile, String remoteFile) throws IOException, MalformedURLException {
return addPath(new Path(localFile.toURI()), new Path(remoteFile));
}
```
Hope this helps! | Create a Java method that does the following: "Add a file to the remote file system.". |
Of course, here is the Java code you requested:
```java
public synchronized URL addPath(Path path, Path remoteFile) throws IOException, MalformedURLException {
if (paths.containsKey(remoteFile)) {
throw new IllegalArgumentException("duplicate path registered");
}
if (remoteFile.isAbsolute()) {
throw new Il... | Create a Java method that does the following: "Add a path to the virtual file system.". |
Of course, here is the Java code you requested:
```java
protected RpcInvocation createRpcInvocationMessage(
final String methodName,
final Class<?>[] parameterTypes,
final Object[] args) throws IOException {
final RpcInvocation rpcInvocation;
if (isLocal) {
rpcInvocation = new LocalRpcInvocation(
... | Create a Java method that does the following: "Creates the rpc invocation message.". |
Of course, here is the Java code you requested:
```java
@Override
public void handleAsyncException(String message, Throwable exception) {
if (isRunning) {
// only fail if the task is still running
getEnvironment().failExternally(exception);
}
}
```
Hope this helps! | Create a Java method that does the following: "Override this method to handle an async exception.". |
Of course, here is the Java code you requested:
```java
public Result registerReference(SharedStateRegistryKey registrationKey, StreamStateHandle state) {
Preconditions.checkNotNull(state);
StreamStateHandle scheduledStateDeletion = null;
SharedStateRegistry.SharedStateEntry entry;
synchronized (registeredS... | Create a Java method that does the following: "Registers a reference to a shared state.". |
Of course, here is the Java code you requested:
```java
public Result unregisterReference(SharedStateRegistryKey registrationKey) {
Preconditions.checkNotNull(registrationKey);
final Result result;
final StreamStateHandle scheduledStateDeletion;
SharedStateRegistry.SharedStateEntry entry;
synchronized (re... | Create a Java method that does the following: "Unregisters a reference to a shared state.". |
Of course, here is the Java code you requested:
```java
public static <W extends Window> TimeEvictor<W> of(Time windowSize) {
return new TimeEvictor<>(windowSize.toMilliseconds());
}
```
Hope this helps! | Create a Java method that does the following: "Creates a new time evictor.". |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.