From c7799649d7d333ca38d1c90bfca10d5114c1a402 Mon Sep 17 00:00:00 2001 From: RickyHuo Date: Wed, 21 Mar 2018 10:40:05 +0800 Subject: [PATCH] Update utils.renderDefault --- .../com/sina/bip/hangout/outputs/ClickhouseUtils.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/sina/bip/hangout/outputs/ClickhouseUtils.java b/src/main/java/com/sina/bip/hangout/outputs/ClickhouseUtils.java index 7e2176f..20680cd 100644 --- a/src/main/java/com/sina/bip/hangout/outputs/ClickhouseUtils.java +++ b/src/main/java/com/sina/bip/hangout/outputs/ClickhouseUtils.java @@ -35,12 +35,16 @@ public static String renderDefault(String dataType) { else if (dataType.equals("Date")) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); return String.format("'%s'", dateFormat.format(new Date())); - } - else if (dataType.equals("DataTime")) { + } else if (dataType.equals("DataTime")) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return String.format("'%s'", dateFormat.format(new Date())); - } else + } else if (dataType.startsWith("Float")) { + return "0.0"; + } else if (dataType.startsWith("UInt") || dataType.startsWith("Int")) { + return "0"; + } else { return ""; + } } public static String realField(String field) {