@Test public void testInsertDualDynamicPartitions() throws Exception { String tableName = "dualdynamicpart"; CommandProcessorResponse ret = driver.run( "CREATE TABLE " + tableName + " (key string, value string) partitioned by (part1 string, part2 string)"); Assert.assertEquals(0, ret.getResponseCode()); assertExistence(warehouseDir + "/" + tableName); // Insert into test, with permission set 0. setPermission(warehouseDir + "/" + tableName, 0); ret = driver.run( "insert into table " + tableName + " partition (part1,part2) select key,value,part1,part2 from mysrc"); Assert.assertEquals(0, ret.getResponseCode()); verifyDualPartitionTable(warehouseDir + "/" + tableName, 0); // Insert overwrite test, with permission set 1. setPermission(warehouseDir + "/" + tableName, 1); ret = driver.run( "insert overwrite table " + tableName + " partition (part1,part2) select key,value,part1,part2 from mysrc"); Assert.assertEquals(0, ret.getResponseCode()); verifyDualPartitionTable(warehouseDir + "/" + tableName, 1); }
@Test public void testCtas() throws Exception { String testDb = "ctasdb"; String tableName = "createtable"; CommandProcessorResponse ret = driver.run("CREATE DATABASE " + testDb); Assert.assertEquals(0, ret.getResponseCode()); assertExistence(warehouseDir + "/" + testDb + ".db"); setPermission(warehouseDir + "/" + testDb + ".db"); verifyPermission(warehouseDir + "/" + testDb + ".db"); ret = driver.run("USE " + testDb); Assert.assertEquals(0, ret.getResponseCode()); ret = driver.run("create table " + tableName + " as select key,value from default.mysrc"); Assert.assertEquals(0, ret.getResponseCode()); assertExistence(warehouseDir + "/" + testDb + ".db/" + tableName); verifyPermission(warehouseDir + "/" + testDb + ".db/" + tableName); Assert.assertTrue(listStatus(warehouseDir + "/" + testDb + ".db/" + tableName).size() > 0); for (String child : listStatus(warehouseDir + "/" + testDb + ".db/" + tableName)) { verifyPermission(child); } ret = driver.run("USE default"); Assert.assertEquals(0, ret.getResponseCode()); }
@Test public void testInsertNonPartTable() throws Exception { // case 1 is non-partitioned table. String tableName = "nonpart"; CommandProcessorResponse ret = driver.run("CREATE TABLE " + tableName + " (key string, value string)"); Assert.assertEquals(0, ret.getResponseCode()); String tableLoc = warehouseDir + "/" + tableName; assertExistence(warehouseDir + "/" + tableName); // case1A: insert into non-partitioned table. setPermission(warehouseDir + "/" + tableName); ret = driver.run("insert into table " + tableName + " select key,value from mysrc"); Assert.assertEquals(0, ret.getResponseCode()); verifyPermission(warehouseDir + "/" + tableName); Assert.assertTrue(listStatus(tableLoc).size() > 0); for (String child : listStatus(tableLoc)) { verifyPermission(child); } // case1B: insert overwrite non-partitioned-table setPermission(warehouseDir + "/" + tableName, 1); ret = driver.run("insert overwrite table " + tableName + " select key,value from mysrc"); Assert.assertEquals(0, ret.getResponseCode()); verifyPermission(warehouseDir + "/" + tableName, 1); Assert.assertTrue(listStatus(tableLoc).size() > 0); for (String child : listStatus(tableLoc)) { verifyPermission(child, 1); } }
@Test public void testExternalTable() throws Exception { String tableName = "externaltable"; String myLocation = warehouseDir + "/myfolder"; FileSystem fs = FileSystem.get(new URI(myLocation), conf); fs.mkdirs(new Path(myLocation)); setPermission(myLocation); CommandProcessorResponse ret = driver.run( "CREATE TABLE " + tableName + " (key string, value string) LOCATION '" + myLocation + "'"); Assert.assertEquals(0, ret.getResponseCode()); ret = driver.run("insert into table " + tableName + " select key,value from mysrc"); Assert.assertEquals(0, ret.getResponseCode()); Assert.assertTrue(listStatus(myLocation).size() > 0); for (String child : listStatus(myLocation)) { verifyPermission(child); } }
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); try { String command = getStatement().trim(); String[] tokens = statement.split("\\s"); String commandArgs = command.substring(tokens[0].length()).trim(); CommandProcessorResponse response = commandProcessor.run(commandArgs); int returnCode = response.getResponseCode(); if (returnCode != 0) { throw toSQLException("Error while processing statement", response); } Schema schema = response.getSchema(); if (schema != null) { setHasResultSet(true); resultSchema = new TableSchema(schema); } else { setHasResultSet(false); resultSchema = new TableSchema(); } } catch (HiveSQLException e) { setState(OperationState.ERROR); throw e; } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException("Error running query: " + e.toString(), e); } setState(OperationState.FINISHED); }
@Test public void testInsertStaticDualPartition() throws Exception { String tableName = "dualstaticpart"; CommandProcessorResponse ret = driver.run( "CREATE TABLE " + tableName + " (key string, value string) partitioned by (part1 string, part2 string)"); Assert.assertEquals(0, ret.getResponseCode()); assertExistence(warehouseDir + "/" + tableName); setPermission(warehouseDir + "/" + tableName); // insert into test ret = driver.run( "insert into table " + tableName + " partition(part1='1', part2='1') select key,value from mysrc where part1='1' and part2='1'"); Assert.assertEquals(0, ret.getResponseCode()); verifyPermission(warehouseDir + "/" + tableName); verifyPermission(warehouseDir + "/" + tableName + "/part1=1"); verifyPermission(warehouseDir + "/" + tableName + "/part1=1/part2=1"); Assert.assertTrue(listStatus(warehouseDir + "/" + tableName + "/part1=1/part2=1").size() > 0); for (String child : listStatus(warehouseDir + "/" + tableName + "/part1=1/part2=1")) { verifyPermission(child); } // insert overwrite test setPermission(warehouseDir + "/" + tableName, 1); ret = driver.run( "insert overwrite table " + tableName + " partition(part1='1', part2='1') select key,value from mysrc where part1='1' and part2='1'"); Assert.assertEquals(0, ret.getResponseCode()); verifyPermission(warehouseDir + "/" + tableName, 1); verifyPermission(warehouseDir + "/" + tableName + "/part1=1", 1); verifyPermission(warehouseDir + "/" + tableName + "/part1=1/part2=1", 1); Assert.assertTrue(listStatus(warehouseDir + "/" + tableName + "/part1=1/part2=1").size() > 0); for (String child : listStatus(warehouseDir + "/" + tableName + "/part1=1/part2=1")) { verifyPermission(child, 1); } }
private void runQuery(HiveConf sqlOperationConf) throws HiveSQLException { try { // In Hive server mode, we are not able to retry in the FetchTask // case, when calling fetch queries since execute() has returned. // For now, we disable the test attempts. driver.setTryCount(Integer.MAX_VALUE); response = driver.run(); if (0 != response.getResponseCode()) { throw toSQLException("Error while processing statement", response); } } catch (HiveSQLException e) { // If the operation was cancelled by another thread, // Driver#run will return a non-zero response code. // We will simply return if the operation state is CANCELED, // otherwise throw an exception if (getStatus().getState() == OperationState.CANCELED) { return; } else { setState(OperationState.ERROR); throw e; } } catch (Throwable e) { setState(OperationState.ERROR); throw new HiveSQLException("Error running query: " + e.toString(), e); } setState(OperationState.FINISHED); }
private void executeQuery(String query) { CommandProcessorResponse response = null; boolean failed = false; int retryCount = RETRIES; try { response = hiveDriver.run(query); } catch (CommandNeedRetryException ex) { if (--retryCount == 0) failed = true; } if (failed || response.getResponseCode() != 0) throw new RuntimeException( String.format( "Failed to execute command '%s', errorMsg = '%s'", query, (response != null ? response.getErrorMessage() : ""))); }
/** * * Compile the query and extract metadata * * @param sqlOperationConf * @throws HiveSQLException */ public void prepare(HiveConf sqlOperationConf) throws HiveSQLException { setState(OperationState.RUNNING); try { driver = new Driver(sqlOperationConf, getParentSession().getUserName()); // set the operation handle information in Driver, so that thrift API users // can use the operation handle they receive, to lookup query information in // Yarn ATS String guid64 = Base64.encodeBase64URLSafeString( getHandle().getHandleIdentifier().toTHandleIdentifier().getGuid()) .trim(); driver.setOperationId(guid64); // In Hive server mode, we are not able to retry in the FetchTask // case, when calling fetch queries since execute() has returned. // For now, we disable the test attempts. driver.setTryCount(Integer.MAX_VALUE); response = driver.compileAndRespond(statement); if (0 != response.getResponseCode()) { throw toSQLException("Error while compiling statement", response); } mResultSchema = driver.getSchema(); // hasResultSet should be true only if the query has a FetchTask // "explain" is an exception for now if (driver.getPlan().getFetchTask() != null) { // Schema has to be set if (mResultSchema == null || !mResultSchema.isSetFieldSchemas()) { throw new HiveSQLException( "Error compiling query: Schema and FieldSchema " + "should be set when query plan has a FetchTask"); } resultSchema = new TableSchema(mResultSchema); setHasResultSet(true); } else { setHasResultSet(false); } // Set hasResultSet true if the plan has ExplainTask // TODO explain should use a FetchTask for reading for (Task<? extends Serializable> task : driver.getPlan().getRootTasks()) { if (task.getClass() == ExplainTask.class) { resultSchema = new TableSchema(mResultSchema); setHasResultSet(true); break; } } } catch (HiveSQLException e) { setState(OperationState.ERROR); throw e; } catch (Throwable e) { setState(OperationState.ERROR); throw new HiveSQLException("Error running query: " + e.toString(), e); } }
@Override public void run() throws HiveSQLException { setState(OperationState.RUNNING); String statement_trimmed = statement.trim(); String[] tokens = statement_trimmed.split("\\s"); String cmd_1 = statement_trimmed.substring(tokens[0].length()).trim(); int ret = 0; String errorMessage = ""; String SQLState = null; try { driver = new Driver(getParentSession().getHiveConf()); // In Hive server mode, we are not able to retry in the FetchTask // case, when calling fetch queries since execute() has returned. // For now, we disable the test attempts. driver.setTryCount(Integer.MAX_VALUE); String subStatement = new VariableSubstitution().substitute(getParentSession().getHiveConf(), statement); response = driver.run(subStatement); if (0 != response.getResponseCode()) { throw new HiveSQLException( "Error while processing statement: " + response.getErrorMessage(), response.getSQLState(), response.getResponseCode()); } mResultSchema = driver.getSchema(); if (mResultSchema != null && mResultSchema.isSetFieldSchemas()) { resultSchema = new TableSchema(mResultSchema); setHasResultSet(true); } else { setHasResultSet(false); } } catch (HiveSQLException e) { setState(OperationState.ERROR); throw e; } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException("Error running query: " + e.toString()); } setState(OperationState.FINISHED); }
@Test public void testInsertSingleDynamicPartition() throws Exception { String tableName = "singledynamicpart"; CommandProcessorResponse ret = driver.run( "CREATE TABLE " + tableName + " (key string, value string) partitioned by (part1 string)"); Assert.assertEquals(0, ret.getResponseCode()); String tableLoc = warehouseDir + "/" + tableName; assertExistence(tableLoc); // Insert into test, with permission set 0. setPermission(tableLoc, 0); ret = driver.run( "insert into table " + tableName + " partition (part1) select key,value,part1 from mysrc"); Assert.assertEquals(0, ret.getResponseCode()); verifySinglePartition(tableLoc, 0); // Insert overwrite test, with permission set 1. setPermission(tableLoc, 1); ret = driver.run( "insert overwrite table " + tableName + " partition (part1) select key,value,part1 from mysrc"); Assert.assertEquals(0, ret.getResponseCode()); verifySinglePartition(tableLoc, 1); // delete and re-insert using insert overwrite. There's different code paths insert vs insert // overwrite for new tables. ret = driver.run("DROP TABLE " + tableName); Assert.assertEquals(0, ret.getResponseCode()); ret = driver.run( "CREATE TABLE " + tableName + " (key string, value string) partitioned by (part1 string)"); Assert.assertEquals(0, ret.getResponseCode()); assertExistence(warehouseDir + "/" + tableName); setPermission(warehouseDir + "/" + tableName); ret = driver.run( "insert overwrite table " + tableName + " partition (part1) select key,value,part1 from mysrc"); Assert.assertEquals(0, ret.getResponseCode()); verifySinglePartition(tableLoc, 0); }
@Test public void testAlterPartition() throws Exception { String tableName = "alterpart"; CommandProcessorResponse ret = driver.run( "CREATE TABLE " + tableName + " (key string, value string) partitioned by (part1 int, part2 int, part3 int)"); Assert.assertEquals(0, ret.getResponseCode()); assertExistence(warehouseDir + "/" + tableName); setPermission(warehouseDir + "/" + tableName); ret = driver.run( "insert into table " + tableName + " partition(part1='1',part2='1',part3='1') select key,value from mysrc"); Assert.assertEquals(0, ret.getResponseCode()); assertExistence(warehouseDir + "/" + tableName); setPermission(warehouseDir + "/" + tableName, 1); // alter partition ret = driver.run( "alter table " + tableName + " partition (part1='1',part2='1',part3='1') rename to partition (part1='2',part2='2',part3='2')"); Assert.assertEquals(0, ret.getResponseCode()); verifyPermission(warehouseDir + "/" + tableName + "/part1=2", 1); verifyPermission(warehouseDir + "/" + tableName + "/part1=2/part2=2", 1); verifyPermission(warehouseDir + "/" + tableName + "/part1=2/part2=2/part3=2", 1); Assert.assertTrue( listStatus(warehouseDir + "/" + tableName + "/part1=2/part2=2/part3=2").size() > 0); for (String child : listStatus(warehouseDir + "/" + tableName + "/part1=2/part2=2/part3=2")) { verifyPermission(child, 1); } }
/** * Tests the permission to the table doesn't change after the truncation * * @throws Exception */ @Test public void testTruncateTable() throws Exception { String tableName = "truncatetable"; String partition = warehouseDir + "/" + tableName + "/part1=1"; CommandProcessorResponse ret = driver.run( "CREATE TABLE " + tableName + " (key STRING, value STRING) PARTITIONED BY (part1 INT)"); Assert.assertEquals(0, ret.getResponseCode()); setPermission(warehouseDir + "/" + tableName); ret = driver.run( "insert into table " + tableName + " partition(part1='1') select key,value from mysrc where part1='1' and part2='1'"); Assert.assertEquals(0, ret.getResponseCode()); assertExistence(warehouseDir + "/" + tableName); verifyPermission(warehouseDir + "/" + tableName); verifyPermission(partition); ret = driver.run("TRUNCATE TABLE " + tableName); Assert.assertEquals(0, ret.getResponseCode()); ret = driver.run( "insert into table " + tableName + " partition(part1='1') select key,value from mysrc where part1='1' and part2='1'"); Assert.assertEquals(0, ret.getResponseCode()); verifyPermission(warehouseDir + "/" + tableName); assertExistence(partition); verifyPermission(partition); }
private static void setupDataTable() throws Exception { CommandProcessorResponse ret = driver.run("DROP TABLE IF EXISTS mysrc"); Assert.assertEquals(0, ret.getResponseCode()); ret = driver.run( "CREATE TABLE mysrc (key STRING, value STRING) PARTITIONED BY (part1 string, part2 string) STORED AS TEXTFILE"); Assert.assertEquals(0, ret.getResponseCode()); ret = driver.run( "LOAD DATA LOCAL INPATH '" + dataFilePath + "' INTO TABLE mysrc PARTITION (part1='1',part2='1')"); Assert.assertEquals(0, ret.getResponseCode()); ret = driver.run( "LOAD DATA LOCAL INPATH '" + dataFilePath + "' INTO TABLE mysrc PARTITION (part1='2',part2='2')"); Assert.assertEquals(0, ret.getResponseCode()); }
@Test public void testCreateDb() throws Exception { // see if db inherits permission from warehouse directory. String testDb = "mydb"; String tableName = "createtable"; setPermission(warehouseDir.toString()); verifyPermission(warehouseDir.toString()); CommandProcessorResponse ret = driver.run("CREATE DATABASE " + testDb); Assert.assertEquals(0, ret.getResponseCode()); assertExistence(warehouseDir + "/" + testDb + ".db"); verifyPermission(warehouseDir + "/" + testDb + ".db"); ret = driver.run("USE " + testDb); Assert.assertEquals(0, ret.getResponseCode()); ret = driver.run("CREATE TABLE " + tableName + " (key string, value string)"); Assert.assertEquals(0, ret.getResponseCode()); verifyPermission(warehouseDir + "/" + testDb + ".db/" + tableName); ret = driver.run("insert into table " + tableName + " select key,value from default.mysrc"); Assert.assertEquals(0, ret.getResponseCode()); assertExistence(warehouseDir + "/" + testDb + ".db/" + tableName); verifyPermission(warehouseDir + "/" + testDb + ".db/" + tableName); Assert.assertTrue(listStatus(warehouseDir + "/" + testDb + ".db/" + tableName).size() > 0); for (String child : listStatus(warehouseDir + "/" + testDb + ".db/" + tableName)) { verifyPermission(child); } ret = driver.run("USE default"); Assert.assertEquals(0, ret.getResponseCode()); // cleanup after the test. fs.delete(warehouseDir, true); fs.mkdirs(warehouseDir); Assert.assertEquals(listStatus(warehouseDir.toString()).size(), 0); setupDataTable(); }
@Test public void testLoad() throws Exception { String tableName = "load"; String location = "/hdfsPath"; fs.copyFromLocalFile(dataFilePath, new Path(location)); // case 1: load data CommandProcessorResponse ret = driver.run("CREATE TABLE " + tableName + " (key string, value string)"); Assert.assertEquals(0, ret.getResponseCode()); String tableLoc = warehouseDir + "/" + tableName; assertExistence(warehouseDir + "/" + tableName); // case1A: load data into non-partitioned table. setPermission(warehouseDir + "/" + tableName); ret = driver.run("load data inpath '" + location + "' into table " + tableName); Assert.assertEquals(0, ret.getResponseCode()); Assert.assertTrue(listStatus(tableLoc).size() > 0); for (String child : listStatus(tableLoc)) { verifyPermission(child); } // case1B: load data into overwrite non-partitioned-table setPermission(warehouseDir + "/" + tableName, 1); fs.copyFromLocalFile(dataFilePath, new Path(location)); ret = driver.run("load data inpath '" + location + "' overwrite into table " + tableName); Assert.assertEquals(0, ret.getResponseCode()); Assert.assertTrue(listStatus(tableLoc).size() > 0); for (String child : listStatus(tableLoc)) { verifyPermission(child, 1); } // case 2 is partitioned table. tableName = "loadpartition"; ret = driver.run( "CREATE TABLE " + tableName + " (key string, value string) partitioned by (part1 int, part2 int)"); Assert.assertEquals(0, ret.getResponseCode()); tableLoc = warehouseDir + "/" + tableName; assertExistence(tableLoc); // case 2A: load data into partitioned table. setPermission(tableLoc); fs.copyFromLocalFile(dataFilePath, new Path(location)); ret = driver.run( "LOAD DATA INPATH '" + location + "' INTO TABLE " + tableName + " PARTITION (part1='1',part2='1')"); Assert.assertEquals(0, ret.getResponseCode()); String partLoc = warehouseDir + "/" + tableName + "/part1=1/part2=1"; Assert.assertTrue(listStatus(partLoc).size() > 0); for (String child : listStatus(partLoc)) { verifyPermission(child); } // case 2B: insert data overwrite into non-partitioned table. setPermission(tableLoc, 1); fs.copyFromLocalFile(dataFilePath, new Path(location)); ret = driver.run( "LOAD DATA INPATH '" + location + "' OVERWRITE INTO TABLE " + tableName + " PARTITION (part1='1',part2='1')"); Assert.assertEquals(0, ret.getResponseCode()); Assert.assertTrue(listStatus(tableLoc).size() > 0); for (String child : listStatus(partLoc)) { verifyPermission(child, 1); } }
/** todo: what should this do on failure? Should it rethrow? Invalidate stats? */ void gatherStats() throws IOException { if (!ci.isMajorCompaction()) { return; } if (columnList.isEmpty()) { LOG.debug( "No existing stats for " + ci.dbname + "." + ci.tableName + " found. Will not run analyze."); return; // nothing to do } // e.g. analyze table page_view partition(dt='10/15/2014',country=’US’) // compute statistics for columns viewtime StringBuilder sb = new StringBuilder("analyze table ").append(ci.dbname).append(".").append(ci.tableName); if (ci.partName != null) { try { sb.append(" partition("); Map<String, String> partitionColumnValues = Warehouse.makeEscSpecFromName(ci.partName); for (Map.Entry<String, String> ent : partitionColumnValues.entrySet()) { sb.append(ent.getKey()).append("='").append(ent.getValue()).append("'"); } sb.append(")"); } catch (MetaException ex) { throw new IOException(ex); } } sb.append(" compute statistics for columns "); for (String colName : columnList) { sb.append(colName).append(","); } sb.setLength(sb.length() - 1); // remove trailing , LOG.info("running '" + sb.toString() + "'"); Driver d = new Driver(conf, userName); SessionState localSession = null; if (SessionState.get() == null) { localSession = SessionState.start(new SessionState(conf)); } try { CommandProcessorResponse cpr = d.run(sb.toString()); if (cpr.getResponseCode() != 0) { throw new IOException( "Could not update stats for table " + ci.getFullTableName() + (ci.partName == null ? "" : "/" + ci.partName) + " due to: " + cpr); } } catch (CommandNeedRetryException cnre) { throw new IOException( "Could not update stats for table " + ci.getFullTableName() + (ci.partName == null ? "" : "/" + ci.partName) + " due to: " + cnre.getMessage()); } finally { if (localSession != null) { localSession.close(); } } }
private void runCommand(String cmd) throws Exception { LOG.debug("Running command '{}'", cmd); ss.setCommandType(null); CommandProcessorResponse response = driver.run(cmd); assertEquals(response.getResponseCode(), 0); }
@Test public void testExim() throws Exception { // export the table to external file. String myLocation = warehouseDir + "/exim"; FileSystem fs = FileSystem.get(new URI(myLocation), conf); fs.mkdirs(new Path(myLocation)); setPermission(myLocation); myLocation = myLocation + "/temp"; CommandProcessorResponse ret = driver.run("export table mysrc to '" + myLocation + "'"); Assert.assertEquals(0, ret.getResponseCode()); // check if exported data has inherited the permissions. assertExistence(myLocation); verifyPermission(myLocation); assertExistence(myLocation + "/part1=1/part2=1"); verifyPermission(myLocation + "/part1=1/part2=1"); Assert.assertTrue(listStatus(myLocation + "/part1=1/part2=1").size() > 0); for (String child : listStatus(myLocation + "/part1=1/part2=1")) { verifyPermission(child); } assertExistence(myLocation + "/part1=2/part2=2"); verifyPermission(myLocation + "/part1=2/part2=2"); Assert.assertTrue(listStatus(myLocation + "/part1=2/part2=2").size() > 0); for (String child : listStatus(myLocation + "/part1=2/part2=2")) { verifyPermission(child); } // import the table back into another database String testDb = "eximdb"; ret = driver.run("CREATE DATABASE " + testDb); Assert.assertEquals(0, ret.getResponseCode()); // use another permission for this import location, to verify that it is really set // (permIndex=2) assertExistence(warehouseDir + "/" + testDb + ".db"); setPermission(warehouseDir + "/" + testDb + ".db", 1); ret = driver.run("USE " + testDb); Assert.assertEquals(0, ret.getResponseCode()); ret = driver.run("import from '" + myLocation + "'"); Assert.assertEquals(0, ret.getResponseCode()); // check permissions of imported, from the exported table assertExistence(warehouseDir + "/" + testDb + ".db/mysrc"); verifyPermission(warehouseDir + "/" + testDb + ".db/mysrc", 1); myLocation = warehouseDir + "/" + testDb + ".db/mysrc"; assertExistence(myLocation); verifyPermission(myLocation, 1); assertExistence(myLocation + "/part1=1/part2=1"); verifyPermission(myLocation + "/part1=1/part2=1", 1); Assert.assertTrue(listStatus(myLocation + "/part1=1/part2=1").size() > 0); for (String child : listStatus(myLocation + "/part1=1/part2=1")) { verifyPermission(child, 1); } assertExistence(myLocation + "/part1=2/part2=2"); verifyPermission(myLocation + "/part1=2/part2=2", 1); Assert.assertTrue(listStatus(myLocation + "/part1=2/part2=2").size() > 0); for (String child : listStatus(myLocation + "/part1=2/part2=2")) { verifyPermission(child, 1); } }