Package cascading.scheme

Examples of cascading.scheme.Scheme


    private EsFactory factory = new EsFactory();

    @Test
    public void testCreateScheme() throws IOException {
        Scheme scheme = factory.createScheme(new Fields(), new Properties());
        assertThat(scheme, notNullValue());

        try {
            scheme.sourceConfInit(null, null, null);
            fail();
        } catch (UnsupportedOperationException ex) {
        }

        try {
            scheme.sinkConfInit(null, null, null);
            fail();
        } catch (UnsupportedOperationException ex) {
        }

        try {
            scheme.source(null, null);
            fail();
        } catch (UnsupportedOperationException ex) {
        }
        try {
            scheme.sink(null, null);
            fail();
        } catch (UnsupportedOperationException ex) {
        }

    }
View Full Code Here


    @Test
    public void testCreateTap() {
        Fields fl = new Fields();
        Properties props = new Properties();

        Scheme scheme = factory.createScheme(fl, props);
        Tap tap = factory.createTap(scheme, "somePath", SinkMode.KEEP, props);
        assertThat(tap, notNullValue());
        assertThat(tap.getClass().getName(), containsString("HadoopTap"));
    }
View Full Code Here

        return new SolrScheme(schemeFields, solrCoreDir, maxSegments, dataDirPropertyName);
    }
   
    @Override
    protected Tap<?, ?, ?> makeSolrSink(Fields fields, String path) throws Exception {
        Scheme scheme = new SolrScheme(fields, SOLR_CORE_DIR);
        return new Hfs(scheme, path, SinkMode.REPLACE);
    }
View Full Code Here

    Path path = new Path(inputPath + "/" + schemeFileName);
    FileSystem fs = path.getFileSystem(new Configuration());
    try {
      FSDataInputStream file = fs.open(path);
      ObjectInputStream ois = new ObjectInputStream(file);
      Scheme scheme = (Scheme) ois.readObject();
      Fields fields = (Fields) ois.readObject();
      scheme.setSourceFields(fields);
      ois.close();
      file.close();
      return scheme;
    } catch (ClassNotFoundException e) {
      throw new IOException("Could not read PyCascading file header: " + inputPath + "/"
View Full Code Here

  @Test
  public void testTapSourceConfigDef() throws IOException
    {
    getPlatform().copyFromLocal( inputFileNums20 );

    Scheme scheme = getPlatform().getTestConfigDefScheme();

    Tap source = getPlatform().getTap( scheme, inputFileNums20, SinkMode.KEEP );

    // process -> after sink/sourceConfInit are called
    // default -> Wrapper for all cluster side calls
View Full Code Here

    Pipe pipe = new Pipe( "test" );

    pipe = new Each( pipe, new Insert( new Fields( "value" ), "nada" ), Fields.ALL );

    Scheme scheme = getPlatform().getTestConfigDefScheme();

    Tap sink = getPlatform().getTap( scheme, getOutputPath( "tapsinkconfigdef" ), SinkMode.REPLACE );

    // process -> after sink/sourceConfInit are called
    // default -> Wrapper for all cluster side calls
View Full Code Here

    }

  @Test
  public void testScheme()
    {
    Scheme scheme = new Scheme()
    {
    @Override
    public void sourceConfInit( FlowProcess flowProcess, Tap tap, Object conf )
      {
      }

    @Override
    public void sinkConfInit( FlowProcess flowProcess, Tap tap, Object conf )
      {
      }

    @Override
    public boolean source( FlowProcess flowProcess, SourceCall sourceCall ) throws IOException
      {
      return false;
      }

    @Override
    public void sink( FlowProcess flowProcess, SinkCall sinkCall ) throws IOException
      {
      }
    };

    assertEqualsTrace( "cascading.TraceTest.testScheme(TraceTest.java", scheme.getTrace() );
    }
View Full Code Here

    }

  @Override
  public Scheme getScheme()
    {
    Scheme scheme = super.getScheme();

    if( scheme != null )
      return scheme;

    return taps[ 0 ].getScheme(); // they should all be equivalent per verifyTaps
View Full Code Here

    {
    verifyNotSourcesSinks( flowDef.getCheckpoints(), flowDef.getSources(), flowDef.getSinks(), "checkpoint" );

    for( Tap checkpointTap : flowDef.getCheckpoints().values() )
      {
      Scheme scheme = checkpointTap.getScheme();

      if( scheme.getSourceFields().equals( Fields.UNKNOWN ) && scheme.getSinkFields().equals( Fields.ALL ) )
        continue;

      throw new PlannerException( "checkpoint tap scheme must be undeclared, source fields must be UNKNOWN, and sink fields ALL, got: " + scheme.toString() );
      }

    Set<String> names = new HashSet<String>( asList( Pipe.names( flowTails ) ) );

    for( String name : flowDef.getCheckpoints().keySet() )
View Full Code Here

    Map sources = new HashMap();

    sources.put( "lower", sourceLower );
    sources.put( "upper", sourceUpper );

    Scheme leftScheme = testTempReplaced ? new SequenceFile( new Fields( "num", "lower", "num2", "upper" ) ) : new TextLine( new Fields( "offset", "line" ), new Fields( "lower" ) );
    Tap sinkLeft = new Hfs( leftScheme, "/splitmiddle/left", SinkMode.REPLACE );

    Scheme rightScheme = testTempReplaced ? new SequenceFile( new Fields( "lower" ) ) : new TextLine( new Fields( "offset", "line" ), new Fields( "lower" ) );
    Tap sinkRight = new Hfs( rightScheme, "/splitmiddle/right", SinkMode.REPLACE );

    Map sinks = new HashMap();

    sinks.put( "left", sinkLeft );
View Full Code Here

TOP

Related Classes of cascading.scheme.Scheme

Copyright © 2018 www.massapicom. 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.