Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Oct 19, 2023
1 parent 6179d23 commit bb4da1d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 6 additions & 4 deletions flow/connectors/snowflake/snowflake.go
Original file line number Diff line number Diff line change
Expand Up @@ -962,11 +962,13 @@ func (c *SnowflakeConnector) generateAndExecuteMergeStatement(
flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("BASE64_DECODE_BINARY(%s:\"%s\") "+
"AS %s,", toVariantColumnName, columnName, targetColumnName))
case qvalue.QValueKindGeography:
flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("TO_GEOGRAPHY(CAST(%s:\"%s\" AS STRING),true) AS %s,",
toVariantColumnName, columnName, targetColumnName))
flattenedCastsSQLArray = append(flattenedCastsSQLArray,
fmt.Sprintf("TO_GEOGRAPHY(CAST(%s:\"%s\" AS STRING),true) AS %s,",
toVariantColumnName, columnName, targetColumnName))
case qvalue.QValueKindGeometry:
flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("TO_GEOMETRY(CAST(%s:\"%s\" AS STRING),true) AS %s,",
toVariantColumnName, columnName, targetColumnName))
flattenedCastsSQLArray = append(flattenedCastsSQLArray,
fmt.Sprintf("TO_GEOMETRY(CAST(%s:\"%s\" AS STRING),true) AS %s,",
toVariantColumnName, columnName, targetColumnName))
// TODO: https://github.com/PeerDB-io/peerdb/issues/189 - handle time types and interval types
// case model.ColumnTypeTime:
// flattenedCastsSQLArray = append(flattenedCastsSQLArray, fmt.Sprintf("TIME_FROM_PARTS(0,0,0,%s:%s:"+
Expand Down
8 changes: 6 additions & 2 deletions flow/connectors/sql/query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,13 @@ func (g *GenericSQLQueryExecutor) CountRows(schemaName string, tableName string)
return count, err
}

func (g *GenericSQLQueryExecutor) CountNonNullRows(schemaName string, tableName string, columnName string) (int64, error) {
func (g *GenericSQLQueryExecutor) CountNonNullRows(
schemaName string,
tableName string,
columnName string) (int64, error) {
var count int64
err := g.db.QueryRowx("SELECT COUNT(CASE WHEN " + columnName + " IS NOT NULL THEN 1 END) AS non_null_count FROM " + schemaName + "." + tableName).Scan(&count)
err := g.db.QueryRowx("SELECT COUNT(CASE WHEN " + columnName +
" IS NOT NULL THEN 1 END) AS non_null_count FROM " + schemaName + "." + tableName).Scan(&count)
return count, err
}

Expand Down

0 comments on commit bb4da1d

Please sign in to comment.