MCPcopy Create free account
hub / github.com/apache/pig / dumpSchema

Method dumpSchema

src/org/apache/pig/PigServer.java:885–912  ·  view source on GitHub ↗

Write the schema for an alias to System.out. @param alias Alias whose schema will be written out @return Schema of alias dumped @throws IOException

(String alias)

Source from the content-addressed store, hash-verified

883 * @throws IOException
884 */
885 public Schema dumpSchema(String alias) throws IOException {
886 try {
887 pigContext.inDumpSchema = true;
888 if ("@".equals(alias)) {
889 alias = getLastRel();
890 }
891 LogicalRelationalOperator op = getOperatorForAlias( alias );
892 LogicalSchema schema = op.getSchema();
893
894 boolean pretty = "true".equals(pigContext.getProperties()
895 .getProperty(PRETTY_PRINT_SCHEMA_PROPERTY));
896
897 if (schema != null) {
898 Schema s = org.apache.pig.newplan.logical.Util.translateSchema(schema);
899 System.out.println(alias + ": " + (pretty ? s.prettyPrint() : s.toString()));
900 return s;
901 } else {
902 System.out.println("Schema for " + alias + " unknown.");
903 return null;
904 }
905 } catch (FrontendException fee) {
906 int errCode = 1001;
907 String msg = "Unable to describe schema for alias " + alias;
908 throw new FrontendException (msg, errCode, PigException.INPUT, false, null, fee);
909 } finally {
910 pigContext.inDumpSchema = false;
911 }
912 }
913
914 /**
915 * Write the schema for a nestedAlias to System.out. Denoted by

Calls 9

getLastRelMethod · 0.95
getOperatorForAliasMethod · 0.95
getSchemaMethod · 0.95
prettyPrintMethod · 0.95
toStringMethod · 0.95
getPropertyMethod · 0.80
translateSchemaMethod · 0.80
equalsMethod · 0.45
getPropertiesMethod · 0.45