You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/11/07 23:32:09 UTC
[GitHub] [iceberg] rdblue commented on a change in pull request #3459: Spark: add show partition sql to spark-3.2 moudle
rdblue commented on a change in pull request #3459:
URL: https://github.com/apache/iceberg/pull/3459#discussion_r744334492
##########
File path: spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/source/SparkTable.java
##########
@@ -298,6 +317,97 @@ public void deleteWhere(Filter[] filters) {
}
}
+ @Override
+ public StructType partitionSchema() {
+ List<Types.NestedField> fields = icebergTable.spec().partitionType().fields();
+ StructField[] structFields = new StructField[fields.size()];
+ int index = 0;
+ for (Types.NestedField field : fields) {
+ StructField structField = new StructField(field.name(), SparkSchemaUtil.convert(field.type()), true,
+ Metadata.empty());
+ structFields[index] = structField;
+ ++index;
+ }
+ return new StructType(structFields);
+ }
+
+ @Override
+ public void createPartition(InternalRow ident, Map<String, String> properties)
+ throws PartitionAlreadyExistsException, UnsupportedOperationException {
+ throw new UnsupportedOperationException("not support create partition, use addFile procedure to refresh");
Review comment:
Iceberg has a style for error messages. Use sentence case, be direct, add context, and try to make it useful. In this case, I think a good error message is "Cannot create partition: partitions exist only when there are rows"
That is direct because it states what the user was attempting, but failed to do: "Cannot create partition". We use `:` before giving the relevant context or reason, "partitions exist only when there are rows". Iceberg does not track partition existence independent of data. Partitions exist if and only if there are rows stored in the partition.
Could you similarly update the others? Some we could implement later, so you can use "not implemented" as the context. For `dropPartition`, I would use "Cannot drop partition: not implemented".
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org