@BeforeClass public static void setup_TestEncodedFieldPaths() throws Exception { try (Table table = DBTests.createOrReplaceTable(TABLE_NAME, ImmutableMap.of("codes", "codes"))) { tableCreated = true; tablePath = table.getPath().toUri().getPath(); DBTests.createIndex(TABLE_NAME, INDEX_NAME, new String[] {"age"}, new String[] {"name.last", "data.salary"}); DBTests.admin().getTableIndexes(table.getPath(), true); try (final InputStream in = TestEncodedFieldPaths.class.getResourceAsStream(JSON_FILE_URL); final DocumentStream stream = Json.newDocumentStream(in);) { table.insertOrReplace(stream); table.flush(); } // wait for the indexes to sync DBTests.waitForRowCount(table.getPath(), 5, INDEX_FLUSH_TIMEOUT); DBTests.waitForIndexFlush(table.getPath(), INDEX_FLUSH_TIMEOUT); } finally { test("ALTER SESSION SET `planner.disable_full_table_scan` = true"); } }
/** * Returns a map of types in this schema by name. * * <p>The implementations of {@link #getTypeNames()} * and {@link #getType(String)} depend on this map. * The default implementation of this method returns the empty map. * Override this method to change their behavior.</p> * * @return Map of types in this schema by name */ protected Map<String, RelProtoDataType> getTypeMap() { return ImmutableMap.of(); }
TypeTable() { this.map = ImmutableMap.of(); }
private EmptyImmutableListMultimap() { super(ImmutableMap.<Object, ImmutableList<Object>>of(), 0); }
private EmptyImmutableSetMultimap() { super(ImmutableMap.<Object, ImmutableSet<Object>>of(), 0, null); }
protected boolean shouldVisitCatalog() { if (filter == null) { return true; } final Map<String, String> recordValues = ImmutableMap.of(CATS_COL_CATALOG_NAME, IS_CATALOG_NAME); // If the filter evaluates to false then we don't need to visit the catalog. // For other two results (TRUE, INCONCLUSIVE) continue to visit the catalog. return filter.evaluate(recordValues) != Result.FALSE; }
/** * Returns an {@code ImmutableClassToInstanceMap} containing a single entry. * * @since 19.0 */ public static <B, T extends B> ImmutableClassToInstanceMap<B> of(Class<T> type, T value) { ImmutableMap<Class<? extends B>, B> map = ImmutableMap.<Class<? extends B>, B>of(type, value); return new ImmutableClassToInstanceMap<B>(map); }
/** Returns an empty type to instance map. */ public static <B> ImmutableTypeToInstanceMap<B> of() { return new ImmutableTypeToInstanceMap<B>(ImmutableMap.<TypeToken<? extends B>, B>of()); }
ImmutableMap<K, V> toImmutableMap() { return (map == null) ? ImmutableMap.<K, V>of() : ImmutableEnumMap.asImmutable(map); } }
protected boolean shouldVisitColumn(String schemaName, String tableName, String columnName) { if (filter == null) { return true; } final Map<String, String> recordValues = ImmutableMap.of( CATS_COL_CATALOG_NAME, IS_CATALOG_NAME, SHRD_COL_TABLE_SCHEMA, schemaName, SCHS_COL_SCHEMA_NAME, schemaName, SHRD_COL_TABLE_NAME, tableName, COLS_COL_COLUMN_NAME, columnName); // If the filter evaluates to false then we don't need to visit the column. // For other two results (TRUE, INCONCLUSIVE) continue to visit the column. return filter.evaluate(recordValues) != Result.FALSE; }
static <K extends Enum<K>, V> ImmutableMap<K, V> asImmutable(EnumMap<K, V> map) { switch (map.size()) { case 0: return ImmutableMap.of(); case 1: Entry<K, V> entry = Iterables.getOnlyElement(map.entrySet()); return ImmutableMap.of(entry.getKey(), entry.getValue()); default: return new ImmutableEnumMap<K, V>(map); } }
protected boolean shouldVisitTable(String schemaName, String tableName, TableType tableType) { if (filter == null) { return true; } final Map<String, String> recordValues = ImmutableMap.of( CATS_COL_CATALOG_NAME, IS_CATALOG_NAME, SHRD_COL_TABLE_SCHEMA, schemaName, SCHS_COL_SCHEMA_NAME, schemaName, SHRD_COL_TABLE_NAME, tableName, TBLS_COL_TABLE_TYPE, tableType.toString()); // If the filter evaluates to false then we don't need to visit the table. // For other two results (TRUE, INCONCLUSIVE) continue to visit the table. return filter.evaluate(recordValues) != Result.FALSE; }
/** * Returns a view of all mappings that have the given column key. If the * column key isn't in {@link #columnKeySet()}, an empty immutable map is * returned. * * <p>Otherwise, for each row key in {@link #rowKeySet()}, the returned map * associates the row key with the corresponding value in the table. Changes * to the returned map will update the underlying table, and vice versa. * * @param columnKey key of column to search for in the table * @return the corresponding map from row keys to values */ @Override public Map<R, V> column(C columnKey) { checkNotNull(columnKey); Integer columnIndex = columnKeyToIndex.get(columnKey); return (columnIndex == null) ? ImmutableMap.<R, V>of() : new Column(columnIndex); }
/** * {@inheritDoc} * * @throws NullPointerException if {@code rowKey} is {@code null} */ @Override public ImmutableMap<C, V> row(R rowKey) { checkNotNull(rowKey); return MoreObjects.firstNonNull( (ImmutableMap<C, V>) rowMap().get(rowKey), ImmutableMap.<C, V>of()); }
/** * {@inheritDoc} * * @throws NullPointerException if {@code columnKey} is {@code null} */ @Override public ImmutableMap<R, V> column(C columnKey) { checkNotNull(columnKey); return MoreObjects.firstNonNull( (ImmutableMap<R, V>) columnMap().get(columnKey), ImmutableMap.<R, V>of()); }
@Override public ImmutableMap<Range<K>, V> asMapOfRanges() { if (ranges.isEmpty()) { return ImmutableMap.of(); } RegularImmutableSortedSet<Range<K>> rangeSet = new RegularImmutableSortedSet<Range<K>>(ranges, Range.<K>rangeLexOrdering()); return new ImmutableSortedMap<Range<K>, V>(rangeSet, values); }
@Override public ImmutableMap<Range<K>, V> asDescendingMapOfRanges() { if (ranges.isEmpty()) { return ImmutableMap.of(); } RegularImmutableSortedSet<Range<K>> rangeSet = new RegularImmutableSortedSet<Range<K>>( ranges.reverse(), Range.<K>rangeLexOrdering().reverse()); return new ImmutableSortedMap<Range<K>, V>(rangeSet, values.reverse()); }