GitHub user nickwallen opened a pull request:
https://github.com/apache/incubator-metron/pull/240
METRON-404 Stellar Compiler Hides Function Initialization Errors
The Stellar compiler is swallowing exceptions thrown during function
initialization. The compiler then reports that the function does not exist when
in fact the function exists, but initialization failed. The actual error during
initialization is lost and not reported anywhere.
For example, I have a function `PROFILE_GET` that is defined, but is set to
fail on initialization. Prior to this change, an error would be reported that
is misleading and hides the actual failure during initialization.
```
org.apache.metron.common.dsl.ParseException: Unable to find string function
PROFILE_GET. Valid functions are IS_DATE,IS_DOMAIN,MONTH,...
at
org.apache.metron.common.stellar.StellarCompiler.exitTransformationFunc(StellarCompiler.java:249)
at
org.apache.metron.common.stellar.generated.StellarParser$TransformationFuncContext.exitRule(StellarParser.java:1616)
```
After this change, the error looks like the following.
```
org.apache.metron.common.dsl.ParseException: Unable to initialize function
'PROFILE_GET'
at
org.apache.metron.common.stellar.StellarCompiler.initializeFunction(StellarCompiler.java:286)
...
Caused by: java.lang.IllegalStateException: missing required context:
PROFILER_HBASE_TABLE, PROFILER_ROW_KEY_BUILDER, PROFILER_COLUMN_BUILDER
at
org.apache.metron.profiler.client.stellar.GetProfile.validateContext(GetProfile.java:121)
at
org.apache.metron.profiler.client.stellar.GetProfile.initialize(GetProfile.java:68)
at
org.apache.metron.common.stellar.StellarCompiler.initializeFunction(StellarCompiler.java:282)
... 38 more
```
This PR is dependent on #233 and METRON-396.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/nickwallen/incubator-metron METRON-404
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-metron/pull/240.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #240
----
commit 465d37e64861a57dc878f13e5c0685ab31ab3b73
Author: cstella <[email protected]>
Date: 2016-08-26T17:21:13Z
METRON-396: Make Stellar function resolution happen via an annotation and
classpath search
commit 5a68d841f41db7a399c6da8747ba29fe793d6039
Author: Nick Allen <[email protected]>
Date: 2016-09-02T20:17:30Z
Merged METRON-396
commit 67f0a952debbd79fef2a3a02889e6e29329eb665
Author: Nick Allen <[email protected]>
Date: 2016-09-02T20:25:11Z
METRON-404 Corrected formatting and whitespace issues.
commit 6ebb028873ca8e9fee379e116ba9e19fcd4d062b
Author: Nick Allen <[email protected]>
Date: 2016-09-02T20:27:03Z
METRON-404 Stellar Compiler Hides Function Initialization Errors
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---