我想将平面文件与配置单元输出进行比较。
例子::
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");
}