Sevenannn opened a new pull request, #13509: URL: https://github.com/apache/datafusion/pull/13509
## Which issue does this PR close? N/A ## Rationale for this change In Datafusion, the `/` operator is semantically integer division. When both a & b are integer, `a/b` result is a integer rounded down to 0. When unparsing Datafusion logical plan to DuckDB SQL query, the query needs to follow the same semantic meaning of integer division. Therefore, the `Operator::Divide` needs to be unparsed to `BinaryOperator::DuckIntegerDivide`, which is `//` in DuckDB. Reference to DuckDB division operator: https://duckdb.org/docs/sql/functions/numeric.html#division-and-modulo-operators. The `//` operator has the same semantic meaning to Datafusion `/` operator  ## What changes are included in this PR? - Add `division_operator` method in Dialect trait to return the division operator for a specific Dialect - Use `BinaryOperator::DuckIntegerDivide` as the division operator for DuckDB Dialect - Use the `division_operator` of dialect to unparse `Operator::Divide` in Unparser `op_to_sql` method ## Are these changes tested? Yes ## Are there any user-facing changes? All division will be unparsed to `//` instead of `/` for DuckDB Dialect. -- 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 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