PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.2.0-rc0/hive/external/jdbc/src/java/org/apache/hadoop/hive/jdbc/HiveDatabaseMetaData.java

#
Java | 1090 lines | 832 code | 205 blank | 53 comment | 53 complexity | 56558270d04032201545028f556d44b7 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.0
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. package org.apache.hadoop.hive.jdbc;
  19. import java.sql.Connection;
  20. import java.sql.DatabaseMetaData;
  21. import java.sql.ResultSet;
  22. import java.sql.RowIdLifetime;
  23. import java.sql.SQLException;
  24. import java.util.ArrayList;
  25. import java.util.Arrays;
  26. import java.util.Collections;
  27. import java.util.Comparator;
  28. import java.util.List;
  29. import java.util.jar.Attributes;
  30. import org.apache.hadoop.hive.metastore.TableType;
  31. import org.apache.hadoop.hive.metastore.api.FieldSchema;
  32. import org.apache.hadoop.hive.metastore.api.Table;
  33. import org.apache.hadoop.hive.service.HiveInterface;
  34. import org.apache.thrift.TException;
  35. /**
  36. * HiveDatabaseMetaData.
  37. *
  38. */
  39. public class HiveDatabaseMetaData implements java.sql.DatabaseMetaData {
  40. private final HiveInterface client;
  41. private static final String CATALOG_SEPARATOR = ".";
  42. private static final char SEARCH_STRING_ESCAPE = '\\';
  43. // The maximum column length = MFieldSchema.FNAME in metastore/src/model/package.jdo
  44. private static final int maxColumnNameLength = 128;
  45. /**
  46. *
  47. */
  48. public HiveDatabaseMetaData(HiveInterface client) {
  49. this.client = client;
  50. }
  51. public boolean allProceduresAreCallable() throws SQLException {
  52. throw new SQLException("Method not supported");
  53. }
  54. public boolean allTablesAreSelectable() throws SQLException {
  55. return true;
  56. }
  57. public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
  58. throw new SQLException("Method not supported");
  59. }
  60. public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
  61. throw new SQLException("Method not supported");
  62. }
  63. public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
  64. throw new SQLException("Method not supported");
  65. }
  66. public boolean deletesAreDetected(int type) throws SQLException {
  67. throw new SQLException("Method not supported");
  68. }
  69. public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
  70. throw new SQLException("Method not supported");
  71. }
  72. public ResultSet getAttributes(String catalog, String schemaPattern,
  73. String typeNamePattern, String attributeNamePattern) throws SQLException {
  74. throw new SQLException("Method not supported");
  75. }
  76. public ResultSet getBestRowIdentifier(String catalog, String schema,
  77. String table, int scope, boolean nullable) throws SQLException {
  78. throw new SQLException("Method not supported");
  79. }
  80. public String getCatalogSeparator() throws SQLException {
  81. return CATALOG_SEPARATOR;
  82. }
  83. public String getCatalogTerm() throws SQLException {
  84. return "database";
  85. }
  86. public ResultSet getCatalogs() throws SQLException {
  87. try {
  88. // TODO a client call to get the schema's after HIVE-675 is implemented
  89. final List<String> catalogs = new ArrayList();
  90. catalogs.add("default");
  91. return new HiveMetaDataResultSet<String>(Arrays.asList("TABLE_CAT")
  92. , Arrays.asList("STRING")
  93. , catalogs) {
  94. private int cnt = 0;
  95. public boolean next() throws SQLException {
  96. if (cnt<data.size()) {
  97. List<Object> a = new ArrayList<Object>(1);
  98. a.add(data.get(cnt)); // TABLE_CAT String => table catalog (may be null)
  99. row = a;
  100. cnt++;
  101. return true;
  102. } else {
  103. return false;
  104. }
  105. }
  106. };
  107. } catch (Exception e) {
  108. throw new SQLException(e);
  109. }
  110. }
  111. public ResultSet getClientInfoProperties() throws SQLException {
  112. throw new SQLException("Method not supported");
  113. }
  114. public ResultSet getColumnPrivileges(String catalog, String schema,
  115. String table, String columnNamePattern) throws SQLException {
  116. throw new SQLException("Method not supported");
  117. }
  118. /**
  119. * Convert a pattern containing JDBC catalog search wildcards into
  120. * Java regex patterns.
  121. *
  122. * @param pattern input which may contain '%' or '_' wildcard characters, or
  123. * these characters escaped using {@link #getSearchStringEscape()}.
  124. * @return replace %/_ with regex search characters, also handle escaped
  125. * characters.
  126. */
  127. private String convertPattern(final String pattern) {
  128. if (pattern==null) {
  129. return ".*";
  130. } else {
  131. StringBuilder result = new StringBuilder(pattern.length());
  132. boolean escaped = false;
  133. for (int i = 0, len = pattern.length(); i < len; i++) {
  134. char c = pattern.charAt(i);
  135. if (escaped) {
  136. if (c != SEARCH_STRING_ESCAPE) {
  137. escaped = false;
  138. }
  139. result.append(c);
  140. } else {
  141. if (c == SEARCH_STRING_ESCAPE) {
  142. escaped = true;
  143. continue;
  144. } else if (c == '%') {
  145. result.append(".*");
  146. } else if (c == '_') {
  147. result.append('.');
  148. } else {
  149. result.append(c);
  150. }
  151. }
  152. }
  153. return result.toString();
  154. }
  155. }
  156. public ResultSet getColumns(String catalog, final String schemaPattern
  157. , final String tableNamePattern
  158. , final String columnNamePattern) throws SQLException {
  159. List<JdbcColumn> columns = new ArrayList<JdbcColumn>();
  160. try {
  161. if (catalog==null) {
  162. catalog = "default";
  163. }
  164. String regtableNamePattern = convertPattern(tableNamePattern);
  165. String regcolumnNamePattern = convertPattern(columnNamePattern);
  166. List<String> tables = client.get_tables(catalog, "*");
  167. for (String table: tables) {
  168. if (table.matches(regtableNamePattern)) {
  169. List<FieldSchema> fields = client.get_fields(catalog, table);
  170. int ordinalPos = 1;
  171. for (FieldSchema field: fields) {
  172. if (field.getName().matches(regcolumnNamePattern)) {
  173. columns.add(new JdbcColumn(field.getName(), table, catalog
  174. , field.getType(), field.getComment(), ordinalPos));
  175. ordinalPos++;
  176. }
  177. }
  178. }
  179. }
  180. Collections.sort(columns, new GetColumnsComparator());
  181. return new HiveMetaDataResultSet<JdbcColumn>(
  182. Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "COLUMN_NAME", "DATA_TYPE"
  183. , "TYPE_NAME", "COLUMN_SIZE", "BUFFER_LENGTH", "DECIMAL_DIGITS"
  184. , "NUM_PREC_RADIX", "NULLABLE", "REMARKS", "COLUMN_DEF", "SQL_DATA_TYPE"
  185. , "SQL_DATETIME_SUB", "CHAR_OCTET_LENGTH", "ORDINAL_POSITION"
  186. , "IS_NULLABLE", "SCOPE_CATLOG", "SCOPE_SCHEMA", "SCOPE_TABLE"
  187. , "SOURCE_DATA_TYPE")
  188. , Arrays.asList("STRING", "STRING", "STRING", "STRING", "I32", "STRING"
  189. , "I32", "I32", "I32", "I32", "I32", "STRING"
  190. , "STRING", "I32", "I32", "I32", "I32"
  191. , "STRING", "STRING", "STRING", "STRING", "I32")
  192. , columns) {
  193. private int cnt = 0;
  194. public boolean next() throws SQLException {
  195. if (cnt<data.size()) {
  196. List<Object> a = new ArrayList<Object>(20);
  197. JdbcColumn column = data.get(cnt);
  198. a.add(column.getTableCatalog()); // TABLE_CAT String => table catalog (may be null)
  199. a.add(null); // TABLE_SCHEM String => table schema (may be null)
  200. a.add(column.getTableName()); // TABLE_NAME String => table name
  201. a.add(column.getColumnName()); // COLUMN_NAME String => column name
  202. a.add(column.getSqlType()); // DATA_TYPE short => SQL type from java.sql.Types
  203. a.add(column.getType()); // TYPE_NAME String => Data source dependent type name.
  204. a.add(column.getColumnSize()); // COLUMN_SIZE int => column size.
  205. a.add(null); // BUFFER_LENGTH is not used.
  206. a.add(column.getDecimalDigits()); // DECIMAL_DIGITS int => number of fractional digits
  207. a.add(column.getNumPrecRadix()); // NUM_PREC_RADIX int => typically either 10 or 2
  208. a.add(DatabaseMetaData.columnNullable); // NULLABLE int => is NULL allowed?
  209. a.add(column.getComment()); // REMARKS String => comment describing column (may be null)
  210. a.add(null); // COLUMN_DEF String => default value (may be null)
  211. a.add(null); // SQL_DATA_TYPE int => unused
  212. a.add(null); // SQL_DATETIME_SUB int => unused
  213. a.add(null); // CHAR_OCTET_LENGTH int
  214. a.add(column.getOrdinalPos()); // ORDINAL_POSITION int
  215. a.add("YES"); // IS_NULLABLE String
  216. a.add(null); // SCOPE_CATLOG String
  217. a.add(null); // SCOPE_SCHEMA String
  218. a.add(null); // SCOPE_TABLE String
  219. a.add(null); // SOURCE_DATA_TYPE short
  220. row = a;
  221. cnt++;
  222. return true;
  223. } else {
  224. return false;
  225. }
  226. }
  227. };
  228. } catch (Exception e) {
  229. throw new SQLException(e);
  230. }
  231. }
  232. /**
  233. * We sort the output of getColumns to guarantee jdbc compliance.
  234. * First check by table name then by ordinal position
  235. */
  236. private class GetColumnsComparator implements Comparator<JdbcColumn> {
  237. public int compare(JdbcColumn o1, JdbcColumn o2) {
  238. int compareName = o1.getTableName().compareTo(o2.getTableName());
  239. if (compareName==0) {
  240. if (o1.getOrdinalPos() > o2.getOrdinalPos()) {
  241. return 1;
  242. } else if (o1.getOrdinalPos() < o2.getOrdinalPos()) {
  243. return -1;
  244. }
  245. return 0;
  246. } else {
  247. return compareName;
  248. }
  249. }
  250. }
  251. public Connection getConnection() throws SQLException {
  252. throw new SQLException("Method not supported");
  253. }
  254. public ResultSet getCrossReference(String primaryCatalog,
  255. String primarySchema, String primaryTable, String foreignCatalog,
  256. String foreignSchema, String foreignTable) throws SQLException {
  257. throw new SQLException("Method not supported");
  258. }
  259. public int getDatabaseMajorVersion() throws SQLException {
  260. throw new SQLException("Method not supported");
  261. }
  262. public int getDatabaseMinorVersion() throws SQLException {
  263. throw new SQLException("Method not supported");
  264. }
  265. public String getDatabaseProductName() throws SQLException {
  266. return "Hive";
  267. }
  268. public String getDatabaseProductVersion() throws SQLException {
  269. try {
  270. return client.getVersion();
  271. } catch (TException e) {
  272. throw new SQLException(e);
  273. }
  274. }
  275. public int getDefaultTransactionIsolation() throws SQLException {
  276. return Connection.TRANSACTION_NONE;
  277. }
  278. public int getDriverMajorVersion() {
  279. return HiveDriver.getMajorDriverVersion();
  280. }
  281. public int getDriverMinorVersion() {
  282. return HiveDriver.getMinorDriverVersion();
  283. }
  284. public String getDriverName() throws SQLException {
  285. return HiveDriver.fetchManifestAttribute(Attributes.Name.IMPLEMENTATION_TITLE);
  286. }
  287. public String getDriverVersion() throws SQLException {
  288. return HiveDriver.fetchManifestAttribute(Attributes.Name.IMPLEMENTATION_VERSION);
  289. }
  290. public ResultSet getExportedKeys(String catalog, String schema, String table)
  291. throws SQLException {
  292. throw new SQLException("Method not supported");
  293. }
  294. public String getExtraNameCharacters() throws SQLException {
  295. throw new SQLException("Method not supported");
  296. }
  297. public ResultSet getFunctionColumns(String arg0, String arg1, String arg2,
  298. String arg3) throws SQLException {
  299. throw new SQLException("Method not supported");
  300. }
  301. public ResultSet getFunctions(String arg0, String arg1, String arg2)
  302. throws SQLException {
  303. throw new SQLException("Method not supported");
  304. }
  305. public String getIdentifierQuoteString() throws SQLException {
  306. throw new SQLException("Method not supported");
  307. }
  308. public ResultSet getImportedKeys(String catalog, String schema, String table)
  309. throws SQLException {
  310. throw new SQLException("Method not supported");
  311. }
  312. public ResultSet getIndexInfo(String catalog, String schema, String table,
  313. boolean unique, boolean approximate) throws SQLException {
  314. throw new SQLException("Method not supported");
  315. }
  316. public int getJDBCMajorVersion() throws SQLException {
  317. return 3;
  318. }
  319. public int getJDBCMinorVersion() throws SQLException {
  320. return 0;
  321. }
  322. public int getMaxBinaryLiteralLength() throws SQLException {
  323. throw new SQLException("Method not supported");
  324. }
  325. public int getMaxCatalogNameLength() throws SQLException {
  326. throw new SQLException("Method not supported");
  327. }
  328. public int getMaxCharLiteralLength() throws SQLException {
  329. throw new SQLException("Method not supported");
  330. }
  331. /**
  332. * Returns the value of maxColumnNameLength.
  333. *
  334. * @param int
  335. */
  336. public int getMaxColumnNameLength() throws SQLException {
  337. return maxColumnNameLength;
  338. }
  339. public int getMaxColumnsInGroupBy() throws SQLException {
  340. throw new SQLException("Method not supported");
  341. }
  342. public int getMaxColumnsInIndex() throws SQLException {
  343. throw new SQLException("Method not supported");
  344. }
  345. public int getMaxColumnsInOrderBy() throws SQLException {
  346. throw new SQLException("Method not supported");
  347. }
  348. public int getMaxColumnsInSelect() throws SQLException {
  349. throw new SQLException("Method not supported");
  350. }
  351. public int getMaxColumnsInTable() throws SQLException {
  352. throw new SQLException("Method not supported");
  353. }
  354. public int getMaxConnections() throws SQLException {
  355. throw new SQLException("Method not supported");
  356. }
  357. public int getMaxCursorNameLength() throws SQLException {
  358. throw new SQLException("Method not supported");
  359. }
  360. public int getMaxIndexLength() throws SQLException {
  361. throw new SQLException("Method not supported");
  362. }
  363. public int getMaxProcedureNameLength() throws SQLException {
  364. throw new SQLException("Method not supported");
  365. }
  366. public int getMaxRowSize() throws SQLException {
  367. throw new SQLException("Method not supported");
  368. }
  369. public int getMaxSchemaNameLength() throws SQLException {
  370. throw new SQLException("Method not supported");
  371. }
  372. public int getMaxStatementLength() throws SQLException {
  373. throw new SQLException("Method not supported");
  374. }
  375. public int getMaxStatements() throws SQLException {
  376. throw new SQLException("Method not supported");
  377. }
  378. public int getMaxTableNameLength() throws SQLException {
  379. throw new SQLException("Method not supported");
  380. }
  381. public int getMaxTablesInSelect() throws SQLException {
  382. throw new SQLException("Method not supported");
  383. }
  384. public int getMaxUserNameLength() throws SQLException {
  385. throw new SQLException("Method not supported");
  386. }
  387. public String getNumericFunctions() throws SQLException {
  388. return "";
  389. }
  390. public ResultSet getPrimaryKeys(String catalog, String schema, String table)
  391. throws SQLException {
  392. throw new SQLException("Method not supported");
  393. }
  394. public ResultSet getProcedureColumns(String catalog, String schemaPattern,
  395. String procedureNamePattern, String columnNamePattern)
  396. throws SQLException {
  397. throw new SQLException("Method not supported");
  398. }
  399. public String getProcedureTerm() throws SQLException {
  400. throw new SQLException("Method not supported");
  401. }
  402. public ResultSet getProcedures(String catalog, String schemaPattern,
  403. String procedureNamePattern) throws SQLException {
  404. return null;
  405. }
  406. public int getResultSetHoldability() throws SQLException {
  407. throw new SQLException("Method not supported");
  408. }
  409. public RowIdLifetime getRowIdLifetime() throws SQLException {
  410. throw new SQLException("Method not supported");
  411. }
  412. public String getSQLKeywords() throws SQLException {
  413. throw new SQLException("Method not supported");
  414. }
  415. public int getSQLStateType() throws SQLException {
  416. return DatabaseMetaData.sqlStateSQL99;
  417. }
  418. public String getSchemaTerm() throws SQLException {
  419. return "";
  420. }
  421. public ResultSet getSchemas() throws SQLException {
  422. return getSchemas(null, null);
  423. }
  424. public ResultSet getSchemas(String catalog, String schemaPattern)
  425. throws SQLException {
  426. return new HiveMetaDataResultSet(Arrays.asList("TABLE_SCHEM", "TABLE_CATALOG")
  427. , Arrays.asList("STRING", "STRING"), null) {
  428. public boolean next() throws SQLException {
  429. return false;
  430. }
  431. };
  432. }
  433. public String getSearchStringEscape() throws SQLException {
  434. return String.valueOf(SEARCH_STRING_ESCAPE);
  435. }
  436. public String getStringFunctions() throws SQLException {
  437. return "";
  438. }
  439. public ResultSet getSuperTables(String catalog, String schemaPattern,
  440. String tableNamePattern) throws SQLException {
  441. throw new SQLException("Method not supported");
  442. }
  443. public ResultSet getSuperTypes(String catalog, String schemaPattern,
  444. String typeNamePattern) throws SQLException {
  445. throw new SQLException("Method not supported");
  446. }
  447. public String getSystemFunctions() throws SQLException {
  448. return "";
  449. }
  450. public ResultSet getTablePrivileges(String catalog, String schemaPattern,
  451. String tableNamePattern) throws SQLException {
  452. throw new SQLException("Method not supported");
  453. }
  454. public ResultSet getTableTypes() throws SQLException {
  455. final TableType[] tt = TableType.values();
  456. ResultSet result = new HiveMetaDataResultSet<TableType>(
  457. Arrays.asList("TABLE_TYPE")
  458. , Arrays.asList("STRING"), new ArrayList<TableType>(Arrays.asList(tt))) {
  459. private int cnt = 0;
  460. public boolean next() throws SQLException {
  461. if (cnt<data.size()) {
  462. List<Object> a = new ArrayList<Object>(1);
  463. a.add(toJdbcTableType(data.get(cnt).name()));
  464. row = a;
  465. cnt++;
  466. return true;
  467. } else {
  468. return false;
  469. }
  470. }
  471. };
  472. return result;
  473. }
  474. public ResultSet getTables(String catalog, String schemaPattern,
  475. String tableNamePattern, String[] types) throws SQLException {
  476. final List<String> tablesstr;
  477. final List<JdbcTable> resultTables = new ArrayList();
  478. final String resultCatalog;
  479. if (catalog==null) { // On jdbc the default catalog is null but on hive it's "default"
  480. resultCatalog = "default";
  481. } else {
  482. resultCatalog = catalog;
  483. }
  484. String regtableNamePattern = convertPattern(tableNamePattern);
  485. try {
  486. tablesstr = client.get_tables(resultCatalog, "*");
  487. for (String tablestr: tablesstr) {
  488. if (tablestr.matches(regtableNamePattern)) {
  489. Table tbl = client.get_table(resultCatalog, tablestr);
  490. if (types == null) {
  491. resultTables.add(new JdbcTable(resultCatalog, tbl.getTableName(), tbl.getTableType()
  492. , tbl.getParameters().get("comment")));
  493. } else {
  494. String tableType = toJdbcTableType(tbl.getTableType());
  495. for(String type : types) {
  496. if (type.equalsIgnoreCase(tableType)) {
  497. resultTables.add(new JdbcTable(resultCatalog, tbl.getTableName(), tbl.getTableType()
  498. , tbl.getParameters().get("comment")));
  499. break;
  500. }
  501. }
  502. }
  503. }
  504. }
  505. Collections.sort(resultTables, new GetTablesComparator());
  506. } catch (Exception e) {
  507. throw new SQLException(e);
  508. }
  509. ResultSet result = new HiveMetaDataResultSet<JdbcTable>(
  510. Arrays.asList("TABLE_CAT", "TABLE_SCHEM", "TABLE_NAME", "TABLE_TYPE", "REMARKS")
  511. , Arrays.asList("STRING", "STRING", "STRING", "STRING", "STRING")
  512. , resultTables) {
  513. private int cnt = 0;
  514. public boolean next() throws SQLException {
  515. if (cnt<data.size()) {
  516. List<Object> a = new ArrayList<Object>(5);
  517. JdbcTable table = data.get(cnt);
  518. a.add(table.getTableCatalog()); // TABLE_CAT String => table catalog (may be null)
  519. a.add(null); // TABLE_SCHEM String => table schema (may be null)
  520. a.add(table.getTableName()); // TABLE_NAME String => table name
  521. try {
  522. a.add(table.getSqlTableType()); // TABLE_TYPE String => "TABLE","VIEW"
  523. } catch (Exception e) {
  524. throw new SQLException(e);
  525. }
  526. a.add(table.getComment()); // REMARKS String => explanatory comment on the table
  527. row = a;
  528. cnt++;
  529. return true;
  530. } else {
  531. return false;
  532. }
  533. }
  534. };
  535. return result;
  536. }
  537. /**
  538. * We sort the output of getTables to guarantee jdbc compliance.
  539. * First check by table type then by table name
  540. */
  541. private class GetTablesComparator implements Comparator<JdbcTable> {
  542. public int compare(JdbcTable o1, JdbcTable o2) {
  543. int compareType = o1.getType().compareTo(o2.getType());
  544. if (compareType==0) {
  545. return o1.getTableName().compareTo(o2.getTableName());
  546. } else {
  547. return compareType;
  548. }
  549. }
  550. }
  551. /**
  552. * Translate hive table types into jdbc table types.
  553. * @param hivetabletype
  554. * @return
  555. */
  556. public static String toJdbcTableType(String hivetabletype) {
  557. if (hivetabletype==null) {
  558. return null;
  559. } else if (hivetabletype.equals(TableType.MANAGED_TABLE.toString())) {
  560. return "TABLE";
  561. } else if (hivetabletype.equals(TableType.VIRTUAL_VIEW.toString())) {
  562. return "VIEW";
  563. } else if (hivetabletype.equals(TableType.EXTERNAL_TABLE.toString())) {
  564. return "EXTERNAL TABLE";
  565. } else {
  566. return hivetabletype;
  567. }
  568. }
  569. public String getTimeDateFunctions() throws SQLException {
  570. return "";
  571. }
  572. public ResultSet getTypeInfo() throws SQLException {
  573. throw new SQLException("Method not supported");
  574. }
  575. public ResultSet getUDTs(String catalog, String schemaPattern,
  576. String typeNamePattern, int[] types) throws SQLException {
  577. return new HiveMetaDataResultSet(
  578. Arrays.asList("TYPE_CAT", "TYPE_SCHEM", "TYPE_NAME", "CLASS_NAME", "DATA_TYPE"
  579. , "REMARKS", "BASE_TYPE")
  580. , Arrays.asList("STRING", "STRING", "STRING", "STRING", "I32", "STRING", "I32")
  581. , null) {
  582. public boolean next() throws SQLException {
  583. return false;
  584. }
  585. };
  586. }
  587. public String getURL() throws SQLException {
  588. throw new SQLException("Method not supported");
  589. }
  590. public String getUserName() throws SQLException {
  591. throw new SQLException("Method not supported");
  592. }
  593. public ResultSet getVersionColumns(String catalog, String schema, String table)
  594. throws SQLException {
  595. throw new SQLException("Method not supported");
  596. }
  597. public boolean insertsAreDetected(int type) throws SQLException {
  598. throw new SQLException("Method not supported");
  599. }
  600. public boolean isCatalogAtStart() throws SQLException {
  601. throw new SQLException("Method not supported");
  602. }
  603. public boolean isReadOnly() throws SQLException {
  604. throw new SQLException("Method not supported");
  605. }
  606. public boolean locatorsUpdateCopy() throws SQLException {
  607. throw new SQLException("Method not supported");
  608. }
  609. public boolean nullPlusNonNullIsNull() throws SQLException {
  610. throw new SQLException("Method not supported");
  611. }
  612. public boolean nullsAreSortedAtEnd() throws SQLException {
  613. throw new SQLException("Method not supported");
  614. }
  615. public boolean nullsAreSortedAtStart() throws SQLException {
  616. throw new SQLException("Method not supported");
  617. }
  618. public boolean nullsAreSortedHigh() throws SQLException {
  619. throw new SQLException("Method not supported");
  620. }
  621. public boolean nullsAreSortedLow() throws SQLException {
  622. throw new SQLException("Method not supported");
  623. }
  624. public boolean othersDeletesAreVisible(int type) throws SQLException {
  625. throw new SQLException("Method not supported");
  626. }
  627. public boolean othersInsertsAreVisible(int type) throws SQLException {
  628. throw new SQLException("Method not supported");
  629. }
  630. public boolean othersUpdatesAreVisible(int type) throws SQLException {
  631. throw new SQLException("Method not supported");
  632. }
  633. public boolean ownDeletesAreVisible(int type) throws SQLException {
  634. throw new SQLException("Method not supported");
  635. }
  636. public boolean ownInsertsAreVisible(int type) throws SQLException {
  637. throw new SQLException("Method not supported");
  638. }
  639. public boolean ownUpdatesAreVisible(int type) throws SQLException {
  640. throw new SQLException("Method not supported");
  641. }
  642. public boolean storesLowerCaseIdentifiers() throws SQLException {
  643. throw new SQLException("Method not supported");
  644. }
  645. public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
  646. throw new SQLException("Method not supported");
  647. }
  648. public boolean storesMixedCaseIdentifiers() throws SQLException {
  649. throw new SQLException("Method not supported");
  650. }
  651. public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
  652. throw new SQLException("Method not supported");
  653. }
  654. public boolean storesUpperCaseIdentifiers() throws SQLException {
  655. throw new SQLException("Method not supported");
  656. }
  657. public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
  658. throw new SQLException("Method not supported");
  659. }
  660. public boolean supportsANSI92EntryLevelSQL() throws SQLException {
  661. throw new SQLException("Method not supported");
  662. }
  663. public boolean supportsANSI92FullSQL() throws SQLException {
  664. throw new SQLException("Method not supported");
  665. }
  666. public boolean supportsANSI92IntermediateSQL() throws SQLException {
  667. throw new SQLException("Method not supported");
  668. }
  669. public boolean supportsAlterTableWithAddColumn() throws SQLException {
  670. return true;
  671. }
  672. public boolean supportsAlterTableWithDropColumn() throws SQLException {
  673. return false;
  674. }
  675. public boolean supportsBatchUpdates() throws SQLException {
  676. return false;
  677. }
  678. public boolean supportsCatalogsInDataManipulation() throws SQLException {
  679. return false;
  680. }
  681. public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
  682. return false;
  683. }
  684. public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
  685. return false;
  686. }
  687. public boolean supportsCatalogsInProcedureCalls() throws SQLException {
  688. return false;
  689. }
  690. public boolean supportsCatalogsInTableDefinitions() throws SQLException {
  691. return false;
  692. }
  693. public boolean supportsColumnAliasing() throws SQLException {
  694. return true;
  695. }
  696. public boolean supportsConvert() throws SQLException {
  697. throw new SQLException("Method not supported");
  698. }
  699. public boolean supportsConvert(int fromType, int toType) throws SQLException {
  700. throw new SQLException("Method not supported");
  701. }
  702. public boolean supportsCoreSQLGrammar() throws SQLException {
  703. throw new SQLException("Method not supported");
  704. }
  705. public boolean supportsCorrelatedSubqueries() throws SQLException {
  706. throw new SQLException("Method not supported");
  707. }
  708. public boolean supportsDataDefinitionAndDataManipulationTransactions()
  709. throws SQLException {
  710. throw new SQLException("Method not supported");
  711. }
  712. public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
  713. throw new SQLException("Method not supported");
  714. }
  715. public boolean supportsDifferentTableCorrelationNames() throws SQLException {
  716. throw new SQLException("Method not supported");
  717. }
  718. public boolean supportsExpressionsInOrderBy() throws SQLException {
  719. throw new SQLException("Method not supported");
  720. }
  721. public boolean supportsExtendedSQLGrammar() throws SQLException {
  722. throw new SQLException("Method not supported");
  723. }
  724. public boolean supportsFullOuterJoins() throws SQLException {
  725. throw new SQLException("Method not supported");
  726. }
  727. public boolean supportsGetGeneratedKeys() throws SQLException {
  728. throw new SQLException("Method not supported");
  729. }
  730. public boolean supportsGroupBy() throws SQLException {
  731. return true;
  732. }
  733. public boolean supportsGroupByBeyondSelect() throws SQLException {
  734. throw new SQLException("Method not supported");
  735. }
  736. public boolean supportsGroupByUnrelated() throws SQLException {
  737. throw new SQLException("Method not supported");
  738. }
  739. public boolean supportsIntegrityEnhancementFacility() throws SQLException {
  740. throw new SQLException("Method not supported");
  741. }
  742. public boolean supportsLikeEscapeClause() throws SQLException {
  743. throw new SQLException("Method not supported");
  744. }
  745. public boolean supportsLimitedOuterJoins() throws SQLException {
  746. throw new SQLException("Method not supported");
  747. }
  748. public boolean supportsMinimumSQLGrammar() throws SQLException {
  749. throw new SQLException("Method not supported");
  750. }
  751. public boolean supportsMixedCaseIdentifiers() throws SQLException {
  752. throw new SQLException("Method not supported");
  753. }
  754. public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
  755. throw new SQLException("Method not supported");
  756. }
  757. public boolean supportsMultipleOpenResults() throws SQLException {
  758. throw new SQLException("Method not supported");
  759. }
  760. public boolean supportsMultipleResultSets() throws SQLException {
  761. return false;
  762. }
  763. public boolean supportsMultipleTransactions() throws SQLException {
  764. throw new SQLException("Method not supported");
  765. }
  766. public boolean supportsNamedParameters() throws SQLException {
  767. throw new SQLException("Method not supported");
  768. }
  769. public boolean supportsNonNullableColumns() throws SQLException {
  770. return false;
  771. }
  772. public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
  773. throw new SQLException("Method not supported");
  774. }
  775. public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
  776. throw new SQLException("Method not supported");
  777. }
  778. public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
  779. throw new SQLException("Method not supported");
  780. }
  781. public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
  782. throw new SQLException("Method not supported");
  783. }
  784. public boolean supportsOrderByUnrelated() throws SQLException {
  785. throw new SQLException("Method not supported");
  786. }
  787. public boolean supportsOuterJoins() throws SQLException {
  788. return true;
  789. }
  790. public boolean supportsPositionedDelete() throws SQLException {
  791. return false;
  792. }
  793. public boolean supportsPositionedUpdate() throws SQLException {
  794. return false;
  795. }
  796. public boolean supportsResultSetConcurrency(int type, int concurrency)
  797. throws SQLException {
  798. throw new SQLException("Method not supported");
  799. }
  800. public boolean supportsResultSetHoldability(int holdability)
  801. throws SQLException {
  802. return false;
  803. }
  804. public boolean supportsResultSetType(int type) throws SQLException {
  805. return true;
  806. }
  807. public boolean supportsSavepoints() throws SQLException {
  808. return false;
  809. }
  810. public boolean supportsSchemasInDataManipulation() throws SQLException {
  811. return false;
  812. }
  813. public boolean supportsSchemasInIndexDefinitions() throws SQLException {
  814. return false;
  815. }
  816. public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
  817. return false;
  818. }
  819. public boolean supportsSchemasInProcedureCalls() throws SQLException {
  820. return false;
  821. }
  822. public boolean supportsSchemasInTableDefinitions() throws SQLException {
  823. return false;
  824. }
  825. public boolean supportsSelectForUpdate() throws SQLException {
  826. return false;
  827. }
  828. public boolean supportsStatementPooling() throws SQLException {
  829. throw new SQLException("Method not supported");
  830. }
  831. public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
  832. throw new SQLException("Method not supported");
  833. }
  834. public boolean supportsStoredProcedures() throws SQLException {
  835. return false;
  836. }
  837. public boolean supportsSubqueriesInComparisons() throws SQLException {
  838. throw new SQLException("Method not supported");
  839. }
  840. public boolean supportsSubqueriesInExists() throws SQLException {
  841. throw new SQLException("Method not supported");
  842. }
  843. public boolean supportsSubqueriesInIns() throws SQLException {
  844. throw new SQLException("Method not supported");
  845. }
  846. public boolean supportsSubqueriesInQuantifieds() throws SQLException {
  847. throw new SQLException("Method not supported");
  848. }
  849. public boolean supportsTableCorrelationNames() throws SQLException {
  850. throw new SQLException("Method not supported");
  851. }
  852. public boolean supportsTransactionIsolationLevel(int level)
  853. throws SQLException {
  854. throw new SQLException("Method not supported");
  855. }
  856. public boolean supportsTransactions() throws SQLException {
  857. return false;
  858. }
  859. public boolean supportsUnion() throws SQLException {
  860. throw new SQLException("Method not supported");
  861. }
  862. public boolean supportsUnionAll() throws SQLException {
  863. throw new SQLException("Method not supported");
  864. }
  865. public boolean updatesAreDetected(int type) throws SQLException {
  866. throw new SQLException("Method not supported");
  867. }
  868. public boolean usesLocalFilePerTable() throws SQLException {
  869. throw new SQLException("Method not supported");
  870. }
  871. public boolean usesLocalFiles() throws SQLException {
  872. throw new SQLException("Method not supported");
  873. }
  874. public boolean isWrapperFor(Class<?> iface) throws SQLException {
  875. throw new SQLException("Method not supported");
  876. }
  877. public <T> T unwrap(Class<T> iface) throws SQLException {
  878. throw new SQLException("Method not supported");
  879. }
  880. public static void main(String[] args) throws SQLException {
  881. HiveDatabaseMetaData meta = new HiveDatabaseMetaData(null);
  882. System.out.println("DriverName: " + meta.getDriverName());
  883. System.out.println("DriverVersion: " + meta.getDriverVersion());
  884. }
  885. }