<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OpenText Analytics Database 26.2.x – R SDK</title>
    <link>/en/extending/developing-udxs/developing-with-sdk/r-sdk/</link>
    <description>Recent content in R SDK on OpenText Analytics Database 26.2.x</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/extending/developing-udxs/developing-with-sdk/r-sdk/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Extending: Installing/upgrading the R language pack for OpenText&amp;trade; Analytics Database</title>
      <link>/en/extending/developing-udxs/developing-with-sdk/r-sdk/installingupgrading-r-language-pack/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/extending/developing-udxs/developing-with-sdk/r-sdk/installingupgrading-r-language-pack/</guid>
      <description>
        
        
        &lt;p&gt;To create R UDxs in OpenText™ Analytics Database, install the R Language Pack package that matches your server version. The R Language Pack includes the R runtime and associated libraries for interfacing with the database. You must use this version of the R runtime; you cannot upgrade it.&lt;/p&gt;
&lt;p&gt;You must install the R Language Pack on each node in the cluster. The OpenText™ Analytics Database R Language Pack must be the only R Language Pack installed on the node.&lt;/p&gt;
&lt;h2 id=&#34;opentexttrade-analytics-database-r-language-pack-prerequisites&#34;&gt;OpenText™ Analytics Database R language pack prerequisites&lt;/h2&gt;
&lt;p&gt;The R Language Pack package requires a number of packages for installation and execution. The names of these dependencies vary among Linux distributions. For Linux platforms, the packages are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;RHEL/CentOS: &lt;code&gt;libgfortran&lt;/code&gt;, &lt;code&gt;xz-libs&lt;/code&gt;, &lt;code&gt;libgomp&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;SUSE Linux Enterprise Server: &lt;code&gt;libgfortran&lt;/code&gt;, &lt;code&gt;liblzma5&lt;/code&gt;, &lt;code&gt;libgomp1&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Debian/Ubuntu: &lt;code&gt;libgfortran&lt;/code&gt;, &lt;code&gt;liblzma5&lt;/code&gt;, &lt;code&gt;libgomp1&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Amazon Linux 2023: &lt;code&gt;libgfortran&lt;/code&gt;, &lt;code&gt;xz-libs&lt;/code&gt;, &lt;code&gt;libgomp&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The database requires version 5 of the &lt;code&gt;libgfortran&lt;/code&gt; library later than 8.3.0 to create R extensions. The &lt;code&gt;libgfortran&lt;/code&gt; library is included by default with the &lt;code&gt;devtool&lt;/code&gt; and &lt;code&gt;gcc&lt;/code&gt; packages.&lt;/p&gt;
&lt;h2 id=&#34;installing-the-opentexttrade-analytics-database-r-language-pack&#34;&gt;Installing the OpenText™ Analytics Database R language pack&lt;/h2&gt;
&lt;p&gt;If you use your operating systems package manager, rather than the rpm or dpkg command, for installation, you do not need to manually install the R Language Pack. The native package managers for each supported Linux version are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;RHEL/CentOS: yum&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;SUSE Linux Enterprise Server: zypper&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Debian/Ubuntu: apt-get&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Amazon Linux 2023: yum&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Download the R language package by browsing to the &lt;a href=&#34;https://opentext.com/products/analytics-database&#34;&gt;OpenText™ Analytics Database website&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On the &lt;strong&gt;Support&lt;/strong&gt; tab, select &lt;strong&gt;Customer Downloads&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;When prompted, log in using your Micro Focus credentials.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Located and select the &lt;code&gt;vertica-R-lang_&lt;/code&gt;&lt;em&gt;&lt;code&gt;version&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.rpm&lt;/code&gt; or &lt;code&gt;vertica-R-lang_&lt;/code&gt;&lt;em&gt;&lt;code&gt;version&lt;/code&gt;&lt;/em&gt;&lt;code&gt;.deb&lt;/code&gt; file for your server version. The R language package version must match your server version to three decimal points.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install the package as root or using sudo:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;RHEL/CentOS&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ yum install vertica-R-lang-&amp;lt;version&amp;gt;.rpm
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;SUSE Linux Enterprise Server&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ zypper install vertica-R-lang-&amp;lt;version&amp;gt;.rpm
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Debian&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ apt-get install ./vertica-R-lang_&amp;lt;version&amp;gt;.deb
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Amazon Linux 2023&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; $ yum install vertica-R-lang-&amp;lt;version&amp;gt;.AMZN.rpm
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The installer puts the R binary in &lt;code&gt;/opt/vertica/R&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&#34;upgrading-the-opentexttrade-analytics-database-r-language-pack&#34;&gt;Upgrading the OpenText™ Analytics Database R language pack&lt;/h2&gt;
&lt;p&gt;When upgrading, some R packages you have manually installed may not work and may have to be reinstalled. If you do not update your package(s), then R returns an error if the package cannot be used. Instructions for upgrading these packages are below.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

The R packages provided in the R Language Pack are automatically upgraded and do not need to be reinstalled.

&lt;/div&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;You must uninstall the R Language package before upgrading the database. Any additional R packages you manually installed remain in &lt;code&gt;/opt/vertica/R&lt;/code&gt; and are not removed when you uninstall the package.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Upgrade your server package as detailed in (/en/setup/upgrading/upgrade/).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After the server package has been updated, install the new R Language package on each host.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you have installed additional R packages, on each node:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;As root run &lt;code&gt;/opt/vertica/R/bin/R&lt;/code&gt; and issue the command:&lt;br /&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; update.packages(checkBuilt=TRUE)
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select a CRAN mirror from the list displayed.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You are prompted to update each package that has an update available for it. You must update any packages that you manually installed and are not compatible with the current version of R in the R Language Pack. &lt;br /&gt;Do &lt;strong&gt;NOT&lt;/strong&gt; update:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Rcpp&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Rinside&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The packages you selected to be updated are installed. Quit R with the command:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; quit()
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;OpenText™ Analytics Database UDx functions written in R do not need to be compiled and you do not need to reload your Vertica-R libraries and functions after an upgrade.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Extending: R packages</title>
      <link>/en/extending/developing-udxs/developing-with-sdk/r-sdk/r-packages/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/extending/developing-udxs/developing-with-sdk/r-sdk/r-packages/</guid>
      <description>
        
        
        &lt;p&gt;The OpenText™ Analytics Database R Language Pack includes the following R packages in addition to the default packages bundled with R:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Rcpp&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;RInside&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;IpSolve&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;lpSolveAPI&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can install additional R packages not included in the OpenText™ Analytics Database R Language Pack by using one of two methods. You must install the same packages on all nodes.&lt;/p&gt;
&lt;h2 id=&#34;installing-r-packages&#34;&gt;Installing R packages&lt;/h2&gt;
&lt;p&gt;You can install additional R packages by using one of the two following methods.&lt;/p&gt;
&lt;p&gt;Using the install.packages() R command:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ sudo /opt/vertica/R/bin/R
&amp;gt; install.packages(&amp;#34;Zelig&amp;#34;);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Using CMD INSTALL:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;/opt/vertica/R/bin/R CMD INSTALL &amp;lt;path-to-package-tgz&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The installed packages are located in: &lt;code&gt;/opt/vertica/R/library&lt;/code&gt;.&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Extending: R and OpenText&amp;trade; Analytics Database data types</title>
      <link>/en/extending/developing-udxs/developing-with-sdk/r-sdk/r-and-data-types/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/extending/developing-udxs/developing-with-sdk/r-sdk/r-and-data-types/</guid>
      <description>
        
        
        &lt;p&gt;The following data types are supported when passing data to/from an R UDx:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
OpenText™ Analytics Database Data Type&lt;/th&gt; 

&lt;th &gt;
R Data Type&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


BOOLEAN&lt;/td&gt; 

&lt;td &gt;


logical&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


DATE, DATETIME, SMALLDATETIME, TIME, TIMESTAMP, TIMESTAMPTZ, TIMETZ&lt;/td&gt; 

&lt;td &gt;


numeric&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


DOUBLE PRECISION, FLOAT, REAL&lt;/td&gt; 

&lt;td &gt;


numeric&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


BIGINT, DECIMAL, INT, NUMERIC, NUMBER, MONEY&lt;/td&gt; 

&lt;td &gt;


numeric&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


BINARY, VARBINARY&lt;/td&gt; 

&lt;td &gt;


character&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


CHAR, VARCHAR&lt;/td&gt; 

&lt;td &gt;


character&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;NULL values in the database are translated to R NA values when sent to the R function. R NA values are translated into database null values when returned from the R function to the database.

&lt;div class=&#34;admonition important&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Important&lt;/h4&gt;
When specifying LONG VARCHAR or LONG VARBINARY data types, include the space between the two words. For example, &lt;code&gt;datatype = c(&amp;quot;long varchar&amp;quot;)&lt;/code&gt;.
&lt;/div&gt;&lt;/p&gt;

      </description>
    </item>
    
    <item>
      <title>Extending: Adding metadata to R libraries</title>
      <link>/en/extending/developing-udxs/developing-with-sdk/r-sdk/adding-metadata-to-r-libraries/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/extending/developing-udxs/developing-with-sdk/r-sdk/adding-metadata-to-r-libraries/</guid>
      <description>
        
        
        &lt;p&gt;You can add metadata, such as author name, the version of the library, a description of your library, and so on to your library. This metadata lets you track the version of your function that is deployed on a Vertica Analytic Database cluster and lets third-party users of your function know who created the function. Your library&#39;s metadata appears in the &lt;a href=&#34;../../../../../en/sql-reference/system-tables/v-monitor-schema/user-libraries/#&#34;&gt;USER_LIBRARIES&lt;/a&gt; system table after your library has been loaded into the Vertica Analytic Database catalog.&lt;/p&gt;

&lt;p&gt;You declare the metadata for your library by calling the &lt;code&gt;RegisterLibrary()&lt;/code&gt; function in one of the source files for your UDx. If there is more than one function call in the source files for your UDx, whichever gets interpreted last as Vertica Analytic Database loads the library is used to determine the library&#39;s metadata.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;RegisterLibrary()&lt;/code&gt; function takes eight string parameters:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;RegisterLibrary(author,
                library_build_tag,
                library_version,
                library_sdk_version,
                source_url,
                description,
                licenses_required,
                signature);
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;author&lt;/code&gt; contains whatever name you want associated with the creation of the library (your own name or your company&#39;s name for example).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;library_build_tag&lt;/code&gt; is a string you want to use to represent the specific build of the library (for example, the SVN revision number or a timestamp of when the library was compiled). This is useful for tracking instances of your library as you are developing them.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;library_version&lt;/code&gt; is the version of your library. You can use whatever numbering or naming scheme you want.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;library_sdk_version&lt;/code&gt; is the version of the Vertica Analytic Database SDK Library for which you&#39;ve compiled the library.&lt;/p&gt;

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

This field isn&#39;t used to determine whether a library is compatible with a version of the Vertica Analytic Database server. The version of the Vertica Analytic Database SDK you use to compile your library is embedded in the library when you compile it. It is this information that Vertica Analytic Database server uses to determine if your library is compatible with it.

&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;source_url&lt;/code&gt; is a URL where users of your function can find more information about it. This can be your company&#39;s website, the GitHub page hosting your library&#39;s source code, or whatever site you like.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;description&lt;/code&gt; is a concise description of your library.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;licenses_required&lt;/code&gt; is a placeholder for licensing information. You must pass an empty string for this value.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;signature&lt;/code&gt; is a placeholder for a signature that will authenticate your library. You must pass an empty string for this value.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The following example shows how to add metadata to an R UDx.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-r&#34; data-lang=&#34;r&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nf&#34;&gt;RegisterLibrary&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;Speedy Analytics Ltd.&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                &lt;span class=&#34;s&#34;&gt;&amp;#34;1234&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                &lt;span class=&#34;s&#34;&gt;&amp;#34;1.0&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                &lt;span class=&#34;s&#34;&gt;&amp;#34;8.1.0&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                &lt;span class=&#34;s&#34;&gt;&amp;#34;http://www.example.com/sales_tax_calculator.R&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                &lt;span class=&#34;s&#34;&gt;&amp;#34;Sales Tax R Library&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                &lt;span class=&#34;s&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;                &lt;span class=&#34;s&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Loading the library and querying the USER_LIBRARIES system table shows the metadata supplied in the call to &lt;code&gt;RegisterLibrary&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE LIBRARY rLib AS &amp;#39;/home/dbadmin/sales_tax_calculator.R&amp;#39; LANGUAGE &amp;#39;R&amp;#39;;
CREATE LIBRARY
=&amp;gt; SELECT * FROM USER_LIBRARIES WHERE lib_name = &amp;#39;rLib&amp;#39;;
-[ RECORD 1 ]-----+---------------------------------------------------------
schema_name       | public
lib_name          | rLib
lib_oid           | 45035996273708350
author            | Speedy Analytics Ltd.
owner_id          | 45035996273704962
lib_file_name     | rLib_02552872a35d9352b4907d3fcd03cf9700a0000000000d3e.R
md5_sum           | 30da555537c4d93c352775e4f31332d2
sdk_version       |
revision          |
lib_build_tag     | 1234
lib_version       | 1.0
lib_sdk_version   | 8.1.0
source_url        | http://www.example.com/sales_tax_calculator.R
description       | Sales Tax R Library
licenses_required |
signature         |
dependencies      |
is_valid          | t
sal_storage_id    | 02552872a35d9352b4907d3fcd03cf9700a0000000000d3e
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Extending: Setting null input and volatility behavior for R functions</title>
      <link>/en/extending/developing-udxs/developing-with-sdk/r-sdk/setting-null-input-and-volatility-behavior-r-functions/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/extending/developing-udxs/developing-with-sdk/r-sdk/setting-null-input-and-volatility-behavior-r-functions/</guid>
      <description>
        
        
        &lt;p&gt;
OpenText™ Analytics Database supports defining volatility and null-input settings for UDxs written in R. Both settings aid in the performance of your R function.&lt;/p&gt;
&lt;h2 id=&#34;volatility-settings&#34;&gt;Volatility settings&lt;/h2&gt;
&lt;p&gt;Volatility settings describe the behavior of the function to the OpenText™ Analytics Database optimizer. For example, if you have identical rows of input data and you know the UDx is immutable, then you can define the UDx as IMMUTABLE. This instructs the database optimizer that it can return a cached value for subsequent identical rows on which the function is called rather than having the function run on each identical row.&lt;/p&gt;
&lt;p&gt;To indicate your UDx&#39;s volatility, set the volatility parameter of your R factory function to one of the following values:&lt;/p&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
Value&lt;/th&gt; 

&lt;th &gt;
Description&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;VOLATILE&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Repeated calls to the function with the same arguments always result in different values. Vertica always calls volatile functions for each invocation.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;IMMUTABLE&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Calls to the function with the same arguments always results in the same return value.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;STABLE&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Repeated calls to the function with the same arguments &lt;em&gt;within the same statement&lt;/em&gt; returns the same output. For example, a function that returns the current user name is stable because the user cannot change within a statement. The user name could change between statements.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;DEFAULT_VOLATILITY&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


The default volatility. This is the same as VOLATILE.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;


&lt;p&gt;If you do not define a volatility, then the function is considered to be VOLATILE.&lt;/p&gt;
&lt;p&gt;The following example sets the volatility to STABLE in the multiplyTwoIntsFactory function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-r&#34; data-lang=&#34;r&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;multiplyTwoIntsFactory&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nf&#34;&gt;list&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;name&lt;/span&gt;                  &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;multiplyTwoInts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;       &lt;span class=&#34;n&#34;&gt;udxtype&lt;/span&gt;               &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;scalar&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;       &lt;span class=&#34;n&#34;&gt;intype&lt;/span&gt;                &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;float&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;float&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;       &lt;span class=&#34;n&#34;&gt;outtype&lt;/span&gt;               &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;float&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;       &lt;span class=&#34;n&#34;&gt;volatility&lt;/span&gt;            &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;stable&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;       &lt;span class=&#34;n&#34;&gt;parametertypecallback&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;multiplyTwoIntsParameters&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;null-input-behavior&#34;&gt;Null input behavior&lt;/h2&gt;
&lt;p&gt;Null input setting determine how to respond to rows that have null input. For example, you can choose to return null if any inputs are null rather than calling the function and having the function deal with a NULL input.&lt;/p&gt;
&lt;p&gt;To indicate how your UDx reacts to NULL input, set the strictness parameter of your R factory function to one of the following values:&lt;/p&gt;

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
Value&lt;/th&gt; 

&lt;th &gt;
Description&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


CALLED_ON_NULL_INPUT&lt;/td&gt; 

&lt;td &gt;


The function must be called, even if one or more arguments are NULL.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


RETURN_NULL_ON_NULL_INPUT&lt;/td&gt; 

&lt;td &gt;


The function always returns a NULL value if any of its arguments are NULL.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


STRICT&lt;/td&gt; 

&lt;td &gt;


A synonym for RETURN_NULL_ON_NULL_INPUT&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


DEFAULT_STRICTNESS&lt;/td&gt; 

&lt;td &gt;


The default strictness setting. This is the same as CALLED_ON_NULL_INPUT.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;


&lt;p&gt;If you do not define a null input behavior, then the function is called on every row of data regardless of the presence of NULL values.&lt;/p&gt;
&lt;p&gt;The following example sets the NULL input behavior to STRICT in the multiplyTwoIntsFactory function:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-r&#34; data-lang=&#34;r&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;multiplyTwoIntsFactory&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;&amp;lt;-&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nf&#34;&gt;list&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;name&lt;/span&gt;                  &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;multiplyTwoInts&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;       &lt;span class=&#34;n&#34;&gt;udxtype&lt;/span&gt;               &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;scalar&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;       &lt;span class=&#34;n&#34;&gt;intype&lt;/span&gt;                &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;float&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;float&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;       &lt;span class=&#34;n&#34;&gt;outtype&lt;/span&gt;               &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;float&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;       &lt;span class=&#34;n&#34;&gt;strictness&lt;/span&gt;            &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;c&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;strict&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;       &lt;span class=&#34;n&#34;&gt;parametertypecallback&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;multiplyTwoIntsParameters&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
      </description>
    </item>
    
  </channel>
</rss>
