influxdata / influxdata/influxdb-java
does all tags defined in POJO need assign a value?
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 469
- PR merge metrics
- No merged PRs in 30d
Description
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Point.java at escapeKey, concatenatedTags, and lineProtocol, then trace how addFieldsFromPOJO handles the unset tag2 field. Check existing tests around POJO tags and line-protocol generation; done means the expected behavior for an unset tag is defined and covered without the reported NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100