
获得徽章 0
- 苹果m1,使用docker安装mysql的时候会遇到:No Matching Manifest For Linux/Arm64/V8 Docker MySql,可以通过docker-compose.yml直接来安装评论点赞
- #Linux小知识# 使用uptime或者top查看cpu负载的时候,出现的load代表的是cpu的繁忙情况,取值代表跑满一个核,cpu的核数可以通过/pro/cpuinfo 查看,一般超过核数的就代表系统忙了,我一般设置的报警值是70%。评论点赞
- 最近在跟公司用户画像相关的项目,里面用到Apache Icebery,主要是解决使用Hive分区过多的导致查询的时候metastore慢的问题,看官方文档,里面讲到跟Icebery的介绍是“Apache Iceberg is an open table format for huge analytic datasets. Iceberg adds tables to Presto and Spark that use a high-performance format that works just like a SQL table.” 这是说为Spark和Presto而生么?#大数据#展开评论点赞
- Java 8 确实可以减少很多代码量,看下面这个例子
public Set<String> findLongTracks(List<Album> albums){
Set<String> trackNames = new HashSet<>();
for (Album album: albums){
for (Track track: album.getTraceList()){
if (track.getLength() > 60){
String name = track.getName();
trackNames.add(name);
}
}
}
return trackNames;
}
------------------
public Set<String> findLongTracks(List<Album> albums) {
Set<String> trackNames = new HashSet<>();
albums.stream().flatMap(album -> album.getTraceList().stream()).
filter(track -> track.getLength() > 60).
map(track -> track.getName()).collect(Collectors.toSet());
return trackNames;
}展开评论点赞 - #每天学点编程知识#
Java8 里面的stream 中的min和max 本质都是reduce操作,reduce不是hadoop里面的recude,这里我理解为一种迭代的过程
比方说,求和,可以写成这样
int count = Stream.of(1, 2, 3).reduce(0, (acc, element) -> acc + element);
(acc, element) -> acc + element 是一个 BinaryOperator
拆分一下的话,就是
BinaryOperator<Integer> accumulator = (acc, element) -> acc + element;
count = accumulator.apply(accumulator.apply(accumulator.apply(0, 1), 2), 3);
不停地累加展开评论点赞 - Java 8 确实写起来,代码量确实少很多
```
List<String> collected = Stream.of("a", "b", "c").collect(Collectors.toList());
List<String> toUpperCase = Stream.of("a", "b", "hello").map(string -> string.toUpperCase()).collect(Collectors.toList());
List<Integer> together = Stream.of(asList(1,2), asList(3,4)).flatMap(numbers -> numbers.stream()).collect(Collectors.toList());
```展开评论点赞