MaxGekk commented on a change in pull request #31614:
URL: https://github.com/apache/spark/pull/31614#discussion_r582099033



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/types/DayTimeIntervalType.scala
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+package org.apache.spark.sql.types
+
+import scala.math.Ordering
+import scala.reflect.runtime.universe.typeTag
+
+import org.apache.spark.annotation.Unstable
+
+/**
+ * The type represents day-time intervals of the SQL standard. A day-time 
interval is made up
+ * of a contiguous subset of the following fields:
+ *   - SECOND, seconds within minutes and possibly fractions of a second 
[0..59.999999],
+ *   - MINUTE, minutes within hours [0..59],
+ *   - HOUR, hours within days [0..23],
+ *   - DAY, days in the range [0..106751991].

Review comment:
       > how do you get the upper limit?
   
   From the formula below:
   ```python
   >>> 2**63/((60*60*23 + 60 * 59 + 59.999999) * 1000000)
   106751991.1685362
   ```
   even more conservative:
   ```python
   >>> 2**63 / (24 * 60 * 60 * 1000000.0)
   106751991.16730064
   ```
   
   > can this be negative?
   
   Interval value, yes. The field, no, according to SQL:2016:
   <img width="989" alt="Screenshot 2021-02-24 at 19 17 31" 
src="https://user-images.githubusercontent.com/1580697/109030606-ffb30a00-76d4-11eb-9ee4-3c705c6f4a8a.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.

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