IMPALA-4442: Fix FE ParserTests UnsatisfiedLinkError In some development environments, the ParserTests may always fail with an java.lang.UnsatisfiedLinkError:
org.apache.impala.service.FeSupport.NativeGetStartupOptions()[B at o.a.i.service.FeSupport.NativeGetStartupOptions(Native Method) at o.a.i.service.FeSupport.GetStartupOptions(FeSupport.java:268) at o.a.i.common.RuntimeEnv.<init>(RuntimeEnv.java:47) at o.a.i.common.RuntimeEnv.<clinit>(RuntimeEnv.java:34) at o.a.i.testutil.TestUtils.assumeKuduIsSupported(TestUtils.java:288) at o.a.i.analysis.ParserTest.TestKuduUpdate(ParserTest.java:1697) I believe the issue is related to some static loading of classes and/or libraries in Java because changing the ParserTest to initialize the Frontend makes the error go away. I haven't been able to pin-point the exact issue with loading, but it makes sense that the ParserTest should initialize the Frontend static state if it will be called by libfesupport later since it seems to be an issue affecting some environments and not others, i.e. subject to environmental factors. This fixes the issue by changing ParserTest to extend FrontendTestBase which initializes the Frontend class statically. Change-Id: I1828504f79c51679f9ca07176bffbe248d450e87 Reviewed-on: http://gerrit.cloudera.org:8080/4976 Reviewed-by: Alex Behm <[email protected]> Tested-by: Internal Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/1a99b782 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/1a99b782 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/1a99b782 Branch: refs/heads/master Commit: 1a99b78227dc37e2ab10d8b117fbc6930b703efb Parents: 3be4b3e Author: Matthew Jacobs <[email protected]> Authored: Mon Nov 7 11:50:24 2016 -0800 Committer: Internal Jenkins <[email protected]> Committed: Tue Nov 8 00:31:35 2016 +0000 ---------------------------------------------------------------------- .../org/apache/impala/analysis/ParserTest.java | 22 ++------------------ 1 file changed, 2 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/1a99b782/fe/src/test/java/org/apache/impala/analysis/ParserTest.java ---------------------------------------------------------------------- diff --git a/fe/src/test/java/org/apache/impala/analysis/ParserTest.java b/fe/src/test/java/org/apache/impala/analysis/ParserTest.java index 092e146..98863ce 100644 --- a/fe/src/test/java/org/apache/impala/analysis/ParserTest.java +++ b/fe/src/test/java/org/apache/impala/analysis/ParserTest.java @@ -18,7 +18,6 @@ package org.apache.impala.analysis; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -30,37 +29,20 @@ import java.util.List; import org.apache.hadoop.hive.metastore.MetaStoreUtils; import org.apache.impala.analysis.TimestampArithmeticExpr.TimeUnit; import org.apache.impala.common.AnalysisException; +import org.apache.impala.common.FrontendTestBase; import org.apache.impala.testutil.TestUtils; import org.junit.Test; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; -public class ParserTest { +public class ParserTest extends FrontendTestBase { // Representative operands for testing. private final static String[] operands_ = new String[] {"i", "5", "true", "NULL", "'a'", "(1.5 * 8)" }; /** - * Asserts in case of parser error. - */ - public Object ParsesOk(String stmt) { - SqlScanner input = new SqlScanner(new StringReader(stmt)); - SqlParser parser = new SqlParser(input); - Object result = null; - try { - result = parser.parse().value; - } catch (Exception e) { - System.err.println(parser.getErrorMsg(stmt)); - e.printStackTrace(); - fail("\n" + parser.getErrorMsg(stmt)); - } - assertNotNull(result); - return result; - } - - /** * Attempts to parse the given select statement, and asserts in case of parser error. * Also asserts that the first select-list expression is of given class. */
