19
19
20
20
import static org .apache .kyuubi .shaded .hive .service .rpc .thrift .TTypeId .*;
21
21
22
- import java .sql .Connection ;
23
- import java .sql .DatabaseMetaData ;
24
- import java .sql .ResultSet ;
25
- import java .sql .SQLException ;
22
+ import java .sql .*;
26
23
import java .util .ArrayList ;
27
24
import java .util .Arrays ;
28
25
import java .util .Comparator ;
37
34
public class KyuubiDatabaseMetaData implements SQLDatabaseMetaData {
38
35
39
36
private final KyuubiConnection connection ;
37
+ private final TProtocolVersion protocol ;
40
38
private final TCLIService .Iface client ;
41
39
private final TSessionHandle sessHandle ;
42
40
private static final String CATALOG_SEPARATOR = "." ;
@@ -50,8 +48,12 @@ public class KyuubiDatabaseMetaData implements SQLDatabaseMetaData {
50
48
private String dbVersion = null ;
51
49
52
50
public KyuubiDatabaseMetaData (
53
- KyuubiConnection connection , TCLIService .Iface client , TSessionHandle sessHandle ) {
51
+ KyuubiConnection connection ,
52
+ TProtocolVersion protocol ,
53
+ TCLIService .Iface client ,
54
+ TSessionHandle sessHandle ) {
54
55
this .connection = connection ;
56
+ this .protocol = protocol ;
55
57
this .client = client ;
56
58
this .sessHandle = sessHandle ;
57
59
}
@@ -568,6 +570,12 @@ public ResultSet getProcedures(String catalog, String schemaPattern, String proc
568
570
569
571
@ Override
570
572
public String getSQLKeywords () throws SQLException {
573
+ if (protocol .compareTo (TProtocolVersion .HIVE_CLI_SERVICE_PROTOCOL_V11 ) < 0 ) {
574
+ throw new SQLFeatureNotSupportedException (
575
+ String .format (
576
+ "Feature is not supported, protocol version is %s, requires %s or higher" ,
577
+ protocol , TProtocolVersion .HIVE_CLI_SERVICE_PROTOCOL_V11 ));
578
+ }
571
579
// Note: the definitions of what ODBC and JDBC keywords exclude are different in different
572
580
// places. For now, just return the ODBC version here; that excludes Hive keywords
573
581
// that are also ODBC reserved keywords. We could also exclude SQL:2003.
0 commit comments