#!/usr/bin/env python
# coding: utf-8# In[6]:# encoding=utf-8
# encoding=utf-8
import pandas as pd
import numpy as np
import re
import time
import subprocess,sys
#import logging
from operator import itemgetter
import os
import logging
'''
定义一个类,用于下文进行加载,从而多线程进行数据连接hive
'''
class Get_data: def run_cmd(self,cmdstr,encoding = 'utf-8'):try:res = subprocess.Popen(cmdstr,shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)except Exception as e:raise eprint('===========res============%s'%res)results = []while True:line = res.stdout.readline().decode(encoding)if line == '' and res.poll() is not None:breakelse: