Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster parsing: reduce String usage, list-based input rows. #15681

Merged
merged 8 commits into from
Jan 18, 2024

Conversation

gianm
Copy link
Contributor

@gianm gianm commented Jan 14, 2024

Three changes:

  1. Reworked FastLineIterator to optionally avoid generating Strings
    entirely, and reduce copying somewhat. Benefits the line-oriented
    JSON, CSV, delimited (TSV), and regex formats.

  2. In the delimited (TSV) format, when the delimiter is a single byte,
    split on UTF-8 bytes directly.

  3. In CSV and delimited (TSV) formats, use list-based input rows when
    the column list is provided upfront by the user.

Benchmarks below. Findings:

  • JsonLineReaderBenchmark only benefits from change (1), and got a 15% improvement.
  • DelimitedInputFormatBenchmark with fromHeader: true benefits from (1) and (2), and got a 22% improvement.
  • DelimitedInputFormatBenchmark with fromHeader: false benefits from all three changes, and got a 30% improvement.
Benchmark                               (fromHeader)  Mode  Cnt     Score    Error  Units
DelimitedInputFormatBenchmark.baseline         false  avgt    5  1912.257 ± 39.227  us/op [master]
DelimitedInputFormatBenchmark.baseline          true  avgt    5  1953.915 ± 44.787  us/op [master]
JsonLineReaderBenchmark.baseline                      avgt    5  2055.294 ± 28.688  us/op [master]

DelimitedInputFormatBenchmark.baseline         false  avgt    5  1321.142 ± 10.115  us/op [patch]
DelimitedInputFormatBenchmark.baseline          true  avgt    5  1506.412 ± 15.892  us/op [patch]
JsonLineReaderBenchmark.baseline                      avgt    5  1734.426 ± 38.518  us/op [patch]

Three changes:

1) Reworked FastLineIterator to optionally avoid generating Strings
   entirely, and reduce copying somewhat. Benefits the line-oriented
   JSON, CSV, delimited (TSV), and regex formats.

2) In the delimited (TSV) format, when the delimiter is a single byte,
   split on UTF-8 bytes directly.

3) In CSV and delimited (TSV) formats, use list-based input rows when
   the column list is provided upfront by the user.
@github-actions github-actions bot added Area - Batch Ingestion Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 labels Jan 14, 2024
* given a particular {@link InputRowSchema}. Note that {@link RowAdapters#standardRow()} always works, but the
* one returned by this method may be more performant.
*/
default RowAdapter<InputRow> createRowAdapter(InputRowSchema inputRowSchema)

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'inputRowSchema' is never used.
@gianm
Copy link
Contributor Author

gianm commented Jan 16, 2024

The only failure is IncrementalIndexIngestionTest.testMultithreadAddFactsUsingExpressionAndJavaScript, which is flaky now, and fixed by #15697. (By removing the test, as it's testing something we don't need.)

Copy link
Member

@clintropolis clintropolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@asdf2014 asdf2014 merged commit d3d0c1c into apache:master Jan 18, 2024
83 checks passed
@adarshsanjeev adarshsanjeev added this to the 30.0.0 milestone May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants