Skip to content

ORC-577 row-level filtering - #475

Merged
jcamachor merged 4 commits into
apache:masterfrom
pgaref:apache-577
May 26, 2020
Merged

jcamachor merged 4 commits into
apache:masterfrom
pgaref:apache-577

Conversation

@pgaref

@pgaref pgaref commented Jan 30, 2020 •

Copy link
Copy Markdown
Contributor

To support row-level filtering functionality as part of the ORC Reader this PR adds an new Reader.option as:

Options setFilter(String columnName, Consumer<VectorizedRowBatch> filter)

The idea is to use a generic Consumer callback that can implement any kind of filtering logic that is completely independent of the rest of the row reading logic in ORC. As a result the we cut down on the total code dependency between ORC and the consumer frameworks.

 

The filter callback with have to set the selected and selectedSize values (that already exist) in the VectorizedRowBatch class. For instance the filter-example below will filter-out all the rows except the first one:

public static void intFirstRowFilter(VectorizedRowBatch batch) { LongColumnVector col1 = (LongColumnVector) batch.cols[0]; int newSize = 0; for (int row = 0; row <1024; ++row) { // Pass ony Valid key if (col1.vector[row] == 0) batch.selected[newSize++] = row; batch.selectedInUse = true; } batch.size = newSize;

The logic of the row-level filter is as follows TreeReader Logic: 

  1. First, read the give columnName(s)
  2. Evaluate the filter callback – filling the selected array and setting the selectedSize value as part of the VectorBatch
  3. For the remaining columns of the VectorBach read only the selected rows to reduce the number or read/decoded rows thus saving CPU cycles

Comment thread java/bench/core/pom.xml Resolved
@omalley

omalley commented Apr 17, 2020

Copy link
Copy Markdown
Contributor

Ok, I've updated this patch to go with my proposed changes with HIVE-23215 and pushed it to https://github.com/omalley/orc/tree/orc-577-v2 .

@pgaref

pgaref commented Apr 17, 2020 •

Copy link
Copy Markdown
Contributor Author

Ok, I've updated this patch to go with my proposed changes with HIVE-23215 and pushed it to https://github.com/omalley/orc/tree/orc-577-v2 .

Awesome, thanks @omalley ! Patch look good -- only comment is that I used a single instance of IOUtils per Reader on purpose to avoid false-sharing, for example when having multiple readers on the same machine-- so I think it makes sense to keep it

Other than that, does it make sense to create an ORC branch for the effort? or just port the changes here? I am pretty sure we will have to make more changes before merging

@omalley

omalley commented Apr 17, 2020

Copy link
Copy Markdown
Contributor

All of the calls were static methods on IOUtils, so it seemed better to remove them unless there is a huge performance impact.

@pgaref

pgaref commented Apr 20, 2020

Copy link
Copy Markdown
Contributor Author

All of the calls were static methods on IOUtils, so it seemed better to remove them unless there is a huge performance impact.

Let me dig deeper on this and I will create a follow-up depending on the findings.
Just updated the PR addressing the comments including the proposed changes plus some cleaning -- please let me know what you think.

Cheers

Panos Garefalakis added 2 commits May 17, 2020 18:26
Using recently released storage-api 2.7.2

Change-Id: I2de933944dbdf92c4a98ae4528fa2a1d22342071
Change-Id: I1a070d3284d29faf440c43dc56f46b0efddd5fe2
@pgaref

pgaref commented May 17, 2020 •

Copy link
Copy Markdown
Contributor Author

Consolidating ORC-577 work and using recently released storage-api 2.7.2 that introduced FilterContext as part of VRB

Change-Id: I039e0a87f981b3ceb690ed50f1bca0653d9e7f28
Change-Id: Ia5cbabdfd4acd0eff03955d564340346e077d561
@jcamachor
jcamachor merged commit 6fac967 into apache:master May 26, 2020
jcamachor pushed a commit that referenced this pull request May 26, 2020
dongjoon-hyun pushed a commit that referenced this pull request Sep 30, 2024
Bumps [org.apache.commons:commons-csv](https://github.com/apache/commons-csv) from 1.11.0 to 1.12.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/apache/commons-csv/blob/master/RELEASE-NOTES.txt">org.apache.commons:commons-csv's changelog</a>.</em></p>
<blockquote>
<p>Apache Commons CSV Version 1.12.0 Release Notes</p>
<p>This document contains the release notes for the 1.12.0 version of Apache Commons CSV.
Commons CSV reads and writes files in variations of the Comma Separated Value (CSV) format.</p>
<p>Commons CSV requires at least Java 8.</p>
<p>The Apache Commons CSV library provides a simple interface for reading and writing CSV files of various types.</p>
<p>Feature and bug fix release (Java 8 or above)</p>
<p>Changes in this version include:</p>
<h2>New Features</h2>
<ul>
<li>CSV-270:  Add CSVException that extends IOException thrown on invalid input instead of IOException. Thanks to Thomas Kamps, Gary Gregory.</li>
</ul>
<h2>Fixed Bugs</h2>
<ul>
<li>
<pre><code>      Fix PMD issues for port to PMD 7.1.0. Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Fix some Javadoc links [#442](apache/commons-csv#442). Thanks to Dávid Szigecsán, Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Extract duplicated code into a method [#444](apache/commons-csv#444). Thanks to Dávid Szigecsán.
</code></pre>
</li>
<li>
<pre><code>      Migrate CSVFormat#print(File, Charset) to NIO [#445](apache/commons-csv#445). Thanks to Dávid Szigecsán.
</code></pre>
</li>
<li>
<pre><code>      Fix documentation for CSVFormat private constructor [#466](apache/commons-csv#466). Thanks to Dávid Szigecsán.
</code></pre>
</li>
<li>CSV-294:  CSVFormat does not support explicit &quot; as escape char. Thanks to Joern Huxhorn, Gary Gregory.</li>
<li>CSV-150:  Escaping is not disableable. Thanks to dota17, Gary Gregory, Jörn Huxhorn.</li>
<li>
<pre><code>      Fix Javadoc warnings on Java 23. Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Improve parser performance by up to 20%, YMMV. Thanks to Gary Gregory.
</code></pre>
</li>
</ul>
<h2>Changes</h2>
<ul>
<li>
<pre><code>      Bump commons-codec:commons-codec from 1.16.1 to 1.17.1 [#422](apache/commons-csv#422), [#449](apache/commons-csv#449). Thanks to Dependabot.
</code></pre>
</li>
<li>
<pre><code>      Bump org.apache.commons:commons-parent from 69 to 75 [#435](apache/commons-csv#435), [#452](apache/commons-csv#452), [#465](apache/commons-csv#465), [#468](apache/commons-csv#468), [#475](apache/commons-csv#475). Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Bump org.codehaus.mojo:taglist-maven-plugin from 3.0.0 to 3.1.0 [#441](apache/commons-csv#441). Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 [#450](apache/commons-csv#450), [#459](apache/commons-csv#459), [#470](apache/commons-csv#470). Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Bump org.hamcrest:hamcrest from 2.2 to 3.0 [#455](apache/commons-csv#455). Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Bump commons-io:commons-io from 2.16.1 to 2.17.0 [#476](apache/commons-csv#476). Thanks to Gary Gregory, Dependabot.
</code></pre>
</li>
</ul>
<p>Historical list of changes: <a href="https://commons.apache.org/proper/commons-csv/changes-report.html">https://commons.apache.org/proper/commons-csv/changes-report.html</a></p>
<p>For complete information on Apache Commons CSV, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Commons CSV website:</p>
<p><a href="https://commons.apache.org/proper/commons-csv/">https://commons.apache.org/proper/commons-csv/</a></p>
<p>Download page: <a href="https://commons.apache.org/proper/commons-csv/download_csv.cgi">https://commons.apache.org/proper/commons-csv/download_csv.cgi</a></p>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/apache/commons-csv/commit/67f0d6b30465d817a341b2e9cd31660a646e980c"><code>67f0d6b</code></a> Prepare for the next release candidate</li>
<li><a href="https://github.com/apache/commons-csv/commit/89eacd90ef235444a79d16d695fec3ff9eb008d4"><code>89eacd9</code></a> Prepare for the next release candidate</li>
<li><a href="https://github.com/apache/commons-csv/commit/f4e3269626140684b58901db9b9cd233ac960c9f"><code>f4e3269</code></a> Merge branch 'master' of <a href="https://gitbox.apache.org/repos/asf/commons-csv">https://gitbox.apache.org/repos/asf/commons-csv</a></li>
<li><a href="https://github.com/apache/commons-csv/commit/342547b911dfe919787d9f53fb330f7d926ec6c3"><code>342547b</code></a> Prepare for the next release candidate</li>
<li><a href="https://github.com/apache/commons-csv/commit/113147f1e7fbd84fe3948c52fda0ee2f6c6a8ea2"><code>113147f</code></a> Add dependency-review.yml to GitHub CI</li>
<li><a href="https://github.com/apache/commons-csv/commit/86ce50b8078761e22cd947be247d5b66dda0d6b9"><code>86ce50b</code></a> Merge pull request <a href="https://redirect.github.com/apache/commons-csv/issues/478">#478</a> from apache/dependabot/github_actions/github/codeql-a...</li>
<li><a href="https://github.com/apache/commons-csv/commit/5b2c26eedf942fc70080010af375b35ff3ddbbde"><code>5b2c26e</code></a> Bump github/codeql-action from 3.26.6 to 3.26.8</li>
<li><a href="https://github.com/apache/commons-csv/commit/4f4b9cf2516762cd766368759c2c122f19f0caa5"><code>4f4b9cf</code></a> Sort members</li>
<li><a href="https://github.com/apache/commons-csv/commit/6a11b896aa8601deceb119c3ee1fd32e2efe276c"><code>6a11b89</code></a> Enable Checkstyle for test sources and fix issues</li>
<li><a href="https://github.com/apache/commons-csv/commit/fce94ea666f09f4c162cd1b67b86bd6e271a9558"><code>fce94ea</code></a> Fix header for Checkstyle</li>
<li>Additional commits viewable in <a href="https://github.com/apache/commons-csv/compare/rel/commons-csv-1.11.0...rel/commons-csv-1.12.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.commons:commons-csv&package-manager=maven&previous-version=1.11.0&new-version=1.12.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Closes #2043 from dependabot[bot]/dependabot/maven/java/org.apache.commons-commons-csv-1.12.0.

Authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
dongjoon-hyun pushed a commit that referenced this pull request Sep 30, 2024
Bumps [org.apache.commons:commons-csv](https://github.com/apache/commons-csv) from 1.11.0 to 1.12.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/apache/commons-csv/blob/master/RELEASE-NOTES.txt">org.apache.commons:commons-csv's changelog</a>.</em></p>
<blockquote>
<p>Apache Commons CSV Version 1.12.0 Release Notes</p>
<p>This document contains the release notes for the 1.12.0 version of Apache Commons CSV.
Commons CSV reads and writes files in variations of the Comma Separated Value (CSV) format.</p>
<p>Commons CSV requires at least Java 8.</p>
<p>The Apache Commons CSV library provides a simple interface for reading and writing CSV files of various types.</p>
<p>Feature and bug fix release (Java 8 or above)</p>
<p>Changes in this version include:</p>
<h2>New Features</h2>
<ul>
<li>CSV-270:  Add CSVException that extends IOException thrown on invalid input instead of IOException. Thanks to Thomas Kamps, Gary Gregory.</li>
</ul>
<h2>Fixed Bugs</h2>
<ul>
<li>
<pre><code>      Fix PMD issues for port to PMD 7.1.0. Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Fix some Javadoc links [#442](apache/commons-csv#442). Thanks to Dávid Szigecsán, Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Extract duplicated code into a method [#444](apache/commons-csv#444). Thanks to Dávid Szigecsán.
</code></pre>
</li>
<li>
<pre><code>      Migrate CSVFormat#print(File, Charset) to NIO [#445](apache/commons-csv#445). Thanks to Dávid Szigecsán.
</code></pre>
</li>
<li>
<pre><code>      Fix documentation for CSVFormat private constructor [#466](apache/commons-csv#466). Thanks to Dávid Szigecsán.
</code></pre>
</li>
<li>CSV-294:  CSVFormat does not support explicit &quot; as escape char. Thanks to Joern Huxhorn, Gary Gregory.</li>
<li>CSV-150:  Escaping is not disableable. Thanks to dota17, Gary Gregory, Jörn Huxhorn.</li>
<li>
<pre><code>      Fix Javadoc warnings on Java 23. Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Improve parser performance by up to 20%, YMMV. Thanks to Gary Gregory.
</code></pre>
</li>
</ul>
<h2>Changes</h2>
<ul>
<li>
<pre><code>      Bump commons-codec:commons-codec from 1.16.1 to 1.17.1 [#422](apache/commons-csv#422), [#449](apache/commons-csv#449). Thanks to Dependabot.
</code></pre>
</li>
<li>
<pre><code>      Bump org.apache.commons:commons-parent from 69 to 75 [#435](apache/commons-csv#435), [#452](apache/commons-csv#452), [#465](apache/commons-csv#465), [#468](apache/commons-csv#468), [#475](apache/commons-csv#475). Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Bump org.codehaus.mojo:taglist-maven-plugin from 3.0.0 to 3.1.0 [#441](apache/commons-csv#441). Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 [#450](apache/commons-csv#450), [#459](apache/commons-csv#459), [#470](apache/commons-csv#470). Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Bump org.hamcrest:hamcrest from 2.2 to 3.0 [#455](apache/commons-csv#455). Thanks to Gary Gregory.
</code></pre>
</li>
<li>
<pre><code>      Bump commons-io:commons-io from 2.16.1 to 2.17.0 [#476](apache/commons-csv#476). Thanks to Gary Gregory, Dependabot.
</code></pre>
</li>
</ul>
<p>Historical list of changes: <a href="https://commons.apache.org/proper/commons-csv/changes-report.html">https://commons.apache.org/proper/commons-csv/changes-report.html</a></p>
<p>For complete information on Apache Commons CSV, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Commons CSV website:</p>
<p><a href="https://commons.apache.org/proper/commons-csv/">https://commons.apache.org/proper/commons-csv/</a></p>
<p>Download page: <a href="https://commons.apache.org/proper/commons-csv/download_csv.cgi">https://commons.apache.org/proper/commons-csv/download_csv.cgi</a></p>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/apache/commons-csv/commit/67f0d6b30465d817a341b2e9cd31660a646e980c"><code>67f0d6b</code></a> Prepare for the next release candidate</li>
<li><a href="https://github.com/apache/commons-csv/commit/89eacd90ef235444a79d16d695fec3ff9eb008d4"><code>89eacd9</code></a> Prepare for the next release candidate</li>
<li><a href="https://github.com/apache/commons-csv/commit/f4e3269626140684b58901db9b9cd233ac960c9f"><code>f4e3269</code></a> Merge branch 'master' of <a href="https://gitbox.apache.org/repos/asf/commons-csv">https://gitbox.apache.org/repos/asf/commons-csv</a></li>
<li><a href="https://github.com/apache/commons-csv/commit/342547b911dfe919787d9f53fb330f7d926ec6c3"><code>342547b</code></a> Prepare for the next release candidate</li>
<li><a href="https://github.com/apache/commons-csv/commit/113147f1e7fbd84fe3948c52fda0ee2f6c6a8ea2"><code>113147f</code></a> Add dependency-review.yml to GitHub CI</li>
<li><a href="https://github.com/apache/commons-csv/commit/86ce50b8078761e22cd947be247d5b66dda0d6b9"><code>86ce50b</code></a> Merge pull request <a href="https://redirect.github.com/apache/commons-csv/issues/478">#478</a> from apache/dependabot/github_actions/github/codeql-a...</li>
<li><a href="https://github.com/apache/commons-csv/commit/5b2c26eedf942fc70080010af375b35ff3ddbbde"><code>5b2c26e</code></a> Bump github/codeql-action from 3.26.6 to 3.26.8</li>
<li><a href="https://github.com/apache/commons-csv/commit/4f4b9cf2516762cd766368759c2c122f19f0caa5"><code>4f4b9cf</code></a> Sort members</li>
<li><a href="https://github.com/apache/commons-csv/commit/6a11b896aa8601deceb119c3ee1fd32e2efe276c"><code>6a11b89</code></a> Enable Checkstyle for test sources and fix issues</li>
<li><a href="https://github.com/apache/commons-csv/commit/fce94ea666f09f4c162cd1b67b86bd6e271a9558"><code>fce94ea</code></a> Fix header for Checkstyle</li>
<li>Additional commits viewable in <a href="https://github.com/apache/commons-csv/compare/rel/commons-csv-1.11.0...rel/commons-csv-1.12.0">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.apache.commons:commons-csv&package-manager=maven&previous-version=1.11.0&new-version=1.12.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

Closes #2043 from dependabot[bot]/dependabot/maven/java/org.apache.commons-commons-csv-1.12.0.

Authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
(cherry picked from commit 0cf506b)
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants