Github user KurtYoung commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3273#discussion_r100454106
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/sources/CsvTableSource.scala
 ---
    @@ -138,4 +141,160 @@ class CsvTableSource(
     
         inputFormat
       }
    +
    +  override def equals(other: Any): Boolean = other match {
    +    case that: CsvTableSource => returnType == that.returnType &&
    +        path == that.path &&
    +        fieldDelim == that.fieldDelim &&
    +        rowDelim == that.rowDelim &&
    +        quoteCharacter == that.quoteCharacter &&
    +        ignoreFirstLine == that.ignoreFirstLine &&
    +        ignoreComments == that.ignoreComments &&
    +        lenient == that.lenient
    +    case _ => false
    +  }
    +
    +  override def hashCode(): Int = {
    +    val state = Seq(returnType)
    +    state.map(_.hashCode()).foldLeft(0)((a, b) => 31 * a + b)
    +  }
    +}
    +
    +object CsvTableSource {
    +
    +  /**
    +    * A builder for creating [[CsvTableSource]] instances.
    +    *
    +    * For example:
    +    *
    +    * {{{
    +    *   val source: CsvTableSource = new CsvTableSourceBuilder()
    +    *     .path("/path/to/your/file.csv")
    +    *     .field("myfield", Types.STRING)
    +    *     .field("myfield2", Types.INT)
    +    *     .build()
    +    * }}}
    +    *
    +    */
    +  class Builder {
    +
    +    private val fieldNames: ListBuffer[String] = ListBuffer[String]()
    --- End diff --
    
    Can we bind the name and type to a MutableMap and do some check when we 
adding fields? Like can not have duplicated filed names?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to