blob: 0ae3c079fa7091607cd5d42e70eb2947c6286598 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_181-google-v7) on Mon Jan 27 16:42:29 PST 2020 -->
<title>BigQueryStorageStreamSource.BigQueryStorageStreamReader (Apache Beam 2.20.0-SNAPSHOT)</title>
<meta name="date" content="2020-01-27">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="BigQueryStorageStreamSource.BigQueryStorageStreamReader (Apache Beam 2.20.0-SNAPSHOT)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.html" title="class in org.apache.beam.sdk.io.gcp.bigquery"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageTableSource.html" title="class in org.apache.beam.sdk.io.gcp.bigquery"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" target="_top">Frames</a></li>
<li><a href="BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.org.apache.beam.sdk.io.BoundedSource.BoundedReader">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.beam.sdk.io.gcp.bigquery</div>
<h2 title="Class BigQueryStorageStreamSource.BigQueryStorageStreamReader" class="title">Class BigQueryStorageStreamSource.BigQueryStorageStreamReader&lt;T&gt;</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html" title="class in org.apache.beam.sdk.io">org.apache.beam.sdk.io.Source.Reader</a>&lt;T&gt;</li>
<li>
<ul class="inheritance">
<li><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html" title="class in org.apache.beam.sdk.io">org.apache.beam.sdk.io.BoundedSource.BoundedReader</a>&lt;T&gt;</li>
<li>
<ul class="inheritance">
<li>org.apache.beam.sdk.io.gcp.bigquery.BigQueryStorageStreamSource.BigQueryStorageStreamReader&lt;T&gt;</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.lang.AutoCloseable</dd>
</dl>
<dl>
<dt>Enclosing class:</dt>
<dd><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.html" title="class in org.apache.beam.sdk.io.gcp.bigquery">BigQueryStorageStreamSource</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.html" title="type parameter in BigQueryStorageStreamSource">T</a>&gt;</dd>
</dl>
<hr>
<br>
<pre><a href="../../../../../../../org/apache/beam/sdk/annotations/Experimental.html" title="annotation in org.apache.beam.sdk.annotations">@Experimental</a>(<a href="../../../../../../../org/apache/beam/sdk/annotations/Experimental.html#value--">value</a>=<a href="../../../../../../../org/apache/beam/sdk/annotations/Experimental.Kind.html#SOURCE_SINK">SOURCE_SINK</a>)
public static class <span class="typeNameLabel">BigQueryStorageStreamSource.BigQueryStorageStreamReader&lt;T&gt;</span>
extends <a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html" title="class in org.apache.beam.sdk.io">BoundedSource.BoundedReader</a>&lt;T&gt;</pre>
<div class="block">A <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html" title="class in org.apache.beam.sdk.io"><code>Source.Reader</code></a> which reads records from a stream.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.org.apache.beam.sdk.io.BoundedSource.BoundedReader">
<!-- -->
</a>
<h3>Fields inherited from class&nbsp;org.apache.beam.sdk.io.<a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html" title="class in org.apache.beam.sdk.io">BoundedSource.BoundedReader</a></h3>
<code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#SPLIT_POINTS_UNKNOWN">SPLIT_POINTS_UNKNOWN</a></code></li>
</ul>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html#advance--">advance</a></span>()</code>
<div class="block">Advances the reader to the next valid record.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html#close--">close</a></span>()</code>
<div class="block">Closes the reader.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html#getCurrent--">getCurrent</a></span>()</code>
<div class="block">Returns the value of the data item that was read by the last <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#start--"><code>Source.Reader.start()</code></a> or <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#advance--"><code>Source.Reader.advance()</code></a> call.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.html" title="class in org.apache.beam.sdk.io.gcp.bigquery">BigQueryStorageStreamSource</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html#getCurrentSource--">getCurrentSource</a></span>()</code>
<div class="block">Returns a <code>Source</code> describing the same input that this <code>Reader</code> currently reads
(including items already read).</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>java.lang.Double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html#getFractionConsumed--">getFractionConsumed</a></span>()</code>
<div class="block">Returns a value in [0, 1] representing approximately what fraction of the <a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#getCurrentSource--"><code>current source</code></a> this reader has read so far, or <code>null</code> if such an
estimate is not available.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.html" title="class in org.apache.beam.sdk.io">BoundedSource</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html#splitAtFraction-double-">splitAtFraction</a></span>(double&nbsp;fraction)</code>
<div class="block">Tells the reader to narrow the range of the input it's going to read and give up the
remainder, so that the new range would contain approximately the given fraction of the amount
of data in the current range.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html#start--">start</a></span>()</code>
<div class="block">Initializes the reader and advances the reader to the first record.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.apache.beam.sdk.io.BoundedSource.BoundedReader">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;org.apache.beam.sdk.io.<a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html" title="class in org.apache.beam.sdk.io">BoundedSource.BoundedReader</a></h3>
<code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#getCurrentTimestamp--">getCurrentTimestamp</a>, <a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#getSplitPointsConsumed--">getSplitPointsConsumed</a>, <a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#getSplitPointsRemaining--">getSplitPointsRemaining</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="start--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>start</h4>
<pre>public&nbsp;boolean&nbsp;start()
throws java.io.IOException</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#start--">Source.Reader</a></code></span></div>
<div class="block">Initializes the reader and advances the reader to the first record.
<p>This method should be called exactly once. The invocation should occur prior to calling
<a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#advance--"><code>Source.Reader.advance()</code></a> or <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#getCurrent--"><code>Source.Reader.getCurrent()</code></a>. This method may perform expensive operations that
are needed to initialize the reader.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#start--">start</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html" title="class in org.apache.beam.sdk.io">Source.Reader</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if a record was read, <code>false</code> if there is no more input available.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
<a name="advance--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>advance</h4>
<pre>public&nbsp;boolean&nbsp;advance()
throws java.io.IOException</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#advance--">Source.Reader</a></code></span></div>
<div class="block">Advances the reader to the next valid record.
<p>It is an error to call this without having called <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#start--"><code>Source.Reader.start()</code></a> first.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#advance--">advance</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html" title="class in org.apache.beam.sdk.io">Source.Reader</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;</code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if a record was read, <code>false</code> if there is no more input available.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
<a name="getCurrent--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCurrent</h4>
<pre>public&nbsp;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&nbsp;getCurrent()
throws java.util.NoSuchElementException</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#getCurrent--">Source.Reader</a></code></span></div>
<div class="block">Returns the value of the data item that was read by the last <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#start--"><code>Source.Reader.start()</code></a> or <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#advance--"><code>Source.Reader.advance()</code></a> call. The returned value must be effectively immutable and remain valid
indefinitely.
<p>Multiple calls to this method without an intervening call to <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#advance--"><code>Source.Reader.advance()</code></a> should
return the same result.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#getCurrent--">getCurrent</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html" title="class in org.apache.beam.sdk.io">Source.Reader</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;</code></dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.util.NoSuchElementException</code> - if <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#start--"><code>Source.Reader.start()</code></a> was never called, or if the last
<a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#start--"><code>Source.Reader.start()</code></a> or <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#advance--"><code>Source.Reader.advance()</code></a> returned <code>false</code>.</dd>
</dl>
</li>
</ul>
<a name="close--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre>public&nbsp;void&nbsp;close()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#close--">Source.Reader</a></code></span></div>
<div class="block">Closes the reader. The reader cannot be used after this method is called.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>close</code>&nbsp;in interface&nbsp;<code>java.lang.AutoCloseable</code></dd>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#close--">close</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html" title="class in org.apache.beam.sdk.io">Source.Reader</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;</code></dd>
</dl>
</li>
</ul>
<a name="getCurrentSource--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCurrentSource</h4>
<pre>public&nbsp;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.html" title="class in org.apache.beam.sdk.io.gcp.bigquery">BigQueryStorageStreamSource</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;&nbsp;getCurrentSource()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#getCurrentSource--">BoundedSource.BoundedReader</a></code></span></div>
<div class="block">Returns a <code>Source</code> describing the same input that this <code>Reader</code> currently reads
(including items already read).
<h3>Usage</h3>
<p>Reader subclasses can use this method for convenience to access unchanging properties of
the source being read. Alternatively, they can cache these properties in the constructor.
<p>The framework will call this method in the course of dynamic work rebalancing, e.g. after
a successful <a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#splitAtFraction-double-"><code>BoundedSource.BoundedReader.splitAtFraction(double)</code></a> call.
<h3>Mutability and thread safety</h3>
<p>Remember that <a href="../../../../../../../org/apache/beam/sdk/io/Source.html" title="class in org.apache.beam.sdk.io"><code>Source</code></a> objects must always be immutable. However, the return value
of this function may be affected by dynamic work rebalancing, happening asynchronously via
<a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#splitAtFraction-double-"><code>BoundedSource.BoundedReader.splitAtFraction(double)</code></a>, meaning it can return a different <a href="../../../../../../../org/apache/beam/sdk/io/Source.html" title="class in org.apache.beam.sdk.io"><code>Source</code></a> object. However, the returned object itself will still itself be immutable. Callers
must take care not to rely on properties of the returned source that may be asynchronously
changed as a result of this process (e.g. do not cache an end offset when reading a file).
<h3>Implementation</h3>
<p>For convenience, subclasses should usually return the most concrete subclass of <a href="../../../../../../../org/apache/beam/sdk/io/Source.html" title="class in org.apache.beam.sdk.io"><code>Source</code></a> possible. In practice, the implementation of this method should nearly always be one
of the following:
<ul>
<li>Source that inherits from a base class that already implements <a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#getCurrentSource--"><code>BoundedSource.BoundedReader.getCurrentSource()</code></a>: delegate to base class. In this case, it is almost always an error
for the subclass to maintain its own copy of the source.
<pre><code>
public FooReader(FooSource&lt;T&gt; source) {
super(source);
}
public FooSource&lt;T&gt; getCurrentSource() {
return (FooSource&lt;T&gt;)super.getCurrentSource();
}
</code></pre>
<li>Source that does not support dynamic work rebalancing: return a private final variable.
<pre><code>
private final FooSource&lt;T&gt; source;
public FooReader(FooSource&lt;T&gt; source) {
this.source = source;
}
public FooSource&lt;T&gt; getCurrentSource() {
return source;
}
</code></pre>
<li><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html" title="class in org.apache.beam.sdk.io"><code>BoundedSource.BoundedReader</code></a> that explicitly supports dynamic work rebalancing:
maintain a variable pointing to an immutable source object, and protect it with
synchronization.
<pre><code>
private FooSource&lt;T&gt; source;
public FooReader(FooSource&lt;T&gt; source) {
this.source = source;
}
public synchronized FooSource&lt;T&gt; getCurrentSource() {
return source;
}
public synchronized FooSource&lt;T&gt; splitAtFraction(double fraction) {
...
FooSource&lt;T&gt; primary = ...;
FooSource&lt;T&gt; residual = ...;
this.source = primary;
return residual;
}
</code></pre>
</ul></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#getCurrentSource--">getCurrentSource</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html" title="class in org.apache.beam.sdk.io">BoundedSource.BoundedReader</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;</code></dd>
</dl>
</li>
</ul>
<a name="splitAtFraction-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>splitAtFraction</h4>
<pre>public&nbsp;<a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.html" title="class in org.apache.beam.sdk.io">BoundedSource</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;&nbsp;splitAtFraction(double&nbsp;fraction)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#splitAtFraction-double-">BoundedSource.BoundedReader</a></code></span></div>
<div class="block">Tells the reader to narrow the range of the input it's going to read and give up the
remainder, so that the new range would contain approximately the given fraction of the amount
of data in the current range.
<p>Returns a <code>BoundedSource</code> representing the remainder.
<h3>Detailed description</h3>
Assuming the following sequence of calls:
<pre><code>
BoundedSource&lt;T&gt; initial = reader.getCurrentSource();
BoundedSource&lt;T&gt; residual = reader.splitAtFraction(fraction);
BoundedSource&lt;T&gt; primary = reader.getCurrentSource();
</code></pre>
<ul>
<li>The "primary" and "residual" sources, when read, should together cover the same set of
records as "initial".
<li>The current reader should continue to be in a valid state, and continuing to read from
it should, together with the records it already read, yield the same records as would
have been read by "primary".
<li>The amount of data read by "primary" should ideally represent approximately the given
fraction of the amount of data read by "initial".
</ul>
For example, a reader that reads a range of offsets <i>[A, B)</i> in a file might implement
this method by truncating the current range to <i>[A, A + fraction*(B-A))</i> and returning a
Source representing the range <i>[A + fraction*(B-A), B)</i>.
<p>This method should return <code>null</code> if the split cannot be performed for this fraction
while satisfying the semantics above. E.g., a reader that reads a range of offsets in a file
should return <code>null</code> if it is already past the position in its range corresponding to
the given fraction. In this case, the method MUST have no effect (the reader must behave as
if the method hadn't been called at all).
<h3>Statefulness</h3>
Since this method (if successful) affects the reader's source, in subsequent invocations
"fraction" should be interpreted relative to the new current source.
<h3>Thread safety and blocking</h3>
This method will be called concurrently to other methods (however there will not be multiple
concurrent invocations of this method itself), and it is critical for it to be implemented in
a thread-safe way (otherwise data loss is possible).
<p>It is also very important that this method always completes quickly. In particular, it
should not perform or wait on any blocking operations such as I/O, RPCs etc. Violating this
requirement may stall completion of the work item or even cause it to fail.
<p>It is incorrect to make both this method and <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#start--"><code>Source.Reader.start()</code></a>/<a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#advance--"><code>Source.Reader.advance()</code></a> <code>synchronized</code>, because those methods can perform blocking operations, and then this method
would have to wait for those calls to complete.
<p><a href="../../../../../../../org/apache/beam/sdk/io/range/RangeTracker.html" title="interface in org.apache.beam.sdk.io.range"><code>RangeTracker</code></a> makes it easy to implement this method
safely and correctly.
<p>By default, returns null to indicate that splitting is not possible.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#splitAtFraction-double-">splitAtFraction</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html" title="class in org.apache.beam.sdk.io">BoundedSource.BoundedReader</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;</code></dd>
</dl>
</li>
</ul>
<a name="getFractionConsumed--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getFractionConsumed</h4>
<pre>public&nbsp;java.lang.Double&nbsp;getFractionConsumed()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#getFractionConsumed--">BoundedSource.BoundedReader</a></code></span></div>
<div class="block">Returns a value in [0, 1] representing approximately what fraction of the <a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#getCurrentSource--"><code>current source</code></a> this reader has read so far, or <code>null</code> if such an
estimate is not available.
<p>It is recommended that this method should satisfy the following properties:
<ul>
<li>Should return 0 before the <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#start--"><code>Source.Reader.start()</code></a> call.
<li>Should return 1 after a <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#start--"><code>Source.Reader.start()</code></a> or <a href="../../../../../../../org/apache/beam/sdk/io/Source.Reader.html#advance--"><code>Source.Reader.advance()</code></a> call that returns false.
<li>The returned values should be non-decreasing (though they don't have to be unique).
</ul>
<p>By default, returns null to indicate that this cannot be estimated.
<h3>Thread safety</h3>
If <a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#splitAtFraction-double-"><code>BoundedSource.BoundedReader.splitAtFraction(double)</code></a> is implemented, this method can be called concurrently to other
methods (including itself), and it is therefore critical for it to be implemented in a
thread-safe way.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html#getFractionConsumed--">getFractionConsumed</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../../org/apache/beam/sdk/io/BoundedSource.BoundedReader.html" title="class in org.apache.beam.sdk.io">BoundedSource.BoundedReader</a>&lt;<a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" title="type parameter in BigQueryStorageStreamSource.BigQueryStorageStreamReader">T</a>&gt;</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.html" title="class in org.apache.beam.sdk.io.gcp.bigquery"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../../../org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageTableSource.html" title="class in org.apache.beam.sdk.io.gcp.bigquery"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/beam/sdk/io/gcp/bigquery/BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" target="_top">Frames</a></li>
<li><a href="BigQueryStorageStreamSource.BigQueryStorageStreamReader.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#fields.inherited.from.class.org.apache.beam.sdk.io.BoundedSource.BoundedReader">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>