<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: def sample(a:Column,b:Column):Column={   var c:Column=null  ;c=a*(1-b);c}      error: overloaded method value + with alternatives  cannot be applied to (org.apache.spark.sql.Column) in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/def-sample-a-Column-b-Column-Column-var-c-Column-null-c-a-1/m-p/235662#M197475</link>
    <description>&lt;H1&gt;c=a*(lit(1)-b)&lt;/H1&gt;</description>
    <pubDate>Wed, 15 May 2019 21:54:43 GMT</pubDate>
    <dc:creator>chiranjeevivenk</dc:creator>
    <dc:date>2019-05-15T21:54:43Z</dc:date>
    <item>
      <title>def sample(a:Column,b:Column):Column={   var c:Column=null  ;c=a*(1-b);c}      error: overloaded method value + with alternatives  cannot be applied to (org.apache.spark.sql.Column)</title>
      <link>https://community.cloudera.com/t5/Support-Questions/def-sample-a-Column-b-Column-Column-var-c-Column-null-c-a-1/m-p/235661#M197474</link>
      <description>&lt;P data-path-to-node="0"&gt;Hi! I'm trying to define a Scala function in Apache Spark that performs some column arithmetic, but I am running into a compilation error.&lt;/P&gt;
&lt;P data-path-to-node="1"&gt;Here is my code:&lt;/P&gt;
&lt;DIV class="code-block ng-tns-c597216360-10 ng-animate-disabled ng-trigger ng-trigger-codeBlockRevealAnimation"&gt;
&lt;DIV class="code-block-decoration header-formatted gds-title-s ng-tns-c597216360-10 ng-star-inserted"&gt;&lt;SPAN class="ng-tns-c597216360-10"&gt;Scala&lt;/SPAN&gt;
&lt;DIV class="buttons ng-tns-c597216360-10 ng-star-inserted"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="formatted-code-block-internal-container ng-tns-c597216360-10"&gt;
&lt;DIV class="animated-opacity ng-tns-c597216360-10"&gt;
&lt;PRE class="ng-tns-c597216360-10"&gt;&lt;CODE class="code-container formatted ng-tns-c597216360-10 embedded" role="text" data-test-id="code-content"&gt;&lt;SPAN class="hljs-function"&gt;&lt;SPAN class="hljs-keyword"&gt;def&lt;/SPAN&gt; &lt;SPAN class="hljs-title"&gt;sample&lt;/SPAN&gt;&lt;/SPAN&gt;(a: &lt;SPAN class="hljs-type"&gt;Column&lt;/SPAN&gt;, b: &lt;SPAN class="hljs-type"&gt;Column&lt;/SPAN&gt;): &lt;SPAN class="hljs-type"&gt;Column&lt;/SPAN&gt; = { 
  &lt;SPAN class="hljs-keyword"&gt;var&lt;/SPAN&gt; c: &lt;SPAN class="hljs-type"&gt;Column&lt;/SPAN&gt; = &lt;SPAN class="hljs-literal"&gt;null&lt;/SPAN&gt;
  c = a * (&lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt; - b)
  c
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P data-path-to-node="3"&gt;When I try to use this, I get the following error message:&lt;/P&gt;
&lt;BLOCKQUOTE data-path-to-node="4"&gt;
&lt;P data-path-to-node="4,0"&gt;&lt;CODE data-index-in-node="0" data-path-to-node="4,0"&gt;error: overloaded method value + with alternatives cannot be applied to (org.apache.spark.sql.Column)&lt;/CODE&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P data-path-to-node="5"&gt;How can I fix this arithmetic expression so it works with Spark &lt;CODE data-index-in-node="64" data-path-to-node="5"&gt;Column&lt;/CODE&gt; objects?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2026 06:47:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/def-sample-a-Column-b-Column-Column-var-c-Column-null-c-a-1/m-p/235661#M197474</guid>
      <dc:creator>chiranjeevivenk</dc:creator>
      <dc:date>2026-06-08T06:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: def sample(a:Column,b:Column):Column={   var c:Column=null  ;c=a*(1-b);c}      error: overloaded method value + with alternatives  cannot be applied to (org.apache.spark.sql.Column)</title>
      <link>https://community.cloudera.com/t5/Support-Questions/def-sample-a-Column-b-Column-Column-var-c-Column-null-c-a-1/m-p/235662#M197475</link>
      <description>&lt;H1&gt;c=a*(lit(1)-b)&lt;/H1&gt;</description>
      <pubDate>Wed, 15 May 2019 21:54:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/def-sample-a-Column-b-Column-Column-var-c-Column-null-c-a-1/m-p/235662#M197475</guid>
      <dc:creator>chiranjeevivenk</dc:creator>
      <dc:date>2019-05-15T21:54:43Z</dc:date>
    </item>
  </channel>
</rss>

