parameters: (self, sql, detail=False)
return_statement: return str(algebra)
docstring: Returns break down of a given query's Logical Relational Algebra plan.
  
          Parameters
          ----------
  
          sql : string SQL query.
          detail : bool to print physical plan
  
          Examples
          --------
  
          Explain this UNION query:
  
          >>> query = '''
          >>>         SELECT a.*
          >>>         FROM taxi_1 as a
          >>>         UNION ALL
          >>>         SELECT b.*
          >>>         FROM taxi_2 as b
          >>>             WHERE b.fare_amount < 100 OR b.passenger_count <> 4
          >>>             '''
          >>> plan = bc.explain(query)
          >>> print(plan)
          LogicalUnion(all=[true])
            LogicalTableScan(table=[[main, taxi_1]])
            BindableTableScan(table=[[main, taxi_2]],
                      filters=[[OR(<($12, 100), <>($3, 4))]])
  
  
          Explain physical plan this UNION query:
  
          >>> query = '''
          >>>         SELECT a.*
          >>>         FROM taxi_1 as a
          >>>         UNION ALL
          >>>         SELECT b.*
          >>>         FROM taxi_2 as b
          >>>             WHERE b.fare_amount < 100 OR b.passenger_count <> 4
          >>>             '''
          >>> plan = bc.explain(query, detail=True)
          >>> print(plan) TODO DFR
          LogicalUnion(all=[true])
            LogicalTableScan(table=[[main, taxi_1]])
            BindableTableScan(table=[[main, taxi_2]],
                      filters=[[OR(<($12, 100), <>($3, 4))]])
  
          Docs: https://docs.blazingdb.com/docs/explain
docstring_summary: Returns break down of a given query's Logical Relational Algebra plan.
docstring_tokens: Returns break down of a given query s Logical Relational Algebra plan .
function: def explain(self, sql, detail=False):
          """
          Returns break down of a given query's Logical Relational Algebra plan.
  
          Parameters
          ----------
  
          sql : string SQL query.
          detail : bool to print physical plan
  
          Examples
          --------
  
          Explain this UNION query:
  
          >>> query = '''
          >>>         SELECT a.*
          >>>         FROM taxi_1 as a
          >>>         UNION ALL
          >>>         SELECT b.*
          >>>         FROM taxi_2 as b
          >>>             WHERE b.fare_amount < 100 OR b.passenger_count <> 4
          >>>             '''
          >>> plan = bc.explain(query)
          >>> print(plan)
          LogicalUnion(all=[true])
            LogicalTableScan(table=[[main, taxi_1]])
            BindableTableScan(table=[[main, taxi_2]],
                      filters=[[OR(<($12, 100), <>($3, 4))]])
  
  
          Explain physical plan this UNION query:
  
          >>> query = '''
          >>>         SELECT a.*
          >>>         FROM taxi_1 as a
          >>>         UNION ALL
          >>>         SELECT b.*
          >>>         FROM taxi_2 as b
          >>>             WHERE b.fare_amount < 100 OR b.passenger_count <> 4
          >>>             '''
          >>> plan = bc.explain(query, detail=True)
          >>> print(plan) TODO DFR
          LogicalUnion(all=[true])
            LogicalTableScan(table=[[main, taxi_1]])
            BindableTableScan(table=[[main, taxi_2]],
                      filters=[[OR(<($12, 100), <>($3, 4))]])
  
          Docs: https://docs.blazingdb.com/docs/explain
          """
          self.lock.acquire()
          try:
              algebra = self.generator.getRelationalAlgebraString(sql)
  
              if detail is True:
                  masterIndex = 0
                  ctxToken = random.randint(0, np.iinfo(np.int32).max)
                  algebra = get_json_plan(str(algebra))
  
                  if self.dask_client is None:
                      physical_plan = cio.runGeneratePhysicalGraphCaller(
                          masterIndex, ["self"], ctxToken, str(algebra)
                      )
                  else:
                      dummy_nodes = [str(i) for i in range(len(self.nodes))]
                      physical_plan = cio.runGeneratePhysicalGraphCaller(
                          masterIndex, dummy_nodes, ctxToken, str(algebra)
                      )
  
          except SqlValidationExceptionClass as exception:
              raise Exception(exception.message())
          except SqlSyntaxExceptionClass as exception:
              raise Exception(exception.message())
          except RelConversionExceptionClass as exception:
              raise Exception(exception.message())
          finally:
              self.lock.release()
  
          if detail is True:
              return format_json_plan(str(physical_plan))
  
          return str(algebra)
function_tokens: def explain ( self , sql , detail = False ) : self . lock . acquire ( ) try : algebra = self . generator . getRelationalAlgebraString ( sql ) if detail is True : masterIndex = 0 ctxToken = random . randint ( 0 , np . iinfo ( np . int32 ) . max ) algebra = get_json_plan ( str ( algebra ) ) if self . dask_client is None : physical_plan = cio . runGeneratePhysicalGraphCaller ( masterIndex , [ "self" ] , ctxToken , str ( algebra ) ) else : dummy_nodes = [ str ( i ) for i in range ( len ( self . nodes ) ) ] physical_plan = cio . runGeneratePhysicalGraphCaller ( masterIndex , dummy_nodes , ctxToken , str ( algebra ) ) except SqlValidationExceptionClass as exception : raise Exception ( exception . message ( ) ) except SqlSyntaxExceptionClass as exception : raise Exception ( exception . message ( ) ) except RelConversionExceptionClass as exception : raise Exception ( exception . message ( ) ) finally : self . lock . release ( ) if detail is True : return format_json_plan ( str ( physical_plan ) ) return str ( algebra )