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

CT-1424 remove dependency on native types feature #175

Merged

Conversation

jirkasemmler
Copy link
Contributor

@jirkasemmler jirkasemmler commented Nov 13, 2024

Jira: CT-1424
Connection PR: https://github.com/keboola/connection/pull/5347
SAPI PR: -


I have dropped the dependency on native-types_timestamp-bc feature because it should be by default these days
-> I removed compareAllColumnsInNativeTable -> SQL builder has been changed so now all INC load does comparing all the columns -> all the tests had to be fixed... kill me now

tag in connection was successful https://dev.azure.com/keboola-dev/Connection%20build/_build/results?buildId=51963&view=results

@@ -498,12 +498,12 @@ public function getUpdateWithPkCommandProvider(): Generator
yield 'typed' => [ // nothing is converted
BigqueryImportOptions::USING_TYPES_USER,
// phpcs:ignore
'UPDATE `import_export_test_schema`.`import_export_test_test` AS `dest` SET `col1` = `src`.`col1`, `col2` = `src`.`col2` FROM `import_export_test_schema`.`stagingTable` AS `src` WHERE `dest`.`col1` = `src`.`col1` '
'UPDATE `import_export_test_schema`.`import_export_test_test` AS `dest` SET `col1` = `src`.`col1`, `col2` = `src`.`col2` FROM `import_export_test_schema`.`stagingTable` AS `src` WHERE `dest`.`col1` = `src`.`col1` AND (`dest`.`col1` IS DISTINCT FROM `src`.`col1` OR `dest`.`col2` IS DISTINCT FROM `src`.`col2`)'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tady mi dava smysl mit ten IS DISTINCT FROM, ale i te stringove tabulky? nemel by tam byt spis ``col2 = COALESCE(src`.`col2`, '')` ? Ale zas na druhou stranu proc, ten IS DISTINCT FROM by mel zvladat i nully?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Už si začínám vzpomínat proč sa chcu zabit pokaždé když vlezu do importů :D Docela sa divím proč to tak je a proč sa tam hodnoty neporovnávajů, určitě to má nějaký debilní, teda dobrý důvod, který si nepamatuju.
Ve string tabulkách null može byt na straně workspace když tam má uživatel tabulku s typama a dělá import do netypové ve storage, pak to udělá takto update protože null a '' je distinct.
Takže je to krapet lepší než to bylo, ale ten COALESCE by tam měl byt spíš. Pak sa coalesce(null,'') = '' a chová sa to stejně.
Ale za boha si nemožu vzpomnět proč sa tam ty hodnoty neporovnávajů.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zajímavé tady sem to přidal a od té doby sa na to nehráblo keboola/php-db-import-export#157

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imho je to tim, ze jsme byli ve vleku tyopvanych tabulek na SNFLK . Tam v tu chvili byla "dohoda" - porovnavame jen PK (protoze NULL problem) - tak jsme udelali takto i BQ implemebtaci

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kazdopadne ten coalesce tam pridam

@@ -381,20 +313,13 @@ public function testImportTimestampBehavior(array $features, array $expectedCont
`name` STRING(50),
`price` DECIMAL,
`isDeleted` INT64,
`_timestamp` TIMESTAMP
`_timestamp` TIMESTAMP,
PRIMARY KEY(id) NOT ENFORCED
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ten PK se z nejakeho duvodu nenastavoval, ale pred tim to asi nevadilo, bo porovnavani hodnot bylo rizene ficurou. ted uz neni a je ten PK tam realne potreba

Copy link
Member

@zajca zajca Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S feature to nemá nic společného o řádek níž sa přidával ten PK a tys to smazal :D Chvilku mě trvalo než sem na to došel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smazal, protoze to realne ten PK nepridavalo. nevim proc, ale proste do tableDefinition to doslo bez PK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a proto jsem to pridal sem. S ficurou to melo podle me spolecne to, ze ta ficura ovlivnovala to, zda se PK realne pouzilo nebo ne. Ale na to se musim jeste podivat hloubeji

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tak to nevím teď sem to testoval u sebe a když smažu ten PRIMARY KEY a přidám tam ten update co tam byl tak ten test mě prošel, nemáš třeba staré závislosti?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevylucuju, zkusim

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hele tak to asi bylo zavislostma. Upgrading google/cloud-bigquery (v1.24.0 => v1.31.0) a uz to frci, toto teda vratim

$stagingTable = StageTableDefinitionFactory::createVarcharStagingTableDefinition(
$destination->getSchemaName(),
[
$columnCollection = new ColumnCollection([
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connection uz vyrabi typovane stage tabulky, takze se musi i tady

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jakože teoreticky to ta lib dovoluje pořád. Už bych ju radši zrušil :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jo, ale chceme to testovat? nebo asi jo, ale primarne chci videt case s tim co od te libky chceme

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jj asi není potřeba mět pokrytů každů kravinu

TO_VARCHAR(TO_BINARY(HEX_ENCODE(\'1\'), \'HEX\')),
TO_VARCHAR(OBJECT_CONSTRUCT(\'name\', \'Jones\'::VARIANT, \'age\', 42::VARIANT)),
TO_VARCHAR(ARRAY_CONSTRUCT(1, 2, 3, NULL)),
TO_VARIANT(\'3.14\'),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stage tabulka je typovana

@jirkasemmler jirkasemmler requested a review from zajca November 19, 2024 21:07
Copy link
Member

@zajca zajca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Padá tam ještě jeden testík.
Otázka je co stým getUpdateWithPkCommand u BQ, tam bych logicky nechal, že sa to neporovnává, ale stejně tak měli všeci teď tu feature a porovnávalo sa to přes distinct :D Takže ten současný kód je vlastně to co je teď na produkci. 🤔

@jirkasemmler jirkasemmler requested a review from zajca December 3, 2024 07:42
Copy link
Member

@zajca zajca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vypadá to cajk, chce to merdžnůt vydat zkusit ještě BQ driver jestli jedů testy a pak až connection

@jirkasemmler jirkasemmler merged commit bf17455 into main Dec 4, 2024
25 checks passed
@jirkasemmler jirkasemmler deleted the jirka-ct-1424-remove-dependency-on-native-types-feature branch December 4, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants