use of io.hops.hopsworks.persistence.entity.featurestore.featuregroup.Featuregroup in project hopsworks by logicalclocks.
the class TestJoinController method setup.
@Before
public void setup() {
fs = new Featurestore();
fs.setHiveDbId(1l);
fs.setProject(new Project("test_proj"));
cachedFeaturegroup = new CachedFeaturegroup();
cachedFeaturegroup.setTimeTravelFormat(TimeTravelFormat.NONE);
fg1 = new Featuregroup(1);
fg1.setName("fg1");
fg1.setVersion(1);
fg1.setCachedFeaturegroup(cachedFeaturegroup);
fg1.setFeaturestore(fs);
fg2 = new Featuregroup(2);
fg2.setName("fg2");
fg2.setVersion(1);
fg2.setCachedFeaturegroup(cachedFeaturegroup);
fg2.setFeaturestore(fs);
joinController = new JoinController(new ConstructorController());
}
use of io.hops.hopsworks.persistence.entity.featurestore.featuregroup.Featuregroup in project hopsworks by logicalclocks.
the class TrainingDatasetControllerTest method testConvertToFilterLogic_multipleConditions.
public void testConvertToFilterLogic_multipleConditions() throws Exception {
// fg.feature > 1 and fg.feature > 2
List<TrainingDatasetFilter> filters = new ArrayList<>();
filters.add(createTrainingDatasetFilter(null, AND, "L"));
filters.add(createTrainingDatasetFilter(createTrainingDatasetFilterCondition("test_f", GREATER_THAN, "2", 0), SINGLE, "L.R"));
filters.add(createTrainingDatasetFilter(createTrainingDatasetFilterCondition("test_f", GREATER_THAN, "1", 0), SINGLE, "L.L"));
Map<String, Feature> featureLookup = Maps.newHashMap();
Feature feature = new Feature("test_f", "fg0");
Featuregroup featuregroup = new Featuregroup();
featuregroup.setId(0);
feature.setFeatureGroup(featuregroup);
featureLookup.put("0.test_f", feature);
FilterLogic actual = target.convertToFilterLogic(filters, featureLookup, "L");
Feature f1 = new Feature("test_f", "fg0", null, false, null, null);
f1.setFeatureGroup(featuregroup);
Filter left = new Filter(f1, GREATER_THAN, "1");
Filter right = new Filter(f1, GREATER_THAN, "2");
Assert.assertEquals(actual.getType(), AND);
Assert.assertEquals(actual.getLeftFilter(), left);
Assert.assertNull(actual.getLeftLogic());
Assert.assertEquals(actual.getRightFilter(), right);
Assert.assertNull(actual.getRightLogic());
}
use of io.hops.hopsworks.persistence.entity.featurestore.featuregroup.Featuregroup in project hopsworks by logicalclocks.
the class TestPitJoinController method testAddEventTimeOn.
@Test
public void testAddEventTimeOn() {
Featuregroup fg1 = new Featuregroup(1);
fg1.setEventTime("ts");
List<Feature> oldOn = Collections.singletonList(new Feature("ft1"));
List<Feature> newOn = pitJoinController.addEventTimeOn(oldOn, fg1, "fg0");
Assert.assertEquals(2, newOn.size());
// should respect order
Assert.assertEquals("ts", newOn.get(1).getName());
}
use of io.hops.hopsworks.persistence.entity.featurestore.featuregroup.Featuregroup in project hopsworks by logicalclocks.
the class TestPitJoinController method testIsPitEnabledTrueQuery.
@Test
public void testIsPitEnabledTrueQuery() {
Featuregroup fg1 = new Featuregroup(1);
fg1.setEventTime("ts");
Featuregroup fg2 = new Featuregroup(2);
fg2.setEventTime("ts");
Query right1 = new Query("fs", fg1);
Query right2 = new Query("fs", fg2);
Query leftQuery = new Query("fs", fg1);
Join join1 = new Join(leftQuery, right1, null, null, null, null, null);
Join join2 = new Join(leftQuery, right2, null, null, null, null, null);
List<Join> joins = Arrays.asList(join1, join2);
leftQuery.setJoins(joins);
Assert.assertEquals(true, pitJoinController.isPitEnabled(leftQuery));
}
use of io.hops.hopsworks.persistence.entity.featurestore.featuregroup.Featuregroup in project hopsworks by logicalclocks.
the class TestPitJoinController method testDropIrrelevantSubqueryFeatures.
@Test
public void testDropIrrelevantSubqueryFeatures() {
Featuregroup fg1 = new Featuregroup(1);
Featuregroup fg2 = new Featuregroup(2);
Featuregroup fg3 = new Featuregroup(3);
Query leftQuery = new Query("fs", fg1);
List<Feature> selectedFeatures = Arrays.asList(new Feature(fg1), new Feature(fg2), new Feature(fg1), new Feature(fg3));
leftQuery.setFeatures(selectedFeatures);
Query rightQuery = new Query("fs", fg3);
List<Feature> filteredSelect = pitJoinController.dropIrrelevantSubqueryFeatures(leftQuery, rightQuery);
Assert.assertEquals(3, filteredSelect.size());
}
Aggregations