Run streamingRead with a partition.

@param ReadPartition $partition The partition.
@return Result
488058
private function executeRead(ReadPartition $partition)
    {
        return $this->read($partition->table(), $partition->keySet(), $partition->columns(), [
            'partitionToken' => $partition->token()
        ] + $partition->options());
    }
141107
public static <T> Stream<T> parallelConcat(final Collection<? extends Stream<? extends T>> c, final int readThreadNum) {
        return parallelConcat(c, readThreadNum, calculateQueueSize(c.size()));
    }
73659
public ResultSubpartitionView createSubpartitionView(int index, BufferAvailabilityListener availabilityListener) throws IOException {
		int refCnt = pendingReferences.get();

		checkState(refCnt != -1, "Partition released.");
		checkState(refCnt > 0, "Partition not pinned.");

		checkElementIndex(index, subpartitions.length, "Subpartition not found.");

		ResultSubpartitionView readView = subpartitions[index].createReadView(availabilityListener);

		LOG.debug("Created {}", readView);

		return readView;
	}
42241
@Override
    public Entry<BatchPartitionWorkUnit, Future<?>> startPartition(PartitionPlanConfig partitionPlanConfig,
                                                                   Step step,
                                                                   PartitionReplyQueue partitionReplyQueue,
                                                                   boolean isRemoteDispatch) {

        BatchPartitionWorkUnit workUnit = createPartitionWorkUnit(partitionPlanConfig, step, partitionReplyQueue, isRemoteDispatch);

        Future<?> futureWork = runPartition(workUnit);

        // TODO: issue "partition.started" message ?

        return new AbstractMap.SimpleEntry<BatchPartitionWorkUnit, Future<?>>(workUnit, futureWork);
    }
749087
private DBObject createQueryPartition(MongoPartition partition) {

        QueryBuilder queryBuilderMin = QueryBuilder.start(partition.getKey());
        DBObject bsonObjectMin = queryBuilderMin.greaterThanEquals(partition.splitWrapper().getStartToken()).get();

        QueryBuilder queryBuilderMax = QueryBuilder.start(partition.getKey());
        DBObject bsonObjectMax = queryBuilderMax.lessThan(partition.splitWrapper().getEndToken()).get();

        QueryBuilder queryBuilder = QueryBuilder.start();
        if (partition.splitWrapper().getStartToken() != null) {
            queryBuilder.and(bsonObjectMin);
        }

        if (partition.splitWrapper().getEndToken() != null) {
            queryBuilder.and(bsonObjectMax);
        }

        LOG.debug("mongodb query "+queryBuilder.get());

        return queryBuilder.get();
    }
345247
public function read($count = 0)
    {
        if (0 === $count) {
            $count = -1;
        }
        fseek($this->resource, $this->readPosition);
        $content = stream_get_contents($this->resource, $count);
        $this->readPosition = ftell($this->resource);
        return $content;
    }
164179
public function stream_open(string $url, string $mode, int $options, ?string &$openedPath): bool
    {
        $partition = self::getPartition($url);
        $path = self::getRelativePath($url);

        $this->filePointer = $partition->fileOpen(
            $path, $mode, $options
        );

        $result = (bool) $this->filePointer;
        if ($result && ($options & STREAM_USE_PATH)) {
            $openedPath = $path;
        }

        return $result;
    }
1319097
public function stream_read($count)
    {
        $ret = mb_substr($this->data, $this->position, $count);
        $this->position += mb_strlen($ret);

        return $ret;
    }
54778
public function read($count)
    {
        // If the archive is complete, we only read the remaining buffer.
        if (!$this->isComplete) {
            if (isset($this->curVideoStream)) {
                if ($this->curVideoStream->eof()) {
                    // Stop streaming the current video.
                    $this->complete_file_stream();

                    $video = next($this->videos);
                    if ($video) {
                        // Start streaming the next video.
                        $this->startVideoStream($video);
                    } else {
                        // No video left.
                        $this->finish();
                        $this->isComplete = true;
                    }
                } else {
                    // Continue streaming the current video.
                    $this->stream_file_part($this->curVideoStream->read($count));
                }
            } else {
                // Start streaming the first video.
                $this->startVideoStream(current($this->videos));
            }
        }

        return fread($this->buffer, $count);
    }
191521
public Stream partition(CustomStreamGrouping partitioner) {
        return partition(Grouping.custom_serialized(Utils.javaSerialize(partitioner)));
    }
477169
func readPartition(reader io.Reader, size uint32) (p Partition, err error) {
	read := func(data interface{}) {
		if err == nil {
			err = binary.Read(reader, binary.LittleEndian, data)
		}
	}

	p.TrailingBytes = make([]byte, size-standardPartitionEntrySize)

	read(&p.Type)
	read(&p.Id)
	read(&p.FirstLBA)
	read(&p.LastLBA)
	read(&p.Flags)
	read(&p.PartNameUTF16)
	read(&p.TrailingBytes)

	return
}
540359
protected function parsePart($stream, $uid, $part, $partNo = 1)
    {
        if (!in_array($part->type, [TYPETEXT, TYPEMULTIPART])) {
            return null;
        }

        $body = imap_fetchbody($stream, $uid, $partNo, static::$bodyFlags);

        $body = static::decode($body, $part->encoding);
        if ('' !== ($charset = $this->findCharset($part))) {
            $body = static::convertBodyEncoding($body, $charset, $part->encoding);
        }

        return (object) [
            'body' => $body,
            'mime_type' => strtolower($part->subtype)
        ];
    }
275784
public void foreachPartition(final Action1<PartitionState> action) {
    int len = partitionStates.length();
    for (int i = 0; i < len; i++) {
      PartitionState ps = partitionStates.get(i);
      if (ps == null) {
        continue;
      }
      action.call(ps);
    }
  }
147351
protected function getAttachmentStream(&$part)
    {
        /** @var resource $temp_fp */
        $temp_fp = tmpfile();

        $headers = $this->getPart('headers', $part);
        $encodingType = array_key_exists('content-transfer-encoding', $headers) ?
            $headers['content-transfer-encoding'] : '';

        if ($temp_fp) {
            if ($this->stream) {
                $start = $part['starting-pos-body'];
                $end = $part['ending-pos-body'];
                fseek($this->stream, $start, SEEK_SET);
                $len = $end - $start;
                $written = 0;
                while ($written < $len) {
                    $write = $len;
                    $data = fread($this->stream, $write);
                    fwrite($temp_fp, $this->decodeContentTransfer($data, $encodingType));
                    $written += $write;
                }
            } elseif ($this->data) {
                $attachment = $this->decodeContentTransfer($this->getPartBodyFromText($part), $encodingType);
                fwrite($temp_fp, $attachment, strlen($attachment));
            }
            fseek($temp_fp, 0, SEEK_SET);
        } else {
            throw new Exception(
                'Could not create temporary files for attachments. Your tmp directory may be unwritable by PHP.'
            );
        }

        return $temp_fp;
    }
243739
@Override
    public void run() {
        try {
            VoltTable partitionKeys = null;
            partitionKeys = m_client.callProcedure("@GetPartitionKeys", "INTEGER").getResults()[0];

            while (partitionKeys.advanceRow()) {
                m_client.callProcedure(new NullCallback(), "DeleteOldAdRequests",
                        partitionKeys.getLong("PARTITION_KEY"),
                        m_expiredAgeInSeconds);
            }

            m_client.callProcedure(new NullCallback(), "DeleteExpiredBids");
        }
        catch (IOException | ProcCallException ex) {
            ex.printStackTrace();
        }
    }
1132296
@Override
	public void createPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSpec, CatalogPartition partition, boolean ignoreIfExists)
		throws TableNotExistException, TableNotPartitionedException, PartitionSpecInvalidException, PartitionAlreadyExistsException, CatalogException {

		validatePartitionSpec(tablePath, partitionSpec);

		if (partitionExists(tablePath, partitionSpec)) {
			if (!ignoreIfExists) {
				throw new PartitionAlreadyExistsException(catalogName, tablePath, partitionSpec);
			}
		} else {
			partitions.get(tablePath).put(partitionSpec, partition.copy());
		}
	}
1102805
public function stream_open($url, $mode, $options, &$openedPath)
  {
    $partition = self::getPartition($url);
    $path = self::getRelativePath($url);

    $this->_filePointer = $partition->fileOpen(
      $path, $mode, $options, $this->_fileEntity
    );

    $result = !!$this->_filePointer;
    if ($result && ($options & STREAM_USE_PATH)) {
      $openedPath = $path;
    }
    return $result;
  }