HuashiSCNU0303 opened a new issue, #781:
URL: https://github.com/apache/datafusion-python/issues/781

   **Describe the bug**
   When a SQL query contains a InList Expr, I can't get the InList object 
through Expr.to_variant().
   
   **To Reproduce**
   ```
   from datafusion import SessionContext
   from datafusion.expr import Filter
   
   
   def traverse_logical_plan(plan):
       cur_node = plan.to_variant()
       if isinstance(cur_node, Filter):
           predicate = cur_node.predicate().to_variant()
       if hasattr(plan, 'inputs'):
           for input_plan in plan.inputs():
               traverse_logical_plan(input_plan)
   
   
   if __name__ == "__main__":
       ctx = SessionContext()
       data = {'id': [1, 2, 3], 'name': ['Alice', 'Bob', 'Charlie']}
       ctx.from_pydict(data, name='table1')
       query = "SELECT * FROM table1 t1 WHERE t1.name IN ('dfa', 'ad', 'dfre', 
'vsa')"
       logical_plan = ctx.sql(query).optimized_logical_plan()
       traverse_logical_plan(logical_plan)
   ```
   
   It produces,
   ```
     File "minimal_example.py", line 8, in traverse_logical_plan
       predicate = cur_node.predicate().to_variant()
   RuntimeError: "Cannot convert this Expr to a Python object: InList(InList { 
expr: Column(Column { relation: Some(Bare { table: \"table1\" }), name: 
\"name\" }), list: [Literal(Utf8(\"dfa\")), Literal(Utf8(\"ad\")), 
Literal(Utf8(\"dfre\")), Literal(Utf8(\"vsa\"))], negated: false })"
   ```
   
   Is there any other method to get the InList object?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to