String comment = tableMeta.getOptions().getComment(); Set<String> hiddenColumns = ImmutableSet.of(); if (comment != null && comment.startsWith(PRESTO_COMMENT_METADATA)) {
public TableMetadataAssert hasComment(String comment) { assertThat(actual.getOptions().getComment()).isEqualTo(comment); return this; }
public TableMetadataAssert doesNotHaveComment(String comment) { assertThat(actual.getOptions().getComment()).isNotEqualTo(comment); return this; }
.append('\''); else and(sb, formatted).append("caching = ").append(formatOptionMap(options.getCaching())); if (options.getComment() != null) and(sb, formatted) .append("comment = '") .append(options.getComment().replace("'", "''")) .append('\''); and(sb, formatted).append("compaction = ").append(formatOptionMap(options.getCompaction()));
@Test(groups = "short") public void should_escape_single_quote_table_comment() { // given String cql = String.format( "CREATE TABLE %s.single_quote (\n" + " c1 int PRIMARY KEY\n" + ") WITH comment = 'comment with single quote '' should work'", keyspace); // when session().execute(cql); TableMetadata table = cluster().getMetadata().getKeyspace(keyspace).getTable("single_quote"); // then assertThat(table.getOptions().getComment()) .isEqualTo("comment with single quote ' should work"); assertThat(table.asCQLQuery()).contains("comment = 'comment with single quote '' should work'"); }
public TableMetadataAssert hasComment(String comment) { assertThat(actual.getOptions().getComment()).isEqualTo(comment); return this; }
assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "10")); assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "10")); assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "ALL")); assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); assertThat(table.getOptions().getCaching()) assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); assertThat(table.getOptions().getCaching())
public TableMetadataAssert doesNotHaveComment(String comment) { assertThat(actual.getOptions().getComment()).isNotEqualTo(comment); return this; }
String comment = tableMeta.getOptions().getComment(); Set<String> hiddenColumns = ImmutableSet.of(); if (comment != null && comment.startsWith(PRESTO_COMMENT_METADATA)) {
String comment = tableMeta.getOptions().getComment(); Set<String> hiddenColumns = ImmutableSet.of(); if (comment != null && comment.startsWith(PRESTO_COMMENT_METADATA)) {
else and(sb, formatted).append("caching = ").append(formatOptionMap(options.getCaching())); if (options.getComment() != null) and(sb, formatted).append("comment = '").append(options.getComment().replace("'", "''")).append('\''); and(sb, formatted).append("compaction = ").append(formatOptionMap(options.getCompaction())); and(sb, formatted).append("compression = ").append(formatOptionMap(options.getCompression()));
else and(sb, formatted).append("caching = ").append(formatOptionMap(options.getCaching())); if (options.getComment() != null) and(sb, formatted).append("comment = '").append(options.getComment().replace("'", "''")).append('\''); and(sb, formatted).append("compaction = ").append(formatOptionMap(options.getCompaction())); and(sb, formatted).append("compression = ").append(formatOptionMap(options.getCompression()));
else and(sb, formatted).append("caching = ").append(formatOptionMap(options.getCaching())); if (options.getComment() != null) and(sb, formatted).append("comment = '").append(options.getComment().replace("'", "''")).append('\''); and(sb, formatted).append("compaction = ").append(formatOptionMap(options.getCompaction())); and(sb, formatted).append("compression = ").append(formatOptionMap(options.getCompression()));
@Test(groups = "short") public void should_escape_single_quote_table_comment() { // given String cql = String.format( "CREATE TABLE %s.single_quote (\n" + " c1 int PRIMARY KEY\n" + ") WITH comment = 'comment with single quote '' should work'", keyspace); // when session().execute(cql); TableMetadata table = cluster().getMetadata().getKeyspace(keyspace).getTable("single_quote"); // then assertThat(table.getOptions().getComment()) .isEqualTo("comment with single quote ' should work"); assertThat(table.asCQLQuery()).contains("comment = 'comment with single quote '' should work'"); }
.addEntry("TABLE_NAME", table.getName()) .addEntry("TABLE_TYPE", TABLE_CONSTANT) .addEntry("REMARKS", table.getOptions().getComment()) .addEntry("TYPE_CAT", null) .addEntry("TYPE_SCHEM", null)
assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "10")); assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "10")); assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); assertThat(table.getOptions().getCaching()).contains(entry("rows_per_partition", "ALL")); assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); assertThat(table.getOptions().getCaching()) assertThat(table.getOptions().getGcGraceInSeconds()).isEqualTo(42); assertThat(table.getOptions().getBloomFilterFalsePositiveChance()).isEqualTo(0.01); assertThat(table.getOptions().getComment()).isEqualTo("My awesome table"); assertThat(table.getOptions().getCaching()).contains(entry("keys", "ALL")); assertThat(table.getOptions().getCaching())