relpipe-data/examples/parallel-hashes-1.sh
branchv_0
changeset 294 abbc9bcfbcc4
equal deleted inserted replaced
293:b862d16a2e9f 294:abbc9bcfbcc4
       
     1 #!/bin/bash
       
     2 
       
     3 findFiles() {
       
     4 	find /bin/ -print0;
       
     5 }
       
     6 
       
     7 fetchAttributes() {
       
     8 	relpipe-in-filesystem \
       
     9 		--parallel 4 \
       
    10 		--file path \
       
    11 		--file type \
       
    12 		--file size \
       
    13 		--streamlet hash;
       
    14 }
       
    15 
       
    16 aggregate() {
       
    17 	relpipe-tr-sql \
       
    18 		--relation "file_hashes" \
       
    19 		"SELECT
       
    20 			path,
       
    21 			type,
       
    22 			size,
       
    23 			sha256,
       
    24 			count(*) OVER (PARTITION BY sha256) AS same_hash_count
       
    25 		FROM filesystem
       
    26 		ORDER BY same_hash_count, sha256, path, type";
       
    27 }
       
    28 
       
    29 findFiles | fetchAttributes | aggregate | relpipe-out-tabular