Skip to content

fix(QTDI-1686):[TCK Framework]: allow pass logical type when studio dynamic schema case #1062

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

wwang-talend
Copy link
Contributor

Requirements

  • Any code change adding any logic MUST be tested through a unit test executed with the default build
  • Any API addition MUST be done with a documentation update if relevant

Why this PR is needed?

https://qlik-dev.atlassian.net/browse/QTDI-1686

What does this PR adds (design/code thoughts)?

https://qlik-dev.atlassian.net/browse/QTDI-1686

Copy link
Contributor

@ypiel-talend ypiel-talend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use withLogicalType insted of withProp.

.withEntry(factory.newEntryBuilder()
.withName("time1")
.withType(Type.DATETIME)
.withProp(SchemaProperty.LOGICAL_TYPE, SchemaProperty.LogicalType.TIME.key())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use withProp(...) to set logical type, please use withLogicalType:

factory.newEntryBuilder()
                .withName("date")
                .withType(Type.DATETIME)
                .withLogicalType(LogicalType.TIME)

Copy link
Contributor

@ypiel-talend ypiel-talend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 more comments

@@ -502,6 +514,9 @@ private Entry toEntry(final String name, final Schema.Type type, final String or
props.put(PATTERN, pattern);
}
props.put(STUDIO_TYPE, studioType);
if (logicalType != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use withLogicalType in the "return factory..." don' put it in a temporary map taht will be used in withProps(...)

       return factory
                .newEntryBuilder()
                .withName(name)
                .withRawName(originalName)
                .withNullable(isNullable)
                .withType(type)
                .withComment(comment)
                .withDefaultValue(defaultValue)
                .withProps(props)
                .withLogicalType(SchemaProperty.LogicalType.valueOf(logicalType))
                .build();

@@ -306,7 +304,14 @@ private DynamicMetadataWrapper generateMetadata(final Entry entry) {

switch (studioType) {
case StudioTypes.DATE:
metadata.getDynamicMetadata().setLogicalType("timestamp-millis");
final String logicalType = entry.getProps().get(LOGICAL_TYPE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use entry.getLogicalType()

Copy link

sonar-eks bot commented Aug 21, 2025

Failed Quality Gate failed

  • 1 New Issues (is greater than 0)

Project ID: org.talend.sdk.component:component-runtime

View in SonarQube

Copy link
Contributor

@ypiel-talend ypiel-talend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants