tsfile icon indicating copy to clipboard operation
tsfile copied to clipboard

[Java] org.apache.tsfile.read.expression.impl is a private package

Open Inky19 opened this issue 6 months ago • 4 comments

I'm trying to create a value filter to query data in a ts file. From all the examples I could find and a search in the source code, the only way to do this is to use something like in this example:

// value filter : device_1.sensor_2 <= 20, should select 1 2 4 6 7
 IExpression valueFilter =
 new SingleSeriesExpression(
 new Path(DEVICE_1, SENSOR_2, true), ValueFilterApi.ltEq(1, 20L, TSDataType.INT64));
 queryAndPrint(paths, readTsFile, valueFilter);

This requires importing SingleSeriesExpression from org.apache.tsfile.read.expression.impl. However, this package is not exported and is even defined as a Private-Package in the MANIFEST generated at the end of the file (at least for the tsfile.jar in the maven repo): Private-Package: org.apache.tsfile.read.expression.impl This seems to be the expected default behavior of the maven-bundle-plugin since it doesn't export any package with impl in the name (see here in the <Export-Package> point). However, this means that OSGI will not allow me to import this package for my application.

Is this normal? And if so, how can I create a value filter without importing this package?

Inky19 avatar Jul 21 '25 10:07 Inky19

It is not expected. For now, we should modify the pom to allow exporting org.apache.tsfile.read.expression.impl. And in the future, we may provide a factory class for this.

Are you interested in creating a pull request to help us with this?

jt2594838 avatar Jul 22 '25 01:07 jt2594838

Thank you for your reply.
That makes sense. I'll look into it to export this package properly for the moment and then make a PR.

Inky19 avatar Jul 22 '25 09:07 Inky19

I hadn't noticed the previous merge of #510, but this PR also fixes that problem as all packages were explicitly exported by Export-Package in the MANIFEST, including org.apache.tsfile.read.expression.impl.

However, I still created a small PR (#556) to correct the unnecessary declaration of private packages (which had no effect anyway).

Inky19 avatar Jul 22 '25 13:07 Inky19

Great, thanks for your contribution.

jt2594838 avatar Jul 23 '25 07:07 jt2594838