use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.
the class CodeBuilder method build.
public CodeDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project project, Users user, Featurestore featurestore, Featuregroup featuregroup, JupyterController.NotebookConversion format) throws ServiceException, FeaturestoreException {
CodeDTO dto = new CodeDTO();
dto.setHref(uri(uriInfo, project, featurestore, featuregroup));
dto.setExpand(expand(resourceRequest));
if (dto.isExpand()) {
AbstractFacade.CollectionInfo<FeaturestoreCode> collectionInfo = codeFacade.findByFeaturegroup(resourceRequest.getOffset(), resourceRequest.getLimit(), resourceRequest.getSort(), resourceRequest.getFilter(), featuregroup);
dto.setCount(collectionInfo.getCount());
for (FeaturestoreCode s : collectionInfo.getItems()) {
dto.addItem(build(uriInfo, resourceRequest, project, user, featuregroup, s, format));
}
}
return dto;
}
use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.
the class CodeBuilder method build.
public CodeDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project project, Users user, Featurestore featurestore, TrainingDataset trainingDataset, JupyterController.NotebookConversion format) throws ServiceException, FeaturestoreException {
CodeDTO dto = new CodeDTO();
dto.setHref(uri(uriInfo, project, featurestore, trainingDataset));
dto.setExpand(expand(resourceRequest));
if (dto.isExpand()) {
AbstractFacade.CollectionInfo<FeaturestoreCode> collectionInfo = codeFacade.findByTrainingDataset(resourceRequest.getOffset(), resourceRequest.getLimit(), resourceRequest.getSort(), resourceRequest.getFilter(), trainingDataset);
dto.setCount(collectionInfo.getCount());
for (FeaturestoreCode s : collectionInfo.getItems()) {
dto.addItem(build(uriInfo, resourceRequest, project, user, trainingDataset, s, format));
}
}
return dto;
}
use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.
the class CodeController method registerCode.
public FeaturestoreCode registerCode(Project project, Users user, Long codeCommitTimeStamp, Long fgCommitId, String applicationId, Featuregroup featuregroup, String entityId, String databricksNotebook, byte[] databricksArchive, CodeActions.RunType type) throws ServiceException, FeaturestoreException {
Inode codeInode = saveCode(project, user, applicationId, featuregroup, entityId, databricksNotebook, databricksArchive, type);
Timestamp commitTime = new Timestamp(codeCommitTimeStamp);
FeaturestoreCode featurestoreCode = new FeaturestoreCode(commitTime, codeInode, featuregroup, applicationId);
if (featuregroup.getFeaturegroupType() == FeaturegroupType.CACHED_FEATURE_GROUP && featuregroup.getCachedFeaturegroup().getTimeTravelFormat() == TimeTravelFormat.HUDI) {
FeatureGroupCommit featureGroupCommit = featureGroupCommitCommitController.findCommitByDate(featuregroup, fgCommitId);
featurestoreCode.setFeatureGroupCommit(featureGroupCommit);
}
return featurestoreCodeFacade.update(featurestoreCode);
}
use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.
the class FeaturestoreCodeFacade method findByFeaturegroup.
public CollectionInfo<FeaturestoreCode> findByFeaturegroup(Integer offset, Integer limit, Set<? extends SortBy> sorts, Set<? extends FilterBy> filters, Featuregroup featuregroup) {
String queryStr = buildQuery("SELECT s from FeaturestoreCode s ", filters, sorts, "s.featureGroup = :featureGroup");
String queryCountStr = buildQuery("SELECT COUNT(s.id) from FeaturestoreCode s ", filters, sorts, "s.featureGroup = :featureGroup");
Query query = em.createQuery(queryStr, FeaturestoreCode.class).setParameter("featureGroup", featuregroup);
Query queryCount = em.createQuery(queryCountStr, FeaturestoreCode.class).setParameter("featureGroup", featuregroup);
setFilter(filters, query);
setFilter(filters, queryCount);
setOffsetAndLim(offset, limit, query);
return new CollectionInfo((Long) queryCount.getSingleResult(), query.getResultList());
}
use of io.hops.hopsworks.persistence.entity.featurestore.code.FeaturestoreCode in project hopsworks by logicalclocks.
the class FeaturestoreCodeFacade method findByTrainingDataset.
public CollectionInfo<FeaturestoreCode> findByTrainingDataset(Integer offset, Integer limit, Set<? extends SortBy> sorts, Set<? extends FilterBy> filters, TrainingDataset trainingDataset) {
String queryStr = buildQuery("SELECT s from FeaturestoreCode s ", filters, sorts, "s.trainingDataset = :trainingDataset");
String queryCountStr = buildQuery("SELECT COUNT(s.id) from FeaturestoreCode s ", filters, sorts, "s.trainingDataset = :trainingDataset");
Query query = em.createQuery(queryStr, FeaturestoreCode.class).setParameter("trainingDataset", trainingDataset);
Query queryCount = em.createQuery(queryCountStr, FeaturestoreCode.class).setParameter("trainingDataset", trainingDataset);
setFilter(filters, query);
setFilter(filters, queryCount);
setOffsetAndLim(offset, limit, query);
return new CollectionInfo((Long) queryCount.getSingleResult(), query.getResultList());
}
Aggregations