|
63 | 63 | import org.apache.iotdb.session.util.ThreadUtils; |
64 | 64 |
|
65 | 65 | import org.apache.thrift.TException; |
| 66 | +import org.apache.tsfile.common.conf.TSFileDescriptor; |
66 | 67 | import org.apache.tsfile.enums.TSDataType; |
67 | 68 | import org.apache.tsfile.file.metadata.IDeviceID; |
68 | 69 | import org.apache.tsfile.file.metadata.enums.CompressionType; |
@@ -221,8 +222,9 @@ public class Session implements ISession { |
221 | 222 | protected static final String TABLE = "table"; |
222 | 223 | protected static final String TREE = "tree"; |
223 | 224 |
|
224 | | - private CompressionType compressionType; |
225 | | - public Map<TSDataType, TSEncoding> columnEncodersMap; |
| 225 | + private CompressionType compressionType = |
| 226 | + TSFileDescriptor.getInstance().getConfig().getCompressor(); |
| 227 | + public Map<TSDataType, TSEncoding> columnEncodersMap = Collections.emptyMap(); |
226 | 228 |
|
227 | 229 | public Session(String host, int rpcPort) { |
228 | 230 | this( |
@@ -3012,12 +3014,25 @@ private TSInsertTabletReq genTSInsertTabletReq(Tablet tablet, boolean sorted, bo |
3012 | 3014 | List<Byte> encodingTypes; |
3013 | 3015 | if (trulyEnableRpcCompression) { |
3014 | 3016 | encodingTypes = new ArrayList<>(tablet.getSchemas().size() + 1); |
3015 | | - encodingTypes.add(this.columnEncodersMap.get(TSDataType.INT64).serialize()); |
| 3017 | + encodingTypes.add( |
| 3018 | + this.columnEncodersMap |
| 3019 | + .getOrDefault( |
| 3020 | + TSDataType.INT64, |
| 3021 | + TSEncoding.valueOf(TSFileDescriptor.getInstance().getConfig().getTimeEncoder())) |
| 3022 | + .serialize()); |
3016 | 3023 | for (IMeasurementSchema measurementSchema : tablet.getSchemas()) { |
3017 | 3024 | if (measurementSchema.getMeasurementName() == null) { |
3018 | 3025 | throw new IllegalArgumentException("measurement should be non null value"); |
3019 | 3026 | } |
3020 | | - encodingTypes.add(this.columnEncodersMap.get(measurementSchema.getType()).serialize()); |
| 3027 | + encodingTypes.add( |
| 3028 | + this.columnEncodersMap |
| 3029 | + .getOrDefault( |
| 3030 | + measurementSchema.getType(), |
| 3031 | + TSEncoding.valueOf( |
| 3032 | + TSFileDescriptor.getInstance() |
| 3033 | + .getConfig() |
| 3034 | + .getValueEncoder(measurementSchema.getType()))) |
| 3035 | + .serialize()); |
3021 | 3036 | } |
3022 | 3037 | } else { |
3023 | 3038 | encodingTypes = |
|
0 commit comments