ColinLeeo commented on code in PR #20729:
URL: https://github.com/apache/druid/pull/20729#discussion_r4379587926


##########
extensions-contrib/tsfile-extensions/src/test/java/org/apache/druid/data/input/tsfile/TsFileInputFormatTest.java:
##########
@@ -0,0 +1,285 @@
+/*
+ * 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.druid.data.input.tsfile;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.druid.data.input.ColumnsFilter;
+import org.apache.druid.data.input.InputEntityReader;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputRow;
+import org.apache.druid.data.input.InputRowSchema;
+import org.apache.druid.data.input.impl.DimensionsSpec;
+import org.apache.druid.data.input.impl.FileEntity;
+import org.apache.druid.data.input.impl.TimestampSpec;
+import org.apache.druid.error.DruidException;
+import org.apache.druid.jackson.DefaultObjectMapper;
+import org.apache.druid.java.util.common.DateTimes;
+import org.apache.druid.java.util.common.parsers.CloseableIterator;
+import org.apache.tsfile.exception.write.WriteProcessException;
+import org.joda.time.Interval;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class TsFileInputFormatTest

Review Comment:
   Added 
`embedded-tests/src/test/java/org/apache/druid/testing/embedded/tsfile/TsFileIngestionTest.java`
 with two end-to-end cases, both verifying row count, per-region counts and 
`__time` bounds:
   
   1. batch ingestion: an `index` task spec with a local input source and the 
`tsfile` input format (`TaskBuilder.ofTypeIndex()`).
   2. MSQ: `INSERT INTO ... SELECT MILLIS_TO_TIMESTAMP("Time"), ... FROM 
TABLE(EXTERN('{"type":"local",...}','{"type":"tsfile",...}','[columns]')) 
PARTITIONED BY DAY`.
   
   On point 3 (the `local(...)` table function syntax): I don't think it can be 
done from an extension right now. `TableDefnRegistry` does accept a 
`List<InputFormatDefn>` of extension-provided definitions, but all three 
production construction sites (`CatalogStorage`, `CatalogClient`, 
`CachedMetadataCatalog`) use the `TableDefnRegistry(jsonMapper)` convenience 
constructor, which passes `null` for those lists; the comment there says the 
definitions should come from Guice later. On top of that, `InputFormats` lives 
in `server`, which cannot depend on a contrib extension. Supporting `format => 
'tsfile'` needs a pluggable registry upstream first; happy to open a separate 
PR for it if the maintainers want that.
   
   Both pass locally with `mvn -pl embedded-tests -am test 
-Dtest=TsFileIngestionTest`.
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to