You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by dz...@apache.org on 2022/09/02 11:47:25 UTC

[drill-site] branch master updated: Document the ISNUMERIC function.

This is an automated email from the ASF dual-hosted git repository.

dzamo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill-site.git


The following commit(s) were added to refs/heads/master by this push:
     new ef25c63ba Document the ISNUMERIC function.
ef25c63ba is described below

commit ef25c63ba79bd469ce811ba78b90ea6ac1fda6ff
Author: James Turton <ja...@somecomputer.xyz>
AuthorDate: Fri Sep 2 13:47:12 2022 +0200

    Document the ISNUMERIC function.
---
 .../sql-functions/021-data-type-functions.md       | 24 +++++++++++-----------
 .../sql-functions/040-string-manipulation.md       | 18 ++++++++++++++++
 2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/_docs/en/sql-reference/sql-functions/021-data-type-functions.md b/_docs/en/sql-reference/sql-functions/021-data-type-functions.md
index a9597fee1..4a6da18d1 100644
--- a/_docs/en/sql-reference/sql-functions/021-data-type-functions.md
+++ b/_docs/en/sql-reference/sql-functions/021-data-type-functions.md
@@ -8,18 +8,18 @@ parent: "SQL Functions"
 
 Drill supports the following functions that return data type information:
 
-**sqlTypeOf()**  
-Returns the data type of a column (using the SQL names) whether the column is NULL or not. You can use the SQL name in a CAST statement, for example:  
-
-              sqlTypeOf( CAST(x AS <data type> ))  
-              //Returns <data type> as the type name.  
-If the type is DECIMAL, the type also includes precision and scale, for example:  
- 
-              DECIMAL(6, 3)  
-**modeOf()**  
-Returns the cardinality (mode) of the column as "NOT NULL", "NULLABLE", or "ARRAY". Drill data types include a cardinality, for example `Optional Int` or `Required VarChar`.  
- 
-**drillTypeOf()**  
+**sqlTypeOf()**
+Returns the data type of a column (using the SQL names) whether the column is NULL or not. You can use the SQL name in a CAST statement, for example:
+
+              sqlTypeOf( CAST(x AS <data type> ))
+              //Returns <data type> as the type name.
+If the type is DECIMAL, the type also includes precision and scale, for example:
+
+              DECIMAL(6, 3)
+**modeOf()**
+Returns the cardinality (mode) of the column as "NOT NULL", "NULLABLE", or "ARRAY". Drill data types include a cardinality, for example `Optional Int` or `Required VarChar`.
+
+**drillTypeOf()**
 Similar to typeOf(), but returns the internal Drill names even if the value is NULL.
 _____
 
diff --git a/_docs/en/sql-reference/sql-functions/040-string-manipulation.md b/_docs/en/sql-reference/sql-functions/040-string-manipulation.md
index 454a736dd..7a5d62a31 100644
--- a/_docs/en/sql-reference/sql-functions/040-string-manipulation.md
+++ b/_docs/en/sql-reference/sql-functions/040-string-manipulation.md
@@ -13,6 +13,7 @@ You can use the following string functions in Drill queries:
 | [CONCAT]({{ site.baseurl }}/docs/string-manipulation/#concat)                 | VARCHAR           |
 | [ILIKE]({{ site.baseurl }}/docs/string-manipulation/#ilike)                   | BOOLEAN           |
 | [INITCAP]({{ site.baseurl }}/docs/string-manipulation/#initcap)               | VARCHAR           |
+| [ISNUMERIC]({{ site.baseurl }}/docs/string-manipulation/#isnumeric)           | INTEGER           |
 | [LENGTH]({{ site.baseurl }}/docs/string-manipulation/#length)                 | INTEGER           |
 | [LIKE]({{ site.baseurl }}/docs/string-manipulation/#like)                     | BOOLEAN           |
 | [LOWER]({{ site.baseurl }}/docs/string-manipulation/#lower)                   | VARCHAR           |
@@ -166,6 +167,23 @@ Returns the string using initial caps.
     |--------------------------|
     1 row selected (0.106 seconds)
 
+## ISNUMERIC
+Returns a 1 if the string argument matches the regular expression `[-+]?\d+(\.\d+)?` otherwise a 0.
+
+### ISNUMERIC Syntax
+
+    ISNUMERIC(string)
+
+### ISNUMERIC Examples
+
+    SELECT ISNUMERIC('3.1415926');
+    |--------|
+    | EXPR$0 |
+    |--------|
+    | 1      |
+    |--------|
+    1 row selected (0.185 seconds)
+
 ## LENGTH
 Returns the number of characters in the string.