<?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: Kudu Client API upsert not throwing exception with few arguments in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/67923#M79190</link>
    <description>&lt;P&gt;Actually I've found that in order to catch such errors, the correct way is actually to get the RowError object returned by the session.apply() method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;OperationResponse op = session.apply(upst);
if (op.hasRowError()){
    RowError r = op.getRowError();
    String str = "error status " + r.getErrorStatus() +
            "\nerror Operation " + r.getOperation().toString() +
            "\nerror TsUUID " + r.getTsUUID() +
             "\nerror toString " + r.toString();
   LOGGER.error(str);&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;The other way I described in my previous post didn't catch any errors. Which is also a bad behaviour.&lt;BR /&gt;If this behaviour is the correct behaviour, than it should be documented.&lt;BR /&gt;&lt;BR /&gt;Like they say: if it is documented is a feature, otherwise it is a bug!&lt;/P&gt;</description>
    <pubDate>Wed, 06 Jun 2018 10:16:10 GMT</pubDate>
    <dc:creator>RikG</dc:creator>
    <dc:date>2018-06-06T10:16:10Z</dc:date>
    <item>
      <title>Kudu Client API upsert not throwing exception with few arguments</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/67901#M79187</link>
      <description>&lt;P&gt;I faced an issue when using the upsert operation to update some columns of a table (I know I should use update instead).&lt;/P&gt;&lt;P&gt;The issue was that when I pass fewer arguments the Kudu API does not throw any exception and it does not insert/update any data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should throw an Exception, right?&lt;BR /&gt;Such behaviour is not documented in the API docs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 13:18:08 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/67901#M79187</guid>
      <dc:creator>RikG</dc:creator>
      <dc:date>2022-09-16T13:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Kudu Client API upsert not throwing exception with few arguments</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/67911#M79188</link>
      <description>&lt;P&gt;Hi RikG, what do you mean by passing fewer arguments to the Kudu API?&amp;nbsp; Note that for row errors you must call KuduSession.getPendingErrors (&lt;A href="https://kudu.apache.org/apidocs/org/apache/kudu/client/KuduSession.html#getPendingErrors--" target="_blank"&gt;https://kudu.apache.org/apidocs/org/apache/kudu/client/KuduSession.html#getPendingErrors--&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 21:03:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/67911#M79188</guid>
      <dc:creator>Dan Burkert</dc:creator>
      <dc:date>2018-06-05T21:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Kudu Client API upsert not throwing exception with few arguments</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/67922#M79189</link>
      <description>&lt;P&gt;No, I mean passing less values for the column than it actually has.&lt;BR /&gt;I tested again and for the arguments (column values) that I don't pass, it ignores them and just updates the existing ones.&lt;BR /&gt;But if the table has columns with NOT NULL restriction, then it does not throw any exception and it should.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My table description:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;CREATE TABLE badjoras (
  house_id STRING,
  tip_id STRING,
  created_ts BIGINT,
  status STRING NOT NULL,
  status_ts BIGINT,
  visible BOOLEAN NOT NULL,
  visible_ts BIGINT,
  PRIMARY KEY (house_id, tip_id)
) PARTITION BY HASH(house_id) PARTITIONS 3 STORED AS KUDU;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I'm doing:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; try {
            if (kc.tableExists(TABLE_BADJORAS)) {
                KuduSession session = kc.newSession();
                KuduTable table = kc.openTable(TABLE_BADJORAS);
                Upsert upst = table.newUpsert();
                PartialRow row = upst.getRow();

                row.addString("house_id", "0123456789");
                row.addString("tip_id", "987654321");


                session.apply(upst);

                System.out.println("overflowed " + session.getPendingErrors().isOverflowed());
               System.out.println("size= " + session.getPendingErrors().getRowErrors().length);
               for (RowError r : session.getPendingErrors().getRowErrors()) {
                   System.out.println("error status " + r.getErrorStatus());
                   System.out.println("error Operation " + r.getOperation().toString());
                   System.out.println("error TsUUID " + r.getTsUUID());
                   System.out.println("error toString " + r.toString());
               }

                LOGGER.info("KUDU BADJORAS" + houseId + "+" + tId + " upserted");

                session.close();
            }
        } catch (KuduException e) {
            e.printStackTrace();
        } finally {
            LOGGER.info("KUDU BADJORAS" + houseId + " run time = " + (System.currentTimeMillis() - start));
        } &lt;/PRE&gt;&lt;P&gt;Using my sample code, when a row is upserted in a table with columns with NOT NULL restrictions it never throws the KuduException, thus it doesn't enter the catch clause.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I've even tried to catch some errors like you recommended, but I got no errors when using such an upsert operation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 09:44:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/67922#M79189</guid>
      <dc:creator>RikG</dc:creator>
      <dc:date>2018-06-06T09:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Kudu Client API upsert not throwing exception with few arguments</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/67923#M79190</link>
      <description>&lt;P&gt;Actually I've found that in order to catch such errors, the correct way is actually to get the RowError object returned by the session.apply() method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;OperationResponse op = session.apply(upst);
if (op.hasRowError()){
    RowError r = op.getRowError();
    String str = "error status " + r.getErrorStatus() +
            "\nerror Operation " + r.getOperation().toString() +
            "\nerror TsUUID " + r.getTsUUID() +
             "\nerror toString " + r.toString();
   LOGGER.error(str);&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;The other way I described in my previous post didn't catch any errors. Which is also a bad behaviour.&lt;BR /&gt;If this behaviour is the correct behaviour, than it should be documented.&lt;BR /&gt;&lt;BR /&gt;Like they say: if it is documented is a feature, otherwise it is a bug!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 10:16:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/67923#M79190</guid>
      <dc:creator>RikG</dc:creator>
      <dc:date>2018-06-06T10:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: Kudu Client API upsert not throwing exception with few arguments</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/68008#M79191</link>
      <description>&lt;P&gt;Hey &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/26395"&gt;@RikG&lt;/a&gt;, you are correct.&amp;nbsp; The way errors are communicated is dependent on the configured FlushMode.&amp;nbsp; In your example the FlushMode is not set, so it's the default of AUTO_FLUSH_SYNC.&amp;nbsp; In AUTO_FLUSH_SYNC mode any per-row errors are immediately returned as part of the OperationResponse, since the write happens synchronously.&amp;nbsp; In AUTO_FLUSH_BACKGROUND mode it's necessary to call getPendingErrors.&amp;nbsp; The docs on AUTO_FLUSH_BACKGROUND cover this to some extent.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jun 2018 20:01:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Kudu-Client-API-upsert-not-throwing-exception-with-few/m-p/68008#M79191</guid>
      <dc:creator>Dan Burkert</dc:creator>
      <dc:date>2018-06-08T20:01:30Z</dc:date>
    </item>
  </channel>
</rss>

