beliefer commented on code in PR #50101: URL: https://github.com/apache/spark/pull/50101#discussion_r1974672469
########## sql/core/src/main/scala/org/apache/spark/sql/jdbc/PostgresDialect.scala: ########## @@ -303,12 +303,27 @@ private case class PostgresDialect() class PostgresSQLBuilder extends JDBCSQLBuilder { override def visitExtract(field: String, source: String): String = { - field match { - case "DAY_OF_YEAR" => s"EXTRACT(DOY FROM $source)" - case "YEAR_OF_WEEK" => s"EXTRACT(YEAR FROM $source)" - case "DAY_OF_WEEK" => s"EXTRACT(DOW FROM $source)" - case _ => super.visitExtract(field, source) + // SECOND, MINUTE, HOUR, QUARTER, YEAR, DAY are identical on postgres and spark + // MONTH is different, postgres returns 0-11, spark returns 1-12. + // Postgres also returns 1-12 but just for interval columns, so without source + // data type, we cannot know how to push down it Review Comment: ![Uploading 屏幕快照 2025-02-28 上午10.37.07.png…]() -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org