-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement logic to determine super types between iceberg types #50412
base: iceberg-schema-comparator
Are you sure you want to change the base?
feat: implement logic to determine super types between iceberg types #50412
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
private fun validateTypeIds(typeId1: TypeID, typeId2: TypeID) { | ||
val unsupportedTypeIds = setOf(BINARY, DECIMAL, FIXED, UUID, MAP, TIMESTAMP_NANO) | ||
if (typeId1 in unsupportedTypeIds || typeId2 in unsupportedTypeIds) { | ||
val badTypeId = if (typeId1 in unsupportedTypeIds) typeId1 else typeId2 | ||
throw IllegalArgumentException( | ||
"Unsupported or unmapped Iceberg type: $badTypeId. Please implement handling if needed." | ||
) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this slightly easier to read:
private fun validateTypeIds(typeId1: TypeID, typeId2: TypeID) { | |
val unsupportedTypeIds = setOf(BINARY, DECIMAL, FIXED, UUID, MAP, TIMESTAMP_NANO) | |
if (typeId1 in unsupportedTypeIds || typeId2 in unsupportedTypeIds) { | |
val badTypeId = if (typeId1 in unsupportedTypeIds) typeId1 else typeId2 | |
throw IllegalArgumentException( | |
"Unsupported or unmapped Iceberg type: $badTypeId. Please implement handling if needed." | |
) | |
} | |
} | |
private fun validateTypeIds(typeId1: TypeID, typeId2: TypeID) { | |
val unsupportedTypes = setOf(BINARY, DECIMAL, FIXED, UUID, MAP, TIMESTAMP_NANO) | |
val providedTypes = listOf(typeId1, typeId2) | |
val foundUnsupported = providedTypes.filter { it in unsupportedTypes } | |
if (foundUnsupported.isNotEmpty()) { | |
throw IllegalArgumentException( | |
"Unsupported or unmapped Iceberg type(s): ${foundUnsupported.joinToString()}. Please implement handling if needed." | |
) | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
validateTypeIds(existingTypeId, incomingTypeId) | ||
|
||
// If promotion is not allowed by Iceberg, fail fast. | ||
if (!TypeUtil.isPromotionAllowed(existingType, incomingType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be happening even before validateTypeIds
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Part of https://github.com/airbytehq/airbyte-internal-issues/issues/10918