dianfu commented on a change in pull request #8575: [FLINK-12583][python]  Add 
all format support align with the Java Table API.
URL: https://github.com/apache/flink/pull/8575#discussion_r291938240
 
 

 ##########
 File path: flink-python/pyflink/table/table_descriptor.py
 ##########
 @@ -368,6 +372,236 @@ def ignore_first_line(self):
         return self
 
 
+class Csv(FormatDescriptor):
+    """
+    Format descriptor for comma-separated values (CSV).
+
+    This descriptor aims to comply with RFC-4180 ("Common Format and MIME Type 
for
+    Comma-Separated Values (CSV) Files") proposed by the Internet Engineering 
Task Force (IETF).
+
+    ..note::
+        This descriptor does not describe Flink's old non-standard CSV table
+        source/sink. Currently, this descriptor can be used when writing to 
Kafka. The old one is
+        still available as :class:`OldCsv` for stream/batch filesystem 
operations.
+    """
+
+    def __init__(self):
+        gateway = get_gateway()
+        self._j_csv = gateway.jvm.Csv()
+        super(Csv, self).__init__(self._j_csv)
+
+    def field_delimiter(self, delimiter):
+        """
+        Sets the field delimiter character (',' by default).
+
+        :param delimiter: The field delimiter character.
+        :return: This :class:`Csv` object.
+        """
+        if not isinstance(delimiter, (str, unicode)) or len(delimiter) > 1:
+            raise TypeError("Only one-character string is supported!")
+        self._j_csv = self._j_csv.fieldDelimiter(delimiter)
+        return self
+
+    def line_delimiter(self, delimiter):
+        """
+        Sets the line delimiter ("\n" by default; otherwise "\r" or "\r\n" are 
allowed).
+
+        :param delimiter: The line delimiter.
+        :return: This :class:`Csv` object.
+        """
+        self._j_csv = self._j_csv.lineDelimiter(delimiter)
+        return self
+
+    def quote_character(self, quote_character):
+        """
+        Sets the field delimiter character (',' by default).
+
+        :param delimiter: The field delimiter character.
+        :return: This :class:`Csv` object.
+        """
+        if not isinstance(quote_character, (str, unicode)) or 
len(quote_character) > 1:
 
 Review comment:
   len(quote_character) != 1

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to