andygrove commented on code in PR #5858:
URL: https://github.com/apache/datafusion-comet/pull/5858#discussion_r3993984521


##########
spark/src/test/resources/sql-tests/expressions/cast/cast_timestamp_signed_year.sql:
##########
@@ -0,0 +1,80 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements.  See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership.  The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License.  You may obtain a copy of the License at
+--
+--   http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied.  See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+-- Config: spark.sql.ansi.enabled=false
+-- ConfigMatrix: spark.sql.session.timeZone=UTC,+05:30
+
+-- Parquet columns exercise the native parser, including every date/time 
segment shape.
+statement
+CREATE TABLE signed_year_valid(s string) USING parquet
+
+statement
+INSERT INTO signed_year_valid VALUES
+  ('+7528'), ('+00463'), ('+79821'), ('+2976'), ('+0000'), ('+002020'),
+  ('+2020-1'), ('+2020-1-2'), ('+2020-1-2T3'), ('+2020-1-2 3:4'),
+  ('+2020-1-2T3:4:5'), ('+2020-1-2 3:4:5.'), ('+2020-1-2T3:4:5.123456789'),
+  ('+2020-1-2T3:4:5Z'), ('+2020-1-2T3:4:5+05:30'), ('+2020-1-2T3:4:5-08:00'),
+  ('+2020-1-2T3:4:5 UTC'), (' +7528 '), ('-0001'), ('-0001-1-2T3:4:5'), (NULL)
+
+statement
+CREATE TABLE signed_year_invalid(s string) USING parquet
+
+statement
+INSERT INTO signed_year_invalid VALUES
+  ('+'), ('++2020'), ('+-2020'), ('-+2020'), ('--2020'), ('+020'), 
('+0002020'),
+  ('+ 2020'), ('+2020'), ('+2020-+1'), ('+2020--1'), ('+2020-1-+2'),
+  ('+12:12:12'), ('+T12:12:12'), ('+2020Z'), ('+2020-1-2Z'), 
('+2020-1-2T3:4Z'),
+  ('++2020-1-2'), ('+-2020-1-2')

Review Comment:
   The interesting thing the deleted prefilter was doing was keeping 
`+`-leading values away from `extract_offset_suffix`, which scans for the 
rightmost `+` or `-` and tries to read everything from there as a zone offset. 
Now that they reach it, the only thing stopping `+05:30` from being read as an 
empty datetime in zone +05:30, or `+1234+05:30` as year +1234 in zone +05:30, 
is the `ends_with_seconds_segment` guard. None of the entries in this list get 
that far: the closest, `+12:12:12`, is rejected earlier because 
`parse_sign_offset` sees a five-character minute field.
   
   Could you add `+05:30`, `+12:12`, `+1234+05:30`, `+-1234` and `+7528 UTC`? I 
ran all five locally and they agree with Spark today, in legacy, try and ANSI, 
so this is just pinning the branch the fix now leans on.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to