This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 96aa0e5876 [fix](tvf) To fix the bug that requires adding backticks on
"frontends()" in order to query the frontends TVF. (#21338)
96aa0e5876 is described below
commit 96aa0e5876f718e375c75963826f79824dbddfcd
Author: zzzzzzzs <[email protected]>
AuthorDate: Fri Jun 30 22:37:21 2023 +0800
[fix](tvf) To fix the bug that requires adding backticks on "frontends()"
in order to query the frontends TVF. (#21338)
---
fe/fe-core/src/main/cup/sql_parser.cup | 2 ++
.../FrontendsTableValuedFunction.java | 4 ++--
.../test_frontends_tvf.groovy | 22 ++++++++++++++++++++++
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/fe/fe-core/src/main/cup/sql_parser.cup
b/fe/fe-core/src/main/cup/sql_parser.cup
index 387625dbc9..08d41b378c 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -7624,6 +7624,8 @@ keyword ::=
{: RESULT = id; :}
| KW_FEATURE:id
{: RESULT = id; :}
+ | KW_FRONTENDS:id
+ {: RESULT = id; :}
| KW_MAP:id
{: RESULT = id; :}
| KW_VARCHAR:id
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/FrontendsTableValuedFunction.java
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/FrontendsTableValuedFunction.java
index 122ecc9e48..92109d05a9 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/FrontendsTableValuedFunction.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/FrontendsTableValuedFunction.java
@@ -32,14 +32,14 @@ import java.util.Map;
/**
* The Implement of table valued function
- * backends().
+ * frontends().
*/
public class FrontendsTableValuedFunction extends MetadataTableValuedFunction {
public static final String NAME = "frontends";
private static final ImmutableList<Column> SCHEMA = ImmutableList.of(
new Column("Name", ScalarType.createStringType()),
- new Column("HOST", ScalarType.createStringType()),
+ new Column("Host", ScalarType.createStringType()),
new Column("EditLogPort", ScalarType.createStringType()),
new Column("HttpPort", ScalarType.createStringType()),
new Column("QueryPort", ScalarType.createStringType()),
diff --git
a/regression-test/suites/correctness_p0/table_valued_function/test_frontends_tvf.groovy
b/regression-test/suites/correctness_p0/table_valued_function/test_frontends_tvf.groovy
index cc7d84d982..05f85eb85a 100644
---
a/regression-test/suites/correctness_p0/table_valued_function/test_frontends_tvf.groovy
+++
b/regression-test/suites/correctness_p0/table_valued_function/test_frontends_tvf.groovy
@@ -25,4 +25,26 @@ suite("test_frontends_tvf") {
table = sql """ select Name from `frontends`();"""
assertTrue(table.size() > 0)
assertTrue(table[0].size == 1)
+
+ // case insensitive
+ table = sql """ select name, host, editlogport, httpport, alive from
frontends();"""
+ assertTrue(table.size() > 0)
+ assertTrue(table[0].size == 5)
+ assertEquals("true", table[0][4])
+
+ // test aliase columns
+ table = sql """ select name as n, host as h, alive as a, editlogport as e
from frontends(); """
+ assertTrue(table.size() > 0)
+ assertTrue(table[0].size == 4)
+ assertEquals("true", table[0][2])
+
+ // test changing position of columns
+ def res = sql """ select count(*) from frontends() where alive = 'true';
"""
+ assertTrue(res[0][0] > 0)
+
+ sql """ select Name, Host, EditLogPort
+ HttpPort, QueryPort, RpcPort, `Role`, IsMaster, ClusterId
+ `Join`, Alive, ReplayedJournalId, LastHeartbeat
+ IsHelper, ErrMsg, Version, CurrentConnected from frontends();
+ """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]