maytasm commented on code in PR #13612:
URL: https://github.com/apache/druid/pull/13612#discussion_r1067382502


##########
server/src/main/java/org/apache/druid/segment/indexing/ReaderUtils.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.segment.indexing;
+
+import org.apache.druid.data.input.impl.DimensionSchema;
+import org.apache.druid.data.input.impl.DimensionsSpec;
+import org.apache.druid.data.input.impl.TimestampSpec;
+import org.apache.druid.java.util.common.logger.Logger;
+import org.apache.druid.java.util.common.parsers.JSONPathFieldSpec;
+import org.apache.druid.java.util.common.parsers.JSONPathFieldType;
+import org.apache.druid.java.util.common.parsers.JSONPathSpec;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.segment.transform.Transform;
+import org.apache.druid.segment.transform.TransformSpec;
+
+import javax.annotation.Nullable;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class ReaderUtils
+{
+  private static final Logger LOG = new Logger(ReaderUtils.class);
+
+  private static final Pattern JSON_PATH_PATTERN = 
Pattern.compile("\\[(.*?)]");
+  private static final Pattern BRACKET_NOTATED_CHILD_PATTERN = 
Pattern.compile("'(.*?)'");
+
+  public static Set<String> getColumnsRequiredForIngestion(
+      Set<String> fullInputSchema,
+      TimestampSpec timestampSpec,
+      DimensionsSpec dimensionsSpec,
+      TransformSpec transformSpec,
+      AggregatorFactory[] aggregators,
+      @Nullable JSONPathSpec flattenSpec
+  )
+  {
+    Set<String> fieldsRequired = new HashSet<>();
+
+    // We need to read timestamp column for Druid timestamp field
+    fieldsRequired.add(timestampSpec.getTimestampColumn());

Review Comment:
   The order should not matter. The flattenspec would add the required column 
for the timestamp to the `fieldsRequired` Set. The timestamspec will add the 
name of the flattencolumn which would then be removed at the end as it does not 
exist in the parquet file



##########
server/src/main/java/org/apache/druid/segment/indexing/ReaderUtils.java:
##########
@@ -0,0 +1,143 @@
+/*
+ * 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.segment.indexing;
+
+import org.apache.druid.data.input.impl.DimensionSchema;
+import org.apache.druid.data.input.impl.DimensionsSpec;
+import org.apache.druid.data.input.impl.TimestampSpec;
+import org.apache.druid.java.util.common.logger.Logger;
+import org.apache.druid.java.util.common.parsers.JSONPathFieldSpec;
+import org.apache.druid.java.util.common.parsers.JSONPathFieldType;
+import org.apache.druid.java.util.common.parsers.JSONPathSpec;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.segment.transform.Transform;
+import org.apache.druid.segment.transform.TransformSpec;
+
+import javax.annotation.Nullable;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class ReaderUtils
+{
+  private static final Logger LOG = new Logger(ReaderUtils.class);
+
+  private static final Pattern JSON_PATH_PATTERN = 
Pattern.compile("\\[(.*?)]");
+  private static final Pattern BRACKET_NOTATED_CHILD_PATTERN = 
Pattern.compile("'(.*?)'");
+
+  public static Set<String> getColumnsRequiredForIngestion(
+      Set<String> fullInputSchema,
+      TimestampSpec timestampSpec,
+      DimensionsSpec dimensionsSpec,
+      TransformSpec transformSpec,
+      AggregatorFactory[] aggregators,
+      @Nullable JSONPathSpec flattenSpec
+  )
+  {
+    Set<String> fieldsRequired = new HashSet<>();
+
+    // We need to read timestamp column for Druid timestamp field
+    fieldsRequired.add(timestampSpec.getTimestampColumn());

Review Comment:
   See ReaderUtilsTest#testGetColumnsRequiredForIngestionWithFlattenTimestamp



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