You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/03/14 19:02:21 UTC

[GitHub] [druid] raminqaf opened a new issue #10993: ParseException while parsing uintiger and IEEE-754 64-bit floating-point number using the InfluxParser

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org