相关疑难解决方法(0)

PIG如何计算别名中的多个行

我做了类似这样的事情来计算PIG中别名的行数:

logs = LOAD 'log'
logs_w_one = foreach logs generate 1 as one;
logs_group = group logs_w_one all;
logs_count = foreach logs_group generate SUM(logs_w_one.one);
dump logs_count;
Run Code Online (Sandbox Code Playgroud)

这似乎效率太低.如果有更好的方法请赐教!

hadoop apache-pig

50
推荐指数
5
解决办法
10万
查看次数

如何获取大文件的行数,至少5G

如何获取大文件的行数,至少5G.使用shell的最快方法.

shell file-io

10
推荐指数
2
解决办法
4223
查看次数

如何加速hadoop上的tensorflow执行?

以下脚本执行速度非常慢.我只想计算twitter-follwer-graph中的总行数(文本文件大约为26 GB).

我需要执行机器学习任务.这只是通过tensorflow从hdfs访问数据的测试.

import tensorflow as tf
import time

filename_queue = tf.train.string_input_producer(["hdfs://default/twitter/twitter_rv.net"], num_epochs=1, shuffle=False)

def read_filename_queue(filename_queue):
    reader = tf.TextLineReader()
    _, line = reader.read(filename_queue)
    return line

line = read_filename_queue(filename_queue)

session_conf = tf.ConfigProto(intra_op_parallelism_threads=1500,inter_op_parallelism_threads=1500)

with tf.Session(config=session_conf) as sess:
    sess.run(tf.initialize_local_variables())
    coord = tf.train.Coordinator()
    threads = tf.train.start_queue_runners(coord=coord)

    start = time.time()
    i = 0
    while True:
        i = i + 1
        if i%100000 == 0:
            print(i)
            print(time.time() - start)

        try:
            sess.run([line])
        except tf.errors.OutOfRangeError:
            print('end of file')
            break
    print('total number of lines = ' + …
Run Code Online (Sandbox Code Playgroud)

python hadoop hdfs tensorflow

6
推荐指数
1
解决办法
616
查看次数

标签 统计

hadoop ×2

apache-pig ×1

file-io ×1

hdfs ×1

python ×1

shell ×1

tensorflow ×1