[CALCITE-2209] Support loading model file through URL#701
[CALCITE-2209] Support loading model file through URL#701walterddr wants to merge 4 commits intoapache:masterfrom
Conversation
|
Can we fix the test errors? |
|
@suez1224 I pushed a fix on all the test errors regarding the upgrade from |
d3ca9e1 to
6bb9496
Compare
|
thank you for addressing this feature! it will improve the quality of my tool. |
6bb9496 to
5953365
Compare
| String fileName = (String) operand.get("file"); | ||
| final File base = | ||
| (File) operand.get(ModelHandler.ExtraOperand.BASE_DIRECTORY.camelName); | ||
| final URI uri = (URI) operand.get(ModelHandler.ExtraOperand.BASE_DIRECTORY.camelName); |
There was a problem hiding this comment.
@walterddr , this looks like a backward-incompatible change. In other words, clients have to update their code even though they don't use URIs yet.
Have you though of a possibility to keep previous code intact while allowing to leverage new API if required?
There was a problem hiding this comment.
hmm. this was confusing to me. I was not sure about the original implementation to directly convert the Object to File.
How about:
Object baseDirObj = operand.get(ModelHandler.ExtraOperand.BASE_DIRECTORY.camelName);
Final File base;
if (baseDirObj instanceof URI) {
uri = (URI) baseDirObj;
base = new File(uri);
} else if (baseDirObj instanceof File) {
base = (File) baseDirObj;
} else {
throw IllegalArgumentException(...);
}
| String fileName = (String) operand.get("file"); | ||
| final File base = | ||
| (File) operand.get(ModelHandler.ExtraOperand.BASE_DIRECTORY.camelName); | ||
| final URI uri = (URI) operand.get(ModelHandler.ExtraOperand.BASE_DIRECTORY.camelName); |
There was a problem hiding this comment.
hmm. this was confusing to me. I was not sure about the original implementation to directly convert the Object to File.
How about:
Object baseDirObj = operand.get(ModelHandler.ExtraOperand.BASE_DIRECTORY.camelName);
Final File base;
if (baseDirObj instanceof URI) {
uri = (URI) baseDirObj;
base = new File(uri);
} else if (baseDirObj instanceof File) {
base = (File) baseDirObj;
} else {
throw IllegalArgumentException(...);
}
| break; | ||
| case BASE_DIRECTORY: | ||
| File f = null; | ||
| URI f; |
There was a problem hiding this comment.
@vlsi one more comment on this is that I changed this to always use URI as Object type in the operandMap. I am assuming this is also a backward-incompatible change since other users who directly alter the operandMap will also have to change File type to URI type.
Any suggestions on how to make it backward compatible. My initial thought would be to give another key, say:
case BASE_DIRECTORY:
// ...
case BASE_DIRECTORY_URI:
// ...
and mark BASE_DIRECTORY as deprecated key
80f411d to
ca27fe9
Compare
49cb002 to
8768a23
Compare
|
Shame this didnt make it in. We could really use this feature |
This addresses: https://issues.apache.org/jira/browse/CALCITE-2209