Examples of ResourceSchema


Examples of org.apache.pig.ResourceSchema

        ResourceFieldSchema[] level0 = new ResourceFieldSchema[] {
                new ResourceFieldSchema()
                    .setName("fld0").setType(DataType.CHARARRAY)
        };
       
        ResourceSchema rSchema0 = new ResourceSchema()
            .setFields(level0);
       
        ResourceFieldSchema[] level2 = new ResourceFieldSchema[] {
                new ResourceFieldSchema()
                    .setName("t2").setType(DataType.BAG).setSchema(rSchema0)
View Full Code Here

Examples of org.apache.pig.ResourceSchema

        Schema level0 = TypeCheckingTestUtil.genFlatSchema(
                aliases,types);
        Schema.FieldSchema fld0 =
            new Schema.FieldSchema("f0", level0, DataType.BAG);
        Schema level1 = new Schema(fld0);
        Schema genSchema = Schema.getPigSchema(new ResourceSchema(level1));
        assertTrue(CheckTwoLevelAccess(genSchema));
    }
View Full Code Here

Examples of org.apache.pig.ResourceSchema

        Schema level0 = TypeCheckingTestUtil.genFlatSchema(
                aliases,types);
        Schema.FieldSchema fld0 =
            new Schema.FieldSchema("f0", level0, DataType.BAG);
        Schema level1 = new Schema(fld0);
        Schema genSchema = Schema.getPigSchema(new ResourceSchema(level1));
        assertTrue(CheckTwoLevelAccess(genSchema));
    }
View Full Code Here

Examples of org.apache.pig.ResourceSchema

                // the create() below will fail is this method gets called
                // more than once
                if(!new File(checkFileName).createNewFile()) {
                    throw new RuntimeException(checkFileName + " already exists!");
                }
                return new ResourceSchema(
                        Utils.getSchemaFromString("a:chararray,b:int"));
            } catch (ParseException e) {
                throw new IOException(e);
            }
        }
View Full Code Here

Examples of org.apache.pig.ResourceSchema

            ResourceFieldSchema stringfs = new ResourceFieldSchema();
            stringfs.setType(DataType.CHARARRAY);
            ResourceFieldSchema intfs = new ResourceFieldSchema();
            intfs.setType(DataType.INTEGER);
           
            ResourceSchema tupleSchema = new ResourceSchema();
            tupleSchema.setFields(new ResourceFieldSchema[]{stringfs, intfs});
            ResourceFieldSchema tuplefs = new ResourceFieldSchema();
            tuplefs.setSchema(tupleSchema);
            tuplefs.setType(DataType.TUPLE);
           
            ResourceSchema bagSchema = new ResourceSchema();
            bagSchema.setFields(new ResourceFieldSchema[]{tuplefs});
            ResourceFieldSchema bagfs = new ResourceFieldSchema();
            bagfs.setSchema(bagSchema);
            bagfs.setType(DataType.BAG);
           
            t.append(flds[0].compareTo("")!=0 ? ps.getLoadCaster().bytesToBag(flds[0].getBytes(), bagfs) : null);
View Full Code Here

Examples of org.apache.pig.ResourceSchema

                    "i:int,d:double);store a into '" + outputFileName + "' using " +
                            "BinStorage();";
            pig.setBatchOn();
            Util.registerMultiLineQuery(pig, query);
            pig.executeBatch();
            ResourceSchema rs = new BinStorage().getSchema(outputFileName,
                    new Job(ConfigurationUtil.toConfiguration(pig.getPigContext().
                            getProperties())));
            Schema expectedSchema = Util.getSchemaFromString(
                    "c:chararray,i:int,d:double");
            Assert.assertTrue("Checking binstorage getSchema output", Schema.equals(
View Full Code Here

Examples of org.apache.pig.ResourceSchema

        StoreFuncInterface storeFunc = store.getStoreFunc();
        if (storeFunc instanceof StoreMetadata) {
            Schema schema = store.getSchema();
            if (schema != null) {
                ((StoreMetadata) storeFunc).storeSchema(
                        new ResourceSchema(schema, store.getSortInfo()), store.getSFile()
                                .getFileName(), new Job(conf));
            }
        }
    }
View Full Code Here

Examples of org.apache.pig.ResourceSchema

        }

        @Override
        public ResourceSchema getSchema(String location, Job job)
                throws IOException {
            return new ResourceSchema(schema);
        }
View Full Code Here

Examples of org.apache.pig.ResourceSchema

  @Override
  public ResourceSchema getSchema(String s, Job job) throws IOException {
    Schema newSchema =  new Schema();
    newSchema.add(new Schema.FieldSchema("timestamp", DataType.LONG));
    newSchema.add(new Schema.FieldSchema("map", DataType.MAP));
    return new ResourceSchema(newSchema);
  }
View Full Code Here

Examples of org.apache.pig.ResourceSchema

    public static ResourceSchema convertToResourceSchema(org.apache.hadoop.zebra.schema.Schema tSchema)
    throws IOException {
        if( tSchema == null )
            return null;

        ResourceSchema rSchema = new ResourceSchema();
        int fieldCount = tSchema.getNumColumns();
        ResourceFieldSchema[] rFields = new ResourceFieldSchema[fieldCount];
        for( int i = 0; i < fieldCount; i++ ) {
            org.apache.hadoop.zebra.schema.Schema.ColumnSchema cSchema = tSchema.getColumn( i );
            if( cSchema != null )
                rFields[i] = convertToResourceFieldSchema( cSchema );
            else
                rFields[i] = new ResourceFieldSchema();
        }
        rSchema.setFields( rFields );
        return rSchema;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.