Skip to content
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

KXI-59012 Make structuredText results easier for consumers to use #507

Merged
merged 5 commits into from
Jan 27, 2025

Conversation

acheung12
Copy link
Collaborator

Changes introduced by this PR

  • Added additions under the request from Philip to make api easier to use
  • Removed values changing to values if items are singular
  • enlisted all incoming values
  • changes are related to https://kxl.atlassian.net/browse/KXI-59012

@ecmel ecmel self-requested a review January 24, 2025 18:27
@@ -147,7 +147,7 @@
originalType ~ `chars;
`chars;
.axq.i_NONPRIMCODE type data];
values: ('[removeTrailingNewline; toString] each data);
values: enlist ('[removeTrailingNewline; toString] each data);
values: $[type values = 11h; enlist values; values];
Copy link
Collaborator

@ecmel ecmel Jan 24, 2025

Choose a reason for hiding this comment

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

Since we always enlist values in the previous line, line 151 may be removed.

@@ -173,7 +173,7 @@
(generateColumns[::;0b;1b;key data;"key"]; generateColumns[::;0b;0b;value data;"values"]);
isTable;
generateTableColumns[originalType;isAtom;0b;data];
generateColumns[originalType;isAtom;0b;data;$[isAtom;"value";"values"]]
generateColumns[originalType;isAtom;0b;data;"values"]
Copy link
Collaborator

@ecmel ecmel Jan 25, 2025

Choose a reason for hiding this comment

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

Line 176 not always generates an array as stated in the ticket. (enlist is missing).

@ecmel
Copy link
Collaborator

ecmel commented Jan 27, 2025

@Philip-Carneiro-KX
Copy link
Collaborator

Philip-Carneiro-KX commented Jan 27, 2025

Tested the code above and from the insights and the conclusion is:

In my change before, the code
values: $[type values = 11h; enlist values; values];

works as if for the following case:

If the values attribute is not an array, it will be converted into an array of length 1 containing the value.
If values is already an array, it will remain unchanged.

With your changes, if the values attribute is not an array, convert to array, if this is an array already, convert it to an array with length 1 of an array

exemples bellow:
Screenshot 2025-01-27 at 10 57 54

Screenshot 2025-01-27 at 10 55 19

Copy link
Collaborator

@Philip-Carneiro-KX Philip-Carneiro-KX left a comment

Choose a reason for hiding this comment

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

as explained in my comment, the idea is: if is array, remain unchanged. if is not array, convert to an array

This also could be used to columns as well

@acheung12
Copy link
Collaborator Author

Made the requested changes.

@Philip-Carneiro-KX Philip-Carneiro-KX self-requested a review January 27, 2025 17:20
@acheung12 acheung12 merged commit aadafc6 into KxSystems:dev Jan 27, 2025
3 checks passed
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.

3 participants