Skip to content

Fix bug using null as measurement name#11742

Merged
MarcosZyk merged 17 commits intoapache:masterfrom
linxt20:fix_bug_usingNullAsMeasurementName
Dec 24, 2023
Merged

Fix bug using null as measurement name#11742
MarcosZyk merged 17 commits intoapache:masterfrom
linxt20:fix_bug_usingNullAsMeasurementName

Conversation

@linxt20
Copy link
Copy Markdown
Contributor

@linxt20 linxt20 commented Dec 18, 2023

This modification is based on the bug identified in timechoDB—TIMECHO-483

Issue Description

The IoTDB's cli session can run normally when receiving null as a template sequence name. The SQL test is as follows: create schema template nullt aligned (null TEXT, s_status BOOLEAN);

However, users found that when adding a measurement node with null as the measurement name to an existing template null_t using IoTDB's Java native interface, an NPE occurred during createSchemaTemplate by the session.

Cause Description:

This is because the cli session of IoTDB processes the input SQL in the ASTVisitor by using parseNodeNameWithoutWildCard to handle the measurement name part as a String. Correspondingly, the Java native interface creates a measurementNode with null as the name, and at this point, the name as a String is assigned as null. Subsequently, the null value will be continuously passed to the server, but the measurement name cannot be null, resulting in this error.

Issue Fix:

This problem fix is based on the principle that the measurement name cannot be null, and an error will be given for any occurrence of null received by the API.

Regarding the problem encountered in the Java native interface, considering that similar issues might exist in other language native interfaces, modifications were made to the server's code. In the StatementGenerator within CreateSchemaTemplateStatement, if the measurement name read is null, an error will be thrown.

@MarcosZyk
Copy link
Copy Markdown
Contributor

Please add some IT to validate this modification.

@MarcosZyk MarcosZyk merged commit 6954461 into apache:master Dec 24, 2023
SzyWilliam pushed a commit to SzyWilliam/iotdb that referenced this pull request Nov 26, 2024
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.

2 participants