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

DRILL-8495: Tried to remove unmanaged buffer #2913

Merged
merged 3 commits into from
May 17, 2024
Merged

Conversation

rymarm
Copy link
Member

@rymarm rymarm commented May 15, 2024

DRILL-8495: Tried to remove unmanaged buffer

The root cause of the issue is that multiple HiveWriters use the same DrillBuf and during execution they may reallocate the buffer if size of the buffer is not enough for a value (256 bytes+). Since drillBuf.reallocIfNeeded(int size) returns a new instance of DrillBuf, all other writers still have a reference for the old one buffer, which after drillBuf.reallocIfNeeded(int size) execution is unmanaged now.

Description

HiveValueWriterFactory now creates a unique DrillBif for each writer.

HiveWriters are actually used one-by-one and we could utilize a single buffer for all the writers. To do this, I could create a class holder for DrillBuf, so each writer has a reference for the same holder, where will be stored a new buffer from every drillBuf.reallocIfNeeded(int size) call. But I thought that such logic looked slightly confusing and I decided just to let each HiveWriter use its own buffer.

Documentation

-

Testing

Add a new unit test to query a Hive table with variable-length values of Binary, VarChar, Char and String types.

@rymarm rymarm requested review from cgivre and jnturton May 15, 2024 11:45
Copy link
Contributor

@jnturton jnturton left a comment

Choose a reason for hiding this comment

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

Thank you Maksym!

@jnturton
Copy link
Contributor

P.S. I see that checkstyle is still upset.

@rymarm
Copy link
Member Author

rymarm commented May 17, 2024

@jnturton I addressed checkstyle issues and failed java tests. Should be fine now)

@jnturton jnturton merged commit a9e84a1 into apache:master May 17, 2024
8 checks passed
@jnturton jnturton added bug backport-to-stable This bug fix is applicable to the latest stable release and should be considered for inclusion there labels May 17, 2024
jnturton pushed a commit to jnturton/drill that referenced this pull request May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-stable This bug fix is applicable to the latest stable release and should be considered for inclusion there bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants