Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -44,10 +44,14 @@ public AdjacentListYaml(org.apache.graphar.info.AdjacentList adjacentList) {
}

public AdjacentList toAdjacentList() {
String adjPrefix = prefix;
if (adjPrefix == null || adjPrefix.isEmpty()) {
adjPrefix = AdjListType.fromOrderedAndAlignedBy(ordered, aligned_by) + "/";
}
return new AdjacentList(
AdjListType.fromOrderedAndAlignedBy(ordered, aligned_by),
FileType.fromString(file_type),
prefix);
adjPrefix);
}

public boolean isOrdered() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,19 @@ public PropertyGroupYaml(PropertyGroup propertyGroup) {
}

public PropertyGroup toPropertyGroup() {
String pgPrefix = prefix;
if (pgPrefix == null || pgPrefix.isEmpty()) {
StringBuilder prefixBuilder = new StringBuilder();
for (PropertyYaml property : properties) {
prefixBuilder.append(property.getName()).append("_");
}
prefixBuilder.append("/");
pgPrefix = prefixBuilder.toString();
}
return new PropertyGroup(
properties.stream().map(PropertyYaml::toProperty).collect(Collectors.toList()),
FileType.fromString(file_type),
prefix);
pgPrefix);
}

public List<PropertyYaml> getProperties() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

package org.apache.graphar.info;

import java.io.IOException;
import java.net.URI;
import org.apache.graphar.info.loader.impl.LocalFileSystemStringGraphInfoLoader;
import org.apache.graphar.info.type.DataType;
import org.junit.Assert;
import org.junit.Before;
Expand All @@ -35,6 +38,7 @@ public void setUp() {
idProperty = TestDataFactory.createIdProperty();
nameProperty = TestDataFactory.createProperty("name", DataType.STRING, false, true);
optionalProperty = TestDataFactory.createProperty("optional", DataType.STRING, false, true);
TestUtil.checkTestData();
}

@Test
Expand Down Expand Up @@ -171,4 +175,19 @@ public void testPropertyImmutability() {
TestVerificationUtils.verifyProperty(prop, "test", true, false);
Assert.assertEquals(DataType.INT32, prop.getDataType());
}

@Test
public void testLoadPropertyDateTypes() throws IOException {
String testDataRoot = TestUtil.getTestData();
String timestampEdge =
testDataRoot + "/ldbc_sample/parquet/person_knows-timestamp_person.edge.yml";
LocalFileSystemStringGraphInfoLoader localFileSystemStringGraphInfoLoader =
new LocalFileSystemStringGraphInfoLoader();
EdgeInfo edgeInfo =
localFileSystemStringGraphInfoLoader.loadEdgeInfo(URI.create(timestampEdge));
Assert.assertTrue(edgeInfo.dump().contains("data_type: timestamp"));
String dateEdge = testDataRoot + "/ldbc_sample/parquet/person_knows-date_person.edge.yml";
edgeInfo = localFileSystemStringGraphInfoLoader.loadEdgeInfo(URI.create(dateEdge));
Assert.assertTrue(edgeInfo.dump().contains("data_type: date"));
}
}