1
0
mirror of synced 2025-12-25 02:09:19 -05:00

Remove ExtendedNameTrasformer (#23655)

This commit is contained in:
Sherif A. Nada
2023-03-07 17:22:08 -08:00
committed by GitHub
parent 1a3f88739a
commit e85eda088e
82 changed files with 178 additions and 220 deletions

View File

@@ -1,40 +0,0 @@
/*
* Copyright (c) 2023 Airbyte, Inc., all rights reserved.
*/
package io.airbyte.integrations.destination;
/**
* When choosing identifiers names in destinations, extended Names can handle more special
* characters than standard Names by using the quoting characters: "..."
*
* This class detects when such special characters are used and adds the appropriate quoting when
* necessary.
*/
public class ExtendedNameTransformer extends StandardNameTransformer {
@Override
public String convertStreamName(final String input) {
return super.convertStreamName(input);
}
// Temporarily disabling the behavior of the ExtendedNameTransformer, see (issue #1785)
protected String disabled_convertStreamName(final String input) {
if (useExtendedIdentifiers(input)) {
return "\"" + input + "\"";
} else {
return applyDefaultCase(input);
}
}
protected boolean useExtendedIdentifiers(final String input) {
boolean result = false;
if (input.matches("[^\\p{Alpha}_].*")) {
result = true;
} else if (input.matches(".*[^\\p{Alnum}_].*")) {
result = true;
}
return result;
}
}

View File

@@ -6,7 +6,6 @@ package io.airbyte.integrations.base;
import static org.junit.jupiter.api.Assertions.assertEquals;
import io.airbyte.integrations.destination.ExtendedNameTransformer;
import io.airbyte.integrations.destination.NamingConventionTransformer;
import io.airbyte.integrations.destination.StandardNameTransformer;
import org.junit.jupiter.api.Test;
@@ -35,10 +34,10 @@ class NameTransformerTest {
assertEquals("_airbyte_raw_identifier_name", namingResolver.getRawTableName("identifier_name"));
}
// Temporarily disabling the behavior of the ExtendedNameTransformer, see (issue #1785)
// Temporarily disabling the behavior of the StandardNameTransformer, see (issue #1785)
// @Test
void testExtendedSQLNaming() {
final NamingConventionTransformer namingResolver = new ExtendedNameTransformer();
final NamingConventionTransformer namingResolver = new StandardNameTransformer();
assertEquals("identifier_name", namingResolver.getIdentifier("identifier_name"));
assertEquals("iDenTiFieR_name", namingResolver.getIdentifier("iDenTiFieR_name"));
assertEquals("__identifier_name", namingResolver.getIdentifier("__identifier_name"));