Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0_3_0 #128

Merged
merged 94 commits into from
Oct 17, 2022
Merged
Changes from 1 commit
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
4696573
python scripts to run checksums
Sep 12, 2022
ad600ef
Adding README.md
Sep 12, 2022
0f99a72
Fix time and concurrent runs due to bad indentation
Sep 12, 2022
839be07
Adding scripts to test classic databases
Sep 12, 2022
64362ab
Useful settings
Sep 12, 2022
0d1d9a2
Fixing the database name
Sep 12, 2022
5cfcb3d
Merge pull request #83 from aadant/mysql_config
subkanthi Sep 13, 2022
465537b
Merge pull request #82 from aadant/test_databases
subkanthi Sep 13, 2022
09a228a
Merge pull request #80 from aadant/table_checksums
subkanthi Sep 13, 2022
12415c3
Changed camel case functions to snake case.
subkanthi Sep 14, 2022
adee53b
Added steps to download menagerie db and apply to docker image.
subkanthi Sep 15, 2022
5b9b27f
Change version and sign column to _version and _sign column to align …
subkanthi Sep 15, 2022
f5bb81b
Set snapshot mode to initial and add customers to initial snapshot.
subkanthi Sep 15, 2022
e8bec2a
Added test files that were moved.
subkanthi Sep 15, 2022
3187eb2
Commented out timezone dependent tests.
subkanthi Sep 15, 2022
8d3c3ec
Comment out checkstlye in github actions.
subkanthi Sep 15, 2022
79d0c86
Merge pull request #88 from Altinity/78-the-virtual-columns-should-be…
subkanthi Sep 15, 2022
4d4941a
Remove zip files in meanagerie database.
subkanthi Sep 16, 2022
1902c37
Merge pull request #86 from Altinity/minor_fixes_checksum
subkanthi Sep 16, 2022
fcf50b9
Added documentation for Confluent Schema Registry REST API.
subkanthi Sep 19, 2022
1cb2751
Revert back adding sakila DB to init mysql scripts
subkanthi Sep 19, 2022
4001165
Revert back adding sakila DB to init mysql scripts
subkanthi Sep 19, 2022
8417afc
Merge pull request #93 from Altinity/77-add-sakila-employees-database
subkanthi Sep 19, 2022
6c59d56
Merge pull request #91 from Altinity/schema_registry_docs
subkanthi Sep 19, 2022
4e798c5
Added logic to transform GEOMETRY to string.
subkanthi Sep 20, 2022
466bf9f
Modified mapping of datetime to datetime(3)
subkanthi Sep 21, 2022
fe9afd4
clickhouse_load initial release
Sep 22, 2022
db1d08a
Redo case
Sep 22, 2022
ffa0381
Fix case
Sep 22, 2022
d0bbf64
Fixed unit tests related to JSON column change.
subkanthi Sep 22, 2022
9190517
Make local modules visible to python
Sep 22, 2022
4eeaa8e
Merge pull request #96 from aadant/clickhouse_loader
subkanthi Sep 23, 2022
0fd3c6d
better support for dates, schema generation fixes for fractional date…
Sep 23, 2022
25b0b5c
Changed JSON mapping to CH string.
subkanthi Sep 23, 2022
b415b97
Adding instructions
Sep 23, 2022
e1dae9c
Adding instructions
Sep 23, 2022
3d9b5be
Merge pull request #97 from aadant/clickhouse_loader
aadant Sep 23, 2022
c5a8479
Merge pull request #98 from Altinity/sakila_db_fixes
subkanthi Sep 25, 2022
9bf36ce
Removed init scripts for MySQL and ClickHouse. Added logic to downloa…
subkanthi Sep 26, 2022
1aeb7b8
Updated sysbench scripts to iterate through multiple tests and perfor…
subkanthi Sep 27, 2022
0b58bdd
Updated sysbench scripts to iterate through multiple tests and perfor…
subkanthi Sep 27, 2022
d3adb12
Merge pull request #103 from Altinity/sakila_db_fixes
subkanthi Sep 27, 2022
7063b49
Change logic of creating input batch by keeping the CH columns as sou…
subkanthi Sep 28, 2022
ec3a3d6
Change logic of creating input batch by keeping the CH columns as sou…
subkanthi Sep 28, 2022
cd3cb6e
Merge remote-tracking branch 'origin/refactor_insert_batch' into refa…
subkanthi Sep 28, 2022
c4b7110
Move hardcoded strings to separate class.
subkanthi Sep 29, 2022
1e09ba8
Move hardcoded strings to separate class.
subkanthi Sep 29, 2022
4c5c21b
Support most data types
Sep 30, 2022
0ddce4d
Adding credits
Sep 30, 2022
22a0067
data_types database
Sep 30, 2022
5f502ca
Merge pull request #112 from aadant/clickhouse_loader
subkanthi Sep 30, 2022
6875a43
Changed Date/DateTime lower/upper limit to use clickhouse-jdbc limits.
subkanthi Sep 30, 2022
b8b256e
Fix QueryFormatterTest unit tests.
subkanthi Sep 30, 2022
3c558d9
Fix QueryFormatterTest unit tests.
subkanthi Sep 30, 2022
fa664fa
Added unit test for date/datetime fields.
subkanthi Oct 2, 2022
a6526c2
Changed date limit logic to use epoch in Days. Updated checksum to us…
subkanthi Oct 3, 2022
cd367a4
Change logic of creating input batch by keeping the CH columns as sou…
subkanthi Sep 28, 2022
4366662
Move hardcoded strings to separate class.
subkanthi Sep 29, 2022
72642c7
Move hardcoded strings to separate class.
subkanthi Sep 29, 2022
9ec1666
Changed Date/DateTime lower/upper limit to use clickhouse-jdbc limits.
subkanthi Sep 30, 2022
253ec46
Fix QueryFormatterTest unit tests.
subkanthi Sep 30, 2022
d82f49a
Fix QueryFormatterTest unit tests.
subkanthi Sep 30, 2022
1b925ad
Added unit test for date/datetime fields.
subkanthi Oct 2, 2022
798e22c
Changed date limit logic to use epoch in Days. Updated checksum to us…
subkanthi Oct 3, 2022
394c177
Merge branch 'refactor_insert_batch' of github.com:Altinity/clickhous…
subkanthi Oct 3, 2022
3aaa168
upd4oct
AlmostIvanSidorov Oct 4, 2022
82927b3
"upd"
AlmostIvanSidorov Oct 4, 2022
c2d671e
Support all MySQL data types + bug fix
Oct 5, 2022
009e816
Support all MySQL data types + bug fix
Oct 5, 2022
85c0830
Support basic partitioning by range
Oct 5, 2022
d0a77b4
"Date->Date32, DateTime -> DateTime64, JSON -> String and Year -> INT32"
AlmostIvanSidorov Oct 5, 2022
df2a153
Added unit tests for DateTime limits.
subkanthi Oct 5, 2022
5aa089b
"insert, alter, delete, update data consistency upd"
AlmostIvanSidorov Oct 5, 2022
cc9fadf
Merge pull request #117 from aadant/clickhouse_loader
subkanthi Oct 5, 2022
1e08d2f
Added logic to override datetime64 mapping for auto create table, set…
subkanthi Oct 5, 2022
108172a
Fixed Debezium time converter test.
subkanthi Oct 5, 2022
c65a68c
Changed logic to use setTimestamp in JDBC for writing DateTime fields…
subkanthi Oct 6, 2022
60f4f77
Merge pull request #115 from Altinity/TestFlows_integration
subkanthi Oct 7, 2022
611abda
Add meaningful digits to data_types.sql
Oct 7, 2022
e6803c7
Fixed TIME range
subkanthi Oct 8, 2022
ae1d6dc
Merge pull request #121 from aadant/clickhouse_loader
subkanthi Oct 8, 2022
19d621f
Map TIMESTAMP to DateTime64(3)
subkanthi Oct 8, 2022
e7a9a99
Merge pull request #110 from Altinity/refactor_insert_batch
subkanthi Oct 8, 2022
9eeb56c
Added to logic to remove trailing zeros in timestamp and time columns…
subkanthi Oct 11, 2022
0c4774c
Changed mysql checksum calculation to cast datetime(1, 2, 3) to datet…
subkanthi Oct 13, 2022
7cac23b
Changed mysql checksum calculation to remove trailing zeros in timest…
subkanthi Oct 13, 2022
fddee83
Refactor datatypes diff script to query the table names from informat…
subkanthi Oct 14, 2022
abc29e8
Map BYTES, bits to String in ClickHouse.
subkanthi Oct 17, 2022
df694ea
Merge pull request #126 from Altinity/122-remove-trailing-zeros-in-ti…
subkanthi Oct 17, 2022
9564451
Updating README.md
subkanthi Oct 17, 2022
b19e5a0
Merge pull request #127 from Altinity/119-document-supported-versions…
subkanthi Oct 17, 2022
399db88
Map Float64(Debezium) to Float32(CH)
subkanthi Oct 17, 2022
5d07702
Merge pull request #131 from Altinity/fix_links
subkanthi Oct 17, 2022
ce76f4e
Resolved conflicts
subkanthi Oct 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added to logic to remove trailing zeros in timestamp and time columns…
…. Updated unit tests.
  • Loading branch information
subkanthi committed Oct 11, 2022

Verified

This commit was signed with the committer’s verified signature.
Huckies Wyatt Zhang
commit 9eeb56ca34623bc61ccd4ea36852f96796ca4c7f
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.altinity.clickhouse.sink.connector.converters;

import com.altinity.clickhouse.sink.connector.metadata.DataTypeRange;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@@ -30,19 +31,13 @@ public static class MicroTimeConverter {
* @return
*/
public static String convert(Object value) {
Long milliTimestamp = (Long) value / 1000;
java.util.Date date = new java.util.Date(milliTimestamp);

Instant i = Instant.EPOCH.plus((Long) value, ChronoUnit.MICROS);


LocalTime time = i.atZone(ZoneOffset.UTC).toLocalTime();
String formattedSecondsTimestamp= time.format(DateTimeFormatter.ofPattern("HH:mm:ss.SSSSSS"));


return formattedSecondsTimestamp;

//return Timestamp.from(Instant.ofEpochMilli((Long) value));
return removeTrailingZeros(formattedSecondsTimestamp);
}
}

@@ -170,7 +165,7 @@ public static String convert(Object value) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(formatString);
LocalDateTime zd = LocalDateTime.parse((String) value, formatter);
result = zd.format(destFormatter);
//result = StringUtils.stripEnd(result, "0");
result = removeTrailingZeros(result);
parsingSuccesful = true;
break;
} catch(Exception e) {
@@ -184,4 +179,14 @@ public static String convert(Object value) {
return result;
}
}

static public String removeTrailingZeros(String data) {
String result = "";

if(data != null) {
result = StringUtils.stripEnd(StringUtils.stripEnd(data, "0"), ".");
}

return result;
}
}
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ public void testMicroTimeConverter() {
Object timeInMicroSeconds = 3723000000L;
String formattedTime = DebeziumConverter.MicroTimeConverter.convert(timeInMicroSeconds);

Assert.assertTrue(formattedTime.equalsIgnoreCase("20:02:03"));
Assert.assertTrue(formattedTime.equalsIgnoreCase("01:02:03"));
}

@Test
@@ -56,7 +56,7 @@ public void testTimestampConverter() {
Object timestampEpoch = 1640995260000L;
String formattedTimestamp = String.valueOf(DebeziumConverter.TimestampConverter.convert(timestampEpoch, false));

Assert.assertTrue(formattedTimestamp.equalsIgnoreCase("2021-12-31 19:01:00"));
Assert.assertTrue(formattedTimestamp.equalsIgnoreCase("1640995260000"));
}

@Test
@@ -65,7 +65,7 @@ public void testTimestampConverterMinRange() {
Object timestampEpoch = -2166681362000L;
String formattedTimestamp = String.valueOf(DebeziumConverter.TimestampConverter.convert(timestampEpoch, false));

Assert.assertTrue(formattedTimestamp.equalsIgnoreCase("1925-01-01 00:00:00"));
Assert.assertTrue(formattedTimestamp.equalsIgnoreCase("-1420070400000"));
}

@Test
@@ -74,7 +74,7 @@ public void testTimestampConverterMaxRange() {
Object timestampEpoch = 4807440238000L;
String formattedTimestamp = String.valueOf(DebeziumConverter.TimestampConverter.convert(timestampEpoch, false));

Assert.assertTrue(formattedTimestamp.equalsIgnoreCase("2122-05-05 16:03:58"));
Assert.assertTrue(formattedTimestamp.equalsIgnoreCase("4807440238000"));
}

@Test
@@ -120,13 +120,13 @@ public void testDateConverterWithinRange() {
public void testZonedTimestampConverter() {

String formattedTimestamp = DebeziumConverter.ZonedTimestampConverter.convert("2021-12-31T19:01:00Z");
Assert.assertTrue(formattedTimestamp.equalsIgnoreCase("2021-12-31 19:01:00.000000"));
Assert.assertTrue(formattedTimestamp.equalsIgnoreCase("2021-12-31 19:01:00"));

String formattedTimestampWMicroSeconds = DebeziumConverter.ZonedTimestampConverter.convert("2038-01-19T03:14:07.999999Z");
Assert.assertTrue(formattedTimestampWMicroSeconds.equalsIgnoreCase("2038-01-19 03:14:07.999999"));

String formattedTimestamp3 = DebeziumConverter.ZonedTimestampConverter.convert("2038-01-19T03:14:07.99Z");
Assert.assertTrue(formattedTimestamp3.equalsIgnoreCase("2038-01-19 03:14:07.990000"));
Assert.assertTrue(formattedTimestamp3.equalsIgnoreCase("2038-01-19 03:14:07.99"));

}

@@ -188,4 +188,19 @@ public void testBatchArrays() {

}

@Test
public void testTrailingZeros() {
String result1 = DebeziumConverter.removeTrailingZeros("2022-01-01 11:50:00.0000");
Assert.assertTrue(result1.equalsIgnoreCase("2022-01-01 11:50:00"));

String result2 = DebeziumConverter.removeTrailingZeros("2022-01-01 11:50:00.0010");
Assert.assertTrue(result2.equalsIgnoreCase("2022-01-01 11:50:00.001"));

String result3 = DebeziumConverter.removeTrailingZeros("2022-01-01 11:50:00.0100");
Assert.assertTrue(result3.equalsIgnoreCase("2022-01-01 11:50:00.01"));

String result4 = DebeziumConverter.removeTrailingZeros("2022-01-01 11:50:00.100");
Assert.assertTrue(result4.equalsIgnoreCase("2022-01-01 11:50:00.1"));
}

}