Skip to content

does all tags defined in POJO need assign a value? #596

Open
@rtecarden

Description

@rtecarden

I created a POJO to insert into influxdb:

@measurement(name = "mymeasurement")
public class Pojo {

@Column(name = "tag1", tag =true)
private string tag1;

@Column(name = "tag2", tag = true)
private String tag2;

@Column(name = "value")
private Double value;

public String getTag1() {
  return tag1;
}

public void setTag1(String tag) {
  this.tag1 = tag;
}

public String getTag2() {
  return tag2;
}

public void setTag2(String tag) {
  this.tag2 = tag;
}

public Double getValue() {
  return value;
}

public void setDoubleObject(Double v) {
  this.value = v;
}

}

when i create a object with out set all tags, it failed with null exception:

Pojo pojo = new Pojo();
pojo.SetTag1("tag1value");
pojo.setValue(1);

Long t = Instant.now().toEpochMilli();
Point point = Point.measurementByPOJO(pojo.getClass()).addFieldsFromPOJO(pojo).time(t,TimeUnit.MILLISECONDS).build();

influxDb.write(getDBName(), getRPName(), point);

java.lang.NullPointerException

     at org.influxdb.dto.Point.escapeKey(Point.java:471)

     at org.influxdb.dto.Point.concatenatedTags(Point.java:432)

     at org.influxdb.dto.Point.lineProtocol(Point.java:420)

my question is does all tag need to be assign a value?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions