This is an automated email from the ASF dual-hosted git repository. mergebot-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/beam-site.git
commit c8413e3afc7ea65c6e9c8baf01557dc15b6e7089 Author: Mergebot <merge...@apache.org> AuthorDate: Thu Feb 22 10:53:44 2018 -0800 Prepare repository for deployment. --- content/documentation/sdks/python-type-safety/index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/documentation/sdks/python-type-safety/index.html b/content/documentation/sdks/python-type-safety/index.html index e116b24..1f3ef16 100644 --- a/content/documentation/sdks/python-type-safety/index.html +++ b/content/documentation/sdks/python-type-safety/index.html @@ -281,19 +281,21 @@ words_with_lens = words | MyTransform() <p>In addition to using type hints for type checking at pipeline construction, you can enable runtime type checking to check that actual elements satisfy the declared type constraints during pipeline execution.</p> -<p>For example, the following code would pass at both pipeline construction and runtime.</p> +<p>For example, the following pipeline emits elements of the wrong type. Depending on the runner implementation, its execution may or may not fail at runtime.</p> <div class="highlighter-rouge"><pre class="highlight"><code>p | beam.Create(['a']) | beam.Map(lambda x: 3).with_output_types(str) </code></pre> </div> -<p>However, if you enable runtime type checking, the code passes at pipeline construction and fails at runtime. To enable runtime type checking, set the pipeline option <code class="highlighter-rouge">runtime_type_check</code> to <code class="highlighter-rouge">True</code>.</p> +<p>However, if you enable runtime type checking, the code is guaranteed to fail at runtime. To enable runtime type checking, set the pipeline option <code class="highlighter-rouge">runtime_type_check</code> to <code class="highlighter-rouge">True</code>.</p> <div class="highlighter-rouge"><pre class="highlight"><code>p | beam.Create(['a']) | beam.Map(lambda x: 3).with_output_types(str) p.run() </code></pre> </div> +<p>Note that because runtime type checks are done for each <code class="highlighter-rouge">PCollection</code> element, enabling this feature may incur a significant performance penalty. It is therefore recommended that runtime type checks are disabled for production pipelines.</p> + <h2 id="use-of-type-hints-in-coders">Use of Type Hints in Coders</h2> <p>When your pipeline reads, writes, or otherwise materializes its data, the elements in your <code class="highlighter-rouge">PCollection</code> need to be encoded and decoded to and from byte strings. Byte strings are used for intermediate storage, for comparing keys in <code class="highlighter-rouge">GroupByKey</code> operations, and for reading from sources and writing to sinks.</p> -- To stop receiving notification emails like this one, please contact mergebot-r...@apache.org.