public void delete_resources(ResourceType t) { Set<String> resources = resourceMaps.getResourceSet(t); if (resources != null && !resources.isEmpty()) { delete_resources(t, new ArrayList<String>(resources)); resourceMaps.getResourceMap().remove(t); resourceMaps.getAllLocalHdfsLocationMap().remove(t); } }
public Set<String> list_hdfs_resource(ResourceType type) { Set<String> set = resourceMaps.getResourceSet(type); Set<String> result = new HashSet<String>(); for (String file : set){ if (resourceMaps.getLocalHdfsLocationMap(ResourceType.FILE).containsKey(file)){ result.add(resourceMaps.getLocalHdfsLocationMap(ResourceType.FILE).get(file)); } if (resourceMaps.getLocalHdfsLocationMap(ResourceType.JAR).containsKey(file)){ result.add(resourceMaps.getLocalHdfsLocationMap(ResourceType.JAR).get(file)); } } return result; }
public void delete_resources(ResourceType t) { Set<String> resources = resourceMaps.getResourceSet(t); if (resources != null && !resources.isEmpty()) { delete_resources(t, new ArrayList<String>(resources)); resourceMaps.getResourceMap().remove(t); } }
public void delete_resources(ResourceType t, List<String> values) { Set<String> resources = resourceMaps.getResourceSet(t); if (resources == null || resources.isEmpty()) { return; Map<String, Set<String>> resourcePathMap = resourceMaps.getResourcePathMap(t); Map<String, Set<String>> reverseResourcePathMap = resourceMaps.getReverseResourcePathMap(t); List<String> deleteList = new LinkedList<String>(); for (String value : values) {
public Set<String> list_resource(ResourceType t, List<String> filter) { Set<String> orig = resourceMaps.getResourceSet(t); if (orig == null) { return null; } if (filter == null) { return orig; } else { Set<String> fnl = new HashSet<String>(); for (String one : orig) { if (filter.contains(one)) { fnl.add(one); } } return fnl; } }
public SessionState(HiveConf conf, String userName) { this.sessionConf = conf; this.userName = userName; this.registry = new Registry(false); if (LOG.isDebugEnabled()) { LOG.debug("SessionState user: " + userName); } isSilent = conf.getBoolVar(HiveConf.ConfVars.HIVESESSIONSILENT); ls = new LineageState(); resourceMaps = new ResourceMaps(); // Must be deterministic order map for consistent q-test output across Java versions overriddenConfigurations = new LinkedHashMap<String, String>(); overriddenConfigurations.putAll(HiveConf.getConfSystemProperties()); // if there isn't already a session name, go ahead and create it. if (StringUtils.isEmpty(conf.getVar(HiveConf.ConfVars.HIVESESSIONID))) { conf.setVar(HiveConf.ConfVars.HIVESESSIONID, makeSessionId()); } // Using system classloader as the parent. Using thread context // classloader as parent can pollute the session. See HIVE-11878 parentLoader = SessionState.class.getClassLoader(); // Make sure that each session has its own UDFClassloader. For details see {@link UDFClassLoader} final ClassLoader currentLoader = Utilities.createUDFClassLoader((URLClassLoader) parentLoader, new String[]{}); this.sessionConf.setClassLoader(currentLoader); resourceDownloader = new ResourceDownloader(conf, HiveConf.getVar(conf, ConfVars.DOWNLOADED_RESOURCES_DIR)); }
private String removeHdfsFilesFromMapping(ResourceType t, String file){ String key = null; if (resourceMaps.getLocalHdfsLocationMap(t).containsValue(file)){ for (Map.Entry<String, String> entry : resourceMaps.getLocalHdfsLocationMap(t).entrySet()){ if (entry.getValue().equals(file)){ key = entry.getKey(); resourceMaps.getLocalHdfsLocationMap(t).remove(key); } } } return key; }
public void delete_resources(ResourceType t, List<String> values) { Set<String> resources = resourceMaps.getResourceSet(t); if (resources == null || resources.isEmpty()) { return; Map<String, Set<String>> resourcePathMap = resourceMaps.getResourcePathMap(t); Map<String, Set<String>> reverseResourcePathMap = resourceMaps.getReverseResourcePathMap(t); List<String> deleteList = new LinkedList<String>(); for (String value : values) {
public void delete_resources(ResourceType t) { Set<String> resources = resourceMaps.getResourceSet(t); if (resources != null && !resources.isEmpty()) { delete_resources(t, new ArrayList<String>(resources)); resourceMaps.getResourceMap().remove(t); } }
public Set<String> list_resource(ResourceType t, List<String> filter) { Set<String> orig = resourceMaps.getResourceSet(t); if (orig == null) { return null; } if (filter == null) { return orig; } else { Set<String> fnl = new HashSet<String>(); for (String one : orig) { if (filter.contains(one)) { fnl.add(one); } } return fnl; } }
public SessionState(HiveConf conf, String userName) { this.sessionConf = conf; this.userName = userName; this.registry = new Registry(false); if (LOG.isDebugEnabled()) { LOG.debug("SessionState user: " + userName); } isSilent = conf.getBoolVar(HiveConf.ConfVars.HIVESESSIONSILENT); resourceMaps = new ResourceMaps(); // Must be deterministic order map for consistent q-test output across Java versions overriddenConfigurations = new LinkedHashMap<String, String>(); overriddenConfigurations.putAll(HiveConf.getConfSystemProperties()); // if there isn't already a session name, go ahead and create it. if (StringUtils.isEmpty(conf.getVar(HiveConf.ConfVars.HIVESESSIONID))) { conf.setVar(HiveConf.ConfVars.HIVESESSIONID, makeSessionId()); getConsole().printInfo("Hive Session ID = " + getSessionId()); } // Using system classloader as the parent. Using thread context // classloader as parent can pollute the session. See HIVE-11878 parentLoader = SessionState.class.getClassLoader(); // Make sure that each session has its own UDFClassloader. For details see {@link UDFClassLoader} final ClassLoader currentLoader = Utilities.createUDFClassLoader((URLClassLoader) parentLoader, new String[]{}); this.sessionConf.setClassLoader(currentLoader); resourceDownloader = new ResourceDownloader(conf, HiveConf.getVar(conf, ConfVars.DOWNLOADED_RESOURCES_DIR)); killQuery = new NullKillQuery(); ShimLoader.getHadoopShims().setHadoopSessionContext(getSessionId()); }
@VisibleForTesting protected List<URI> resolveAndDownload(ResourceType resourceType, String value, boolean convertToUnix) throws URISyntaxException, IOException { List<URI> uris = resourceDownloader.resolveAndDownload(value, convertToUnix); if (ResourceDownloader.isHdfsUri(value)) { assert uris.size() == 1 : "There should only be one URI localized-resource."; resourceMaps.getLocalHdfsLocationMap(resourceType).put(uris.get(0).toString(), value); } return uris; }
public List<String> add_resources(ResourceType t, Collection<String> values, boolean convertToUnix) throws RuntimeException { Set<String> resourceSet = resourceMaps.getResourceSet(t); Map<String, Set<String>> resourcePathMap = resourceMaps.getResourcePathMap(t); Map<String, Set<String>> reverseResourcePathMap = resourceMaps.getReverseResourcePathMap(t); List<String> localized = new ArrayList<String>(); try {
public Set<String> list_local_resource(ResourceType type) { Set<String> resources = new HashSet<String>(list_resource(type, null)); Set<String> set = resourceMaps.getResourceSet(type); for (String file : set){ if (resourceMaps.getLocalHdfsLocationMap(ResourceType.FILE).containsKey(file)){ resources.remove(file); } if (resourceMaps.getLocalHdfsLocationMap(ResourceType.JAR).containsKey(file)){ resources.remove(file); } } return resources; }
public Set<String> list_resource(ResourceType t, List<String> filter) { Set<String> orig = resourceMaps.getResourceSet(t); if (orig == null) { return null; } if (filter == null) { return orig; } else { Set<String> fnl = new HashSet<String>(); for (String one : orig) { if (filter.contains(one)) { fnl.add(one); } } return fnl; } }
public SessionState(HiveConf conf, String userName) { this.conf = conf; this.userName = userName; if (LOG.isDebugEnabled()) { LOG.debug("SessionState user: " + userName); } isSilent = conf.getBoolVar(HiveConf.ConfVars.HIVESESSIONSILENT); ls = new LineageState(); resourceMaps = new ResourceMaps(); dependencyResolver = new DependencyResolver(); // Must be deterministic order map for consistent q-test output across Java versions overriddenConfigurations = new LinkedHashMap<String, String>(); overriddenConfigurations.putAll(HiveConf.getConfSystemProperties()); // if there isn't already a session name, go ahead and create it. if (StringUtils.isEmpty(conf.getVar(HiveConf.ConfVars.HIVESESSIONID))) { conf.setVar(HiveConf.ConfVars.HIVESESSIONID, makeSessionId()); } parentLoader = JavaUtils.getClassLoader(); }
public List<String> add_resources(ResourceType t, Collection<String> values, boolean convertToUnix) throws RuntimeException { Set<String> resourceSet = resourceMaps.getResourceSet(t); Map<String, Set<String>> resourcePathMap = resourceMaps.getResourcePathMap(t); Map<String, Set<String>> reverseResourcePathMap = resourceMaps.getReverseResourcePathMap(t); List<String> localized = new ArrayList<String>(); try {
public void delete_resources(ResourceType t, List<String> values) { Set<String> resources = resourceMaps.getResourceSet(t); if (resources == null || resources.isEmpty()) { return; Map<String, Set<String>> resourcePathMap = resourceMaps.getResourcePathMap(t); Map<String, Set<String>> reverseResourcePathMap = resourceMaps.getReverseResourcePathMap(t); List<String> deleteList = new LinkedList<String>(); for (String value : values) {
public List<String> add_resources(ResourceType t, Collection<String> values, boolean convertToUnix) throws RuntimeException { Set<String> resourceSet = resourceMaps.getResourceSet(t); Map<String, Set<String>> resourcePathMap = resourceMaps.getResourcePathMap(t); Map<String, Set<String>> reverseResourcePathMap = resourceMaps.getReverseResourcePathMap(t); List<String> localized = new ArrayList<String>(); try {