mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge branch 'master' of github.com:yandex/ClickHouse
This commit is contained in:
commit
68c57b2b61
@ -72,9 +72,9 @@ void DataTypeDateTime::serializeTextCSV(const IColumn & column, size_t row_num,
|
||||
|
||||
void DataTypeDateTime::deserializeTextCSV(IColumn & column, ReadBuffer & istr, const char delimiter) const
|
||||
{
|
||||
LocalDateTime value;
|
||||
readCSV(value, istr);
|
||||
static_cast<ColumnUInt32 &>(column).getData().push_back(static_cast<time_t>(value));
|
||||
time_t x;
|
||||
readCSVSimple(x, istr, readDateTimeText);
|
||||
static_cast<ColumnUInt32 &>(column).getData().push_back(x);
|
||||
}
|
||||
|
||||
void registerDataTypeDateTime(DataTypeFactory & factory)
|
||||
|
@ -629,7 +629,7 @@ void readDateTimeTextFallback(time_t & datetime, ReadBuffer & buf, const DateLUT
|
||||
/** In YYYY-MM-DD hh:mm:ss format, according to specified time zone.
|
||||
* As an exception, also supported parsing of unix timestamp in form of decimal number.
|
||||
*/
|
||||
inline void readDateTimeText(time_t & datetime, ReadBuffer & buf, const DateLUTImpl & date_lut = DateLUT::instance())
|
||||
inline void readDateTimeText(time_t & datetime, ReadBuffer & buf, const DateLUTImpl & date_lut)
|
||||
{
|
||||
/** Read 10 characters, that could represent unix timestamp.
|
||||
* Only unix timestamp of 5-10 characters is supported.
|
||||
@ -666,6 +666,11 @@ inline void readDateTimeText(time_t & datetime, ReadBuffer & buf, const DateLUTI
|
||||
readDateTimeTextFallback(datetime, buf, date_lut);
|
||||
}
|
||||
|
||||
inline void readDateTimeText(time_t & datetime, ReadBuffer & buf)
|
||||
{
|
||||
readDateTimeText(datetime, buf, DateLUT::instance());
|
||||
}
|
||||
|
||||
inline void readDateTimeText(LocalDateTime & datetime, ReadBuffer & buf)
|
||||
{
|
||||
char s[19];
|
||||
@ -767,7 +772,7 @@ inline void readDoubleQuoted(LocalDateTime & x, ReadBuffer & buf)
|
||||
|
||||
/// CSV, for numbers, dates, datetimes: quotes are optional, no special escaping rules.
|
||||
template <typename T>
|
||||
inline void readCSVSimple(T & x, ReadBuffer & buf)
|
||||
inline void readCSVSimple(T & x, ReadBuffer & buf, void (*readText_)(T & x, ReadBuffer & buf) = readText)
|
||||
{
|
||||
if (buf.eof())
|
||||
throwReadAfterEOF();
|
||||
@ -777,7 +782,7 @@ inline void readCSVSimple(T & x, ReadBuffer & buf)
|
||||
if (maybe_quote == '\'' || maybe_quote == '\"')
|
||||
++buf.position();
|
||||
|
||||
readText(x, buf);
|
||||
readText_(x, buf);
|
||||
|
||||
if (maybe_quote == '\'' || maybe_quote == '\"')
|
||||
assertChar(maybe_quote, buf);
|
||||
|
@ -2,3 +2,7 @@ Hello, world 123 2016-01-01
|
||||
Hello, "world" 456 2016-01-02
|
||||
Hello "world" 789 2016-01-03
|
||||
Hello\n world 100 2016-01-04
|
||||
2016-01-01 01:02:03 1
|
||||
2016-01-02 01:02:03 2
|
||||
2017-08-15 13:15:01 3
|
||||
1970-01-02 06:46:39 4
|
||||
|
@ -11,3 +11,13 @@ Hello "world", 789 ,2016-01-03
|
||||
|
||||
clickhouse-client --query="SELECT * FROM test.csv ORDER BY d";
|
||||
clickhouse-client --query="DROP TABLE test.csv";
|
||||
|
||||
clickhouse-client --query="CREATE TABLE test.csv (t DateTime, s String) ENGINE = Memory";
|
||||
|
||||
echo '"2016-01-01 01:02:03","1"
|
||||
2016-01-02 01:02:03, "2"
|
||||
1502792101,"3"
|
||||
99999,"4"' | clickhouse-client --query="INSERT INTO test.csv FORMAT CSV";
|
||||
|
||||
clickhouse-client --query="SELECT * FROM test.csv ORDER BY s";
|
||||
clickhouse-client --query="DROP TABLE test.csv";
|
||||
|
@ -42,11 +42,11 @@ Create tables in ClickHouse:
|
||||
LO_TAX UInt8,
|
||||
LO_COMMITDATE Date,
|
||||
LO_SHIPMODE String
|
||||
)Engine=MergeTree(LO_ORDERDATE,(LO_ORDERKEY,LO_LINENUMBER,LO_ORDERDATE),8192);
|
||||
) Engine = MergeTree(LO_ORDERDATE,(LO_ORDERKEY,LO_LINENUMBER,LO_ORDERDATE),8192);
|
||||
|
||||
CREATE TABLE customer (
|
||||
C_CUSTKEY UInt32,
|
||||
C_NAME String,
|
||||
C_NAME String,
|
||||
C_ADDRESS String,
|
||||
C_CITY String,
|
||||
C_NATION String,
|
||||
@ -54,7 +54,7 @@ Create tables in ClickHouse:
|
||||
C_PHONE String,
|
||||
C_MKTSEGMENT String,
|
||||
C_FAKEDATE Date
|
||||
)Engine=MergeTree(C_FAKEDATE,(C_CUSTKEY,C_FAKEDATE),8192);
|
||||
) Engine = MergeTree(C_FAKEDATE,(C_CUSTKEY,C_FAKEDATE),8192);
|
||||
|
||||
CREATE TABLE part (
|
||||
P_PARTKEY UInt32,
|
||||
@ -67,7 +67,7 @@ Create tables in ClickHouse:
|
||||
P_SIZE UInt8,
|
||||
P_CONTAINER String,
|
||||
P_FAKEDATE Date
|
||||
)Engine=MergeTree(P_FAKEDATE,(P_PARTKEY,P_FAKEDATE),8192);
|
||||
) Engine = MergeTree(P_FAKEDATE,(P_PARTKEY,P_FAKEDATE),8192);
|
||||
|
||||
CREATE TABLE lineorderd AS lineorder ENGINE = Distributed(perftest_3shards_1replicas, default, lineorder, rand());
|
||||
CREATE TABLE customerd AS customer ENGINE = Distributed(perftest_3shards_1replicas, default, customer, rand());
|
||||
|
Loading…
Reference in New Issue
Block a user