簡體   English   中英

MapReduce程序,用於比較配置單元輸出和平面文件

[英]MapReduce program for comparing of hive output and a flat file

我想將一個平面文件與蜂巢輸出進行比較。

例::

Hive> select * from hive_table;
abcd,1234
def,456

平面文件包含:

abcd,1234
def,456

因此,我想將兩者與列和行進行比較以進行驗證。

嘗試這個,

List<String> hiveList = new ArrayList<String>(); // add all the output of Hive into the List
        hiveList.add("abcd,1234");
        hiveList.add("def,456");

        List<String> arrayList = new ArrayList<String>(); // add all the data from file into the List
        arrayList.add("abcd,1234");
        arrayList.add("def,456");

        if(hiveList.containsAll(arrayList)) // even a single space value changed this will be false
        {
            System.out.println("Contains");
        }
        else
        {
            System.out.println("Not Contains");
        }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM