Skip to content

Commit

Permalink
chore: add long and boolean array attribute type (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
GurtejSohi authored Jan 19, 2024
1 parent 5998726 commit 1597f9e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.hypertrace.core.graphql.attributes;

import static org.hypertrace.core.attribute.service.v1.AttributeKind.TYPE_BOOL;
import static org.hypertrace.core.attribute.service.v1.AttributeKind.TYPE_BOOL_ARRAY;
import static org.hypertrace.core.attribute.service.v1.AttributeKind.TYPE_DOUBLE;
import static org.hypertrace.core.attribute.service.v1.AttributeKind.TYPE_DOUBLE_ARRAY;
import static org.hypertrace.core.attribute.service.v1.AttributeKind.TYPE_INT64;
import static org.hypertrace.core.attribute.service.v1.AttributeKind.TYPE_INT64_ARRAY;
import static org.hypertrace.core.attribute.service.v1.AttributeKind.TYPE_STRING;
import static org.hypertrace.core.attribute.service.v1.AttributeKind.TYPE_STRING_ARRAY;
import static org.hypertrace.core.attribute.service.v1.AttributeKind.TYPE_STRING_MAP;
Expand Down Expand Up @@ -33,6 +35,8 @@ public class AttributeModelTranslator {
.put(TYPE_STRING_MAP, AttributeModelType.STRING_MAP)
.put(TYPE_STRING_ARRAY, AttributeModelType.STRING_ARRAY)
.put(TYPE_DOUBLE_ARRAY, AttributeModelType.DOUBLE_ARRAY)
.put(TYPE_BOOL_ARRAY, AttributeModelType.BOOLEAN_ARRAY)
.put(TYPE_INT64_ARRAY, AttributeModelType.LONG_ARRAY)
.build();

public Optional<AttributeModel> translate(AttributeMetadata attributeMetadata) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ public enum AttributeModelType {
TIMESTAMP,
STRING_MAP,
STRING_ARRAY,
DOUBLE_ARRAY
DOUBLE_ARRAY,
LONG_ARRAY,
BOOLEAN_ARRAY;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ public enum AttributeType {
TIMESTAMP,
STRING_MAP,
STRING_ARRAY,
DOUBLE_ARRAY;
DOUBLE_ARRAY,
LONG_ARRAY,
BOOLEAN_ARRAY;

public static final String TYPE_NAME = "AttributeType";
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.hypertrace.core.graphql.common.utils.attributes;

import static org.hypertrace.core.graphql.attributes.AttributeModelType.BOOLEAN;
import static org.hypertrace.core.graphql.attributes.AttributeModelType.BOOLEAN_ARRAY;
import static org.hypertrace.core.graphql.attributes.AttributeModelType.DOUBLE;
import static org.hypertrace.core.graphql.attributes.AttributeModelType.DOUBLE_ARRAY;
import static org.hypertrace.core.graphql.attributes.AttributeModelType.LONG;
import static org.hypertrace.core.graphql.attributes.AttributeModelType.LONG_ARRAY;
import static org.hypertrace.core.graphql.attributes.AttributeModelType.STRING;
import static org.hypertrace.core.graphql.attributes.AttributeModelType.STRING_ARRAY;
import static org.hypertrace.core.graphql.attributes.AttributeModelType.STRING_MAP;
Expand All @@ -28,6 +30,8 @@ public class AttributeTypeConverter implements Converter<AttributeModelType, Att
.put(STRING_MAP, AttributeType.STRING_MAP)
.put(STRING_ARRAY, AttributeType.STRING_ARRAY)
.put(DOUBLE_ARRAY, AttributeType.DOUBLE_ARRAY)
.put(LONG_ARRAY, AttributeType.LONG_ARRAY)
.put(BOOLEAN_ARRAY, AttributeType.BOOLEAN_ARRAY)
.build();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,11 @@ void testConvert() {
assertEquals(
AttributeType.DOUBLE_ARRAY,
attributeTypeConverter.convert(AttributeModelType.DOUBLE_ARRAY).blockingGet());
assertEquals(
AttributeType.LONG_ARRAY,
attributeTypeConverter.convert(AttributeModelType.LONG_ARRAY).blockingGet());
assertEquals(
AttributeType.BOOLEAN_ARRAY,
attributeTypeConverter.convert(AttributeModelType.BOOLEAN_ARRAY).blockingGet());
}
}

0 comments on commit 1597f9e

Please sign in to comment.