Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ public static Decoder getDecoderByType(TSEncoding encoding, TSDataType dataType)
case TIMESTAMP:
return new LongRLBEDecoder();
case FLOAT:
return new FloatRLBEDecoder();
case DOUBLE:
return new FloatDecoder(TSEncoding.valueOf(encoding.toString()), dataType);
return new DoubleRLBEDecoder();
default:
throw new TsFileDecodingException(String.format(ERROR_MSG, encoding, dataType));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,6 @@ public void initFromProps(Map<String, String> props) {

public static class RLBE extends TSEncodingBuilder {

private int maxPointNumber = 0;

@Override
public Encoder getEncoder(TSDataType type) {
switch (type) {
Expand All @@ -354,8 +352,9 @@ public Encoder getEncoder(TSDataType type) {
case TIMESTAMP:
return new LongRLBE();
case FLOAT:
return new FloatRLBE();
case DOUBLE:
return new FloatEncoder(TSEncoding.RLBE, type, maxPointNumber);
return new DoubleRLBE();
default:
throw new UnSupportedDataTypeException("RLBE doesn't support data type: " + type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
*/
package org.apache.tsfile.encoding.decoder;

import org.apache.tsfile.encoding.encoder.DoublePrecisionEncoderV1;
import org.apache.tsfile.encoding.encoder.DoubleRLBE;
import org.apache.tsfile.encoding.encoder.Encoder;
import org.apache.tsfile.encoding.encoder.FloatRLBE;
import org.apache.tsfile.encoding.encoder.TSEncodingBuilder;
import org.apache.tsfile.enums.TSDataType;
import org.apache.tsfile.file.metadata.enums.TSEncoding;

import org.junit.After;
import org.junit.Before;
Expand Down Expand Up @@ -179,7 +181,8 @@ public void testFloat() throws IOException {

@Test
public void testDouble() throws IOException {
Encoder encoder = new DoublePrecisionEncoderV1();
Encoder encoder =
TSEncodingBuilder.RLBE.getEncodingBuilder(TSEncoding.RLBE).getEncoder(TSDataType.DOUBLE);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
double value = 7.101f;
int num = 1000;
Expand All @@ -188,7 +191,7 @@ public void testDouble() throws IOException {
}
encoder.flush(baos);
ByteBuffer buffer = ByteBuffer.wrap(baos.toByteArray());
Decoder decoder = new DoublePrecisionDecoderV1();
Decoder decoder = Decoder.getDecoderByType(TSEncoding.RLBE, TSDataType.DOUBLE);
for (int i = 0; i < num; i++) {
if (decoder.hasNext(buffer)) {
assertEquals(value + 2 * i, decoder.readDouble(buffer), delta);
Expand Down Expand Up @@ -228,7 +231,8 @@ private void testFloatLength(List<Float> valueList, boolean isDebug, int repeatC

private void testDoubleLength(List<Double> valueList, boolean isDebug, int repeatCount)
throws Exception {
Encoder encoder = new DoublePrecisionEncoderV1();
Encoder encoder =
TSEncodingBuilder.RLBE.getEncodingBuilder(TSEncoding.RLBE).getEncoder(TSDataType.DOUBLE);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (int i = 0; i < repeatCount; i++) {
for (double value : valueList) {
Expand All @@ -240,7 +244,7 @@ private void testDoubleLength(List<Double> valueList, boolean isDebug, int repea
ByteBuffer buffer = ByteBuffer.wrap(baos.toByteArray());

for (int i = 0; i < repeatCount; i++) {
Decoder decoder = new DoublePrecisionDecoderV1();
Decoder decoder = Decoder.getDecoderByType(TSEncoding.RLBE, TSDataType.DOUBLE);
for (double value : valueList) {
if (decoder.hasNext(buffer)) {
double value_ = decoder.readDouble(buffer);
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@
<cmake.generator>Unix Makefiles</cmake.generator>
<python.venv.bin>venv/bin/</python.venv.bin>
<python.exe.bin>python3</python.exe.bin>
<python.compiler.argument> </python.compiler.argument>
<python.compiler.argument/>
</properties>
</profile>
<!-- Profile for linux amd64 (mainly AMD Processors) (Self-Enabling) -->
Expand All @@ -687,7 +687,7 @@
<cmake.generator>Unix Makefiles</cmake.generator>
<python.venv.bin>venv/bin/</python.venv.bin>
<python.exe.bin>python3</python.exe.bin>
<python.compiler.argument> </python.compiler.argument>
<python.compiler.argument/>
</properties>
</profile>
<!-- Profile for linux aarch64 (mainly newer Mac or Raspberry PI Processors) (Self-Enabling) -->
Expand All @@ -706,7 +706,7 @@
<cmake.generator>Unix Makefiles</cmake.generator>
<python.venv.bin>venv/bin/</python.venv.bin>
<python.exe.bin>python3</python.exe.bin>
<python.compiler.argument> </python.compiler.argument>
<python.compiler.argument/>
</properties>
</profile>
<!-- Profile for mac x86_64 (mainly Intel Processors) (Self-Enabling) -->
Expand All @@ -724,7 +724,7 @@
<cmake.generator>Unix Makefiles</cmake.generator>
<python.venv.bin>venv/bin/</python.venv.bin>
<python.exe.bin>python3</python.exe.bin>
<python.compiler.argument> </python.compiler.argument>
<python.compiler.argument/>
</properties>
</profile>
<!-- Profile for mac aarch64 (mainly AMD Processors) (Self-Enabling) -->
Expand All @@ -742,7 +742,7 @@
<cmake.generator>Unix Makefiles</cmake.generator>
<python.venv.bin>venv/bin/</python.venv.bin>
<python.exe.bin>python3</python.exe.bin>
<python.compiler.argument> </python.compiler.argument>
<python.compiler.argument/>
</properties>
</profile>
<!-- profile for windows x86_64 (mainly Intel Processors) (Self-Enabling) -->
Expand Down