4

i have a complex hive query which underlying joins are cartesian product. so i need to set the below properties. but when i execute these properties using pyhive it is not able to execute. i am getting an error asking to set properties for cartesian.

set1 = '''SET hive.strict.checks.cartesian.product=false'''

set2 = '''SET hive.mapred.mode=strict'''

def connectData(query,host,port,username):
    conn = hive.Connection(host=host, port=port, username=username).cursor()
    conn.execute(query)
    val=conn.fetchall()
    columnNames = [a[0] for a in  conn.description]
    df=pd.DataFrame(data=val,columns=columnNames)
    return df

def settings(query,host,port,username):
    conn = hive.Connection(host=host, port=port, username=username).cursor()
    conn.execute(query)

settings(set1, host, port, username)
settings(set2, host, port, username)

df = connectData(query, host, port, username)
print(df)
leftjoin
  • 36,950
  • 8
  • 57
  • 116
LUZO
  • 1,019
  • 4
  • 19
  • 42

1 Answers1

3

Try settings as shown below:

hive.connect('host', configuration={'hive.strict.checks.cartesian.product':'false'})
hive.connect('host', configuration={'hive.mapred.mode':'strict'})
vikrant rana
  • 4,509
  • 6
  • 32
  • 72