|
12 | 12 | import java.lang.reflect.Method; |
13 | 13 | import java.math.BigInteger; |
14 | 14 | import java.time.LocalDate; |
| 15 | +import java.time.LocalDateTime; |
15 | 16 | import java.time.ZoneId; |
16 | 17 | import java.time.ZonedDateTime; |
17 | 18 | import java.util.HashMap; |
@@ -128,6 +129,43 @@ public static void writeDate(OutputStream out, ZonedDateTime value, boolean defa |
128 | 129 | } |
129 | 130 | } |
130 | 131 |
|
| 132 | + public static void writeDate32(OutputStream out, LocalDate value, boolean defaultsSupport, boolean isNullable, ClickHouseDataType dataType, boolean hasDefault, String column) throws IOException { |
| 133 | + if (writeValuePreamble(out, defaultsSupport, isNullable, dataType, hasDefault, column, value)) { |
| 134 | + SerializerUtils.writeDate32(out, value, ZoneId.of("UTC")); // TODO: check |
| 135 | + } |
| 136 | + } |
| 137 | + |
| 138 | + public static void writeDate32(OutputStream out, ZonedDateTime value, boolean defaultsSupport, boolean isNullable, ClickHouseDataType dataType, boolean hasDefault, String column) throws IOException { |
| 139 | + if (writeValuePreamble(out, defaultsSupport, isNullable, dataType, hasDefault, column, value)) { |
| 140 | + SerializerUtils.writeDate32(out, value, ZoneId.of("UTC")); // TODO: check |
| 141 | + } |
| 142 | + } |
| 143 | + |
| 144 | + // Support for DateTime section |
| 145 | + public static void writeTimeDate(OutputStream out, LocalDateTime value, boolean defaultsSupport, boolean isNullable, ClickHouseDataType dataType, boolean hasDefault, String column) throws IOException { |
| 146 | + if (writeValuePreamble(out, defaultsSupport, isNullable, dataType, hasDefault, column, value)) { |
| 147 | + SerializerUtils.writeDateTime(out, value, ZoneId.of("UTC")); // TODO: check |
| 148 | + } |
| 149 | + } |
| 150 | + |
| 151 | + public static void writeTimeDate(OutputStream out, ZonedDateTime value, boolean defaultsSupport, boolean isNullable, ClickHouseDataType dataType, boolean hasDefault, String column) throws IOException { |
| 152 | + if (writeValuePreamble(out, defaultsSupport, isNullable, dataType, hasDefault, column, value)) { |
| 153 | + SerializerUtils.writeDateTime(out, value, ZoneId.of("UTC")); // TODO: check |
| 154 | + } |
| 155 | + } |
| 156 | + |
| 157 | + public static void writeTimeDate64(OutputStream out, LocalDateTime value, boolean defaultsSupport, boolean isNullable, ClickHouseDataType dataType, boolean hasDefault, String column, int scale) throws IOException { |
| 158 | + if (writeValuePreamble(out, defaultsSupport, isNullable, dataType, hasDefault, column, value)) { |
| 159 | + SerializerUtils.writeDateTime64(out, value, scale, ZoneId.of("UTC")); // TODO: check |
| 160 | + } |
| 161 | + } |
| 162 | + |
| 163 | + public static void writeTimeDate64(OutputStream out, ZonedDateTime value, boolean defaultsSupport, boolean isNullable, ClickHouseDataType dataType, boolean hasDefault, String column, int scale) throws IOException { |
| 164 | + if (writeValuePreamble(out, defaultsSupport, isNullable, dataType, hasDefault, column, value)) { |
| 165 | + SerializerUtils.writeDateTime64(out, value, scale, ZoneId.of("UTC")); // TODO: check |
| 166 | + } |
| 167 | + } |
| 168 | + |
131 | 169 | // clickhouse type String support |
132 | 170 | public static void writeString(OutputStream out, String value, boolean defaultsSupport, boolean isNullable, ClickHouseDataType dataType, boolean hasDefault, String column) throws IOException { |
133 | 171 | if (writeValuePreamble(out, defaultsSupport, isNullable, dataType, hasDefault, column, value)) { |
|
0 commit comments