Mark Roddy avatar Mark Roddy committed 3fc9315 Draft

add support for pig 0.9.2

Comments (0)

Files changed (1)

squealer/pigserver.py

         Overriding as this method in the base class prints to stdout
         for no good reason.
         """
-        lp = self.getPlanFromAlias(alias, "describe")
-        lp = self.compileLp(alias, False)
+        if hasattr(self, 'getPlanFromAlias'):
+            # for pig 0.8-
+            lp = self.getPlanFromAlias(alias, "describe")
+            lp = self.compileLp(alias, False)
 
-        for lo in lp.getLeaves():
-            if lo.getAlias() == alias:
-                return lo.getSchema()
+            for lo in lp.getLeaves():
+                if lo.getAlias() == alias:
+                    return lo.getSchema()
+        else:
+            # For pig 0.9+, conditionally importing so as not
+            # to break on older versions
+            import org.apache.pig.newplan.logical.Util
+            op = self.getOperatorForAlias(alias)
+            schema = op.getSchema()
+            s = org.apache.pig.newplan.logical.Util.translateSchema(schema)
+            return s            
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.