@Test public void testGetFunctions() throws Exception { SessionHandle sessionHandle = client.openSession("tom", "password"); assertNotNull(sessionHandle); OperationHandle opHandle = client.getFunctions(sessionHandle, null, null, "*"); TableSchema schema = client.getResultSetMetadata(opHandle); ColumnDescriptor columnDesc = schema.getColumnDescriptorAt(0); assertEquals("FUNCTION_CAT", columnDesc.getName()); assertEquals(Type.STRING_TYPE, columnDesc.getType()); columnDesc = schema.getColumnDescriptorAt(1); assertEquals("FUNCTION_SCHEM", columnDesc.getName()); assertEquals(Type.STRING_TYPE, columnDesc.getType()); columnDesc = schema.getColumnDescriptorAt(2); assertEquals("FUNCTION_NAME", columnDesc.getName()); assertEquals(Type.STRING_TYPE, columnDesc.getType()); columnDesc = schema.getColumnDescriptorAt(3); assertEquals("REMARKS", columnDesc.getName()); assertEquals(Type.STRING_TYPE, columnDesc.getType()); columnDesc = schema.getColumnDescriptorAt(4); assertEquals("FUNCTION_TYPE", columnDesc.getName()); assertEquals(Type.INT_TYPE, columnDesc.getType()); columnDesc = schema.getColumnDescriptorAt(5); assertEquals("SPECIFIC_NAME", columnDesc.getName()); assertEquals(Type.STRING_TYPE, columnDesc.getType()); // Cleanup client.closeOperation(opHandle); client.closeSession(sessionHandle); }
/** * Instantiates a new hive persistent result set. * * @param resultSetPath the result set path * @param opHandle the op handle * @param client the client * @throws HiveSQLException the hive sql exception */ public HivePersistentResultSet(Path resultSetPath, OperationHandle opHandle, CLIServiceClient client) throws HiveSQLException { this.path = resultSetPath; this.metadata = client.getResultSetMetadata(opHandle); }
/** * Instantiates a new hive persistent result set. * * @param resultSetPath the result set path * @param opHandle the op handle * @param client the client * @throws HiveSQLException the hive sql exception */ public HivePersistentResultSet(Path resultSetPath, OperationHandle opHandle, CLIServiceClient client) throws HiveSQLException { this.path = resultSetPath; this.metadata = client.getResultSetMetadata(opHandle); }
/** * Instantiates a new hive in memory result set. * * @param hiveHandle the hive handle * @param client the client * @param closeAfterFecth the close after fecth * @throws HiveSQLException the hive sql exception */ public HiveInMemoryResultSet(OperationHandle hiveHandle, CLIServiceClient client, boolean closeAfterFecth) throws HiveSQLException { this.client = client; this.opHandle = hiveHandle; this.closeAfterFecth = closeAfterFecth; this.metadata = client.getResultSetMetadata(opHandle); this.numColumns = metadata.getColumnDescriptors().size(); this.orientation = FetchOrientation.FETCH_FIRST; }
/** * Instantiates a new hive in memory result set. * * @param hiveHandle the hive handle * @param client the client * @param closeAfterFecth the close after fecth * @throws HiveSQLException the hive sql exception */ public HiveInMemoryResultSet(OperationHandle hiveHandle, CLIServiceClient client, boolean closeAfterFecth) throws HiveSQLException { this.client = client; this.opHandle = hiveHandle; this.closeAfterFecth = closeAfterFecth; this.metadata = client.getResultSetMetadata(opHandle); this.numColumns = metadata.getColumnDescriptors().size(); this.orientation = FetchOrientation.FETCH_FIRST; }