-
Notifications
You must be signed in to change notification settings - Fork 302
Add PolarisObjectMapper #2164
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
Add PolarisObjectMapper #2164
Conversation
@@ -187,8 +108,4 @@ public int getAttemptCount() { | |||
return null; |
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.
if you look above this line, json errors around task state dont get reported to PolarisDiagnostics
but are simply logged
import org.apache.polaris.core.entity.PolarisBaseEntity; | ||
import org.apache.polaris.core.entity.PolarisTaskConstants; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** A mapper to serialize/deserialize polaris objects. */ | ||
public class PolarisObjectMapperUtil { | ||
public final class PolarisObjectMapperUtil { |
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.
if we go forward with this PR we might want to rename this class as it now only deals with task (execution) state?
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.
Either way works for me :)
@@ -41,16 +40,16 @@ public static TaskEntity of(PolarisBaseEntity polarisEntity) { | |||
|
|||
public <T> T readData(Class<T> klass) { | |||
PolarisCallContext polarisCallContext = CallContext.getCurrentContext().getPolarisCallContext(); |
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.
if PolarisObjectMapperUtil
methods did not require the PolarisDiagnostics
for reporting json-related errors, then this usage of CallContext.getCurrentContext()
could go away (also below in this file).
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.
found this gem a well:
polaris/polaris-core/src/main/java/org/apache/polaris/core/entity/CatalogEntity.java
Lines 219 to 221 in 987c554
if (configStr != null) { | |
return ConnectionConfigInfoDpo.deserialize(new PolarisDefaultDiagServiceImpl(), configStr); | |
} |
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.
This looks like a nice refactoring... Did you mean to remove the "draft" state and open this PR for reviews?
not yet, i will probably make an alternative PR where i remove update: alternative PR (which is better imo) now available #2176 |
closing as the alternative PR got merged |
all static methods that took a
PolarisCallContext
as first parameter can be moved to the new class.if we did not need to log json-related exceptions to
PolarisDiagnostics
(which we dont do in other places) then we could keep everything as static util methods.