def formatJoin()

in aiops/RCRank/model/modules/QueryFormer/utils.py [0:0]


def formatJoin(json_node):
   
    join = None
    if 'Hash Cond' in json_node:
        join = json_node['Hash Cond']
    elif 'Join Filter' in json_node:
        join = json_node['Join Filter']
    elif 'Index Cond' in json_node and not json_node['Index Cond'][-2].isnumeric():
        join = json_node['Index Cond']
    
    if join is not None:

        twoCol = join[1:-1].split(' = ')
        twoCol = [json_node['Alias'] + '.' + col 
                  if len(col.split('.')) == 1 and 'Alias' in json_node.keys() else col for col in twoCol ] 
        join = ' = '.join(sorted(twoCol))
    
    return join