FrankChen021 commented on code in PR #19510:
URL: https://github.com/apache/druid/pull/19510#discussion_r3348720984
##########
extensions-contrib/druid-iceberg-extensions/pom.xml:
##########
@@ -760,6 +760,23 @@
<scope>provided</scope>
</dependency>
+ <dependency>
Review Comment:
[P2] Register new Arrow dependencies in licenses.yaml
This module adds iceberg-arrow, arrow-vector, and arrow-memory-unsafe, while
the root pom also manages arrow-memory-netty, but licenses.yaml has no Arrow or
Iceberg Arrow entries. dev/license.md says new library dependencies must be
registered there, so binary license/notice generation is incomplete until these
artifacts are added.
##########
extensions-contrib/druid-iceberg-extensions/src/main/java/org/apache/druid/iceberg/input/IcebergArrowInputSource.java:
##########
@@ -0,0 +1,101 @@
+/*
+ * 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.iceberg.input;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.druid.data.input.InputFormat;
+import org.apache.druid.data.input.InputRowSchema;
+import org.apache.druid.data.input.InputSource;
+import org.apache.druid.data.input.InputSourceReader;
+import org.apache.druid.iceberg.filter.IcebergFilter;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.TableScan;
+import org.joda.time.DateTime;
+
+import javax.annotation.Nullable;
+import java.io.File;
+
+public class IcebergArrowInputSource extends AbstractIcebergInputSource
implements InputSource
+{
+ public static final String TYPE_KEY = "iceberg_arrow";
+
+ @JsonProperty
+ private final int arrowBatchSize;
+
+ @JsonCreator
+ public IcebergArrowInputSource(
+ @JsonProperty("tableName") String tableName,
+ @JsonProperty("namespace") String namespace,
+ @JsonProperty("icebergFilter") @Nullable IcebergFilter icebergFilter,
+ @JsonProperty("icebergCatalog") IcebergCatalog icebergCatalog,
+ @JsonProperty("snapshotTime") @Nullable DateTime snapshotTime,
+ @JsonProperty("residualFilterMode") @Nullable ResidualFilterMode
residualFilterMode,
+ @JsonProperty("arrowBatchSize") @Nullable Integer arrowBatchSize
+ )
+ {
+ super(tableName, namespace, icebergFilter, icebergCatalog, snapshotTime,
residualFilterMode);
+ this.arrowBatchSize = arrowBatchSize != null && arrowBatchSize > 0
+ ? arrowBatchSize
+ : IcebergArrowInputSourceReader.DEFAULT_BATCH_SIZE;
+ }
+
+ @JsonProperty
+ public int getArrowBatchSize()
+ {
+ return arrowBatchSize;
+ }
+
+ @Override
+ public boolean needsFormat()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isSplittable()
+ {
+ return false;
+ }
+
+ @Override
+ public InputSourceReader reader(
+ InputRowSchema inputRowSchema,
+ @Nullable InputFormat inputFormat,
+ File temporaryDirectory
+ )
+ {
+ final Table table = retrieveTable();
+ if (icebergFilter != null) {
+ final TableScan filteredScan = icebergFilter.filter(
+ table.newScan().caseSensitive(icebergCatalog.isCaseSensitive())
+ );
+ icebergCatalog.enforceResidualMode(filteredScan,
getResidualFilterMode());
Review Comment:
[P2] Apply snapshotTime before residual enforcement
reader() checks residuals on a filtered scan built from table.newScan(), but
snapshotTime is only applied later inside
IcebergArrowInputSourceReader.buildScan(). With residualFilterMode=FAIL,
historical ingestion can throw or pass based on the current snapshot rather
than the snapshot actually being read. Apply asOfTime(snapshotTime.getMillis())
before enforceResidualMode, or move enforcement into the reader after the
snapshot is selected.
--
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]