Tabnine Logo
SqlUtils.parseSchemaPath
Code IndexAdd Tabnine to your IDE (free)

How to use
parseSchemaPath
method
in
com.dremio.common.utils.SqlUtils

Best Java code snippets using com.dremio.common.utils.SqlUtils.parseSchemaPath (Showing top 6 results out of 315)

origin: dremio/dremio-oss

 @Override
 public void setValue(UserSession session, String value) {
  session.defaultSchemaPath = Strings.isNullOrEmpty(value) ? null : new NamespaceKey(SqlUtils.parseSchemaPath(value));
 }
},
origin: dremio/dremio-oss

 @Test
 public void testParseSchemaPath() {
  assertEquals(asList("a", "b", "c"), SqlUtils.parseSchemaPath("a.b.c"));
  assertEquals(asList("a"), SqlUtils.parseSchemaPath("a"));
  assertEquals(asList("a", "b.c", "d"), SqlUtils.parseSchemaPath("a.\"b.c\".d"));
  assertEquals(asList("a", "c"), SqlUtils.parseSchemaPath("a..c"));
 }
}
origin: dremio/dremio-oss

private void assertFoldersExist(List<String> expFolders) throws Exception {
 for (String folderPath : expFolders) {
  NamespaceKey folderKey = new NamespaceKey(SqlUtils.parseSchemaPath(folderPath));
  namespaceService.getFolder(folderKey); // if the folder doesn't exit we get an exception
 }
}
origin: dremio/dremio-oss

private void assertFoldersDoNotExist(List<String> expFolders) throws Exception {
 for (String folderPath : expFolders) {
  NamespaceKey folderKey = new NamespaceKey(SqlUtils.parseSchemaPath(folderPath));
  try {
   namespaceService.getFolder(folderKey); // if the folder doesn't exit we get an exception
   fail();
  } catch (NamespaceNotFoundException ex) { /* no-op */ }
 }
}
origin: dremio/dremio-oss

 @Override
 public List<SimpleCommandResult> toResult(String sql, SqlNode sqlNode) throws Exception {
  final SqlUseSchema useSchema = SqlNodeUtil.unwrap(sqlNode, SqlUseSchema.class);
  // first we try locally.
  NamespaceKey orig = new NamespaceKey(useSchema.getSchema());
  NamespaceKey defaultPath = catalog.resolveToDefault(orig);
  NamespaceKey compoundPath = orig.size() == 1 && orig.getRoot().contains(".") ? new NamespaceKey(SqlUtils.parseSchemaPath(orig.getRoot())) : null;

  if(defaultPath != null && catalog.containerExists(defaultPath)) {
   session.setDefaultSchemaPath(defaultPath.getPathComponents());
  } else if (catalog.containerExists(orig)) {
   session.setDefaultSchemaPath(orig.getPathComponents());
  } else if(compoundPath != null && catalog.containerExists(compoundPath)) {
   // kept to support old compound use statements.
   session.setDefaultSchemaPath(compoundPath.getPathComponents());
  } else {
   throw UserException.validationError().message("Schema [%s] is not valid with respect to either root schema or current default schema.", orig).build(logger);
  }

  return Collections.singletonList(SimpleCommandResult.successful("Default schema changed to [%s]", session.getDefaultSchemaPath()));
 }
}
origin: dremio/dremio-oss

private static SourceTableDefinition newDataset(final String dsPath) {
 final List<String> path = SqlUtils.parseSchemaPath(dsPath);
 SourceTableDefinition ret = mock(SourceTableDefinition.class);
 NamespaceKey datasetName = new NamespaceKey(path);
 when(ret.getName()).thenReturn(datasetName);
 BatchSchema schema = BatchSchema.newBuilder()
   .addField(new Field("string", FieldType.nullable(ArrowType.Utf8.INSTANCE), null))
   .build();
 DatasetConfig dsConfig = new DatasetConfig()
   .setName(Util.last(path))
   .setFullPathList(path)
   .setType(DatasetType.PHYSICAL_DATASET_SOURCE_FILE)
   .setRecordSchema(ByteString.EMPTY)
   .setPhysicalDataset(
     new PhysicalDataset()
       .setFormatSettings(null))
   .setSchemaVersion(DatasetHelper.CURRENT_VERSION)
   .setRecordSchema(schema.toByteString())
   .setReadDefinition(new ReadDefinition());
 try {
  when(ret.getDataset()).thenReturn(dsConfig);
 } catch (Exception ignored) {
 }
 when(ret.getType()).thenReturn(DatasetType.PHYSICAL_DATASET_SOURCE_FILE);
 when(ret.isSaveable()).thenReturn(true);
 return ret;
}
com.dremio.common.utilsSqlUtilsparseSchemaPath

Javadoc

Parse the schema path into a list of schema entries.

Popular methods of SqlUtils

  • quoteIdentifier
    quote the identifier if it is a: - doesn't start with a character, - contains non-alphanumeric chara
  • isKeyword
    Is the given id a reserved keyword?
  • quotedCompound
  • stringLiteral
    Convert given string value as string literal in SQL.
  • quoteString
  • quoteUnicodeString

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSharedPreferences (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JOptionPane (javax.swing)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now