You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/04/01 10:31:31 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #5806: Fix `interval` to use consistent units and arrow parser

alamb commented on code in PR #5806:
URL: https://github.com/apache/arrow-datafusion/pull/5806#discussion_r1155091108


##########
datafusion/core/tests/sqllogictests/test_files/interval.slt:
##########
@@ -23,7 +23,113 @@ select
   arrow_typeof(interval '5 months'),
   arrow_typeof(interval '5 days 3 nanoseconds')
 ----
-Interval(YearMonth) Interval(MonthDayNano)
+Interval(MonthDayNano) Interval(MonthDayNano)
+
+
+## This is incredibly confusing but document it in tests:
+#
+# years is parsed as a column name

Review Comment:
   DataFusion is consistent with postgres so in that sense it is not a bug 
   
   This behavior is due to how the statement is parsed (sqlparser-rs treats `years` as the alias)
   
   It is incredibly confusing (I was confused for a while)
   
   Now that we have proper `Utf8` -> `Interval` parsing (thanks to @doki23 ) in arrow-rs I think the preferred way to create intervals should be `'5 months'::interval` which does the right thing and doesn't have the wacky syntax
   
   



-- 
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-unsubscribe@arrow.apache.org

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