[ https://issues.apache.org/jira/browse/PHOENIX-4231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16369703#comment-16369703 ]
ASF GitHub Bot commented on PHOENIX-4231: ----------------------------------------- Github user aertoria commented on a diff in the pull request: https://github.com/apache/phoenix/pull/292#discussion_r169213703 --- Diff: phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java --- @@ -322,6 +327,99 @@ public void testDeleteJar() throws Exception { assertFalse(rs.next()); } + /** + * Test adding jars from an HDFS URI. + * @throws Exception + */ + @Test + public void testAddJarsFromHDFS() throws Exception { + compileTestClass(MY_ARRAY_INDEX_CLASS_NAME, MY_ARRAY_INDEX_PROGRAM, 7); + Statement stmt = driver.connect(url, EMPTY_PROPS).createStatement(); + // Note that we have already added all locally created UDF jars to the hbase.dynamic.jars.dir directory + ResultSet rs = stmt.executeQuery("list jars"); + int count = 0; + while(rs.next()) { + count++; + } + Path destJarPathOnHDFS = copyJarsFromDynamicJarsDirToDummyHDFSDir("myjar7.jar"); + stmt.execute("delete jar '"+ util.getConfiguration().get(QueryServices.DYNAMIC_JARS_DIR_KEY)+"/"+"myjar7.jar'"); + stmt.execute("add jars '" + destJarPathOnHDFS.toString() + "'"); + rs = stmt.executeQuery("list jars"); + int finalCount = 0; + while(rs.next()) { + finalCount++; + } + assertEquals(count, finalCount); --- End diff -- original `list jars` equal to `list jars`, shouldn't the newly added jar make it plus 1? i.e., assertEquals(count+1, finalCount); > Support restriction of remote UDF load sources > ----------------------------------------------- > > Key: PHOENIX-4231 > URL: https://issues.apache.org/jira/browse/PHOENIX-4231 > Project: Phoenix > Issue Type: Improvement > Reporter: Andrew Purtell > Assignee: Chinmay Kulkarni > Priority: Major > > When allowUserDefinedFunctions is true, users can load UDFs remotely via a > jar file from any HDFS filesystem reachable on the network. The setting > hbase.dynamic.jars.dir can be used to restrict locations for jar loading but > is only applied to jars loaded from the local filesystem. We should > implement support for similar restriction via configuration for jars loaded > via hdfs:// URIs. -- This message was sent by Atlassian JIRA (v7.6.3#76005)