You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/07/01 22:47:08 UTC

[GitHub] [incubator-superset] serenajiang commented on a change in pull request #10208: feat: support nulls in the csv uploads

serenajiang commented on a change in pull request #10208:
URL: https://github.com/apache/incubator-superset/pull/10208#discussion_r448653031



##########
File path: superset/forms.py
##########
@@ -15,12 +15,27 @@
 # specific language governing permissions and limitations
 # under the License.
 """Contains the logic to create cohesive forms on the explore view"""
+import json
 from typing import Any, List, Optional
 
 from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
 from wtforms import Field
 
 
+class JsonListField(Field):
+    widget = BS3TextFieldWidget()
+    data: List[str] = []
+
+    def _value(self) -> str:
+        return json.dumps(self.data)
+
+    def process_formdata(self, valuelist: List[str]) -> None:

Review comment:
       Just curious - what happens if the user passes in a malformed input?

##########
File path: superset/db_engine_specs/hive.py
##########
@@ -106,6 +106,31 @@ def fetch_data(cls, cursor: Any, limit: int) -> List[Tuple[Any, ...]]:
         except pyhive.exc.ProgrammingError:
             return []
 
+    @classmethod
+    def get_create_table_stmt(
+        cls,
+        table: Table,
+        schema_definition: str,
+        header_line_count: int,
+        null_values: Optional[List[str]],
+    ) -> text:
+        tblproperties = []
+        # available options:
+        # https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL
+        if header_line_count > 0:
+            tblproperties.append(f"'skip.header.line.count'='{header_line_count}'")
+        if null_values:
+            # hive only supports 1 value for the null format
+            tblproperties.append(f"'serialization.null.format'='{null_values[0]}'")
+        tblproperties_stmt = ""
+        if tblproperties:
+            tblproperties_stmt = f"tblproperties ({', '.join(tblproperties)})"

Review comment:
       Can we write this in some way that lets us use `:params` for the table properties?




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org