You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kudu.apache.org by "Grant Henke (Jira)" <ji...@apache.org> on 2020/06/03 14:39:00 UTC

[jira] [Updated] (KUDU-2731) Getting column schema information from KuduSchema requires copying a KuduColumnSchema object

     [ https://issues.apache.org/jira/browse/KUDU-2731?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Grant Henke updated KUDU-2731:
------------------------------
    Component/s: perf

> Getting column schema information from KuduSchema requires copying a KuduColumnSchema object
> --------------------------------------------------------------------------------------------
>
>                 Key: KUDU-2731
>                 URL: https://issues.apache.org/jira/browse/KUDU-2731
>             Project: Kudu
>          Issue Type: Improvement
>          Components: perf
>    Affects Versions: 1.9.0
>            Reporter: William Berkeley
>            Priority: Major
>
> I'm looking at a CPU profile of Impala inserting into Kudu. {{KuduTableSink::Send}} has code that schematically does the following:
> {noformat}
> for each row in the batch
>   for each column
>     if (schema.Column(col_idx).isNullable()) {
>       write->mutable_row()->SetNull(col);
>     }
>   }
> }
> {noformat}
> See [kudu-table-sink.cc|https://github.com/apache/impala/blob/branch-3.1.0/be/src/exec/kudu-table-sink.cc#L236]. However, {{KuduSchema::Column}} copies the column schema and returns it by value, so the if statement constructs and destroys a column schema object just to check if the column is nullable.
> This is by far the biggest user of CPU in the Impala process (35% or so). The workload might be I/O bound writing to Kudu anyway, though. Nevertheless, we should provide a way to avoid this copying in the API, either by adding a method like
> {noformat}
> class KuduSchema {
>   const KuduColumnSchema& get_column(int idx);
> }
> {noformat}
> or a method like
> {noformat}
> class KuduSchema {
>   bool is_column_nullable(int idx);
> }
> {noformat}
> The former is the most flexible while the latter frees the client from worrying about holding the ref longer than the KuduColumnSchema object lives. We might need to add a number of methods similar to the latter method to cover other potentially useful things like checking encoding, type, etc.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)