Record Class CsvFileSourceConfig

java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.source.CsvFileSourceConfig
Record Components:
path - the file system path to the CSV file; must not be blank
hasHeader - true if the first row contains column names
columns - the ordered column specifications; must not be empty
references - the declared column references; may be empty
All Implemented Interfaces:
SourceConfig

public record CsvFileSourceConfig(String path, boolean hasHeader, List<ColumnSpec> columns, List<ColumnReference> references) extends Record implements SourceConfig
Configuration for a local CSV file source.

Example:

   source Products from csv("./products.csv") {
       schema: {
           id:    NUMBER,
           name:  STRING,
           price: NUMBER
       }
   };
 

When hasHeader() is true the first row of the file is treated as a header row and matched against the schema column names. When false columns are matched positionally.

An optional references: block declares foreign-key style relationships from this source's columns to other relations.

  • Constructor Details

    • CsvFileSourceConfig

      public CsvFileSourceConfig(String path, boolean hasHeader, List<ColumnSpec> columns, List<ColumnReference> references)
      Creates an instance of a CsvFileSourceConfig record class.
      Parameters:
      path - the value for the path record component
      hasHeader - the value for the hasHeader record component
      columns - the value for the columns record component
      references - the value for the references record component
    • CsvFileSourceConfig

      public CsvFileSourceConfig(String path, boolean hasHeader, List<ColumnSpec> columns)
      Creates a config with no declared references.
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • path

      public String path()
      Returns the value of the path record component.
      Returns:
      the value of the path record component
    • hasHeader

      public boolean hasHeader()
      Returns the value of the hasHeader record component.
      Returns:
      the value of the hasHeader record component
    • columns

      public List<ColumnSpec> columns()
      Returns the value of the columns record component.
      Returns:
      the value of the columns record component
    • references

      public List<ColumnReference> references()
      Returns the value of the references record component.
      Returns:
      the value of the references record component