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

StructuredType part 1. #1557

Closed

Conversation

sfc-gh-pmotacki
Copy link
Contributor

Overview

SNOW-XXXXX

External contributors - please answer these questions before submitting a pull request. Thanks!

Please answer these questions before submitting your pull requests. Thanks!

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes #NNNN

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
    • I am adding new logging messages
    • I am modifying authorization mechanisms
    • I am adding new credentials
    • I am modifying OCSP code
    • I am adding a new dependency
  3. Please describe how your code solves the related issue.

    Please write a short description of how your code change solves the related issue.

Pre-review checklist

  • This change has passed precommit
  • I have reviewed code coverage report for my PR in (Sonarqube)

@sfc-gh-pfus sfc-gh-pfus force-pushed the structuredType branch 6 times, most recently from 751e21e to 60bc8d6 Compare November 15, 2023 10:01
@sfc-gh-pfus sfc-gh-pfus changed the base branch from master to SNOW-956803-structured-type November 16, 2023 07:07
@sfc-gh-pfus sfc-gh-pfus marked this pull request as ready for review November 16, 2023 08:09
@sfc-gh-pfus sfc-gh-pfus requested a review from a team as a code owner November 16, 2023 08:09
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.*;
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's not use wildcard imports


@Override
public byte readByte() throws SQLException {
return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want to add some todo comments for default values?

import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.*;
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's not use wildcard imports

JsonNode jsonNode = OBJECT_MAPPER.readTree((String) obj);
return new JsonSqlInput(jsonNode);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we throw own exception?

@@ -31,7 +31,8 @@

/** Arrow result set implementation */
public class SFArrowResultSet extends SFBaseResultSet implements DataConversionContext {
static final SFLogger logger = SFLoggerFactory.getLogger(SFArrowResultSet.class);
private static final SFLogger logger = SFLoggerFactory.getLogger(SFArrowResultSet.class);
private static final ObjectMapper OBJECT_MAPPER = ObjectMapperFactory.getObjectMapper();
Copy link
Collaborator

Choose a reason for hiding this comment

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

private static final field for logger has different convention than OBJECT_MAPPER - we should keep and use one of them

JsonNode jsonNode = OBJECT_MAPPER.readTree(input);
return new JsonSqlInput(jsonNode);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we throw own exception here?

public class SnowflakeObjectTypeFactories {
private static final Map<Class<?>, Supplier<SQLData>> factories = new HashMap<>();

public static synchronized void register(Class<?> type, Supplier<SQLData> factory) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to have synchronized method here or can we use ConcurrentHashMap instead?

import java.util.Map;
import java.util.TimeZone;
import java.sql.Date;
import java.util.*;
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's avoid wildcard imports

try {
return type.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException(e);
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we throw own exception?

package net.snowflake.client.util;

public class Predicates {
public static void notNull(Object o, String msg) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

sfc-gh-pfus and others added 2 commits November 16, 2023 11:50
# Conflicts:
#	src/main/java/net/snowflake/client/core/SFJsonResultSet.java
Copy link

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants