【问题标题】:Hive UDF performance too slowHive UDF 性能太慢
【发布时间】:2014-06-25 18:53:27
【问题描述】:

我已经在 Select query where condition 中使用 Custom Hive UDF 函数执行了 Hive SQL 脚本,它已经运行了两天多。 我想知道这里到底有什么问题?调用java需要很多时间还是查询执行它自己需要很多时间?

我的数据集如下, 表 A 有 200 万条记录, 表 B 有 100 万条记录,

示例查询如下

选择**** 从 (选择 * 从 A A1 WHERE A1.ds in ('2014-06-11', '2014-06-12') ) A1 左外连接 (选择 * 从 B B1 WHERE B1.ds in ('2014-06-11', '2014-06-12') ) B1 where customUDF(A1.data, B1.data)

这可能是什么问题?是否有任何 Hive 脚本分析工具可用于查找确切的时间?

【问题讨论】:

    标签: hive database-performance


    【解决方案1】:

    假设您可以访问 UDF,您可以在函数中添加以下内容(sudo 代码):

    long start = System.currentTimeMillis();
    MapredContext context = MapredContext.get();
    Reporter reporter = context.getReporter();
    String group = "instrumentation.udf";
    String counter = "customUDF";
    
    // function business logic
    
    long elapsed = System.currentTimeMillis() - start;
    reporter.incrCounter(group, counter, elapsed);
    

    【讨论】:

    • 感谢您的回答。没有这样的类称为 MapredContext :(
    • 有什么更新吗?谁能帮助我们解决性能问题?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多