You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/04/17 04:05:30 UTC
[GitHub] [spark] huaxingao opened a new pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
huaxingao opened a new pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237
### What changes were proposed in this pull request?
Document Literal in SQL Reference
### Why are the changes needed?
Make SQL Reference complete
### Does this PR introduce any user-facing change?
Yes
<img width="1000" alt="Screen Shot 2020-04-16 at 8 58 23 PM" src="https://user-images.githubusercontent.com/13592258/79530770-29b38e80-8025-11ea-95ad-fac0461f57b9.png">
<img width="1000" alt="Screen Shot 2020-04-16 at 8 58 53 PM" src="https://user-images.githubusercontent.com/13592258/79530772-2b7d5200-8025-11ea-9ae0-b713d249079b.png">
<img width="1000" alt="Screen Shot 2020-04-16 at 8 59 17 PM" src="https://user-images.githubusercontent.com/13592258/79530776-2f10d900-8025-11ea-9ccc-095edc436376.png">
### How was this patch tested?
Manually build and check
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615508468
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121431/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615030786
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26075/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615536809
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410542464
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,378 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
Review comment:
I think ```<em>``` makes the format a little prettier.
<img width="821" alt="Screen Shot 2020-04-17 at 6 36 45 PM" src="https://user-images.githubusercontent.com/13592258/79624979-7efda780-80da-11ea-86a4-ad3a4ad36600.png">
vs.
<img width="792" alt="Screen Shot 2020-04-17 at 6 36 00 PM" src="https://user-images.githubusercontent.com/13592258/79624983-8329c500-80da-11ea-80d2-cd696cf4bb96.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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410658795
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
Review comment:
How about putting the info in the `#### Parameters` section?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615513655
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26116/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615030786
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26075/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615534906
**[Test build #121438 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121438/testReport)** for PR 28237 at commit [`39862ae`](https://github.com/apache/spark/commit/39862aed22e5cf5f8d207526683c94efc50076ee).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410012747
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
+ c: one character of user's character set.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>'Hello, World!', 'Spark SQL', 'dbname.schema'</code>
+ </dd>
+</dl>
+
+### Boolean Literals
+
+A boolean literal is used to specify a boolean value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>TRUE | FALSE </code>
+ </dd>
+</dl>
+
+### Numeric Literals
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>[ + | - ] digit [ ... ] [ l | L ]</code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9 <br>
+ l or L: indicates <code>LongType</code>.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>6, +188, -54, 1000L</code>
+ </dd>
+</dl>
+
+#### Floating Point and Decimal Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ [ + | - ] { digit [ ... ] [ . ] [ digit [ ... ] ] | . digit [ ... ] } <br>
+ [ { e | E } [ + | - ] digit [ ... ] ] [ d | D ]
+ </code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+ e or E: indicates that the number is in scientific notation format. <br>
+ d or D: indicates <code>DoubleType</code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>5E2, 3.e6, 2.3E-2, +3.e+3, -4D, 0.25</code>
+ </dd>
+</dl>
+
+### Datetime Literals
+
+A Datetime literal is used to specify a datetime data type value.
+
+#### Date Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ DATE 'YYYY-MM-DD'
+ </code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>DATE '2011-11-11'</code>
+ </dd>
+</dl>
+
+#### Timestamp Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ TIMESTAMP yyyy-MM-dd HH:mm[:ss.SSSSSSzzz]
+ </code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>TIMESTAMP '1997-01-31 09:26:56.123'</code><br>
+ <code>TIMESTAMP '1997-01-31 09:26:56.66666666CST'</code>
+ </dd>
+</dl>
+
+### Interval Literals
+
+An inerval literal is used to specify a fixed period of time.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ INTERVAL value { YEAR | MONTH | DAY | HOUR | MINUTE | SECOND | MILLISECOND | MICROSECOND }
Review comment:
should be` {value unit}+`
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615535066
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26122/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615034264
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121391/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615519206
**[Test build #121435 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121435/testReport)** for PR 28237 at commit [`2059414`](https://github.com/apache/spark/commit/2059414001fd4e95febe09aea18bcce809d50d22).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615503627
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26115/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410809690
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
Review comment:
I think we need this to differentiate it from the default case, which is described as a 4-byte signed integer number.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615519523
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615519529
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26119/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410660331
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | . digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] }
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicate a 4-byte single-precision floating point number.<br>
+D: case insensitive, indicates <code>DOUBLE</code>, which is a 8-byte double-precision floating point number.<br>
+BD: case insensitive, indicates <code>BIGDECIMAL</code>, which is an arbitrary-precision signed decimal number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 5E2 AS col;
+ +-----+
+ | col|
+ +-----+
+ |500.0|
+ +-----+
+
+SELECT 5D AS col;
+ +---+
+ |col|
+ +---+
+ |5.0|
+ +---+
+
+SELECT -5BD AS col;
+ +---+
+ |col|
+ +---+
+ |-5 |
+ +---+
+
+SELECT 12.578e-2d AS col;
+ +-------+
+ | col|
+ +-------+
+ |0.12578|
+ +-------+
+
+SELECT -.1234567E+2BD AS col;
+ +---------+
+ | col|
+ +---------+
+ |-12.34567|
+ +---------+
+
+SELECT +3.e+3 AS col;
+ +------+
+ | col|
+ +------+
+ |3000.0|
+ +------+
+
+SELECT -3.E-3D AS col;
+ +------+
+ | col|
+ +------+
+ |-0.003|
+ +------+
+{% endhighlight %}
+
+### Datetime Literal
+
Review comment:
Could you double-check this section? @MaxGekk @yaooqinn
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615521152
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410012037
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
+ c: one character of user's character set.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>'Hello, World!', 'Spark SQL', 'dbname.schema'</code>
+ </dd>
+</dl>
+
+### Boolean Literals
+
+A boolean literal is used to specify a boolean value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>TRUE | FALSE </code>
+ </dd>
+</dl>
+
+### Numeric Literals
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>[ + | - ] digit [ ... ] [ l | L ]</code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9 <br>
+ l or L: indicates <code>LongType</code>.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>6, +188, -54, 1000L</code>
+ </dd>
+</dl>
+
+#### Floating Point and Decimal Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ [ + | - ] { digit [ ... ] [ . ] [ digit [ ... ] ] | . digit [ ... ] } <br>
+ [ { e | E } [ + | - ] digit [ ... ] ] [ d | D ]
+ </code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+ e or E: indicates that the number is in scientific notation format. <br>
+ d or D: indicates <code>DoubleType</code>
Review comment:
let's mention BD as well, and mention what's the data type without postfix.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615503108
**[Test build #121431 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121431/testReport)** for PR 28237 at commit [`7628fb8`](https://github.com/apache/spark/commit/7628fb8f59ce01041685e0501ce980169ea85e6a).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615536812
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121438/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] viirya commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410511766
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
+ c: one character of user's character set.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>'Hello, World!', 'Spark SQL', 'dbname.schema'</code>
+ </dd>
+</dl>
+
+### Boolean Literals
+
+A boolean literal is used to specify a boolean value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>TRUE | FALSE </code>
+ </dd>
+</dl>
+
+### Numeric Literals
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>[ + | - ] digit [ ... ] [ l | L ]</code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9 <br>
+ l or L: indicates <code>LongType</code>.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>6, +188, -54, 1000L</code>
+ </dd>
+</dl>
+
+#### Floating Point and Decimal Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ [ + | - ] { digit [ ... ] [ . ] [ digit [ ... ] ] | . digit [ ... ] } <br>
+ [ { e | E } [ + | - ] digit [ ... ] ] [ d | D ]
+ </code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+ e or E: indicates that the number is in scientific notation format. <br>
+ d or D: indicates <code>DoubleType</code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>5E2, 3.e6, 2.3E-2, +3.e+3, -4D, 0.25</code>
+ </dd>
+</dl>
+
+### Datetime Literals
+
+A Datetime literal is used to specify a datetime data type value.
+
+#### Date Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ DATE 'YYYY-MM-DD'
+ </code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>DATE '2011-11-11'</code>
+ </dd>
+</dl>
+
+#### Timestamp Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ TIMESTAMP yyyy-MM-dd HH:mm[:ss.SSSSSSzzz]
Review comment:
I think `yyyy`, `yyyy-mm`, `yyyy-mm-dd`...also work.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615030784
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410661889
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
Review comment:
We don't need to describe array/map literals?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410916091
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | . digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] }
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicate a 4-byte single-precision floating point number.<br>
+D: case insensitive, indicates <code>DOUBLE</code>, which is a 8-byte double-precision floating point number.<br>
+BD: case insensitive, indicates <code>BIGDECIMAL</code>, which is an arbitrary-precision signed decimal number.<br>
Review comment:
Where should we document them? I think we should do somewhere.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616024663
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410916442
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,505 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### Syntax
+
+{% highlight sql %}
+'c [ ... ]' | "c [ ... ]"
+{% endhighlight %}
+
+#### <em>Parameters</em>
+
+<dl>
+ <dt><code><em>c</em></code></dt>
+ <dd>
+ One character from the character set. Use <code>\</code> to escape special characters.
+ </dd>
+</dl>
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +---------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### Syntax
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### Examples
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### Syntax
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### Examples
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### Syntax
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+
+#### Parameters
+
+<dl>
+ <dt><code><em>digit</em></code></dt>
+ <dd>
+ Any numeral from 0 to 9.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>L</em></code></dt>
+ <dd>
+ Case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>S</em></code></dt>
+ <dd>
+ Case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Y</em></code></dt>
+ <dd>
+ Case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>default (no postfix)</em></code></dt>
+ <dd>
+ Indicates a 4-byte signed integer number.
+ </dd>
+</dl>
+#### Examples
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### Syntax
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
Review comment:
Can we remove a space in the head?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410660767
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
Review comment:
nit: how about using the same format, 4 indents, in the Syntax section?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410979265
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | . digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] }
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicate a 4-byte single-precision floating point number.<br>
+D: case insensitive, indicates <code>DOUBLE</code>, which is a 8-byte double-precision floating point number.<br>
+BD: case insensitive, indicates <code>BIGDECIMAL</code>, which is an arbitrary-precision signed decimal number.<br>
Review comment:
I re-arranged data types page to add these floating point special values. Here is the PR https://github.com/apache/spark/pull/28264
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615034264
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121391/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410526295
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,378 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'c [ ... ]' | "c [ ... ]"
+{% endhighlight %}
+c: one character of the user's character set.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ |col |
Review comment:
nit: makes it right-aligned.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615513655
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26116/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615535064
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616028195
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121469/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615519529
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26119/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615034259
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616217960
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616217966
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121487/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615534906
**[Test build #121438 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121438/testReport)** for PR 28237 at commit [`39862ae`](https://github.com/apache/spark/commit/39862aed22e5cf5f8d207526683c94efc50076ee).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615034139
**[Test build #121391 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121391/testReport)** for PR 28237 at commit [`71353a0`](https://github.com/apache/spark/commit/71353a02e979f71c6bb5dd3733a5d293a48e1731).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410661621
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | . digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] }
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
Review comment:
nit: `one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9` -> `any number` or `any number from 0 to 9`?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615513649
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410809649
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | . digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] }
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicate a 4-byte single-precision floating point number.<br>
+D: case insensitive, indicates <code>DOUBLE</code>, which is a 8-byte double-precision floating point number.<br>
+BD: case insensitive, indicates <code>BIGDECIMAL</code>, which is an arbitrary-precision signed decimal number.<br>
Review comment:
I think strictly speaking, infinity, nan are not constants, because ```SELECT infinity``` doesn't work, so I guess no need to document these here.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616028195
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121469/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615521107
**[Test build #121435 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121435/testReport)** for PR 28237 at commit [`2059414`](https://github.com/apache/spark/commit/2059414001fd4e95febe09aea18bcce809d50d22).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616024667
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26153/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615508468
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121431/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] MaxGekk commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
MaxGekk commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410662178
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | . digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] }
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicate a 4-byte single-precision floating point number.<br>
+D: case insensitive, indicates <code>DOUBLE</code>, which is a 8-byte double-precision floating point number.<br>
+BD: case insensitive, indicates <code>BIGDECIMAL</code>, which is an arbitrary-precision signed decimal number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 5E2 AS col;
+ +-----+
+ | col|
+ +-----+
+ |500.0|
+ +-----+
+
+SELECT 5D AS col;
+ +---+
+ |col|
+ +---+
+ |5.0|
+ +---+
+
+SELECT -5BD AS col;
+ +---+
+ |col|
+ +---+
+ |-5 |
+ +---+
+
+SELECT 12.578e-2d AS col;
+ +-------+
+ | col|
+ +-------+
+ |0.12578|
+ +-------+
+
+SELECT -.1234567E+2BD AS col;
+ +---------+
+ | col|
+ +---------+
+ |-12.34567|
+ +---------+
+
+SELECT +3.e+3 AS col;
+ +------+
+ | col|
+ +------+
+ |3000.0|
+ +------+
+
+SELECT -3.E-3D AS col;
+ +------+
+ | col|
+ +------+
+ |-0.003|
+ +------+
+{% endhighlight %}
+
+### Datetime Literal
+
+A Datetime literal is used to specify a datetime value.
+
+#### Date Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+DATE 'yyyy [ -MM-dd ]'
Review comment:
Actual patterns https://github.com/apache/spark/blob/744c2480b580e0b68387328926ef7634cfb93adc/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala#L440-L445
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615535064
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616024667
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26153/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410012985
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
+ c: one character of user's character set.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>'Hello, World!', 'Spark SQL', 'dbname.schema'</code>
+ </dd>
+</dl>
+
+### Boolean Literals
+
+A boolean literal is used to specify a boolean value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>TRUE | FALSE </code>
+ </dd>
+</dl>
+
+### Numeric Literals
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>[ + | - ] digit [ ... ] [ l | L ]</code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9 <br>
+ l or L: indicates <code>LongType</code>.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>6, +188, -54, 1000L</code>
+ </dd>
+</dl>
+
+#### Floating Point and Decimal Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ [ + | - ] { digit [ ... ] [ . ] [ digit [ ... ] ] | . digit [ ... ] } <br>
+ [ { e | E } [ + | - ] digit [ ... ] ] [ d | D ]
+ </code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+ e or E: indicates that the number is in scientific notation format. <br>
+ d or D: indicates <code>DoubleType</code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>5E2, 3.e6, 2.3E-2, +3.e+3, -4D, 0.25</code>
+ </dd>
+</dl>
+
+### Datetime Literals
+
+A Datetime literal is used to specify a datetime data type value.
+
+#### Date Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ DATE 'YYYY-MM-DD'
+ </code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>DATE '2011-11-11'</code>
+ </dd>
+</dl>
+
+#### Timestamp Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ TIMESTAMP yyyy-MM-dd HH:mm[:ss.SSSSSSzzz]
+ </code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>TIMESTAMP '1997-01-31 09:26:56.123'</code><br>
+ <code>TIMESTAMP '1997-01-31 09:26:56.66666666CST'</code>
+ </dd>
+</dl>
+
+### Interval Literals
+
+An inerval literal is used to specify a fixed period of time.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ INTERVAL value { YEAR | MONTH | DAY | HOUR | MINUTE | SECOND | MILLISECOND | MICROSECOND }
Review comment:
and we also support `INTERVAL str unit TO unit`.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410210113
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
Review comment:
nit: add one blank.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410809664
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
Review comment:
I added the escape description, but I reverted to the original syntax for string, because we always use ```...``` to mean ```the preceding element can be repeated```.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615503627
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26115/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] viirya commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410512109
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
+ c: one character of user's character set.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>'Hello, World!', 'Spark SQL', 'dbname.schema'</code>
+ </dd>
+</dl>
+
+### Boolean Literals
+
+A boolean literal is used to specify a boolean value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>TRUE | FALSE </code>
+ </dd>
+</dl>
+
+### Numeric Literals
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>[ + | - ] digit [ ... ] [ l | L ]</code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9 <br>
+ l or L: indicates <code>LongType</code>.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>6, +188, -54, 1000L</code>
+ </dd>
+</dl>
+
+#### Floating Point and Decimal Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ [ + | - ] { digit [ ... ] [ . ] [ digit [ ... ] ] | . digit [ ... ] } <br>
+ [ { e | E } [ + | - ] digit [ ... ] ] [ d | D ]
+ </code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+ e or E: indicates that the number is in scientific notation format. <br>
+ d or D: indicates <code>DoubleType</code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>5E2, 3.e6, 2.3E-2, +3.e+3, -4D, 0.25</code>
+ </dd>
+</dl>
+
+### Datetime Literals
+
+A Datetime literal is used to specify a datetime data type value.
+
+#### Date Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ DATE 'YYYY-MM-DD'
+ </code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>DATE '2011-11-11'</code>
+ </dd>
+</dl>
+
+#### Timestamp Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ TIMESTAMP yyyy-MM-dd HH:mm[:ss.SSSSSSzzz]
Review comment:
And even just time part, e.g. `hh:mm:ss`, etc.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410526234
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,378 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'c [ ... ]' | "c [ ... ]"
Review comment:
I feel the format `'c [ ... ]'` is a bit unclear... how about just saying `'...' | "..."` and then saying it like, `...` means any string? Also, could you describe an escape for meta characters?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616217902
**[Test build #121487 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121487/testReport)** for PR 28237 at commit [`37f5baa`](https://github.com/apache/spark/commit/37f5baa6e2eaba6538edbc0a6da5bb305caf011a).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615535066
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26122/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410809705
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
Review comment:
I think array and map are functions instead of constants, so no need to document these here.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615521158
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121435/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616028189
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615030484
**[Test build #121391 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121391/testReport)** for PR 28237 at commit [`71353a0`](https://github.com/apache/spark/commit/71353a02e979f71c6bb5dd3733a5d293a48e1731).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616216145
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410809622
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,378 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
Review comment:
OK I will remove <em>
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616028189
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615508463
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616215986
**[Test build #121487 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121487/testReport)** for PR 28237 at commit [`37f5baa`](https://github.com/apache/spark/commit/37f5baa6e2eaba6538edbc0a6da5bb305caf011a).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615521152
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615030784
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410012595
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
+ c: one character of user's character set.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>'Hello, World!', 'Spark SQL', 'dbname.schema'</code>
+ </dd>
+</dl>
+
+### Boolean Literals
+
+A boolean literal is used to specify a boolean value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>TRUE | FALSE </code>
+ </dd>
+</dl>
+
+### Numeric Literals
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>[ + | - ] digit [ ... ] [ l | L ]</code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9 <br>
+ l or L: indicates <code>LongType</code>.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>6, +188, -54, 1000L</code>
+ </dd>
+</dl>
+
+#### Floating Point and Decimal Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ [ + | - ] { digit [ ... ] [ . ] [ digit [ ... ] ] | . digit [ ... ] } <br>
+ [ { e | E } [ + | - ] digit [ ... ] ] [ d | D ]
+ </code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+ e or E: indicates that the number is in scientific notation format. <br>
+ d or D: indicates <code>DoubleType</code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>5E2, 3.e6, 2.3E-2, +3.e+3, -4D, 0.25</code>
+ </dd>
+</dl>
+
+### Datetime Literals
+
+A Datetime literal is used to specify a datetime data type value.
+
+#### Date Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ DATE 'YYYY-MM-DD'
+ </code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>DATE '2011-11-11'</code>
+ </dd>
+</dl>
+
+#### Timestamp Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ TIMESTAMP yyyy-MM-dd HH:mm[:ss.SSSSSSzzz]
Review comment:
It's actually `yyyy-MM-dd [HH:mm:ss.SSSSSSzzz]`, `TIMESTAMP'2011-11-11'` also works
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615536809
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410206575
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
Review comment:
nit: `aka constant` -> `also known as constants`? I personally think its better not to use abbreviation for official documents where possible.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410207290
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
Review comment:
If we list up contents here, I think its better to use hyper-links.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410660201
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
Review comment:
Your forgot to describe escapes here? https://github.com/apache/spark/pull/28237#discussion_r410526234
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615513351
**[Test build #121432 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121432/testReport)** for PR 28237 at commit [`c8c768f`](https://github.com/apache/spark/commit/c8c768f2e61f687c4d654abca369dc172bfbb875).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410661840
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
Review comment:
We need `, which is a 8-byte signed integer number.`? It seems we've already describe them in the `Data Types` section.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410011853
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
+ c: one character of user's character set.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>'Hello, World!', 'Spark SQL', 'dbname.schema'</code>
+ </dd>
+</dl>
+
+### Boolean Literals
+
+A boolean literal is used to specify a boolean value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>TRUE | FALSE </code>
+ </dd>
+</dl>
+
+### Numeric Literals
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>[ + | - ] digit [ ... ] [ l | L ]</code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9 <br>
+ l or L: indicates <code>LongType</code>.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>6, +188, -54, 1000L</code>
+ </dd>
+</dl>
+
+#### Floating Point and Decimal Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ [ + | - ] { digit [ ... ] [ . ] [ digit [ ... ] ] | . digit [ ... ] } <br>
+ [ { e | E } [ + | - ] digit [ ... ] ] [ d | D ]
+ </code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+ e or E: indicates that the number is in scientific notation format. <br>
Review comment:
which is double type
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615517519
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] MaxGekk commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
MaxGekk commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410662287
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | . digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] }
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicate a 4-byte single-precision floating point number.<br>
+D: case insensitive, indicates <code>DOUBLE</code>, which is a 8-byte double-precision floating point number.<br>
+BD: case insensitive, indicates <code>BIGDECIMAL</code>, which is an arbitrary-precision signed decimal number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 5E2 AS col;
+ +-----+
+ | col|
+ +-----+
+ |500.0|
+ +-----+
+
+SELECT 5D AS col;
+ +---+
+ |col|
+ +---+
+ |5.0|
+ +---+
+
+SELECT -5BD AS col;
+ +---+
+ |col|
+ +---+
+ |-5 |
+ +---+
+
+SELECT 12.578e-2d AS col;
+ +-------+
+ | col|
+ +-------+
+ |0.12578|
+ +-------+
+
+SELECT -.1234567E+2BD AS col;
+ +---------+
+ | col|
+ +---------+
+ |-12.34567|
+ +---------+
+
+SELECT +3.e+3 AS col;
+ +------+
+ | col|
+ +------+
+ |3000.0|
+ +------+
+
+SELECT -3.E-3D AS col;
+ +------+
+ | col|
+ +------+
+ |-0.003|
+ +------+
+{% endhighlight %}
+
+### Datetime Literal
+
+A Datetime literal is used to specify a datetime value.
+
+#### Date Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+DATE 'yyyy [ -MM-dd ]'
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT DATE '1997' AS col;
+ +----------+
+ | col|
+ +----------+
+ |1997-01-01|
+ +----------+
+
+SELECT TIMESTAMP '1997-01' AS col;
+ +----------+
+ | col|
+ +----------+
+ |1997-01-01|
+ +----------+
+
+SELECT DATE '2011-11-11' AS col;
+ +----------+
+ | col|
+ +----------+
+ |2011-11-11|
+ +----------+
+{% endhighlight %}
+
+#### Timestamp Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TIMESTAMP { 'yyyy [ -MM-dd HH:mm:ss.SSSSSSzzz ]' | '[ yyyy-MM-dd ] HH:mm [ :ss.SSSSSSzzz ]' }
Review comment:
Here are the patterns https://github.com/apache/spark/blob/744c2480b580e0b68387328926ef7634cfb93adc/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala#L257-L276
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615513649
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410526390
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,378 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
Review comment:
nit: We need `<em>`here to follow the other format?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410208094
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
+ c: one character of user's character set.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
Review comment:
How about using the example format below along with the other documents?
```
#### Examples
{% highlight sql %}
SELECT 'Hello, World!';
...
{% endhighlight %}
```
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410809710
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | . digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] }
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicate a 4-byte single-precision floating point number.<br>
+D: case insensitive, indicates <code>DOUBLE</code>, which is a 8-byte double-precision floating point number.<br>
+BD: case insensitive, indicates <code>BIGDECIMAL</code>, which is an arbitrary-precision signed decimal number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 5E2 AS col;
+ +-----+
+ | col|
+ +-----+
+ |500.0|
+ +-----+
+
+SELECT 5D AS col;
+ +---+
+ |col|
+ +---+
+ |5.0|
+ +---+
+
+SELECT -5BD AS col;
+ +---+
+ |col|
+ +---+
+ |-5 |
+ +---+
+
+SELECT 12.578e-2d AS col;
+ +-------+
+ | col|
+ +-------+
+ |0.12578|
+ +-------+
+
+SELECT -.1234567E+2BD AS col;
+ +---------+
+ | col|
+ +---------+
+ |-12.34567|
+ +---------+
+
+SELECT +3.e+3 AS col;
+ +------+
+ | col|
+ +------+
+ |3000.0|
+ +------+
+
+SELECT -3.E-3D AS col;
+ +------+
+ | col|
+ +------+
+ |-0.003|
+ +------+
+{% endhighlight %}
+
+### Datetime Literal
+
+A Datetime literal is used to specify a datetime value.
+
+#### Date Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+DATE 'yyyy [ -MM-dd ]'
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT DATE '1997' AS col;
+ +----------+
+ | col|
+ +----------+
+ |1997-01-01|
+ +----------+
+
+SELECT TIMESTAMP '1997-01' AS col;
+ +----------+
+ | col|
+ +----------+
+ |1997-01-01|
+ +----------+
+
+SELECT DATE '2011-11-11' AS col;
+ +----------+
+ | col|
+ +----------+
+ |2011-11-11|
+ +----------+
+{% endhighlight %}
+
+#### Timestamp Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TIMESTAMP { 'yyyy [ -MM-dd HH:mm:ss.SSSSSSzzz ]' | '[ yyyy-MM-dd ] HH:mm [ :ss.SSSSSSzzz ]' }
Review comment:
@MaxGekk
Thanks for the patterns. I tested on spark-sql and found that a few more (e.g. ```'[T][h]h:'```) also work. I list them all. Could you take a quick look to see if the list is OK?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615034259
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615517400
**[Test build #121432 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121432/testReport)** for PR 28237 at commit [`c8c768f`](https://github.com/apache/spark/commit/c8c768f2e61f687c4d654abca369dc172bfbb875).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616216145
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616217960
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615030484
**[Test build #121391 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121391/testReport)** for PR 28237 at commit [`71353a0`](https://github.com/apache/spark/commit/71353a02e979f71c6bb5dd3733a5d293a48e1731).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615517530
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121432/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615536812
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121438/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615508463
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616217966
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121487/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615503614
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615513351
**[Test build #121432 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121432/testReport)** for PR 28237 at commit [`c8c768f`](https://github.com/apache/spark/commit/c8c768f2e61f687c4d654abca369dc172bfbb875).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410916489
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,505 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### Syntax
+
+{% highlight sql %}
+'c [ ... ]' | "c [ ... ]"
+{% endhighlight %}
+
+#### <em>Parameters</em>
+
+<dl>
+ <dt><code><em>c</em></code></dt>
+ <dd>
+ One character from the character set. Use <code>\</code> to escape special characters.
+ </dd>
+</dl>
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +---------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### Syntax
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### Examples
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### Syntax
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### Examples
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### Syntax
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+
+#### Parameters
+
+<dl>
+ <dt><code><em>digit</em></code></dt>
+ <dd>
+ Any numeral from 0 to 9.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>L</em></code></dt>
+ <dd>
+ Case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>S</em></code></dt>
+ <dd>
+ Case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Y</em></code></dt>
+ <dd>
+ Case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>default (no postfix)</em></code></dt>
+ <dd>
+ Indicates a 4-byte signed integer number.
+ </dd>
+</dl>
+#### Examples
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### Syntax
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### Parameters
+
+<dl>
+ <dt><code><em>digit</em></code></dt>
+ <dd>
+ Any numeral from 0 to 9.
+ </dd>
+</dl>
+
+#### Examples
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### Syntax
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] |
Review comment:
ditto: Can we remove a space in the head?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410658597
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,378 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
Review comment:
I personally think the second one looks fine for the consistency with the others, e.g.,
https://github.com/apache/spark/blame/master/docs/sql-ref-syntax-qry-select-setops.md#L36
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410208502
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
Review comment:
How about double-quote cases, e.g., "xxxx"?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615519206
**[Test build #121435 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121435/testReport)** for PR 28237 at commit [`2059414`](https://github.com/apache/spark/commit/2059414001fd4e95febe09aea18bcce809d50d22).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410809668
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
Review comment:
I guess it might be better to align the options?
```
[ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] |
digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] |
. digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] }
```
```
DATE { 'yyyy' |
'yyyy-[m]m' |
'yyyy-[m]m-[d]d' |
'yyyy-[m]m-[d]d ' |
'yyyy-[m]m-[d]d[T]c[...]' }
```
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616025906
**[Test build #121469 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121469/testReport)** for PR 28237 at commit [`0121faf`](https://github.com/apache/spark/commit/0121faf90018a7b15bcc303298576d442412ef1a).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615517519
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615503614
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615536753
**[Test build #121438 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121438/testReport)** for PR 28237 at commit [`39862ae`](https://github.com/apache/spark/commit/39862aed22e5cf5f8d207526683c94efc50076ee).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410011717
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
+ c: one character of user's character set.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>'Hello, World!', 'Spark SQL', 'dbname.schema'</code>
+ </dd>
+</dl>
+
+### Boolean Literals
+
+A boolean literal is used to specify a boolean value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>TRUE | FALSE </code>
+ </dd>
+</dl>
+
+### Numeric Literals
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>[ + | - ] digit [ ... ] [ l | L ]</code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9 <br>
+ l or L: indicates <code>LongType</code>.
Review comment:
can we document all the postfixes? And also mention that no postfix means integer type.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616028087
**[Test build #121469 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121469/testReport)** for PR 28237 at commit [`0121faf`](https://github.com/apache/spark/commit/0121faf90018a7b15bcc303298576d442412ef1a).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615508317
**[Test build #121431 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121431/testReport)** for PR 28237 at commit [`7628fb8`](https://github.com/apache/spark/commit/7628fb8f59ce01041685e0501ce980169ea85e6a).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615519523
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615503108
**[Test build #121431 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121431/testReport)** for PR 28237 at commit [`7628fb8`](https://github.com/apache/spark/commit/7628fb8f59ce01041685e0501ce980169ea85e6a).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615521158
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121435/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] maropu commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410659732
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,385 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (also known as a constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * [String Literal](#string-literal)
+ * [Null Literal](#null-literal)
+ * [Boolean Literal](#boolean-literal)
+ * [Numeric Literal](#numeric-literal)
+ * [Datetime Literal](#datetime-literal)
+ * [Interval Literal](#interval-literal)
+
+### String Literal
+
+A string literal is used to specify a character string value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+'...' | "..."
+{% endhighlight %}
+...: indicates any string.
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 'Hello, World!' AS col;
+ +-------------+
+ | col|
+ +-------------+
+ |Hello, World!|
+ +-------------+
+
+SELECT "SPARK SQL" AS col;
+ +---------+
+ | col|
+ +---------+
+ |Spark SQL|
+ +---------+
+
+SELECT SELECT 'it\'s $10.' AS col;
+ +---------+
+ | col|
+ +---------+
+ |It's $10.|
+ +----------+
+{% endhighlight %}
+
+### Null Literal
+
+A null literal is used to specify a null value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+NULL
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT NULL AS col;
+ +----+
+ | col|
+ +----+
+ |NULL|
+ +----+
+{% endhighlight %}
+
+### Boolean Literal
+
+A boolean literal is used to specify a boolean value.
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+TRUE | FALSE
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT TRUE AS col;
+ +----+
+ | col|
+ +----+
+ |true|
+ +----+
+{% endhighlight %}
+
+### Numeric Literal
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+[ + | - ] digit [ ... ] [ L | S | Y ]
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicates a 4-byte signed integer number.<br>
+L: case insensitive, indicates <code>BIGINT</code>, which is a 8-byte signed integer number.<br>
+S: case insensitive, indicates <code>SMALLINT</code>, which is a 2-byte signed integer number.<br>
+Y: case insensitive, indicates <code>TINYINT</code>, which is a 1-byte signed integer number.<br>
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT -2147483648 AS col;
+ +-----------+
+ | col|
+ +-----------+
+ |-2147483648|
+ +-----------+
+
+SELECT 9223372036854775807l AS col;
+ +-------------------+
+ | col|
+ +-------------------+
+ |9223372036854775807|
+ +-------------------+
+
+SELECT -32Y AS col;
+ +---+
+ |col|
+ +---+
+ |-32|
+ +---+
+
+SELECT 482S AS col;
+ +---+
+ |col|
+ +---+
+ |482|
+ +---+
+{% endhighlight %}
+
+#### Decimal Literal
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] . [ digit [ ... ] ] | . digit [ ... ] }
+{% endhighlight %}
+
+#### <em>Examples</em>
+
+{% highlight sql %}
+SELECT 12.578 AS col;
+ +------+
+ | col|
+ +------+
+ |12.578|
+ +------+
+
+SELECT -0.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+
+SELECT -.1234567 AS col;
+ +----------+
+ | col|
+ +----------+
+ |-0.1234567|
+ +----------+
+{% endhighlight %}
+
+#### Floating Point and BigDecimal Literals
+
+#### <em>Syntax</em>
+
+{% highlight sql %}
+ [ + | - ] { digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | digit [ ... ] . [ digit [ ... ] ] [ E [ + | - ] digit [ ... ] ] [ D | BD ]
+ | . digit [ ... ] [ E [ + | - ] digit [ ... ] ] [ D | BD ] }
+{% endhighlight %}
+digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+default (no postfix): indicate a 4-byte single-precision floating point number.<br>
+D: case insensitive, indicates <code>DOUBLE</code>, which is a 8-byte double-precision floating point number.<br>
+BD: case insensitive, indicates <code>BIGDECIMAL</code>, which is an arbitrary-precision signed decimal number.<br>
Review comment:
Where should we document some special literals? e.g., infinity, nan, ... https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala#L241-L247
```
scala> sql("select double('infinity')").show()
+------------------------+
|CAST(infinity AS DOUBLE)|
+------------------------+
| Infinity|
+------------------------+
```
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616216148
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26171/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS]
Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616025906
**[Test build #121469 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121469/testReport)** for PR 28237 at commit [`0121faf`](https://github.com/apache/spark/commit/0121faf90018a7b15bcc303298576d442412ef1a).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615517530
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/121432/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616215986
**[Test build #121487 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121487/testReport)** for PR 28237 at commit [`37f5baa`](https://github.com/apache/spark/commit/37f5baa6e2eaba6538edbc0a6da5bb305caf011a).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616024663
Merged build finished. Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] viirya commented on a change in pull request #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
viirya commented on a change in pull request #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#discussion_r410511007
##########
File path: docs/sql-ref-literals.md
##########
@@ -0,0 +1,155 @@
+---
+layout: global
+title: Literals
+displayTitle: Literals
+license: |
+ 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.
+---
+
+A literal (aka constant) represents a fixed data value. Spark SQL supports the following literals:
+
+ * String Literals
+ * Boolean Literals
+ * Numeric Literals
+ * Datetime Literals
+ * Interval Literals
+
+### String Literals
+
+A string literal is used to specify a character string value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>'c [ ... ]'</code><br>
+ c: one character of user's character set.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>'Hello, World!', 'Spark SQL', 'dbname.schema'</code>
+ </dd>
+</dl>
+
+### Boolean Literals
+
+A boolean literal is used to specify a boolean value.
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>TRUE | FALSE </code>
+ </dd>
+</dl>
+
+### Numeric Literals
+
+A numeric literal is used to specify a fixed or floating-point number.
+
+#### Integer Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>[ + | - ] digit [ ... ] [ l | L ]</code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9 <br>
+ l or L: indicates <code>LongType</code>.
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>6, +188, -54, 1000L</code>
+ </dd>
+</dl>
+
+#### Floating Point and Decimal Literals
+
+<dl>
+ <dt><code><em>Format:</em></code></dt>
+ <dd>
+ <code>
+ [ + | - ] { digit [ ... ] [ . ] [ digit [ ... ] ] | . digit [ ... ] } <br>
+ [ { e | E } [ + | - ] digit [ ... ] ] [ d | D ]
+ </code><br>
+ digit: one of 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9. <br>
+ e or E: indicates that the number is in scientific notation format. <br>
+ d or D: indicates <code>DoubleType</code>
+ </dd>
+</dl>
+<dl>
+ <dt><code><em>Examples:</em></code></dt>
+ <dd>
+ <code>5E2, 3.e6, 2.3E-2, +3.e+3, -4D, 0.25</code>
+ </dd>
+</dl>
+
+### Datetime Literals
+
+A Datetime literal is used to specify a datetime data type value.
Review comment:
`a datetime value` or `a value of datetime data type`
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-616216148
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/26171/
Test PASSed.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] huaxingao commented on issue #28237:
[SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
Posted by GitBox <gi...@apache.org>.
huaxingao commented on issue #28237: [SPARK-31465][SQL][DOCS] Document Literal in SQL Reference
URL: https://github.com/apache/spark/pull/28237#issuecomment-615044346
cc @maropu
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org