-
Notifications
You must be signed in to change notification settings - Fork 300
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
Custom query fix #1428
Custom query fix #1428
Conversation
Custom query change as per review
private static NeptuneConnection createConnection(java.util.Map<String, String> configOptions) | ||
{ | ||
GraphType graphType = GraphType.PROPERTYGRAPH; | ||
if (System.getenv("neptune_graphtype") != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use configOptions.getEnv here. We dump System.getEnv to configOptions when the RecordHandler is instantiated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
switch(graphType){ | ||
case PROPERTYGRAPH: | ||
return new NeptuneGremlinConnection(configOptions.get("neptune_endpoint"), | ||
configOptions.get("neptune_port"), Boolean.parseBoolean(configOptions.get("iam_enabled")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets make static variables for these properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
break; | ||
|
||
case VIEW: | ||
String query = recordsRequest.getSchema().getCustomMetadata().get("query"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add static variable here pls. Maybe its worth creating a class for constants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
this.connectionString = "https://" + neptuneEndpoint + ":" + neptunePort; | ||
} | ||
|
||
public void connect() throws NeptuneSigV4SignerException |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need a separate connect() class? why not include this as a part of the constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connect now from constructor
@@ -29,7 +29,8 @@ | |||
</Appenders> | |||
<Loggers> | |||
<Logger name="com.amazonaws.athena.connector.lambda" level="${env:ATHENA_FEDERATION_SDK_LOG_LEVEL:-warn}" /> | |||
<Logger name="com.amazonaws.athena.connectors.neptune" level="${env:ATHENA_FEDERATION_SDK_LOG_LEVEL:-warn}" /> | |||
<Logger name="com.amazonaws.athena.connectors.neptune" level="warn" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert the changes and keep as: level="${env:ATHENA_FEDERATION_SDK_LOG_LEVEL:-warn}
This is used for customer debugging so that log levels can be configured via lambda env variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
String pfx = k.substring(PREFIX_LEN); | ||
String val = recordsRequest.getSchema().getCustomMetadata().get(k); | ||
prefixMap.put(pfx, val); | ||
prefixBlock += "PREFIX " + pfx + ": <" + val + ">\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a stringbuilder for readability or string.format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now using string builder
{ | ||
ArrowType arrowType = field.getType(); | ||
Types.MinorType minorType = Types.getMinorTypeForArrowType(arrowType); | ||
Boolean enableCaseinsensitivematch = (System.getenv("enable_caseinsensitivematch") == null) ? true : Boolean.parseBoolean(System.getenv("enable_caseinsensitivematch")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you'll need to use configOptions here. Using System.getEnv within the connectors isn't recommended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
} | ||
|
||
// 2. Build the SPARQL query | ||
String queryMode = recordsRequest.getSchema().getCustomMetadata().get("querymode"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls use constants for all of these. Its hard to determine where they're coming from without prior context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
Made code changes to address review comments |
build failure |
|
||
<<<<<<< HEAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like some merge headers got added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed merge headers
Issue #, if available:
#1398
Description of changes:
Add RDF support to Neptune connector. This builds on recent changes for property graph views in Neptune connector.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.