Class TablePlanRead

All Implemented Interfaces:
TablePlan

public class TablePlanRead extends TablePlanCommon<TablePlanRead>
Reads rows into a TableColumnar.

Example:


 StreamSource streamSource = StreamSources.fromString("Code,Amount\nabc,10.5\n", "values.csv");
 RowSource rowSource = RowSourceCsv.builder().withStreamSource(streamSource).withSeparator(',').build();

 TableColumnar table = new TablePlanRead().withTableName(TableName.of("Trades")).execute(rowSource);
 
  • Constructor Details

    • TablePlanRead

      public TablePlanRead()
  • Method Details

    • withIncludeResourceName

      public TablePlanRead withIncludeResourceName(ColumnName resourceName)
    • getResourceName

      public ColumnName getResourceName()
    • withTransform

      public TablePlanRead withTransform(Transform transform)
    • withTransforms

      public TablePlanRead withTransforms(Transform... transforms)
    • getTransforms

      public List<Transform> getTransforms()
    • withColumnType

      public TablePlanRead withColumnType(ColumnName columnName, Column.Type columnType)
    • getColumnType

      public Column.Type getColumnType(ColumnName columnName)
    • getColumnTypes

      public Map<ColumnName,Column.Type> getColumnTypes()
    • execute

      public TableColumnar execute(TableName tableName, Column... columns)
    • execute

      public TableColumnar execute(TableName tableName, TableDescription tableDescription, Column... columns)
    • execute

      public TableColumnar execute(TableColumnar table)
    • execute

      public TableColumnar execute(StreamSource streamSource, TabularRowReader reader)
    • execute

      public TableColumnar execute(RowCursor rowCursor)
      Description copied from interface: TablePlan
      Executes this plan against an already-open row supplier.

      Use this lower-level entry point when the caller already owns the live source resource and wants to control its lifetime explicitly.

      CSV example:

      
       StreamSource streamSource = ...;
       TablePlanRead plan = new TablePlanRead();
      
       try (InputStream inputStream = streamSource.openStream();
               RowCursor rowCursor = RowCursorCsv.builder()
                       .withSeparator(';')
                       .build(inputStream))
       {
           TableColumnar table = plan.execute(rowCursor);
       }
       
      JDBC example:
      
       PreparedStatement preparedStatement = ...;
       TablePlanRead plan = new TablePlanRead();
      
       try (ResultSet resultSet = preparedStatement.executeQuery();
               RowCursor rowCursor = new RowCursorResultSet(resultSet))
       {
           TableColumnar table = plan.execute(rowCursor);
       }
       
      Parameters:
      rowCursor - open row supplier to consume
      Returns:
      the resulting table
    • execute

      public TableColumnar execute(RowSource rowSource)
      Description copied from interface: TablePlan
      Executes this plan against a configured row source.

      This is the simplest high-level entry point when the source should handle opening and closing its own row supplier internally.

      CSV example:

      
       StreamSource streamSource = ...;
       TablePlanRead plan = new TablePlanRead();
      
       TableColumnar table = plan.execute(RowSourceCsv.builder()
               .withStreamSource(streamSource)
               .withSeparator(';')
               .build());
       
      JDBC example:
      
       PreparedStatement preparedStatement = ...;
       TablePlanRead plan = new TablePlanRead();
      
       TableColumnar table = plan.execute(RowSourceResultSet.builder()
               .withPreparedStatement(preparedStatement)
               .build());
       
      Parameters:
      rowSource - configured source that opens rows for this execution
      Returns:
      the resulting table
    • self

      protected TablePlanRead self()
      Specified by:
      self in class TablePlanCommon<TablePlanRead>