[Update ] How can i make InfluxDB recognize my input as an int or uint when writing points?

[Update] - When querying for the data as a group i select the closetime and convert it to UINT, now i can atleast query succesfully. But the problem for me remeans i cant seem to write a value (point) as in UINT data type, it wil automatically set the datatype in influxDB to double.

How can i make InfluxDB recognize my input as an int or uint when writing points?

Hello,

i have some trouble retreiving a specific datatype from my db an i cant figure out why this is, this has been an issue for over a week for me. I create the following point, and write it to the db:

public static Point createPoint(Candlestick c, String Ticker, String interval) {
    return Point.measurement(Ticker)
            .addTag(DB_Config.TAG_TIMEFRAME, interval)
            .time(c.getOpenTime(), WritePrecision.MS)
            .addField(DB_Config.OPEN, c.getOpen())      //double
            .addField(DB_Config.HIGH, c.getHigh())          //double
            .addField(DB_Config.LOW, c.getLow())             //double
            .addField(DB_Config.CLOSE, c.getClose())      //double
            .addField(DB_Config.VOLUME, c.getVolume())   //double
            .addField(DB_Config.CLOSE_TIME, c.getCloseTime());     //Long
}

No problems there, but when i want to retreive the same fields with the following query:

    Flux flux = Flux.from(DB_Config.BUCKET)
            .range(startRange, endOfRange)
            .filter(getCandleRestrictions(ticker, interval))
            .groupBy(DB_Config.OPEN_TIME);

including the Restrictions →

public static Restrictions getCandleRestrictions(String ticker, String timeframe) {
    return Restrictions.and(
            Restrictions.measurement().equal(ticker),
            Restrictions.tag(DB_Config.TAG_TIMEFRAME).equal(timeframe),

            Restrictions.or(
                    Restrictions.field().equal(DB_Config.OPEN),
                    Restrictions.field().equal(DB_Config.HIGH),
                    Restrictions.field().equal(DB_Config.LOW),
                    Restrictions.field().equal(DB_Config.CLOSE),
                    Restrictions.field().equal(DB_Config.VOLUME),
                    Restrictions.field().equal(DB_Config.CLOSE_TIME) // CANT QUERRY WHEN C`Preformatted text`LOSE TIME IS HERE
            ));
}

When running the query above i always get the following exception:

“Exception in thread “main” com.influxdb.exceptions.BadRequestException: runtime error @4:5-4:29: group: schema collision detected: column “_value” is both of type int and float”

I cleared the db multiple times, tried to cast the close_time value to other datatypes / string / int / double but ik keep getting this error.

When i remove this line : "Restrictions.field().equal(DB_Config.CLOSE_TIME) " from the restrictions i can query succesfully right away.

Any help would be really appreciated !

thank youu in advance.

Using:
InfluxDB 2.11
InfluxDB java-client
Flux-dsl - latest verrsion

In java we have NumberUtils.isCreatable() method which takes string value as input and determines whether this is a numeric(includes int, double,float), if the numberUtils.isCreateable is true, then insert using addField (String fieldName, number Value)
Example Snippet:
if(NumberUtils.isCreatable(String.valueOf(c.getHigh())) {
.addField(DB_Config.LOW, c.getLow())
}
@Nonnull
public Point addField(@Nonnull final String field, @Nullable final Number value) {
return putField(field, value);

This is the way that I found for different data types