use of io.hops.hopsworks.common.featurestore.feature.FeatureGroupFeatureDTO in project hopsworks by logicalclocks.
the class TestOnlineFeatureGroupController method testBuildAlterStatementDefaultValueOther.
@Test
public void testBuildAlterStatementDefaultValueOther() {
List<FeatureGroupFeatureDTO> features = new ArrayList<>();
features.add(new FeatureGroupFeatureDTO("feature", "float", "", false, "10.0"));
String output = onlineFeaturegroupController.buildAlterStatement("tbl", "db", features);
String expected = "ALTER TABLE `db`.`tbl` ADD COLUMN `feature` float NOT NULL DEFAULT 10.0;";
Assert.assertEquals(expected, output);
}
use of io.hops.hopsworks.common.featurestore.feature.FeatureGroupFeatureDTO in project hopsworks by logicalclocks.
the class TestOnlineFeatureGroupController method testBuildAlterStatementDefaultValueString.
@Test
public void testBuildAlterStatementDefaultValueString() {
List<FeatureGroupFeatureDTO> features = new ArrayList<>();
features.add(new FeatureGroupFeatureDTO("feature", "string", "", false, "defaultValue"));
String output = onlineFeaturegroupController.buildAlterStatement("tbl", "db", features);
String expected = "ALTER TABLE `db`.`tbl` ADD COLUMN `feature` VARCHAR(100) NOT NULL DEFAULT 'defaultValue';";
Assert.assertEquals(expected, output);
}
use of io.hops.hopsworks.common.featurestore.feature.FeatureGroupFeatureDTO in project hopsworks by logicalclocks.
the class TestOnlineFeatureGroupController method testBuildCreateStatementTableSpaceNoDefaultValue.
@Test
public void testBuildCreateStatementTableSpaceNoDefaultValue() {
Mockito.when(settings.getOnlineFeatureStoreTableSpace()).thenReturn("abc");
List<FeatureGroupFeatureDTO> features = new ArrayList<>();
features.add(new FeatureGroupFeatureDTO("pk", "int", "", true, false));
features.add(new FeatureGroupFeatureDTO("feature", "String", "", false, false));
String output = onlineFeaturegroupController.buildCreateStatement("db", "tbl", features);
String expected = "CREATE TABLE IF NOT EXISTS `db`.`tbl`(`pk` int, `feature` VARCHAR(100), PRIMARY KEY (`pk`))" + "ENGINE=ndbcluster COMMENT='NDB_TABLE=READ_BACKUP=1'/*!50100 TABLESPACE `abc` STORAGE DISK */";
Assert.assertEquals(expected, output);
}
use of io.hops.hopsworks.common.featurestore.feature.FeatureGroupFeatureDTO in project hopsworks by logicalclocks.
the class TestOnlineFeatureGroupController method testBuildCreateStatementNoDefaultValue.
@Test
public void testBuildCreateStatementNoDefaultValue() {
Mockito.when(settings.getOnlineFeatureStoreTableSpace()).thenReturn("");
List<FeatureGroupFeatureDTO> features = new ArrayList<>();
features.add(new FeatureGroupFeatureDTO("pk", "int", "", true, false));
features.add(new FeatureGroupFeatureDTO("feature", "String", "", false, false));
String output = onlineFeaturegroupController.buildCreateStatement("db", "tbl", features);
String expected = "CREATE TABLE IF NOT EXISTS `db`.`tbl`(`pk` int, `feature` VARCHAR(100), PRIMARY KEY (`pk`))" + "ENGINE=ndbcluster COMMENT='NDB_TABLE=READ_BACKUP=1'";
Assert.assertEquals(expected, output);
}
Aggregations