JackieTien97 commented on code in PR #820:
URL: https://github.com/apache/tsfile/pull/820#discussion_r3259400024
##########
java/tsfile/src/main/java/org/apache/tsfile/read/TsFileSequenceReader.java:
##########
@@ -2857,7 +2853,7 @@ public List<AbstractAlignedChunkMetadata>
getAlignedChunkMetadata(
Pair<IMetadataIndexEntry, Long> metadataIndexPair =
getMetadataAndEndOffsetOfDeviceNode(deviceMetadataIndexNode, device,
true);
if (metadataIndexPair == null) {
- throw new IOException("Device {" + device + "} is not in
tsFileMetaData");
+ throw new
IOException(Messages.format("error.read.device_not_in_metadata", device));
Review Comment:
Breaks an existing test under non-English locale.
`TsFileReaderTest.testGetAlignedChunkMetadata` asserts the literal English
text returned by this throw:
https://github.com/apache/tsfile/blob/03c3aa6ad5436183c13a0174deeafebad0d89715/java/tsfile/src/test/java/org/apache/tsfile/read/TsFileReaderTest.java#L528-L530
Under `-Dtsfile.locale=zh` (or a Chinese-default JVM), `e.getMessage()`
becomes `设备 {d3} 不在 tsFileMetaData 中` from
[`error.read.device_not_in_metadata`](https://github.com/apache/tsfile/blob/7c880c3826cb8df4ea74a7d44830e4e51e8fcea0/java/common/src/main/resources/org/apache/tsfile/i18n/messages_zh.properties)
in `messages_zh.properties`, and the `assertEquals` fails.
##########
java/tsfile/src/main/java/org/apache/tsfile/read/TsFileSequenceReader.java:
##########
@@ -2886,7 +2882,7 @@ public List<AbstractAlignedChunkMetadata>
getAlignedChunkMetadataByMetadataIndex
throws IOException {
TimeseriesMetadata firstTimeseriesMetadata =
getTimeColumnMetadata(metadataIndexNode, null);
if (firstTimeseriesMetadata == null) {
- throw new IOException("Timeseries of device {" + device + "} are not
aligned");
+ throw new
IOException(Messages.format("error.read.timeseries_not_aligned", device));
Review Comment:
Same locale-sensitivity issue as the comment above.
`TsFileReaderTest.testGetAlignedChunkMetadata` asserts the literal English
text returned by this throw:
https://github.com/apache/tsfile/blob/03c3aa6ad5436183c13a0174deeafebad0d89715/java/tsfile/src/test/java/org/apache/tsfile/read/TsFileReaderTest.java#L536-L538
Under `zh` locale, the message becomes `设备 {d2} 的时间序列不是对齐的` from
`error.read.timeseries_not_aligned`, and the `assertEquals` fails.
##########
java/tsfile/src/main/java/org/apache/tsfile/encoding/encoder/TSEncodingBuilder.java:
##########
@@ -81,7 +82,8 @@ public static TSEncodingBuilder getEncodingBuilder(TSEncoding
type) {
case CAMEL:
return new Camel();
default:
- throw new UnsupportedOperationException("Unsupported encoding: " +
type);
+ throw new UnsupportedOperationException(
+ Messages.format("error.encoding.ts_encoding_builder_unsupported",
type));
Review Comment:
Breaks `TSEncodingBuilderTest.testTSEncodingBuilder` under non-English
locale.
The test asserts the literal English text that this throw used to produce:
https://github.com/apache/tsfile/blob/39e55a358291ca756f3ee5d8f85c144f3139ccec/java/tsfile/src/test/java/org/apache/tsfile/encoding/encoder/TSEncodingBuilderTest.java#L55-L58
Under `zh` locale, `e.getMessage()` becomes `不支持的 encoding: %1$s` (with
`%1$s` substituted) from `error.encoding.ts_encoding_builder_unsupported`, and
the `assertEquals` fails. (Same fix as for the `TsFileSequenceReader` comments.)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]