aokolnychyi commented on code in PR #15372:
URL: https://github.com/apache/iceberg/pull/15372#discussion_r2843306182
##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkTable.java:
##########
@@ -286,6 +290,28 @@ public MetadataColumn[] metadataColumns() {
return cols.toArray(SparkMetadataColumn[]::new);
}
+ @Override
+ public Constraint[] constraints() {
+ List<Constraint> constraints = Lists.newArrayList();
+
+ SparkReadConf readConf = new SparkReadConf(sparkSession(), icebergTable);
+ Set<String> identifierFieldNames =
icebergTable.schema().identifierFieldNames();
+
+ if (readConf.identifierFieldsRely() && !identifierFieldNames.isEmpty()) {
+ NamedReference[] columns =
+
identifierFieldNames.stream().map(FieldReference::apply).toArray(NamedReference[]::new);
Review Comment:
FieldReference is a Catalyst private class. I believe `Spark3Util` has a
utility that produces named references. We can extend it to accept a collection
of them.
##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkTable.java:
##########
@@ -286,6 +290,28 @@ public MetadataColumn[] metadataColumns() {
return cols.toArray(SparkMetadataColumn[]::new);
}
+ @Override
+ public Constraint[] constraints() {
+ List<Constraint> constraints = Lists.newArrayList();
+
+ SparkReadConf readConf = new SparkReadConf(sparkSession(), icebergTable);
+ Set<String> identifierFieldNames =
icebergTable.schema().identifierFieldNames();
+
+ if (readConf.identifierFieldsRely() && !identifierFieldNames.isEmpty()) {
+ NamedReference[] columns =
+
identifierFieldNames.stream().map(FieldReference::apply).toArray(NamedReference[]::new);
Review Comment:
`FieldReference` is a Catalyst private class. I believe `Spark3Util` has a
utility that produces named references. We can extend it to accept a collection
of them.
--
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]