[Solved-1 Solution] Importing a common constant declared pig file in other pig files ?
How to import a common constant declared file in other pig files ?
- The IMPORT keyword is used to import macros, not constants. %declare and %default are preprocessor statements, and its scope is all the remaining lines in the script.
- If we declare it in a script, but import it from a different one, it will not work because it is out of scope.
- Both statements are valid in a macro, as long as we use the declared variable inside the macro. If we need to define constants outside the script for modularity.
we need to use a parameter file like below:
- Then we have to run the pig script
- If we really want to use IMPORT, we could create a macro which takes care of the filtering with that constant value:
- We can use macro instead of calling filter function