2016-08-08 16 views
2

Ich weiß, dass Apache Phoenix alle Funktionsmetadaten in SYSTEM.FUNCTION speichern wird, aber wenn ich die Abfrage benutze, folge der folgenden Anweisung, die Ausnahme auszulösen.Phoenix sqline kann Systemtabelle nicht abfragen SYSTEM.FUNCTION

0: jdbc:phoenix:10.1.226.15:2181> select * from SYSTEM.FUNCTION; 
Error: ERROR 604 (42P00): Syntax error. Mismatched input. Expecting "NAME", got "FUNCTION" at line 1, column 22. (state=42P00,code=604) 
org.apache.phoenix.exception.PhoenixParserException: ERROR 604 (42P00): Syntax error. Mismatched input. Expecting "NAME", got "FUNCTION" at line 1, column 22. 
    at org.apache.phoenix.exception.PhoenixParserException.newException(PhoenixParserException.java:33) 

oder

0: jdbc:phoenix:10.1.226.15:2181> select * from FUNCTION; 
Error: ERROR 601 (42P00): Syntax error. Encountered "FUNCTION" at line 1, column 15. (state=42P00,code=601) 
org.apache.phoenix.exception.PhoenixParserException: ERROR 601 (42P00): Syntax error. Encountered "FUNCTION" at line 1, column 15. 

Die Tabelle FUNCTION existieren in SYSTEM-Schema, kann aber nicht abfragen, in anderer Seite der Tabelle Katalog in SYSTEM Schema I Anweisung und ruft die richtigen Daten durchführen kann.

0: jdbc:phoenix:10.1.226.15:2181> !tables 
+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------+ 
|    TABLE_CAT     |    TABLE_SCHEM    |    TABLE_NAME    |    TABLE_TYPE    |     REMARKS   | 
+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------+ 
|           | SYSTEM         | CATALOG         | SYSTEM TABLE        |         | 
|           | SYSTEM         | FUNCTION         | SYSTEM TABLE        |         | 
|           | SYSTEM         | SEQUENCE         | SYSTEM TABLE        |         | 
|           | SYSTEM         | STATS         | SYSTEM TABLE        |         | 
+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------+ 



0: jdbc:phoenix:10.1.226.15:2181> select * from system.catalog; 
+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------+ 
|    TENANT_ID     |    TABLE_SCHEM    |    TABLE_NAME    |    COLUMN_NAME    |    COLUMN_FAMILY   | 
+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------------+------------------------------------+ 
|           | SYSTEM         | CATALOG         |           |         | 
|           | SYSTEM         | CATALOG         | ARRAY_SIZE        | 0         | 
|           | SYSTEM         | CATALOG         | BUFFER_LENGTH       | 0         | 
.... 

Kann jemand erklären warum?

Antwort

2

function, wie select, ist ein reserviertes Schlüsselwort. Wenn Sie auf die Tabelle verweisen möchten, schließen Sie sie in Anführungszeichen ein (und es wird auch zwischen Groß- und Kleinschreibung unterschieden).