iotdb icon indicating copy to clipboard operation
iotdb copied to clipboard

[Bug] 使用insertTablets插入,当MeasurementSchema 的TSDataType 是TSDataType.TEXT 时,不支持空值插入,指定了bitmap也不行

Open yangjiexuhuan opened this issue 2 years ago • 3 comments

Search before asking

  • [ ] I searched in the issues and found nothing similar.

Version

1.1.0

Describe the bug and provide the minimal reproduce step

1、构建Table schemas ,指定TSDataType 类型是TSDataType.TEXT 2、构造模拟数据插入空值

       if (containNull && i % 9 == 0) {
              tablet.bitMaps[i].mark((int) row);
            }else{
              tablet.addValue(schemaList.get(i).getMeasurementId(),row,random.nextDouble()*1000+"");
            }

3、插入 sessionPool.insertTablets(tabletMap, false); 报错 Exception in thread "main" java.lang.NullPointerException at org.apache.iotdb.tsfile.write.record.Tablet.calOccupationOfOneColumn(Tablet.java:341)

What did you expect to see?

希望正常入库

What did you see instead?

Exception in thread "main" java.lang.NullPointerException at org.apache.iotdb.tsfile.write.record.Tablet.calOccupationOfOneColumn(Tablet.java:341) source code: Tablet l ine:252 for(int rowIndex = 0; rowIndex < this.rowSize; ++rowIndex) { valueOccupation += ### binaries[rowIndex].getLength(); }

Anything else?

No response

Are you willing to submit a PR?

  • [ ] I'm willing to submit a PR!

yangjiexuhuan avatar Apr 26 '23 15:04 yangjiexuhuan

Hi, this is your first issue in IoTDB project. Thanks for your report. Welcome to join the community!

github-actions[bot] avatar Apr 26 '23 15:04 github-actions[bot]

目前的版本如果需要插入TEXT类型空值需要用这样的写法

if (containNull && i % 9 == 0) {
  tablet.bitMaps[i].mark((int) row);
  tablet.addValue(schemaList.get(i).getMeasurementId(), row, "");
} else {
  tablet.addValue(schemaList.get(i).getMeasurementId(), row, random.nextDouble()*1000 + "");
}

之后我们可以考虑把你的用法做成语法糖。

HTHou avatar May 09 '23 02:05 HTHou

请问下, 这个问题在哪个版本会修复?

jamestao83 avatar Mar 08 '24 07:03 jamestao83