Package cascading.tap

Examples of cascading.tap.TapException


      {
      return new LineNumberReader( new InputStreamReader( inputStream, charsetName ) );
      }
    catch( UnsupportedEncodingException exception )
      {
      throw new TapException( exception );
      }
    }
View Full Code Here


      {
      return new PrintWriter( new OutputStreamWriter( outputStream, charsetName ) );
      }
    catch( UnsupportedEncodingException exception )
      {
      throw new TapException( exception );
      }
    }
View Full Code Here

    // ignore the output. will catch the failure downstream if any.
    // not ignoring the output causes race conditions with other systems writing to the same directory.
    File parentFile = file.getAbsoluteFile().getParentFile();

    if( parentFile != null && parentFile.exists() && parentFile.isFile() )
      throw new TapException( "cannot create parent directory, it already exists as a file: " + parentFile.getAbsolutePath() );

    // don't test for success, just fighting a race condition otherwise
    // will get caught downstream
    if( parentFile != null )
      parentFile.mkdirs();
View Full Code Here

      {
      return new LineNumberReader( new InputStreamReader( inputStream, charsetName ) );
      }
    catch( UnsupportedEncodingException exception )
      {
      throw new TapException( exception );
      }
    }
View Full Code Here

      {
      return new PrintWriter( new OutputStreamWriter( outputStream, charsetName ) );
      }
    catch( UnsupportedEncodingException exception )
      {
      throw new TapException( exception );
      }
    }
View Full Code Here

    TupleEntryIterator iterator = null;

    try
      {
      if( !tap.resourceExists( flowProcess.getConfigCopy() ) )
        throw new TapException( "unable to read fields from tap: " + tap + ", does not exist" );

      iterator = tap.openForRead( flowProcess );

      TupleEntry entry = iterator.hasNext() ? iterator.next() : null;

      if( entry == null )
        throw new TapException( "unable to read fields from tap: " + tap + ", is empty" );

      Object[] result = onlyParseLine( entry.getTuple().getString( 0 ) ); // don't coerce if type info is avail

      result = cleanParsedLine( result );

      Type[] inferred = inferTypes( result ); // infer type from field name, after removing quotes/escapes

      result = cleanFields( result ); // clean field names to remove any meta-data or manage case

      sourceFields = new Fields( Arrays.copyOf( result, result.length, Comparable[].class ) );

      if( inferred != null )
        sourceFields = sourceFields.applyTypes( inferred );
      }
    catch( IOException exception )
      {
      throw new TapException( "unable to read fields from tap: " + tap, exception );
      }
    finally
      {
      if( iterator != null )
        {
View Full Code Here

        catch( Exception exception )
          {
          result[ i ] = null;

          if( !safe )
            throw new TapException( getSafeMessage( split[ i ], i ), exception, new Tuple( line ) ); // trap actual line data

          if( LOG.isDebugEnabled() )
            LOG.debug( getSafeMessage( split[ i ], i ), exception );
          }
        }
View Full Code Here

    Object[] split = createSplit( line, splitPattern, numValues == 0 ? 0 : -1 );

    if( numValues != 0 && split.length != numValues )
      {
      if( enforceStrict )
        throw new TapException( getParseMessage( split ), new Tuple( line ) ); // trap actual line data

      if( LOG.isDebugEnabled() )
        LOG.debug( getParseMessage( split ) );

      Object[] array = new Object[ numValues ];
View Full Code Here

      return joinNoQuote( iterable, buffer );
      }
    catch( IOException exception )
      {
      throw new TapException( "unable to append data", exception );
      }
    }
View Full Code Here

  public boolean source( FlowProcess<? extends Configuration> flowProcess, SourceCall<Object[], RecordReader> sourceCall ) throws IOException
    {
    if( !sourceFired )
      {
      sourceFired = true;
      throw new TapException( "fail", new Tuple( "bad data" ) );
      }

    return super.source( flowProcess, sourceCall );
    }
View Full Code Here

TOP

Related Classes of cascading.tap.TapException

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.