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

Infinate loop in Result iterator for DML commands #25

Open
DALDEI opened this issue Jan 2, 2021 · 2 comments
Open

Infinate loop in Result iterator for DML commands #25

DALDEI opened this issue Jan 2, 2021 · 2 comments

Comments

@DALDEI
Copy link

DALDEI commented Jan 2, 2021

Some SQL commands can produce an infinite loop iterating the result set.
Ive tracked this down to them producing either unsupported protobuf types (eg. type 1)
or 0 columns (may be related).
The 0 column problem results in the iterator code to not advance the CSV pointer -- e.g the conditions never call the appropreate methods to read more from the CSV file if there are ' 0 columns' (triggered likely by the former issue) .

Examples to try

SHOW TABLES
MSCK REPAIR TABLE tablename

@DALDEI
Copy link
Author

DALDEI commented Jan 2, 2021

src/main/java/io/burt/athena/result/csv/VeryBasicCsvParser.java
If columnCount ends up 0 then next() never advances.

@iconara
Copy link
Collaborator

iconara commented Jan 3, 2021

Thank you, good catch. Would you like to take a stab at fixing it? You've already identified the source of the CSV parsing issue. I think you can duplicate this test

@Nested
class WhenTheInputIsEmpty {
@BeforeEach
void setUp() {
parser = new VeryBasicCsvParser(createInput(new String[0][0]), 3);
}
@Test
void returnsNull() {
assertNull(parser.next());
}
}
and change the 3 (the number of columns) to a 0 to trigger the bug (also duplicate the corresponding test for hasNext).

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

No branches or pull requests

2 participants