コード例 #1
0
    private ScanRequest GetNextRowsRequest()
    {
        var request = new ScanRequestPB
        {
            ScannerId      = _scannerId,
            CallSeqId      = _sequenceId,
            BatchSizeBytes = (uint)_batchSizeBytes
        };

        return(new ScanRequest(
                   ScanRequestState.Next,
                   request,
                   _schema,
                   _replicaSelection,
                   _table.TableId,
                   Tablet,
                   _partitionPruner.NextPartitionKey,
                   _isFaultTolerant));
    }
コード例 #2
0
    private ScanRequest GetCloseRequest()
    {
        var request = new ScanRequestPB
        {
            ScannerId      = _scannerId,
            BatchSizeBytes = 0,
            CloseScanner   = true
        };

        return(new ScanRequest(
                   ScanRequestState.Closing,
                   request,
                   _schema,
                   _replicaSelection,
                   _table.TableId,
                   Tablet,
                   _partitionPruner.NextPartitionKey,
                   _isFaultTolerant));
    }
コード例 #3
0
    private ScanRequest GetOpenRequest()
    {
        var request = new ScanRequestPB();

        var newRequest = request.NewScanRequest = new NewScanRequestPB
        {
            Limit          = (ulong)(_limit - _numRowsReturned),
            OrderMode      = _orderMode,
            CacheBlocks    = _cacheBlocks,
            ReadMode       = (Protobuf.ReadMode)_readMode,
            RowFormatFlags = (ulong)RowFormatFlags.ColumnarLayout
        };

        newRequest.ProjectedColumns.AddRange(_columns);

        // For READ_YOUR_WRITES scan, use the propagated timestamp from
        // the scanner.
        if (_readMode == ReadMode.ReadYourWrites)
        {
            long timestamp = _lowerBoundPropagationTimestamp;
            if (timestamp != KuduClient.NoTimestamp)
            {
                newRequest.PropagatedTimestamp = (ulong)timestamp;
            }
        }

        // If the mode is set to read on snapshot set the snapshot timestamps.
        if (_readMode == ReadMode.ReadAtSnapshot)
        {
            if (SnapshotTimestamp != KuduClient.NoTimestamp)
            {
                newRequest.SnapTimestamp = (ulong)SnapshotTimestamp;
            }

            if (_startTimestamp != KuduClient.NoTimestamp)
            {
                newRequest.SnapStartTimestamp = (ulong)_startTimestamp;
            }
        }

        if (_isFaultTolerant && _lastPrimaryKey.Length > 0)
        {
            newRequest.LastPrimaryKey = _lastPrimaryKey;
        }

        if (_startPrimaryKey.Length > 0)
        {
            newRequest.StartPrimaryKey = UnsafeByteOperations.UnsafeWrap(_startPrimaryKey);
        }

        if (_endPrimaryKey.Length > 0)
        {
            newRequest.StopPrimaryKey = UnsafeByteOperations.UnsafeWrap(_endPrimaryKey);
        }

        foreach (KuduPredicate predicate in _predicates.Values)
        {
            newRequest.ColumnPredicates.Add(predicate.ToProtobuf());
        }

        request.BatchSizeBytes = (uint)_batchSizeBytes;

        return(new ScanRequest(
                   ScanRequestState.Opening,
                   request,
                   _schema,
                   _replicaSelection,
                   _table.TableId,
                   Tablet,
                   _partitionPruner.NextPartitionKey,
                   _isFaultTolerant));
    }