[
https://issues.apache.org/jira/browse/PIG-2729?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13416394#comment-13416394
]
Rohini Palaniswamy commented on PIG-2729:
-----------------------------------------
Johannes,
You need to do "git diff --no-prefix" to get the patch so that it can be
applied on svn. And it would be easier to review if you can also post the patch
in reviewboard.
1) Small nitpick. The paths variable need not be defined outside the if block.
{code}
String[] paths = {};
+ if (srchPath != null) {
+ paths = srchPath.split(","); //Could just be String[]
paths = srchPath.split(",");
{code}
2) The problem I mentioned in the previous comment about "../" still exists.
You have also removed the f.exists() || f.isAbsolute() ||
scriptPath.startsWith("./") checks. They are required. Now the search will be
looking at the wrong paths even if the file existed or was an absolute path and
makes the behavior unpredictable. For eg: If there was a statement, import
'/dir1/file1.pig' and the pig.import.search.path was '/dir2,/dir3', then you
would be considering files /dir2/dir1/file1.pig and /dir3/dir1/file1.pig. The
same thing will happen for relative paths from base dir and ./ and ../.
3) Doing a canonical path for f.exists() is not required. canonicalize results
internally in a native call and would just add overhead.
Thanks,
Rohini
> Macro expansion does not use pig.import.search.path - UnitTest borked
> ---------------------------------------------------------------------
>
> Key: PIG-2729
> URL: https://issues.apache.org/jira/browse/PIG-2729
> Project: Pig
> Issue Type: Bug
> Affects Versions: 0.9.2, 0.10.0
> Environment: pig-0.9.2 and pig-0.10.0, hadoop-0.20.2 from Clouderas
> distribution cdh3u3 on Kubuntu 12.04 64Bit.
> Reporter: Johannes Schwenk
> Fix For: 0.10.0
>
> Attachments: PIG-2729.patch, test-macros.tar.gz,
> use-search-path-for-imports.patch
>
>
> org.apache.pig.test.TestMacroExpansion, in function importUsingSearchPathTest
> the import statement is provided with the full path to /tmp/mytest2.pig so
> the pig.import.search.path is never used. I changed the import to
> import 'mytest2.pig';
> and ran the UnitTest again. This time the test failed as expected from my
> experience from earlier this day trying in vain to get pig eat my
> pig.import.search.path property! Other properties in the same custom
> properties file (provided via -propertyFile command line option) like
> udf.import.list get read without any problem.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira