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

[BENCH-5181] Fix range data conversion in requests #1169

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ public static Literal fromApiObject(ApiLiteral apiLiteral) {
apiLiteral.getValueUnion().getInt64Val() != null
? Long.parseLong(apiLiteral.getValueUnion().getInt64Val())
: null);
case DOUBLE -> Literal.forDouble(apiLiteral.getValueUnion().getDoubleVal());
case STRING -> Literal.forString(apiLiteral.getValueUnion().getStringVal());
case BOOLEAN -> Literal.forBoolean(apiLiteral.getValueUnion().isBoolVal());
case DATE -> Literal.forDate(apiLiteral.getValueUnion().getDateVal());
Expand Down
20 changes: 13 additions & 7 deletions ui/src/data/source.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import * as tanagra from "tanagra-api";
import * as tanagraUnderlay from "tanagra-underlay/underlayConfig";
import { Underlay } from "underlaysSlice";
import { isValid } from "util/valid";
import { DataType } from "tanagra-api";

export type EntityNode = {
data: DataEntry;
Expand Down Expand Up @@ -1036,7 +1037,7 @@ export class BackendUnderlaySource implements UnderlaySource {
}

const limit = options?.fetchAll ? 100000 : options?.limit;
const req = {
return {
entityName: entity.name,
underlayName: this.underlay.name,
query: {
Expand Down Expand Up @@ -1074,7 +1075,6 @@ export class BackendUnderlaySource implements UnderlaySource {
pageMarker: options?.pageMarker,
},
};
return req;
}

private async queryHints(
Expand Down Expand Up @@ -1606,19 +1606,26 @@ function isInternalAttribute(attribute: string): boolean {
}

export function literalFromDataValue(value: DataValue): tanagra.Literal {
let dataType = tanagra.DataType.Int64;
if (typeof value === "string") {
let dataType: DataType;
if (typeof value === "bigint") {
dataType = tanagra.DataType.Int64;
} else if (typeof value == "number") {
dataType = tanagra.DataType.Double;
} else if (typeof value === "string") {
dataType = tanagra.DataType.String;
} else if (typeof value === "boolean") {
dataType = tanagra.DataType.Boolean;
} else if (value instanceof Date) {
dataType = tanagra.DataType.Date;
} else {
throw new Error(`Unsupported type of ${JSON.stringify(value)}.`);
}

return {
dataType,
valueUnion: {
int64Val: typeof value === "bigint" ? String(value) : undefined,
doubleVal: typeof value === "number" ? value : undefined,
stringVal: typeof value === "string" ? value : undefined,
boolVal: typeof value === "boolean" ? value : undefined,
dateVal: value instanceof Date ? value.toISOString() : undefined,
Expand Down Expand Up @@ -2106,7 +2113,7 @@ function fromAPIFeatureSetInternal(
function toAPICriteriaGroupSections(
groupSections: GroupSection[]
): tanagra.CriteriaGroupSection[] {
const sections = groupSections.map((section) => ({
return groupSections.map((section) => ({
id: section.id,
displayName: section.name ?? "",
operator: toAPICriteriaGroupSectionOperator(section.filter.kind),
Expand All @@ -2122,7 +2129,6 @@ function toAPICriteriaGroupSections(
),
disabled: !!section.disabled,
}));
return sections;
}

function toAPICriteriaGroups(groups: Group[]): tanagra.CriteriaGroup[] {
Expand Down Expand Up @@ -2252,7 +2258,7 @@ function parseAPIError<T>(p: Promise<T>) {
}

const text = await response.text();
let message = "";
let message;
try {
message = JSON.parse(text).message;
} catch (e) {
Expand Down