raminqaf opened a new issue #10993:
URL: https://github.com/apache/druid/issues/10993


   ### Affected Version
   0.13.0-incubating
   
   ### Description
   My team and I are currently working on a project, and we used the 
[InfluxParser](https://github.com/apache/druid/blob/master/extensions-contrib/influx-extensions/src/main/java/org/apache/druid/data/input/influx/InfluxParser.java)
 in our project to parse string line protocols to [data point 
objects](https://github.com/influxdata/influxdb-client-java/blob/master/client/src/main/java/com/influxdb/client/write/Point.java).
 After testing it with different [field value 
types](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/#data-types-and-format)
 we noticed that some of the field values are not supported. As for an example, 
consider the following test:
   
   ```java
       @Test
       void shouldNotParseLineWithFieldValueAsUnsignedIntegerToDataPoint() {
           final String lineProtocol = "myMeasurement fieldKey=12485903u";
   
           final Point actualDataPoint = 
InfluxParser.parseToDataPoint(lineProtocol);
   
           assert actualDataPoint != null;
           final Long expectedFieldValue = 12485903L;
           assertEquals(expectedFieldValue, 
actualDataPoint.getField("fieldKey"));
       }
   ```
   
   Currently, this test throws a `ParseException` and fails. The reason behind 
it is that in the  
[InfluxLineProtogol.g4](https://github.com/apache/druid/blob/master/extensions-contrib/influx-extensions/src/main/antlr4/org/apache/druid/data/input/influx/InfluxLineProtocol.g4#L70)
 the value context NUMBER doesn't support `u` yet.
   
   This issue also arises whenever we tested IEEE-754 64-bit floating-point 
numbers, which is [supported by 
InfluxDB](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protocol/#float).
 Consider the following test case:
   
   ```java
       @Test
       void shouldParseLineWithFieldValueAsFloatToDataPoint() throws 
ParseException {
           final String lineProtocol = "myMeasurement fieldKey=-1.234456e+78";
           final Point actualDataPoint = 
InfluxParser.parseToDataPoint(lineProtocol);
   
           assert actualDataPoint != null;
           final double expectedFieldValue =-1.234456e+78;
           assertEquals(expectedFieldValue, 
actualDataPoint.getField("fieldKey"));
       }
   ```
   Unfortunately, this test will fail since the parser is not caple of parsing 
the float filed value. The parser should parse these lines since they are all 
examples provided by InfluxDB 
[documentation](https://docs.influxdata.com/influxdb/cloud/reference/syntax/line-protoco).
 


----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to