Spark+ES+ClickHouse 构建DMP用户画像

获取ZY:Spark+ES+ClickHouse 构建DMP用户画像 importjava.util.Arrays;
importjava.util.Collections;
importjava.util.List;
publicclassListPageUtil{

/** * 每页显现条数 */ privateintpageSize; /** * 总页数 */ privateintpageCount; /** * 原集合 */ privateListdata; publicListPageUtil(Listdata,intpageSize) { if(data =https://www.it610.com/article/=null|| data.isEmpty()) { thrownewIllegalArgumentException("data must be not empty!"); }this.data = https://www.it610.com/article/data; this.pageSize = pageSize; this.pageCount = data.size()/pageSize; if(data.size()%pageSize!=0){ this.pageCount++; } }/** * 得到分页后的数据 * * @param pageNum 页码 * @return 分页后结果 */ publicListgetPagedList(intpageNum) { intfromIndex = (pageNum -1) * pageSize; if(fromIndex>= data.size()) { returnCollections.emptyList(); }inttoIndex = pageNum * pageSize; if(toIndex >= data.size()) { toIndex = data.size(); } returndata.subList(fromIndex, toIndex); }publicintgetPageSize() { returnpageSize; }publicListgetData() { returndata; }publicintgetPageCount() { returnpageCount; }publicstaticvoidmain(String[] args) { Integer[] array = {1,2,3,4,5,6,7,8,9,10,11,12}; Listlist = Arrays.asList(array); ListPageUtilpager =newListPageUtil(list,10); System.out.println(pager.getPageCount()); Listpage1 = pager.getPagedList(1); System.out.println(page1); Listpage2 = pager.getPagedList(2); System.out.println(page2); Listpage3 = pager.getPagedList(3); System.out.println(page3); }

【Spark+ES+ClickHouse 构建DMP用户画像】}

    推荐阅读