jt2594838 commented on code in PR #307:
URL: https://github.com/apache/tsfile/pull/307#discussion_r1857654312


##########
java/tsfile/src/main/java/org/apache/tsfile/write/v4/AbstractTableModelTsFileWriter.java:
##########
@@ -0,0 +1,280 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tsfile.write.v4;
+
+import org.apache.tsfile.common.TsFileApi;
+import org.apache.tsfile.common.conf.TSFileConfig;
+import org.apache.tsfile.common.conf.TSFileDescriptor;
+import org.apache.tsfile.encrypt.EncryptParameter;
+import org.apache.tsfile.encrypt.IEncryptor;
+import org.apache.tsfile.exception.encrypt.EncryptException;
+import org.apache.tsfile.file.metadata.IDeviceID;
+import org.apache.tsfile.write.chunk.AlignedChunkGroupWriterImpl;
+import org.apache.tsfile.write.chunk.IChunkGroupWriter;
+import org.apache.tsfile.write.chunk.NonAlignedChunkGroupWriterImpl;
+import org.apache.tsfile.write.schema.Schema;
+import org.apache.tsfile.write.writer.TsFileIOWriter;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.security.MessageDigest;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+abstract class AbstractTableModelTsFileWriter implements ITsFileWriter {
+
+  protected static final TSFileConfig config = 
TSFileDescriptor.getInstance().getConfig();
+  protected static final Logger LOG = 
LoggerFactory.getLogger(AbstractTableModelTsFileWriter.class);
+
+  /** IO writer of this TsFile. */
+  protected final TsFileIOWriter fileWriter;
+
+  protected EncryptParameter encryptParam;
+
+  protected final int pageSize;
+  protected long recordCount = 0;
+
+  // deviceId -> measurementIdList
+  protected Map<IDeviceID, List<String>> flushedMeasurementsInDeviceMap = new 
HashMap<>();
+
+  // DeviceId -> LastTime
+  protected Map<IDeviceID, Long> alignedDeviceLastTimeMap = new HashMap<>();
+
+  // TimeseriesId -> LastTime
+  protected Map<IDeviceID, Map<String, Long>> nonAlignedTimeseriesLastTimeMap 
= new HashMap<>();
+
+  protected Map<IDeviceID, IChunkGroupWriter> groupWriters = new TreeMap<>();
+
+  /** min value of threshold of data points num check. */
+  protected long recordCountForNextMemCheck = 100;
+
+  protected long chunkGroupSizeThreshold;
+
+  /**
+   * init this Writer.
+   *
+   * @param file the File to be written by this TsFileWriter
+   */
+  @TsFileApi
+  protected AbstractTableModelTsFileWriter(File file, long 
chunkGroupSizeThreshold)
+      throws IOException {
+    Schema schema = new Schema();
+    TSFileConfig conf = TSFileDescriptor.getInstance().getConfig();
+    this.fileWriter = new TsFileIOWriter(file);
+    fileWriter.setSchema(schema);
+
+    this.pageSize = conf.getPageSizeInByte();
+    this.chunkGroupSizeThreshold = chunkGroupSizeThreshold;
+    config.setTSFileStorageFs(conf.getTSFileStorageFs());

Review Comment:
   I mean the `config` and `conf` seem to be the same object, and this set is 
unlikely to change anything.



-- 
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]

Reply via email to