linxt20 opened a new pull request, #11742:
URL: https://github.com/apache/iotdb/pull/11742

   This modification is based on the bug identified in timechoDB - TIMECHO-483.
   
   **Problem Description:**
   
   The IoTDB's cli session is capable of functioning properly when receiving 
'null' as a measurement name. An SQL test example is as follows: `create schema 
template nullt aligned (null TEXT, s_status BOOLEAN);`
   
   However, users have noticed that within the IoTDB's Java native interface, 
when a measurement node containing 'null' as a measurement name is added to an 
existing template 'null_t' and then `createSchemaTemplate` is performed via the 
session, a NullPointerException (NPE) occurs.
   
   **Cause Description:**
   
   This issue arises because the IoTDB's cli session, within the ASTVisitor, 
processes the measurement name part as a String using 
`parseNodeNameWithoutWildCard` for the input SQL. Conversely, the Java native 
interface creates a measurementNode with 'null' as the name, thus assigning the 
name as null in the form of a String. Consequently, this null value is 
consistently transmitted to the server. However, a measurement name cannot be 
null, leading to this error.
   
   **Problem Resolution:**
   
   The fix for this issue is based on the principle that a measurement cannot 
support null. Both cases of 'null' and null will now result in an error.
   
   Within the cli session, the visitCreateSchemaTemplate in ASTVisitor has been 
modified to pre-fetch the measurement name and perform a case-insensitive 
comparison with "null". If they match, an error will be thrown.
   
   Regarding the issue observed in the Java native interface, considering 
similar potential issues in other language interfaces, modifications have been 
made to the server's code. The CreateSchemaTemplateStatement in 
StatamenetGenerator within the server's code has been adjusted. If the read 
measurement name is null, empty, or "null", an error will be thrown.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to