wangyong9999 commented on code in PR #315:
URL: https://github.com/apache/paimon-cpp/pull/315#discussion_r3996635047
##########
src/paimon/core/schema/schema_validation.cpp:
##########
@@ -802,6 +804,89 @@ Status SchemaValidation::ValidateMosaicDataFields(const
TableSchema& schema,
return Status::OK();
}
+Status SchemaValidation::ValidateLanceDataField(const
std::shared_ptr<arrow::Field>& field) {
+ if (VariantTypeUtils::IsVariantField(field)) {
+ return Status::Invalid("Lance file format does not support type
VARIANT");
+ }
+ if (BlobUtils::IsBlobField(field)) {
+ return Status::Invalid("Lance file format does not support type BLOB");
+ }
+
+ const std::shared_ptr<arrow::DataType>& type = field->type();
+ switch (type->id()) {
+ case arrow::Type::BOOL:
+ case arrow::Type::INT8:
+ case arrow::Type::INT16:
+ case arrow::Type::INT32:
+ case arrow::Type::INT64:
+ case arrow::Type::FLOAT:
+ case arrow::Type::DOUBLE:
+ case arrow::Type::DATE32:
+ case arrow::Type::STRING:
+ case arrow::Type::BINARY:
+ case arrow::Type::TIME32:
+ case arrow::Type::DECIMAL128:
+ case arrow::Type::FIXED_SIZE_LIST:
+ return Status::OK();
+ case arrow::Type::TIMESTAMP: {
+ const auto& timestamp_type = checked_cast<const
arrow::TimestampType&>(*type);
+ if (!timestamp_type.timezone().empty()) {
+ return Status::Invalid(
+ "Lance file format does not support type
LOCAL_ZONED_TIMESTAMP");
+ }
+ return Status::OK();
+ }
+ case arrow::Type::LIST:
+ return ValidateLanceDataField(type->field(0));
+ case arrow::Type::STRUCT:
+ if (field->nullable()) {
+ return Status::Invalid(fmt::format(
+ "Lance file format does not support nullable ROW field
'{}'", field->name()));
+ }
Review Comment:
Follow-up in 8399a06d: added nested ROW and nested LIST regressions, plus a
null LIST hiding a null ROW element. Rejection of visible null parents and
round trips of valid slices/hidden values all pass. No further production
changes were needed.
--
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]